aboutsummaryrefslogtreecommitdiffstats
path: root/conkeror/.conkerorrc/init.org
blob: 012b02ecc43c4fadeafcd6048623e583ecc68519 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
Add commands to search through and open links from history.

#+BEGIN_SRC js
  define_browser_object_class(
      "history-url", null,
      function (I, prompt) {
          check_buffer(I.buffer, content_buffer);
          var result = yield I.buffer.window.minibuffer.read_url(
              $prompt = prompt, $use_webjumps = false, $use_history = true,
              $use_bookmarks = false, $sort_order = 'date_descending'
          );
          yield co_return(result);
      }
  );

  interactive("find-url-from-history",
              "Find a page from history in the current buffer",
              "find-url",
              $browser_object = browser_object_history_url);
  interactive("find-url-from-history-new-buffer",
              "Find a page from history in a new buffer",
              "find-url-new-buffer",
              $browser_object = browser_object_history_url);

  define_key(content_buffer_normal_keymap, "H", "find-url-from-history");
  define_key(content_buffer_normal_keymap, "h", "find-url-from-history-new-buffer");

#+END_SRC

Set the hints digits to the keys on my keyboard's home row, for easy
access.

#+BEGIN_SRC js
  hint_digits = "arstdhneio";
#+END_SRC

Add the ~search-engines/~ directory to the opensearch load path.

#+BEGIN_SRC js
  function add_to_opensearch_load_path(new_path) {
      if (new_path.startsWith('/')) {
          opensearch_load_paths.push(new_path);
      } else {
          let path = get_home_directory();
          path.append('.conkerorrc');
          path.append(new_path);

          opensearch_load_paths.push(path);
      }
  }

  add_to_opensearch_load_path('search-engines');
#+END_SRC

Add a Mozilla Developer Network webjump. This uses their OpenSearch
description.

#+BEGIN_SRC js
  define_opensearch_webjump("mdn", "mozilla-developer-network.xml");
#+END_SRC

Add a Duck Duck Go webjump. This uses the OpenSearch
description. Conkeror has a =duckduck= webjump, but I prefer the
shorter ddg.

#+BEGIN_SRC js
  define_opensearch_webjump("ddg", "duckduckgo.xml");
#+END_SRC

Add a [[https://wpackagist.org/][WordPress Packagist]] webjump.

#+BEGIN_SRC js
  define_webjump("wpackagist",
                 "https://wpackagist.org/search?q=%s&type=any",
                 $alternative="https://wpackagist.org/",
                 $doc="Search WordPress packagist for plugins and themes.");
#+END_SRC

Add the ~site-js/~ directory to the load path.

#+BEGIN_SRC js
  function add_to_load_path(new_path) {
      if (new_path.startsWith('/')) {
          load_paths.push("file://" + new_path);
      } else {
          let path = get_home_directory();
          path.append('.conkerorrc');
          path.append(new_path);

          load_paths.push("file://" + path.path);
      }
  }

  add_to_load_path('site-js');
#+END_SRC

* Scuttle

  Load the scuttle module.

  #+BEGIN_SRC js
    require('scuttle');
  #+END_SRC

  Set the URL of my scuttle installation.

  #+BEGIN_SRC js
    scuttle_url = 'https://ryuslash.org/scuttle/';
  #+END_SRC

  Add the bookmarked widget to the mode line. This requires my
  customized version of Scuttle to be able to check if a buffer has
  been bookmarked or not.

  #+BEGIN_SRC js
    add_hook('mode_line_hook', mode_line_adder(scuttle_bookmarked_widget));
  #+END_SRC

  Set-up keybindings for posting to scuttle.

  #+BEGIN_SRC js
    define_key(default_global_keymap, 'p', 'scuttle-post');
    define_key(default_global_keymap, 'P', 'scuttle-post-link');
  #+END_SRC