From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Newsgroups: gmane.emacs.bugs Subject: bug#59141: 28.1.90; Face :extend when all the line but trailing \n is invisible Date: Sat, 12 Nov 2022 12:18:49 +0100 Message-ID: <87bkpc4e06.fsf@gmail.com> References: <871qqcdfvr.fsf@localhost> <83h6z5psqe.fsf@gnu.org> <83bkpdpf92.fsf@gnu.org> <8335app826.fsf@gnu.org> <831qq9p7b7.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13208"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 59141@debbugs.gnu.org, yantar92@posteo.net, Abdul-Lateef Haji-Ali , juri@linkov.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 12 12:19:13 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 1otoXX-0003Cq-CS for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Nov 2022 12:19:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otoXP-0005lr-AY; Sat, 12 Nov 2022 06:19:03 -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 1otoXO-0005lj-9r for bug-gnu-emacs@gnu.org; Sat, 12 Nov 2022 06:19:02 -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 1otoXO-0002yd-1x for bug-gnu-emacs@gnu.org; Sat, 12 Nov 2022 06:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1otoXN-0008Oz-TQ for bug-gnu-emacs@gnu.org; Sat, 12 Nov 2022 06:19:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Nov 2022 11:19: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.166825193932288 (code B ref 59141); Sat, 12 Nov 2022 11:19:01 +0000 Original-Received: (at 59141) by debbugs.gnu.org; 12 Nov 2022 11:18:59 +0000 Original-Received: from localhost ([127.0.0.1]:47406 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otoXL-0008Oh-20 for submit@debbugs.gnu.org; Sat, 12 Nov 2022 06:18:59 -0500 Original-Received: from mail-wm1-f54.google.com ([209.85.128.54]:40793) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1otoXI-0008OT-N9 for 59141@debbugs.gnu.org; Sat, 12 Nov 2022 06:18:57 -0500 Original-Received: by mail-wm1-f54.google.com with SMTP id v124-20020a1cac82000000b003cf7a4ea2caso7125687wme.5 for <59141@debbugs.gnu.org>; Sat, 12 Nov 2022 03:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mh0MKZJRgvCGSCvP08RMPhCBQZQVT6SSe/My1YihNF4=; b=WvGIf1MuRA0LjhbzmRUuGmDuWIuENDnTv58QvutpORIhYeDPzMYYN8jufjaVAyfbyy cUAvrejUyqWpzuVitNUGrc6Z4medJAiZXjYc4kc/0P7wZ70BtTwCK+mZk/ef9+NxmbKL ea/iww+zqoppnOvieguTF63Xmlc5dTqbUGaiWWkbwmYf1O5ukllGR6uy2wJ3tDRIurnO fXyZp+hqq8I1Lw6WIFtbGwsdmOJmvpOH8k70Uo735riI9vUOm+uMyhNm9X/kUaffIaO3 srvS+X01InJoArsMFd5mC1K/g3+ZbwaGfiJz5hLIsz00Vpj4kZeLepcqw8sPtanXuxxW CEQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=mh0MKZJRgvCGSCvP08RMPhCBQZQVT6SSe/My1YihNF4=; b=G69G8pthjH6ixFFS4jwupWUlbe3Q0qIaTfO8872tsNYlUouHqjNuK7cQyqqaCiO+VB NBZoDPShU+hH8W23aKe5mY99FU8KRAl15eVIAZPTCs65fz/VeO9UxEiQf7Wyyg62fkTo gDBuhxaYtxkgaXJeu1smI2iyCKtXsLJvMAM2S9N9SYKOZ7BpYKZ2eJ3kfLTURp/nXB84 fHTd6koiDDqAv0KySRBhH8aMRglZOYieY5+ZNWVOJ5KxIRXslSHCKXLFHgCWQa3ClinF Mx0qRGedVVFCj0tl/SBxN3RGFVSygPuoCsbgy4Ks0nUtL9wmHXEPwQBB79mniStetdnK 51dA== X-Gm-Message-State: ANoB5pluz2B2mm4V/+iPtf5Smg9JlrdGQwGvksTS0fc2WHE/g0/JqCmU va/fKXofx3N2MgwjpdcTtNQ= X-Google-Smtp-Source: AA0mqf5H709/10CUjE4lzKk09GNZWSJEYeEumlc2ZqENQV+FSOk9LRJGxW5HZ+mqGvUJTk8f+SPZcQ== X-Received: by 2002:a05:600c:c8:b0:3cf:6c0d:a27 with SMTP id u8-20020a05600c00c800b003cf6c0d0a27mr3635062wmm.196.1668251930749; Sat, 12 Nov 2022 03:18:50 -0800 (PST) Original-Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id y10-20020adff14a000000b00236860e7e9esm4083948wro.98.2022.11.12.03.18.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 03:18:50 -0800 (PST) In-Reply-To: <831qq9p7b7.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 11 Nov 2022 22:25:32 +0200") 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:247648 Archived-At: Eli Zaretskii writes: > You are basically suggesting to hide the entire buffer text and > instead display something else via display properties. That's not > what outline modes do. > > The solution to this problem is simple: don't use the :extend > attribute for these faces. That's all. This attribute is not > intended for what you want to achieve here. A whole bunch of problems > automatically gets resolved if you don't use :extend. Can't speak to what :extend is intended for, but I think it's worth noting that magit-section successfully combines overlays with :extend to do exactly what outline.el does (a hierarchy of collapsable buffer sections), without the problem under discussion. If someone came up with a patch to allow outline.el to delimit and hide sections using a logic closer to magit-section's[1] (via an opt-in variable, to be set e.g. by major modes, so that users happy with the status quo are not affected), would that patch be given any consideration? Asking because OT1H, it seems to me that this kind of change would be on par with Juri's proposed outline-search-function in bug#53981, i.e. an opt-in change to a core part of outline.el's design; OTOH the above sounds quite final, so I don't want to waste anyone's time. [1] Here are the relevant parts AFAIU, based on a cursory exploration. Obviously nothing can be ported verbatim to outline.el: e.g. the eieio idioms are not suited, neither are the parts that manipulate buffer content directly (like magit-diff-wash-hunk deleting then re-inserting the hunk heading). Still, I'm hopeful we could teach outline.el the logic of where headings end and content starts, and how to set overlays to hide the latter. * magit-section.el: (defclass magit-section () ([=E2=80=A6] (start :initform nil :initarg :start) (content :initform nil) (end :initform nil) [=E2=80=A6])) (defun magit-section-hide (section) "Hide the body of the current section." (interactive (list (magit-current-section))) (if (eq section magit-root-section) (user-error "Cannot hide root section") (oset section hidden t) (when-let ((beg (oref section content))) (let ((end (oref section end))) (when (< beg (point) end) (goto-char (oref section start))) (remove-overlays beg end 'invisible t) (let ((o (make-overlay beg end))) (overlay-put o 'evaporate t) (overlay-put o 'invisible t)))) [=E2=80=A6])) (defmacro magit-insert-section (&rest args) "Insert a section at point. [=E2=80=A6]" [=E2=80=A6] :start (point-marker) [=E2=80=A6]) * magit-diff.el: (defun magit-diff-wash-hunk () (when (looking-at "^@\\{2,\\} \\(.+?\\) @\\{2,\\}\\(?: \\(.*\\)\\)?") (let* ((heading (match-string 0)) (ranges (mapcar (lambda (str) (let ((range (mapcar #'string-to-number (split-string (substring str 1) ",")= ))) ;; A single line is +1 rather than +1,1. (if (length=3D range 1) (nconc range (list 1)) range))) (split-string (match-string 1)))) (about (match-string 2)) (combined (length=3D ranges 3)) (value (cons about ranges))) (magit-delete-line) (magit-insert-section section (hunk value) (insert (propertize (concat heading "\n") 'font-lock-face 'magit-diff-hunk-heading)) (magit-insert-heading) (while (not (or (eobp) (looking-at "^[^-+\s\\]"))) (forward-line)) (oset section end (point)) (oset section washer #'magit-diff-paint-hunk) (oset section combined combined) [=E2=80=A6])) t)) JS-less, text/plain references: https://raw.githubusercontent.com/magit/magit/master/lisp/magit-section.el https://raw.githubusercontent.com/magit/magit/master/lisp/magit-diff.el