GNU bug report logs - #15722
[PATCH] Man: Add menu.

Previous Next

Package: emacs;

Reported by: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>

Date: Sat, 26 Oct 2013 12:27:01 UTC

Severity: wishlist

Tags: patch

Fixed in version 24.4

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15722 in the body.
You can then email your comments to 15722 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15722; Package emacs. (Sat, 26 Oct 2013 12:27:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 26 Oct 2013 12:27:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Man: Add menu.
Date: Sat, 26 Oct 2013 14:26:20 +0200
I wasn't sure if it is acceptable to use `cl-lib'.  The check whether
there is a "SEE ALSO" section could be simplified to
  (cl-member Man-see-also-regexp Man--sections :test #'string-match-p)

* 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 <at> c-plusplus.de>
---
 lisp/man.el | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/lisp/man.el b/lisp/man.el
index 5619803..a9dcd98 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -368,6 +368,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)
+
 
 ;; other variables and keymap initializations
 (defvar Man-original-frame)
@@ -446,6 +452,31 @@ (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 (let (m)
+                   (dolist (sec Man--sections m)
+                     (when (and (not m)
+                                (string-match-p Man-see-also-regexp sec))
+                       (setq m t))))]
+        ["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 +1427,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





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15722; Package emacs. (Sat, 26 Oct 2013 19:08:01 GMT) Full text and rfc822 format available.

Message #8 received at 15722 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
Cc: 15722 <at> debbugs.gnu.org
Subject: Re: bug#15722: [PATCH] Man: Add menu.
Date: Sat, 26 Oct 2013 15:07:55 -0400
Rüdiger Sonderfeld wrote:

> I wasn't sure if it is acceptable to use `cl-lib'.

It is.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15722; Package emacs. (Sat, 26 Oct 2013 19:18:02 GMT) Full text and rfc822 format available.

Message #11 received at 15722 <at> debbugs.gnu.org (full text, mbox):

From: Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 15722 <at> debbugs.gnu.org
Subject: [PATCH] Man: Add menu.
Date: Sat, 26 Oct 2013 21:16:54 +0200
* 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 <at> 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)
+
 
 ;; 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 sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. (Sun, 27 Oct 2013 02:05:01 GMT) Full text and rfc822 format available.

Notification sent to Rüdiger Sonderfeld <ruediger <at> c-plusplus.de>:
bug acknowledged by developer. (Sun, 27 Oct 2013 02:05:02 GMT) Full text and rfc822 format available.

Message #16 received at 15722-done <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 15722-done <at> debbugs.gnu.org
Subject: Re: [PATCH] Man: Add menu.
Date: Sat, 26 Oct 2013 22:04:14 -0400
Version: 24.4

Thank you, applied. Trivial comments follow:

Rüdiger Sonderfeld wrote:

> +(defcustom man-imenu-title "Contents"
> +  "The title to use if man adds a Contents menu to the menubar.
> +Default is \"Contents\"."

No need to say what the default is, since that information is
automatically available. New defcustoms need :version tags.

BTW, I suggest you create a Savannah account and request membership of
the Emacs project so that you can commit these things yourself.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 24 Nov 2013 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 166 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.