emacs-devel
[Top][All Lists]
Advanced

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

Re: Suggestions for improvements to the *Completions* buffer


From: Po Lu
Subject: Re: Suggestions for improvements to the *Completions* buffer
Date: Sat, 18 Dec 2021 20:31:14 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)

Philip Kaludercic <philipk@posteo.net> writes:

> Here are the patches that would implement this behaviour.  I have to use
> it for a bit longer before I can say if it is preferable, but I guess if
> something along these lines were to be applied, this could be an option.

Could this part be made optional, at least for those of us with muscle
memory?  I actually expect the focus to return to the previous window
(not necessarily the minibuffer) when I press `z' in a completion
buffer.

Thanks.

> +(defun completion-quit ()
> +  "Close the completion buffer and return to the minibuffer."
> +  (interactive)
> +  (quit-window)
> +  (switch-to-minibuffer))
> +
> +(defun completion-kill-buffer ()
> +  "Close the completion buffer and return to the minibuffer."
> +  (interactive)
> +  (let ((win (get-buffer-window "*Completions*")))
> +    (when win (quit-window t win)))
> +  (switch-to-minibuffer))
> +
>  (defvar completion-list-mode-map
>    (let ((map (make-sparse-keymap)))
>      (set-keymap-parent map special-mode-map)
> @@ -8984,10 +8997,12 @@ completion-list-mode-map
>      (define-key map [right] 'next-completion)
>      (define-key map [?\t] 'next-completion)
>      (define-key map [backtab] 'previous-completion)
> -    (define-key map "z" 'kill-current-buffer)
>      (define-key map "n" 'next-completion)
>      (define-key map "p" 'previous-completion)
>      (define-key map "\M-g\M-c" 'switch-to-minibuffer)
> +    (define-key map "z" #'completion-kill-buffer)
> +    (define-key map [remap keyboard-quit] #'delete-completion-window)
> +    (define-key map [remap quit-window] #'completion-quit)
>      map)
>    "Local map for completion list buffers.")
>  
> -- 
> 2.30.2


reply via email to

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