aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorRĂ¼diger Sonderfeld2013-10-26 19:02:02 -0700
committerGlenn Morris2013-10-26 19:02:02 -0700
commitca7e59d46cd7c030a4b50234c0257156ce08e7e3 (patch)
tree7830d347cf6c8e85a1a18ecc6ddfa9f637b5625c /lisp
parentc556b44bd53f77077d4a92baba6fa381f6400d5b (diff)
downloademacs-ca7e59d46cd7c030a4b50234c0257156ce08e7e3.tar.gz
emacs-ca7e59d46cd7c030a4b50234c0257156ce08e7e3.zip
Add menu for M-x man
* lisp/man.el (man-imenu-title): New option. (Man-mode-map): Add menu. (Man-mode): Add imenu to menu. Fixes: debbugs:15722
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/man.el30
2 files changed, 36 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e25d5bab1e1..8b31efc50b7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12013-10-27 RĂ¼diger Sonderfeld <ruediger@c-plusplus.de>
2
3 * man.el (man-imenu-title): New option.
4 (Man-mode-map): Add menu. (Bug#15722)
5 (Man-mode): Add imenu to menu.
6
12013-10-26 Dmitry Gutov <dgutov@yandex.ru> 72013-10-26 Dmitry Gutov <dgutov@yandex.ru>
2 8
3 * progmodes/ruby-mode.el (ruby-smie--args-separator-p): Be more 9 * progmodes/ruby-mode.el (ruby-smie--args-separator-p): Be more
diff --git a/lisp/man.el b/lisp/man.el
index 56198035a22..bea53c6addd 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -89,6 +89,7 @@
89;;; Code: 89;;; Code:
90 90
91(require 'ansi-color) 91(require 'ansi-color)
92(require 'cl-lib)
92(require 'button) 93(require 'button)
93 94
94(defgroup man nil 95(defgroup man nil
@@ -368,6 +369,12 @@ specified subject, if your `man' program supports it."
368Otherwise, the value is whatever the function 369Otherwise, the value is whatever the function
369`Man-support-local-filenames' should return.") 370`Man-support-local-filenames' should return.")
370 371
372(defcustom man-imenu-title "Contents"
373 "The title to use if man adds a Contents menu to the menubar."
374 :version "24.4"
375 :type 'string
376 :group 'man)
377
371 378
372;; other variables and keymap initializations 379;; other variables and keymap initializations
373(defvar Man-original-frame) 380(defvar Man-original-frame)
@@ -446,6 +453,28 @@ Otherwise, the value is whatever the function
446 ;; manual page can contain references to other man pages 453 ;; manual page can contain references to other man pages
447 (define-key map "\r" 'man-follow) 454 (define-key map "\r" 'man-follow)
448 (define-key map "?" 'describe-mode) 455 (define-key map "?" 'describe-mode)
456
457 (easy-menu-define nil map
458 "`Man-mode' menu."
459 '("Man"
460 ["Next Section" Man-next-section t]
461 ["Previous Section" Man-previous-section t]
462 ["Go To Section..." Man-goto-section t]
463 ["Go To \"SEE ALSO\" Section" Man-goto-see-also-section
464 :active (cl-member Man-see-also-regexp Man--sections
465 :test #'string-match-p)]
466 ["Follow Reference..." Man-follow-manual-reference
467 :active Man--refpages
468 :help "Go to a manpage referred to in the \"SEE ALSO\" section"]
469 "--"
470 ["Next Manpage" Man-next-manpage
471 :active (> (length Man-page-list) 1)]
472 ["Previous Manpage" Man-previous-manpage
473 :active (> (length Man-page-list) 1)]
474 "--"
475 ["Man..." man t]
476 ["Kill Buffer" Man-kill t]
477 ["Quit" Man-quit t]))
449 map) 478 map)
450 "Keymap for Man mode.") 479 "Keymap for Man mode.")
451 480
@@ -1396,6 +1425,7 @@ The following key bindings are currently in effect in the buffer:
1396 (buffer-disable-undo) 1425 (buffer-disable-undo)
1397 (auto-fill-mode -1) 1426 (auto-fill-mode -1)
1398 (setq imenu-generic-expression (list (list nil Man-heading-regexp 0))) 1427 (setq imenu-generic-expression (list (list nil Man-heading-regexp 0)))
1428 (imenu-add-to-menubar man-imenu-title)
1399 (set (make-local-variable 'outline-regexp) Man-heading-regexp) 1429 (set (make-local-variable 'outline-regexp) Man-heading-regexp)
1400 (set (make-local-variable 'outline-level) (lambda () 1)) 1430 (set (make-local-variable 'outline-level) (lambda () 1))
1401 (set (make-local-variable 'bookmark-make-record-function) 1431 (set (make-local-variable 'bookmark-make-record-function)