[Top][All Lists]

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

Re: completion-list-mode-map

From: Stefan Monnier
Subject: Re: completion-list-mode-map
Date: Mon, 11 Jul 2011 23:20:51 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>> Note: if a mode derives from special-mode, then it does not need the
>> (put 'foo-mode 'mode-class 'special).
> OK, I see some instances where this is still present although the mode is
> derived from special-mode. I assume those can be removed then?


>> define-derived-mode will set the keymap parent to special-mode-map if
>> the mode's keymap doesn't already have a parent.
> There is multiple instances where the mode derives from special-mode, but
> the keymap parent is explicitly set to special-mode also.  Should those
> be removed?

They don't hurt.

>> (One of) the purposes of special-mode is to standardize key bindings, so
>> I think that thumbs-kill-buffer will have to go: it does something
>> similar to quit-window, and the differences are just an annoyance.
>> In other cases, the key-binding conflicts may need to be resolved by finding
>> new keys, rather than just ditching the old binding.
> There is quite a few of these mode-specific functions. I will do a survey
> and see if any modes do special (as in unusual) things in these functions,
> which would not be covered by `quit-window'.


Here are some comments about your patch:

> @@ -34,14 +34,11 @@
>  (eval-when-compile (require 'easymenu))
>  (defvar help-mode-map
> -  (let ((map (make-sparse-keymap)))
> -    (set-keymap-parent map button-buffer-map)
> -
> +  (let ((map (copy-keymap button-buffer-map)))
>      (define-key map [mouse-2] 'help-follow-mouse)
>      (define-key map "\C-c\C-b" 'help-go-back)

copy-keymap is usually a bad idea.  I guess you used it in order to
still be able to inherit from special-mode-map, but that's not needed
any more: I installed a week ago changes that add multiple-keymap
inheritance, so you should be able to do

    (set-keymap-parent map (make-composed-keymap button-buffer-map

to get the same result without copying any keymap.

> -  (interactive)
> -  (kill-all-local-variables)
> -  (use-local-map help-mode-map)
> -  (setq mode-name "Help")
> -  (setq major-mode 'help-mode)
> -
> -  (view-mode)
>    (set (make-local-variable 'view-no-disable-on-exit) t)

Why keep the view-no-disable-on-exit setting?

> -(defvar help-xref-override-view-map
> -  (let ((map (make-sparse-keymap)))
> -    (set-keymap-parent map view-mode-map)
> -    (define-key map "\r" nil)
> -    map)
> -  "Replacement keymap for `view-mode' in help buffers.")
> -
>  ;;;###autoload
>  (defun help-make-xrefs (&optional buffer)
>    "Parse and hyperlink documentation cross-references in the given BUFFER.
> @@ -594,9 +561,6 @@
>                                       (current-buffer)))
>            (when (or help-xref-stack help-xref-forward-stack)
>              (insert "\n")))
> -        ;; View mode steals RET from us.
> -        (set (make-local-variable 'minor-mode-overriding-map-alist)
> -             (list (cons 'view-mode help-xref-override-view-map)))
>          (set-buffer-modified-p old-modified)))))
Looks pretty good overall, thank you.


reply via email to

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