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


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Matthias Meulien <orontee <at> gmail.com>
Cc: 51809 <at> debbugs.gnu.org
Subject: bug#51809: 29.0.50; [PATCH] Support for outline default state in Diff buffers
Date: Tue, 28 Dec 2021 20:37:52 +0200
>> I am now back to the origin of this bug report (toggling visibility of
>> some diff hunks depending on long lines, chunks size, or file names) and
>> I see there's a major drawback with the outline mode default visibility
>> state approach: When outline minor mode is set through diff-mode-hook,
>> the buffer is emtpy and applying the default state visibility is a
>> no-op; It's a side-effect of the buffer content being generated
>> asynchronously...
>
> I fixed it using an advice to `vc-diff-finish', but wondering whether
> there's a clean way to achieve the same...
> [...]
> (defadvice vc-diff-finish (after ensure-outline-apply-default-state activate)
>   (when outline-minor-mode
>     (outline-apply-default-state)))

After bug#52855 will be closed, it should be possible to do this by:

  (add-hook 'vc-diff-finish-functions 'outline-apply-default-state)

Also xref works nicely, although I don't know why it requires
`outline-apply-default-state' after enabling `outline-minor-mode':

#+begin_src emacs-lisp
(add-hook 'xref-after-update-hook
          (lambda ()
            (setq-local outline-regexp (if (eq xref-file-name-display 'abs)
                                           "/" "[^ 0-9]")
                        outline-default-state 1
                        outline-default-state-subtree-visibility '((match-regexp . "ChangeLog\\|test/manual/etags")))
            (outline-minor-mode +1)
            (outline-apply-default-state)))
#+end_src




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.