all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Rüdiger Sonderfeld" <ruediger@c-plusplus.de>
To: Glenn Morris <rgm@gnu.org>
Cc: 15722@debbugs.gnu.org
Subject: bug#15722: [PATCH] Man: Add menu.
Date: Sat, 26 Oct 2013 21:16:54 +0200	[thread overview]
Message-ID: <10639495.1VFYxECAcK@descartes> (raw)
In-Reply-To: <7z61sjsvec.fsf@fencepost.gnu.org>

* lisp/man.el (man-imenu-title): New defcustom.
  (Man-mode-map): Add menu entry.
  (Man-mode): Add imenu to menu.

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
---
 lisp/man.el | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/lisp/man.el b/lisp/man.el
index 5619803..76ce6c3 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -89,6 +89,7 @@
 ;;; Code:
 
 (require 'ansi-color)
+(require 'cl-lib)
 (require 'button)
 
 (defgroup man nil
@@ -368,6 +369,12 @@ (defvar Man-support-local-filenames 'auto-detect
 Otherwise, the value is whatever the function
 `Man-support-local-filenames' should return.")
 
+(defcustom man-imenu-title "Contents"
+  "The title to use if man adds a Contents menu to the menubar.
+Default is \"Contents\"."
+  :type 'string
+  :group 'man)
+
 \f
 ;; other variables and keymap initializations
 (defvar Man-original-frame)
@@ -446,6 +453,28 @@ (defvar Man-mode-map
     ;; manual page can contain references to other man pages
     (define-key map "\r"   'man-follow)
     (define-key map "?"    'describe-mode)
+
+    (easy-menu-define nil map
+      "`Man-mode' menu."
+      '("Man"
+        ["Next Section" Man-next-section t]
+        ["Previous Section" Man-previous-section t]
+        ["Go To Section..." Man-goto-section t]
+        ["Go To \"SEE ALSO\" Section" Man-goto-see-also-section
+         :active (cl-member Man-see-also-regexp Man--sections
+                            :test #'string-match-p)]
+        ["Follow Reference..." Man-follow-manual-reference
+         :active Man--refpages
+         :help "Go to a manpage referred to in the \"SEE ALSO\" section"]
+        "--"
+        ["Next Manpage" Man-next-manpage
+         :active (> (length Man-page-list) 1)]
+        ["Previous Manpage" Man-previous-manpage
+         :active (> (length Man-page-list) 1)]
+        "--"
+        ["Man..." man t]
+        ["Kill Buffer" Man-kill t]
+        ["Quit" Man-quit t]))
     map)
   "Keymap for Man mode.")
 
@@ -1396,6 +1425,7 @@ (define-derived-mode Man-mode fundamental-mode "Man"
   (buffer-disable-undo)
   (auto-fill-mode -1)
   (setq imenu-generic-expression (list (list nil Man-heading-regexp 0)))
+  (imenu-add-to-menubar man-imenu-title)
   (set (make-local-variable 'outline-regexp) Man-heading-regexp)
   (set (make-local-variable 'outline-level) (lambda () 1))
   (set (make-local-variable 'bookmark-make-record-function)
-- 
1.8.4.1






  reply	other threads:[~2013-10-26 19:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-26 12:26 bug#15722: [PATCH] Man: Add menu Rüdiger Sonderfeld
2013-10-26 19:07 ` Glenn Morris
2013-10-26 19:16   ` Rüdiger Sonderfeld [this message]
2013-10-27  2:04     ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10639495.1VFYxECAcK@descartes \
    --to=ruediger@c-plusplus.de \
    --cc=15722@debbugs.gnu.org \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.