From: Juri Linkov <juri@linkov.net>
To: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
Cc: 59141@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>,
Abdul-Lateef Haji-Ali <abdo.haji.ali@gmail.com>,
yantar92@posteo.net
Subject: bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible
Date: Mon, 14 Nov 2022 19:32:04 +0200 [thread overview]
Message-ID: <86fsely0q3.fsf@mail.linkov.net> (raw)
In-Reply-To: <87zgctajf5.fsf@gmail.com> ("Kévin Le Gouguec"'s message of "Mon, 14 Nov 2022 12:02:06 +0100")
>> I still don't understand is does magit use outline-mode?
>
> It does not; it relies on magit-section (see references a couple of
> messages prior), which does more or less the exact same job outline.el
> does: let the user navigate and un/fold a hierarchy of headings.
>
> Some recent features of outline.el have indeed been in magit-section for
> a long time: visibility cycling with TAB/S-TAB, bitmap fringe indicators
> (with fallback to outline-style ellipses e.g. on TTYs).
>
> My point with this comparison is to show that an outline-like UI with
> :extended backgrounds is obviously possible; in my previous messages, I
> tried to highlight the relevant code in magit-section that handles
> delimiting section headings vs content and setting the overlays.
>
> I did that mainly FTR, so that Someone™ with motivation and time can see
> if outline.el could grow a user option to support a similar way to
> display outlines, thus solving the problem of :extended backgrounds.
I haven't looked at the magit-section source code. I once tried
to copy the syntax highlighting code from diff-mode to magit-diff,
but magit code is such a mess that I abandoned the attempt.
But from your screenshots it's clear what is needed to do
to achieve the same in outline(-minor)-mode:
1. to support the :extended face attribute on the outline heading lines,
newlines should be included in the match. This is not a patch,
but only shows possible changes:
@@ -242,7 +242,7 @@ outline-font-lock-keywords
'(
;; Highlight headings according to the level.
(eval . (list (or outline-search-function
- (concat "^\\(?:" outline-regexp "\\).*"))
+ (concat "^\\(?:" outline-regexp "\\).*\n"))
0 '(if outline-minor-mode
(if outline-minor-mode-highlight
(list 'face (outline-font-lock-face)))
@@ -486,7 +486,7 @@ outline-minor-mode-highlight-buffer
(save-excursion
(goto-char (point-min))
(let ((regexp (unless outline-search-function
- (concat "^\\(?:" outline-regexp "\\).*$"))))
+ (concat "^\\(?:" outline-regexp "\\).*\n"))))
(while (if outline-search-function
(funcall outline-search-function)
(re-search-forward regexp nil t))
Maybe such changes are not needed when a function in
outline-search-function could include newlines in the match.
2. not to hide the newline of the outline heading line,
overlay boundaries could be shifted forward by 1:
@@ -960,7 +960,7 @@ outline-flag-region
;; We use `front-advance' here because the invisible text begins at the
;; very end of the heading, before the newline, so text inserted at FROM
;; belongs to the heading rather than to the entry.
- (let ((o (make-overlay from to nil 'front-advance)))
+ (let ((o (make-overlay (1+ from) (1+ to) nil 'front-advance)))
(overlay-put o 'evaporate t)
(overlay-put o 'invisible 'outline)
(overlay-put o 'isearch-open-invisible
Maybe this could be conditional via a new option that you proposed.
3. Your screenshot shows that magit doesn't use an ellipsis.
And indeed, ellipses get in the way. But we need to find a way
to disable them without breaking this feature. The line
(overlay-put o 'invisible 'outline)
either should be replaced with
(overlay-put o 'invisible t)
or the ellipsis glyph to be disabled with something like:
(or standard-display-table (setq standard-display-table (make-display-table)))
(set-char-table-extra-slot standard-display-table 4 (vector))
next prev parent reply other threads:[~2022-11-14 17:32 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-09 2:24 bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible Ihor Radchenko
2022-11-09 7:49 ` Kévin Le Gouguec
2022-11-09 12:36 ` Eli Zaretskii
2022-11-09 17:12 ` Juri Linkov
2022-11-10 1:36 ` Ihor Radchenko
2022-11-10 7:45 ` Juri Linkov
2022-11-11 1:58 ` Ihor Radchenko
2022-11-11 7:46 ` Eli Zaretskii
2022-11-12 12:44 ` Ihor Radchenko
2022-11-11 8:13 ` Juri Linkov
2022-11-13 4:31 ` Ihor Radchenko
2022-11-11 12:30 ` Al Haji-Ali
2022-11-11 12:42 ` Eli Zaretskii
2022-11-11 16:00 ` Al Haji-Ali
2022-11-11 17:34 ` Eli Zaretskii
2022-11-11 19:47 ` Abdul-Lateef Haji-Ali
2022-11-11 20:09 ` Eli Zaretskii
2022-11-11 20:17 ` Abdul-Lateef Haji-Ali
2022-11-11 20:25 ` Eli Zaretskii
2022-11-12 11:18 ` Kévin Le Gouguec
2022-11-12 17:46 ` Juri Linkov
2022-11-13 10:50 ` Kévin Le Gouguec
2022-11-13 17:53 ` Juri Linkov
2022-11-13 22:22 ` Kévin Le Gouguec
2022-11-14 7:43 ` Juri Linkov
2022-11-14 11:02 ` Kévin Le Gouguec
2022-11-14 17:32 ` Juri Linkov [this message]
2022-11-14 17:44 ` Eli Zaretskii
2022-11-15 8:02 ` Juri Linkov
2022-11-15 14:42 ` Eli Zaretskii
2022-11-15 15:01 ` Ihor Radchenko
2022-11-15 15:05 ` Eli Zaretskii
2022-11-16 1:38 ` Ihor Radchenko
2022-11-16 13:01 ` Eli Zaretskii
2022-11-20 18:42 ` Juri Linkov
2022-11-14 22:22 ` Kévin Le Gouguec
2022-11-20 18:38 ` Juri Linkov
2022-11-22 7:52 ` Juri Linkov
2022-11-22 15:02 ` Eli Zaretskii
2022-11-22 17:35 ` Juri Linkov
2022-11-22 18:42 ` Eli Zaretskii
2022-11-22 19:16 ` Juri Linkov
2022-11-22 19:36 ` Eli Zaretskii
2022-11-12 17:52 ` Juri Linkov
2022-11-12 18:31 ` Eli Zaretskii
2024-01-25 22:53 ` Ihor Radchenko
2024-01-26 7:08 ` Eli Zaretskii
2022-11-09 12:29 ` Eli Zaretskii
2022-11-09 22:19 ` Kévin Le Gouguec
2022-11-10 7:10 ` Eli Zaretskii
2022-11-10 23:41 ` Kévin Le Gouguec
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=86fsely0q3.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=59141@debbugs.gnu.org \
--cc=abdo.haji.ali@gmail.com \
--cc=eliz@gnu.org \
--cc=kevin.legouguec@gmail.com \
--cc=yantar92@posteo.net \
/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).