[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Line Numbers and the Options Menu

From: Alex
Subject: Re: Line Numbers and the Options Menu
Date: Fri, 14 Jul 2017 00:18:51 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Michael Albinus <address@hidden> writes:

> 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.


I personally don't use the Options menu in these situations, but I
figure I should comment since I'm making a minor mode interface for
`display-line-numbers' (see the thread starting from [1]).

Firstly, I think that it makes more sense to put this inside of the
Show/Hide submenu.

Secondly, it might be nicer to use the (hopefully) upcoming mode
interface for the menu for the following reasons:

1) The other entries in the menu appear to enable/disable features

2) The other entries appear to allow for specific buffers to
enable/disable the feature apart from the menu-bar (without them
menu-bar overwriting the buffer's customization).

Feel free to not use it though.

Here's something I quickly tested out which may help if you choose to
use the mode, which I believe satisfies the above. It would replace your
lambda expressions.

(defun menu-bar-display-line-numbers-mode (type)
  (require 'display-line-numbers)
  (setq-default display-line-numbers-type type)
  (if type
      (if global-display-line-numbers-mode
          (dolist (b (buffer-list))
            (with-current-buffer b
              (when display-line-numbers-mode
                (setq display-line-numbers type))))
    (global-display-line-numbers-mode -1)))

Footnotes: [1]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]