unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Line Numbers and the Options Menu
@ 2017-07-13 11:33 Michael Albinus
  2017-07-13 16:05 ` Eli Zaretskii
  2017-07-14  6:18 ` Alex
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Albinus @ 2017-07-13 11:33 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 168 bytes --]

Hi,

now that we have `display-line-numbers', I propose to offer its setting
in the Options Menu. Any objection to install the appended patch?

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: *vc-diff* --]
[-- Type: text/x-patch, Size: 2701 bytes --]

diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 3ca7d1b..612ea65 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1202,6 +1202,50 @@ menu-bar-showhide-menu
                                                  'tool-bar-lines))))))
     menu))

+(defvar menu-bar-line-numbers-menu
+  (let ((menu (make-sparse-keymap "Line Numbers")))
+
+    (bindings--define-key menu [visual]
+      `(menu-item "Visual Line Numbers"
+                  ,(lambda ()
+                     (interactive)
+                     (setq display-line-numbers 'visual)
+                     (message "Visual line numbers enabled"))
+                  :help "Enable visual line numbers"
+                  :button (:radio . (eq display-line-numbers 'visual))
+                  :visible (menu-bar-menu-frame-live-and-visible-p)))
+
+    (bindings--define-key menu [relative]
+      `(menu-item "Relative Line Numbers"
+                  ,(lambda ()
+                     (interactive)
+                     (setq display-line-numbers 'relative)
+                     (message "Relative line numbers enabled"))
+                  :help "Enable relative line numbers"
+                  :button (:radio . (eq display-line-numbers 'relative))
+                  :visible (menu-bar-menu-frame-live-and-visible-p)))
+
+    (bindings--define-key menu [absolute]
+      `(menu-item "Absolute Line Numbers"
+                  ,(lambda ()
+                     (interactive)
+                     (setq display-line-numbers t)
+                     (message "Absolute line numbers enabled"))
+                  :help "Enable absolute line numbers"
+                  :button (:radio . (eq display-line-numbers t))
+                  :visible (menu-bar-menu-frame-live-and-visible-p)))
+
+    (bindings--define-key menu [none]
+      `(menu-item "No Line Numbers"
+                  ,(lambda ()
+                     (interactive)
+                     (setq display-line-numbers nil)
+                     (message "Line numbers disabled"))
+                  :help "Disable line numbers"
+                  :button (:radio . (null display-line-numbers))
+                  :visible (menu-bar-menu-frame-live-and-visible-p)))
+    menu))
+
 (defvar menu-bar-line-wrapping-menu
   (let ((menu (make-sparse-keymap "Line Wrapping")))

@@ -1408,6 +1452,10 @@ menu-bar-options-menu
       `(menu-item "Default Search Options"
 		  ,menu-bar-search-options-menu))

+    (bindings--define-key menu [line-numbers]
+      `(menu-item "Line Numbers in This Buffer"
+		  ,menu-bar-line-numbers-menu))
+
     (bindings--define-key menu [line-wrapping]
       `(menu-item "Line Wrapping in This Buffer"
 		  ,menu-bar-line-wrapping-menu))

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-14  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-13 11:33 Line Numbers and the Options Menu Michael Albinus
2017-07-13 16:05 ` Eli Zaretskii
2017-07-14  6:18 ` Alex
2017-07-14  8:13   ` Michael Albinus

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).