David Kettler <[EMAIL PROTECTED]> writes:
> Below is some code that defines keystrokes to (somewhat)
> conveniently choose which of webjumps, bookmarks and history will be
> completed in the URL prompt.  It's okay, but only affects future
> prompts; if you use the keystrokes while in the minibuffer, the
> current completions are not affected.  I don't know how to achieve
> that and I'm interested in suggestions.  This seems to be related to
> the issue discussed at http://bugs.conkeror.org/conkeror/issue23.
>
> regards, David.
>
>
> /* Very clunky completion changer */
>
> function set_completion_all(val) {
>   url_completion_use_webjumps  = val;
>   url_completion_use_bookmarks = val;
>   url_completion_use_history   = val;
> }
>
> function set_completion(type) {
>   set_completion_all(false);
>   switch (type) {
>   case "w" : 
>     url_completion_use_webjumps  = true;
>     break;
>   case "b":
>     url_completion_use_bookmarks = true;
>     break;
>   case "h":
>     url_completion_use_history   = true;
>     break;
>   case "a":
>     set_completion_all(true);
>     break;
>   case "d":
>     url_completion_use_webjumps  = true;
>     url_completion_use_bookmarks = true;
>     url_completion_use_history   = false;
>     break;
>   }
> }
>
> function show_completion(minibuffer) {
>   var ids = ["Completion:"];
>   url_completion_use_webjumps  && ids.push("webjumps");
>   url_completion_use_bookmarks && ids.push("bookmarks");
>   url_completion_use_history   && ids.push("history");
>   minibuffer.show(ids.join(" "));
> }
>
> /* Set completion type according to the last keystroke in the key sequence. */
> interactive("set-completion", null, function (I) {
>   set_completion(I.key_sequence.pop());
>   show_completion(I.minibuffer);
> });
>
> define_keymap("set_completion_keymap");
> define_key(default_base_keymap, "C-l", set_completion_keymap);
> define_key(set_completion_keymap, "w", "set-completion");
> define_key(set_completion_keymap, "b", "set-completion");
> define_key(set_completion_keymap, "h", "set-completion");
> define_key(set_completion_keymap, "a", "set-completion");
> define_key(set_completion_keymap, "d", "set-completion");

You might post this code as a comment at
<http://bugs.conkeror.org/issue10> so people can easily find it.

-- 
John Foerch

_______________________________________________
Conkeror mailing list
[email protected]
https://www.mozdev.org/mailman/listinfo/conkeror

Reply via email to