From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs 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 Organization: LINKOV.NET Message-ID: <86fsely0q3.fsf@mail.linkov.net> References: <871qqcdfvr.fsf@localhost> <83h6z5psqe.fsf@gnu.org> <83bkpdpf92.fsf@gnu.org> <8335app826.fsf@gnu.org> <831qq9p7b7.fsf@gnu.org> <87bkpc4e06.fsf@gmail.com> <865yfkoz1n.fsf@mail.linkov.net> <87mt8vnn6h.fsf@gmail.com> <86leoebv1q.fsf@mail.linkov.net> <87leoev6j0.fsf@gmail.com> <864jv26l0g.fsf@mail.linkov.net> <87zgctajf5.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29463"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: 59141@debbugs.gnu.org, Eli Zaretskii , Abdul-Lateef Haji-Ali , yantar92@posteo.net To: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 15 02:28:10 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oukkD-0007WJ-Kn for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 15 Nov 2022 02:28:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ouijp-0004OR-Ti; Mon, 14 Nov 2022 18:19:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ouiea-0002R9-AI for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2022 18:14:12 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oudQE-0001OB-Dx for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2022 12:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oudQD-0000A4-V9 for bug-gnu-emacs@gnu.org; Mon, 14 Nov 2022 12:39:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Nov 2022 17:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59141 X-GNU-PR-Package: emacs Original-Received: via spool by 59141-submit@debbugs.gnu.org id=B59141.1668447501561 (code B ref 59141); Mon, 14 Nov 2022 17:39:01 +0000 Original-Received: (at 59141) by debbugs.gnu.org; 14 Nov 2022 17:38:21 +0000 Original-Received: from localhost ([127.0.0.1]:50824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oudPY-00008y-VB for submit@debbugs.gnu.org; Mon, 14 Nov 2022 12:38:21 -0500 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:55671) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oudPW-00008k-TK for 59141@debbugs.gnu.org; Mon, 14 Nov 2022 12:38:19 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id BABB120003; Mon, 14 Nov 2022 17:38:09 +0000 (UTC) In-Reply-To: <87zgctajf5.fsf@gmail.com> ("=?UTF-8?Q?K=C3=A9vin?= Le Gouguec"'s message of "Mon, 14 Nov 2022 12:02:06 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:247888 Archived-At: >> 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))