unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 68979@debbugs.gnu.org
Subject: bug#68979: Outline mode menu
Date: Fri, 09 Feb 2024 09:12:58 +0200	[thread overview]
Message-ID: <86o7cqjgnl.fsf@mail.linkov.net> (raw)
In-Reply-To: <86o7csf9zx.fsf@mail.linkov.net> (Juri Linkov's message of "Wed,  07 Feb 2024 19:40:50 +0200")

> While adding new commands ‘outline-cycle’ and ‘outline-cycle-buffer’
> to the outline mode menu, I noticed a strange menu definition.
>
> It looks like "Hide", "Show" and "Headings" were intended to be a submenu,
> but due to the broken menus these titles are not used.
>
>     (define-key map [hide] (cons "Hide" (make-sparse-keymap "Hide")))
>     (define-key map [hide outline-hide-other]
>
>     (define-key map [show] (cons "Show" (make-sparse-keymap "Show")))
>     (define-key map [show outline-show-subtree]
>
>     (define-key map [headings] (cons "Headings" (make-sparse-keymap "Headings")))
>     (define-key map [headings demote-subtree]
>
> Probably this should be transformed to 'easy-menu-define'.

Actually this implementation is intentional as the comments explain.
So there is nothing to do here.

Also I failed to add new commands ‘outline-cycle’ and ‘outline-cycle-buffer’
because they equally fit into both submenus "Show" and "Hide".

So this request could be closed with the following patch that adds the
menu item for outline-minor-mode to make it more prominent as discussed
in bug#68824.

diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 47c6a8f0613..5b290899ff5 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1353,6 +1353,15 @@ menu-bar-showhide-menu
                                   (frame-visible-p
                                    (symbol-value 'speedbar-frame))))))
 
+    (bindings--define-key menu [showhide-outline-minor-mode]
+      '(menu-item "Outlines" outline-minor-mode
+                  :help "Turn outline-minor-mode on/off"
+                  :visible (seq-some #'local-variable-p
+                                     '(outline-search-function
+                                       outline-regexp outline-level))
+                  :button (:toggle . (and (boundp 'outline-minor-mode)
+                                          outline-minor-mode))))
+
     (bindings--define-key menu [showhide-tab-line-mode]
       '(menu-item "Window Tab Line" global-tab-line-mode
                   :help "Turn window-local tab-lines on/off"





  reply	other threads:[~2024-02-09  7:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 17:40 bug#68979: Outline mode menu Juri Linkov
2024-02-09  7:12 ` Juri Linkov [this message]
2024-02-10 17:34   ` Juri Linkov

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=86o7cqjgnl.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=68979@debbugs.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).