GNU bug report logs - #51809
29.0.50; [PATCH] Support for outline default state in Diff buffers

Previous Next

Package: emacs;

Reported by: Matthias Meulien <orontee <at> gmail.com>

Date: Sat, 13 Nov 2021 13:10:02 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #53 received at 51809 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Matthias Meulien <orontee <at> gmail.com>
Cc: 51809 <at> debbugs.gnu.org
Subject: Re: bug#51809: 29.0.50; [PATCH] Support for outline default state
 in Diff buffers
Date: Sun, 12 Dec 2021 10:43:39 +0200
> 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: show<n>levels (<n> = 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.




This bug report was last modified 3 years and 91 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.