diff options
| author | Christoph Scholtes | 2011-08-28 14:58:16 -0400 |
|---|---|---|
| committer | Chong Yidong | 2011-08-28 14:58:16 -0400 |
| commit | 09ac1c2ac0d1b96834f7ffb707060cb387473c4d (patch) | |
| tree | c117eb1e81e4699b186f0173d2f16334056cbb2a | |
| parent | ddb54206dd7aa4f461f59fe98b982691e1432a61 (diff) | |
| download | emacs-09ac1c2ac0d1b96834f7ffb707060cb387473c4d.tar.gz emacs-09ac1c2ac0d1b96834f7ffb707060cb387473c4d.zip | |
Make Help mode inherit from special-mode.
* help-mode.el (help-mode-map): Add special-mode-map to parent.
(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.
| -rw-r--r-- | lisp/ChangeLog | 9 | ||||
| -rw-r--r-- | lisp/help-mode.el | 43 |
2 files changed, 13 insertions, 39 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4af6010b556..5d4470a7f87 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2011-08-28 Christoph Scholtes <cschol2112@googlemail.com> | ||
| 2 | |||
| 3 | * help-mode.el (help-mode-map): Add special-mode-map to parent. | ||
| 4 | (help-mode): Derive help-mode from special-mode. Don't invoke | ||
| 5 | view-mode from help-mode. | ||
| 6 | (help-xref-override-view-map): Remove. | ||
| 7 | (help-make-xrefs): Remove minor-mode-overriding-map-alist since | ||
| 8 | view-mode is not used anymore. | ||
| 9 | |||
| 1 | 2011-08-28 Chong Yidong <cyd@stupidchicken.com> | 10 | 2011-08-28 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 11 | ||
| 3 | * server.el (server-port): Doc fix. | 12 | * server.el (server-port): Doc fix. |
diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 1a96f29c4cc..64c114c993d 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el | |||
| @@ -35,13 +35,12 @@ | |||
| 35 | 35 | ||
| 36 | (defvar help-mode-map | 36 | (defvar help-mode-map |
| 37 | (let ((map (make-sparse-keymap))) | 37 | (let ((map (make-sparse-keymap))) |
| 38 | (set-keymap-parent map button-buffer-map) | 38 | (set-keymap-parent map (make-composed-keymap button-buffer-map |
| 39 | 39 | special-mode-map)) | |
| 40 | (define-key map [mouse-2] 'help-follow-mouse) | 40 | (define-key map [mouse-2] 'help-follow-mouse) |
| 41 | (define-key map "\C-c\C-b" 'help-go-back) | 41 | (define-key map "\C-c\C-b" 'help-go-back) |
| 42 | (define-key map "\C-c\C-f" 'help-go-forward) | 42 | (define-key map "\C-c\C-f" 'help-go-forward) |
| 43 | (define-key map "\C-c\C-c" 'help-follow-symbol) | 43 | (define-key map "\C-c\C-c" 'help-follow-symbol) |
| 44 | ;; Documentation only, since we use minor-mode-overriding-map-alist. | ||
| 45 | (define-key map "\r" 'help-follow) | 44 | (define-key map "\r" 'help-follow) |
| 46 | map) | 45 | map) |
| 47 | "Keymap for help mode.") | 46 | "Keymap for help mode.") |
| @@ -266,37 +265,13 @@ The format is (FUNCTION ARGS...).") | |||
| 266 | 'help-function 'customize-create-theme | 265 | 'help-function 'customize-create-theme |
| 267 | 'help-echo (purecopy "mouse-2, RET: edit this theme file")) | 266 | 'help-echo (purecopy "mouse-2, RET: edit this theme file")) |
| 268 | 267 | ||
| 269 | ;;;###autoload | 268 | (define-derived-mode help-mode special-mode "Help" |
| 270 | (defun help-mode () | ||
| 271 | "Major mode for viewing help text and navigating references in it. | 269 | "Major mode for viewing help text and navigating references in it. |
| 272 | Entry to this mode runs the normal hook `help-mode-hook'. | 270 | Entry to this mode runs the normal hook `help-mode-hook'. |
| 273 | Commands: | 271 | Commands: |
| 274 | \\{help-mode-map}" | 272 | \\{help-mode-map}" |
| 275 | (interactive) | ||
| 276 | (kill-all-local-variables) | ||
| 277 | (use-local-map help-mode-map) | ||
| 278 | (setq mode-name "Help") | ||
| 279 | (setq major-mode 'help-mode) | ||
| 280 | |||
| 281 | (view-mode) | ||
| 282 | (set (make-local-variable 'view-no-disable-on-exit) t) | ||
| 283 | ;; With Emacs 22 `view-exit-action' could delete the selected window | ||
| 284 | ;; disregarding whether the help buffer was shown in that window at | ||
| 285 | ;; all. Since `view-exit-action' is called with the help buffer as | ||
| 286 | ;; argument it seems more appropriate to have it work on the buffer | ||
| 287 | ;; only and leave it to `view-mode-exit' to delete any associated | ||
| 288 | ;; window(s). | ||
| 289 | (setq view-exit-action | ||
| 290 | (lambda (buffer) | ||
| 291 | ;; Use `with-current-buffer' to make sure that `bury-buffer' | ||
| 292 | ;; also removes BUFFER from the selected window. | ||
| 293 | (with-current-buffer buffer | ||
| 294 | (bury-buffer)))) | ||
| 295 | |||
| 296 | (set (make-local-variable 'revert-buffer-function) | 273 | (set (make-local-variable 'revert-buffer-function) |
| 297 | 'help-mode-revert-buffer) | 274 | 'help-mode-revert-buffer)) |
| 298 | |||
| 299 | (run-mode-hooks 'help-mode-hook)) | ||
| 300 | 275 | ||
| 301 | ;;;###autoload | 276 | ;;;###autoload |
| 302 | (defun help-mode-setup () | 277 | (defun help-mode-setup () |
| @@ -403,13 +378,6 @@ it does not already exist." | |||
| 403 | (error "Current buffer is not in Help mode")) | 378 | (error "Current buffer is not in Help mode")) |
| 404 | (current-buffer)))) | 379 | (current-buffer)))) |
| 405 | 380 | ||
| 406 | (defvar help-xref-override-view-map | ||
| 407 | (let ((map (make-sparse-keymap))) | ||
| 408 | (set-keymap-parent map view-mode-map) | ||
| 409 | (define-key map "\r" nil) | ||
| 410 | map) | ||
| 411 | "Replacement keymap for `view-mode' in help buffers.") | ||
| 412 | |||
| 413 | ;;;###autoload | 381 | ;;;###autoload |
| 414 | (defun help-make-xrefs (&optional buffer) | 382 | (defun help-make-xrefs (&optional buffer) |
| 415 | "Parse and hyperlink documentation cross-references in the given BUFFER. | 383 | "Parse and hyperlink documentation cross-references in the given BUFFER. |
| @@ -594,9 +562,6 @@ that." | |||
| 594 | (current-buffer))) | 562 | (current-buffer))) |
| 595 | (when (or help-xref-stack help-xref-forward-stack) | 563 | (when (or help-xref-stack help-xref-forward-stack) |
| 596 | (insert "\n"))) | 564 | (insert "\n"))) |
| 597 | ;; View mode steals RET from us. | ||
| 598 | (set (make-local-variable 'minor-mode-overriding-map-alist) | ||
| 599 | (list (cons 'view-mode help-xref-override-view-map))) | ||
| 600 | (set-buffer-modified-p old-modified))))) | 565 | (set-buffer-modified-p old-modified))))) |
| 601 | 566 | ||
| 602 | ;;;###autoload | 567 | ;;;###autoload |