emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C-r and C-s in minibuffer should search completion


From: Juri Linkov
Subject: Re: C-r and C-s in minibuffer should search completion
Date: Sun, 30 Mar 2008 02:44:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu)

>> In the patch below I renamed minibuffer-default-add-p into
>> minibuffer-default-add-done, changed its default to nil, and
>> removed make-variable-buffer-local for minibuffer-default-add-function.
>
> Thanks, please install it.

Done.

I also reverted the recent change in `call-interactively' that adds
buffers to the list of defaults.

However, there is one problem now: `C-x b M-n M-n' puts in the minibuffer
the name of the current buffer because the current buffer is in the front
of the buffer list acquired from the completion table in read-buffer.

But it makes no sense to switch to the current buffer, so the case 'B'
in `call-interactively' specially removes the current buffer from the
default value by using `Fother_buffer' specially for the command
`switch-to-buffer'.

I see no other way of removing the current buffer from the list for M-n
than using the following patch for `minibuffer-default-add-completions'.
It seems there is no other suitable place to remove the current buffer
in the call chain: `C-x b' -> `call-interactively' -> `read-buffer' ->
`completing-read' with `internal-complete-buffer' ->
`minibuffer-default-add-completions'.  This change should also work
for all commands that read a buffer name because when they need the
current buffer, they usually put the current buffer to the default value.
So it would be ok to remove it from the list.

Index: lisp/simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.913
diff -c -r1.913 simple.el
*** lisp/simple.el      29 Mar 2008 22:56:17 -0000      1.913
--- lisp/simple.el      30 Mar 2008 00:43:14 -0000
***************
*** 1332,1337 ****
--- 1333,1343 ----
                              minibuffer-completion-table
                              minibuffer-completion-predicate
                              t)))
+ 
+     ;; Remove the current buffer from the list of buffer completions
+     (when (eq minibuffer-completion-table 'internal-complete-buffer)
+       (setq all (cdr all)))
+ 
      (if (listp def)
        (append def all)
        (cons def (delete def all)))))

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]