bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51809: 29.0.50; [PATCH] Support for outline default state in Diff bu


From: Juri Linkov
Subject: bug#51809: 29.0.50; [PATCH] Support for outline default state in Diff buffers
Date: Sun, 12 Dec 2021 10:43:39 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]