"John J. Foerch" <[email protected]> writes:
>
> You need a new reader, since buffer order is hard-coded into read_buffer.
> So try this...
>
>
> minibuffer.prototype.read_recent_buffer = function () {
>     var window = this.window;
>     var buffer = this.window.buffers.current;
>     keywords(arguments, $prompt = "Buffer:",
>              $default = buffer,
>              $history = "buffer");
>     var buffers = window.buffers.buffer_list.slice(0);
>     buffers.push(buffers.shift());
>     var completer = all_word_completer(
>         $completions = buffers,
>         $get_string = function (x) x.description,
>         $get_description = function (x) x.title);
>     var result = yield this.read(
>         $keymap = read_buffer_keymap,
>         $prompt = arguments.$prompt,
>         $history = arguments.$history,
>         $completer = completer,
>         $match_required = true,
>         $auto_complete = "buffer",
>         $auto_complete_initial = true,
>         $auto_complete_delay = 0,
>         $default_completion = arguments.$default);
>     yield co_return(result);
> };
>
> interactive("switch-to-recent-buffer",
>     "Switch to a buffer specified in the minibuffer.  List of buffers "+
>     "will be ordered by recency.",
>     function (I) {
>         switch_to_buffer(
>             I.window,
>             (yield I.minibuffer.read_recent_buffer(
>                 $prompt = "Switch to buffer:",
>                 $default = (I.window.buffers.count > 1 ?
>                             I.window.buffers.buffer_list[1] :
>                             I.buffer))));
>     });
>
> define_key(default_global_keymap, "C-x B", "switch-to-recent-buffer");


Yes, it works perfectly. Thanks a million.
With your permission I will post this on conkeror's tips page.

Vitaly.

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

Reply via email to