unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: emacs-devel@gnu.org
Subject: Line Numbers and the Options Menu
Date: Thu, 13 Jul 2017 13:33:34 +0200	[thread overview]
Message-ID: <87h8yg7er5.fsf@detlef> (raw)

[-- 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))

             reply	other threads:[~2017-07-13 11:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-13 11:33 Michael Albinus [this message]
2017-07-13 16:05 ` Line Numbers and the Options Menu Eli Zaretskii
2017-07-14  6:18 ` Alex
2017-07-14  8:13   ` Michael Albinus

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87h8yg7er5.fsf@detlef \
    --to=michael.albinus@gmx.de \
    --cc=emacs-devel@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 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).