emacs-devel
[Top][All Lists]
Advanced

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

Re: Usability suggestion : completion for M-:


From: Juri Linkov
Subject: Re: Usability suggestion : completion for M-:
Date: Sat, 15 Mar 2008 23:36:14 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu)

>> Emacs seems to have a consistent behaviour regarding TAB and
>> completion, i.e : Almost everywhere, TAB triggers completion when :
>> - indentation does not make sens
>> - tabulation char is unlikely to make sens
>>
>> For exemple, TAB triggers completion in find-file. I think TAB should
>> be bound to lisp-complete-symbol in M-x eval-expression, aka M-: .
>>
>> Hope everybody agree and this will be widely considered as a simple
>> yet positive change.
>
> ISTR this being discussed on this list at some point in the past, but
> don't remember the details.
>
> At first glance, it seems like a definite win to rebind TAB to symbol
> completion.  Any anyone point out a usage pattern where the old
> binding of TAB is preferable?

I think the only problem preventing this change is one completion message
that overwrites the minibuffer when TAB doesn't find a completion.
I propose the patch below similar to the patch I proposed for the
shell command minibuffer completion.

When this is fixed, it makes sense to allow TAB to complete a lisp
symbol part of the eval-expression minibuffer in the same way as TAB
will allow completion of command name and file name parts of the
shell-command minibuffer.

Index: lisp/emacs-lisp/lisp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/lisp.el,v
retrieving revision 1.84
diff -c -r1.84 lisp.el
*** lisp/emacs-lisp/lisp.el     5 Mar 2008 20:54:56 -0000       1.84
--- lisp/emacs-lisp/lisp.el     15 Mar 2008 21:35:47 -0000
***************
*** 667,673 ****
             (completion (try-completion pattern obarray predicate)))
        (cond ((eq completion t))
              ((null completion)
!              (message "Can't find completion for \"%s\"" pattern)
               (ding))
              ((not (string= pattern completion))
               (delete-region beg end)
--- 667,675 ----
             (completion (try-completion pattern obarray predicate)))
        (cond ((eq completion t))
              ((null completion)
!              (if (window-minibuffer-p (selected-window))
!                  (minibuffer-message (format " [No completions of \"%s\"]" 
pattern))
!                (message "Can't find completion for \"%s\"" pattern))
               (ding))
              ((not (string= pattern completion))
               (delete-region beg end)

Index: lisp/simple.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/simple.el,v
retrieving revision 1.906
diff -c -r1.906 simple.el
*** lisp/simple.el      14 Mar 2008 17:42:16 -0000      1.906
--- lisp/simple.el      15 Mar 2008 21:35:59 -0000
***************
*** 1012,1017 ****
--- 1012,1018 ----
  ;; Initialize read-expression-map.  It is defined at C level.
  (let ((m (make-sparse-keymap)))
    (define-key m "\M-\t" 'lisp-complete-symbol)
+   (define-key m "\t" 'lisp-complete-symbol)
    (set-keymap-parent m minibuffer-local-map)
    (setq read-expression-map m))
  
-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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