emacs-devel
[Top][All Lists]
Advanced

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

Re: completion-list-mode-map


From: Christoph Scholtes
Subject: Re: completion-list-mode-map
Date: Mon, 11 Jul 2011 22:20:39 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (windows-nt)

Stefan Monnier <address@hidden> writes:

>> 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?
>
> Yes.

OK. I will clean those up.

>> 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.

OK.

> 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

Excellent. That was exactly what I was trying to achieve.

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

Oversight. Removed.

Here is the updated patch with Changelog entry.

Christoph


=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog      2011-07-06 22:43:46 +0000
+++ lisp/ChangeLog      2011-07-12 04:12:27 +0000
@@ -1,3 +1,12 @@
+2011-07-12  Christoph Scholtes  <address@hidden>
+
+       * help-mode.el (help-mode-map): Add special-mode-map to parent map.
+       (help-mode): Derive help-mode from special-mode. Don't invoke
+       view-mode from help-mode.
+       (help-xref-override-view-map): Remove.
+       (help-make-xrefs): Remove minor-mode-overriding-map-alist since
+       view-mode is not used anymore.
+
 2011-07-06  Richard Stallman  <address@hidden>
 
        * mail/rmailmm.el (rmail-mime-process): Use markers for buf positions.

=== modified file 'lisp/help-mode.el'
--- lisp/help-mode.el   2011-06-13 13:14:42 +0000
+++ lisp/help-mode.el   2011-07-12 03:41:40 +0000
@@ -35,13 +35,12 @@
 
 (defvar help-mode-map
   (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map button-buffer-map)
-
+    (set-keymap-parent map (make-composed-keymap button-buffer-map
+                                                 special-mode-map))
     (define-key map [mouse-2] 'help-follow-mouse)
     (define-key map "\C-c\C-b" 'help-go-back)
     (define-key map "\C-c\C-f" 'help-go-forward)
     (define-key map "\C-c\C-c" 'help-follow-symbol)
-    ;; Documentation only, since we use minor-mode-overriding-map-alist.
     (define-key map "\r" 'help-follow)
     map)
   "Keymap for help mode.")
@@ -266,37 +265,13 @@
   'help-function 'customize-create-theme
   'help-echo (purecopy "mouse-2, RET: edit this theme file"))
 
-;;;###autoload
-(defun help-mode ()
+(define-derived-mode help-mode special-mode "Help"
   "Major mode for viewing help text and navigating references in it.
 Entry to this mode runs the normal hook `help-mode-hook'.
 Commands:
 \\{help-mode-map}"
-  (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)
-  ;; With Emacs 22 `view-exit-action' could delete the selected window
-  ;; disregarding whether the help buffer was shown in that window at
-  ;; all.  Since `view-exit-action' is called with the help buffer as
-  ;; argument it seems more appropriate to have it work on the buffer
-  ;; only and leave it to `view-mode-exit' to delete any associated
-  ;; window(s).
-  (setq view-exit-action
-       (lambda (buffer)
-         ;; Use `with-current-buffer' to make sure that `bury-buffer'
-         ;; also removes BUFFER from the selected window.
-         (with-current-buffer buffer
-           (bury-buffer))))
-
   (set (make-local-variable 'revert-buffer-function)
-       'help-mode-revert-buffer)
-
-  (run-mode-hooks 'help-mode-hook))
+       'help-mode-revert-buffer))
 
 ;;;###autoload
 (defun help-mode-setup ()
@@ -403,13 +378,6 @@
        (error "Current buffer is not in Help mode"))
      (current-buffer))))
 
-(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 +562,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)))))
 
 ;;;###autoload



reply via email to

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