diff options
| author | Stefan Monnier | 2025-07-17 13:34:58 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2025-07-17 13:34:58 -0400 |
| commit | ec0a3c0d602b5da09352be66d616d97d21562c94 (patch) | |
| tree | bde358aa01a73cdec2d5279b039cbeff969599a3 | |
| parent | 430bf07c74f16277d715a143d83bdaf1574a293c (diff) | |
| download | emacs-scratch/outline-button-cover.tar.gz emacs-scratch/outline-button-cover.zip | |
lisp/outline.el (outline--insert-button): Fix RET on covered buttonscratch/outline-button-cover
| -rw-r--r-- | lisp/outline.el | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lisp/outline.el b/lisp/outline.el index b712e45214a..b35923bf266 100644 --- a/lisp/outline.el +++ b/lisp/outline.el | |||
| @@ -1996,18 +1996,26 @@ With a prefix argument, show headings up to that LEVEL." | |||
| 1996 | ;; `icon' is either plist or a string, depending on | 1996 | ;; `icon' is either plist or a string, depending on |
| 1997 | ;; the `outline-minor-mode-use-buttons' settings | 1997 | ;; the `outline-minor-mode-use-buttons' settings |
| 1998 | (let ((o (seq-find (lambda (o) (overlay-get o 'outline-button)) | 1998 | (let ((o (seq-find (lambda (o) (overlay-get o 'outline-button)) |
| 1999 | (overlays-at (point))))) | 1999 | (overlays-at (point)))) |
| 2000 | ;; When `outline-button-cover-text' but the button is in the margin, | ||
| 2001 | ;; the keymap ends up placed on an invisible chunk of text, so we | ||
| 2002 | ;; want the cmd-loop to place the cursor *before* the invisible text | ||
| 2003 | ;; rather than after, otherwise the keymap is ignored. | ||
| 2004 | (cursor-in-front (and (eq outline-minor-mode-use-buttons 'in-margins) | ||
| 2005 | outline-button-cover-text))) | ||
| 2000 | (unless o | 2006 | (unless o |
| 2001 | (when (eq outline-minor-mode-use-buttons 'insert) | 2007 | (when (eq outline-minor-mode-use-buttons 'insert) |
| 2002 | (let ((inhibit-read-only t)) | 2008 | (let ((inhibit-read-only t)) |
| 2003 | (insert (apply #'propertize " " (text-properties-at (point)))) | 2009 | (insert (apply #'propertize " " (text-properties-at (point)))) |
| 2004 | (forward-line 0))) | 2010 | (forward-line 0))) |
| 2005 | (setq o (make-overlay (point) (1+ (point)))) | 2011 | (setq o (make-overlay (point) (1+ (point)) nil t cursor-in-front)) |
| 2006 | (overlay-put o 'outline-button t) | 2012 | (overlay-put o 'outline-button t) |
| 2007 | (overlay-put o 'evaporate t)) | 2013 | (overlay-put o 'evaporate t)) |
| 2008 | (pcase outline-minor-mode-use-buttons | 2014 | (pcase outline-minor-mode-use-buttons |
| 2009 | ('in-margins | 2015 | ('in-margins |
| 2010 | (when outline-button-cover-text | 2016 | (when outline-button-cover-text |
| 2017 | ;; FIXME: Use the `display' property instead of | ||
| 2018 | ;; `invisible+before-string'? | ||
| 2011 | (overlay-put o 'invisible t)) | 2019 | (overlay-put o 'invisible t)) |
| 2012 | (overlay-put o 'before-string | 2020 | (overlay-put o 'before-string |
| 2013 | (outline--button-icons type 'in-margins)) | 2021 | (outline--button-icons type 'in-margins)) |