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#51809: 29.0.50; [PATCH] Support for outline default state in Diff buffers Date: Sun, 12 Dec 2021 10:43:39 +0200 Organization: LINKOV.NET Message-ID: <86ilvu6w6k.fsf@mail.linkov.net> References: <87lf1sw6ji.fsf@gmail.com> <86h7cgdk4v.fsf@mail.linkov.net> <87ee7kvshn.fsf@gmail.com> <87a6i7x5iq.fsf@gmail.com> <86k0hbam7r.fsf@mail.linkov.net> <878rxrmy7q.fsf@gmail.com> <86y256uc0v.fsf@mail.linkov.net> <87r1ajknsr.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="21268"; 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: 51809@debbugs.gnu.org To: Matthias Meulien Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 12 10:01:44 2021 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 1mwKjn-0005NU-Qt for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Dec 2021 10:01:43 +0100 Original-Received: from localhost ([::1]:57896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mwKjm-0002hr-Hw for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Dec 2021 04:01:42 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mwKhK-0000sU-LS for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 03:59:12 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39102) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mwKhC-0003bT-Eo for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 03:59:10 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mwKhC-0005Kv-C4 for bug-gnu-emacs@gnu.org; Sun, 12 Dec 2021 03:59:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Dec 2021 08:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51809 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51809-submit@debbugs.gnu.org id=B51809.163929952620490 (code B ref 51809); Sun, 12 Dec 2021 08:59:02 +0000 Original-Received: (at 51809) by debbugs.gnu.org; 12 Dec 2021 08:58:46 +0000 Original-Received: from localhost ([127.0.0.1]:50648 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwKgv-0005KQ-Tx for submit@debbugs.gnu.org; Sun, 12 Dec 2021 03:58:46 -0500 Original-Received: from relay11.mail.gandi.net ([217.70.178.231]:56863) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mwKgt-0005Jr-Ou for 51809@debbugs.gnu.org; Sun, 12 Dec 2021 03:58:44 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 9B511100006; Sun, 12 Dec 2021 08:58:36 +0000 (UTC) In-Reply-To: <87r1ajknsr.fsf@gmail.com> (Matthias Meulien's message of "Sat, 11 Dec 2021 19:18:44 +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" Xref: news.gmane.io gmane.emacs.bugs:222193 Archived-At: > I've this simple patch for the outline.el part. Thanks, this is a good starting point to add just the basic functionality like org-mode initial visibility supported by ‘org-startup-folded’ and per-file settings: #+STARTUP: fold (or ‘overview’, this is equivalent) #+STARTUP: nofold (or ‘showall’, this is equivalent) #+STARTUP: content #+STARTUP: showlevels ( = 2..5) #+STARTUP: showeverything > @@ -1058,13 +1060,16 @@ outline-show-heading > -(defun outline-hide-sublevels (levels) > +(defun outline-hide-sublevels (levels &optional fun) It seems you don't use this argument in this patch? > + :local t > + :safe t) > +;; TODO fix variable being set through file local variable > One thing that bothers me is that I am not able to store the wanted > default visibility state as a local variable... Any suggestion welcome! For example, `outline-minor-mode-cycle' and `outline-minor-mode-highlight' have no `:local t', but when visiting a file that sets these file local variables, then automatically become local. > +(defun outline-apply-default-state () > + "Apply the outline state defined by `outline-default-state'." > + (interactive) > + (cond > + ((not outline-default-state) (outline-show-all)) It seems this change doesn't keep the current default behavior. Maybe the result will look like it currently works, maybe not. Who knows what effect will have calling `outline-show-all' by default in some user configurations. > + ((eq outline-default-state 'only-headings) > + (outline-show-all) > + (outline-hide-region-body (point-min) (point-max))) > + ((integerp outline-default-state) > + (outline-hide-sublevels outline-default-state)) > + ((when (functionp outline-default-state) > + (funcall outline-default-state))))) Maybe some other values from org-mode could be supported too? > Also, I've not started to rewrite the diff-mode part on top of this > patch, so comments are most welcome in case I am going in wrong > direction. I think the direction is right: first outline could support the initial visibility feature, then later various modes could use it: in diff-mode, xref, etc.