[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#59141: 28.1.90; Face :extend when all the line but trailing \n is in
From: |
Juri Linkov |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
>> 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))
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, (continued)
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Eli Zaretskii, 2022/11/11
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Abdul-Lateef Haji-Ali, 2022/11/11
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Eli Zaretskii, 2022/11/11
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Kévin Le Gouguec, 2022/11/12
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Juri Linkov, 2022/11/12
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Kévin Le Gouguec, 2022/11/13
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Juri Linkov, 2022/11/13
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Kévin Le Gouguec, 2022/11/13
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Juri Linkov, 2022/11/14
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Kévin Le Gouguec, 2022/11/14
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible,
Juri Linkov <=
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Kévin Le Gouguec, 2022/11/14
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Juri Linkov, 2022/11/20
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Juri Linkov, 2022/11/22
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Eli Zaretskii, 2022/11/22
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Juri Linkov, 2022/11/22
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Eli Zaretskii, 2022/11/22
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Juri Linkov, 2022/11/22
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Eli Zaretskii, 2022/11/22
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Eli Zaretskii, 2022/11/14
- bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible, Juri Linkov, 2022/11/15