From: miha--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 51974@debbugs.gnu.org
Subject: bug#51974: 29.0.50; [PATCH] Fix deactivation of outline-minor-mode-cycle-map bindings
Date: Fri, 19 Nov 2021 12:41:57 +0100 [thread overview]
Message-ID: <87lf1ke5iy.fsf@miha-pc> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 268 bytes --]
Customize 'outline-minor-mode-cycle' to t and enable outline-minor-mode.
Put point on a heading and TAB cycles visibility as expected. However,
disabling the minor mode, the keymap remains active and TAB still cycles
on this heading. I propose this patch to fix this.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Fix-deactivation-of-outline-cycle-bindings.patch --]
[-- Type: text/x-patch, Size: 2943 bytes --]
From ab15d70f3d8d182a44ea8797732c239aa9f7a8ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miha=20Rihtar=C5=A1i=C4=8D?= <miha@kamnitnik.top>
Date: Fri, 19 Nov 2021 11:38:34 +0100
Subject: [PATCH] Fix deactivation of outline cycle bindings
* lisp/outline.el (outline-minor-mode):
(outline-font-lock-keywords): Don't modify the 'keymap' text property
directly. Modify 'outline-cycle-keymap' property and have the minor
mode set it up as an alias to the 'keymap' property, or reset it on
deactivation.
---
lisp/outline.el | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/lisp/outline.el b/lisp/outline.el
index a4d2a3b7d7..e41ec364f4 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -226,9 +226,11 @@ outline-font-lock-keywords
(if outline-minor-mode-cycle
(if outline-minor-mode-highlight
(list 'face (outline-font-lock-face)
- 'keymap outline-minor-mode-cycle-map)
+ 'outline-cycle-keymap
+ outline-minor-mode-cycle-map)
(list 'face nil
- 'keymap outline-minor-mode-cycle-map))
+ 'outline-cycle-keymap
+ outline-minor-mode-cycle-map))
(if outline-minor-mode-highlight
(list 'face (outline-font-lock-face))))
(outline-font-lock-face))
@@ -428,6 +430,11 @@ outline-minor-mode
(if (and global-font-lock-mode (font-lock-specified-p major-mode))
(progn
(font-lock-add-keywords nil outline-font-lock-keywords t)
+ (setq-local char-property-alias-alist
+ (copy-alist char-property-alias-alist))
+ (cl-pushnew
+ 'outline-cycle-keymap
+ (alist-get 'keymap char-property-alias-alist))
(font-lock-flush))
(outline-minor-mode-highlight-buffer)))
;; Turn off this mode if we change major modes.
@@ -438,8 +445,10 @@ outline-minor-mode
;; Cause use of ellipses for invisible text.
(add-to-invisibility-spec '(outline . t)))
(when (or outline-minor-mode-cycle outline-minor-mode-highlight)
- (if font-lock-fontified
- (font-lock-remove-keywords nil outline-font-lock-keywords))
+ (when font-lock-fontified
+ (font-lock-remove-keywords nil outline-font-lock-keywords)
+ (when-let ((as (assq 'keymap char-property-alias-alist)))
+ (setcdr as (remq 'outline-cycle-keymap (cdr as)))))
(remove-overlays nil nil 'outline-overlay t)
(font-lock-flush))
(setq line-move-ignore-invisible nil)
--
2.34.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
next reply other threads:[~2021-11-19 11:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-19 11:41 miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-11-20 9:45 ` bug#51974: 29.0.50; [PATCH] Fix deactivation of outline-minor-mode-cycle-map bindings Lars Ingebrigtsen
2021-11-20 10:45 ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-11-21 8:12 ` Lars Ingebrigtsen
2021-11-21 17:55 ` Juri Linkov
2021-11-21 17:58 ` Juri Linkov
2022-01-11 19:24 ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
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=87lf1ke5iy.fsf@miha-pc \
--to=bug-gnu-emacs@gnu.org \
--cc=51974@debbugs.gnu.org \
--cc=miha@kamnitnik.top \
/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).