Hi Juri, Juri Linkov writes: >>> (...) Also xref works nicely, although I don't know why it requires >>> `outline-apply-default-state' after enabling `outline-minor-mode': >> >> It's a mistake to rely on `hack-local-variables-hook' to call >> `outline-apply-default-state' when Outline minor mode is enabled since >> `hack-local-variables-hook' is run after processing a file's local >> variable specs. > > There is also such a case possible where the file begins with a prop-line: > > # -*- mode: outline-minor; -*- > > and ends with the Local Variables section, e.g.: > > # outline-default-state: 2 > > `hack-local-variables-hook' can handle such case in `outline-minor-mode'. > This usage of "mode:" looks quite exotic to me. Isn't outine-minor a minor mode? According to the documentation: The special variable/value pair ‘mode: MODENAME;’, if present, specifies a major mode (without the “-mode” suffix). I prefer not support this if possible. >> I'll send an updated patch after some time using this. > > Now you can take in use a new hook added in bug#52855 that allows > applying the default state after vc-diff finishes: > > (add-hook 'vc-diff-finish-functions 'outline-apply-default-state) Thanks, I updated my configuration to the following: (add-hook 'diff-mode-hook #'(lambda () (setq outline-default-state 1 outline-default-rules '(subtree-is-long subtree-has-long-lines (match-regexp . "NEWS\\|test\\|package-lock\\.json\\|poetry\\.lock"))))) (add-hook 'vc-diff-finish-functions #'(lambda () (when outline-minor-mode (outline-apply-default-state)))) (add-hook 'xref-after-update-hook #'(lambda () (setq outline-regexp (if (eq xref-file-name-display 'abs) "/" "[^ 0-9]") outline-default-state 1 outline-default-rules '((match-regexp . "ChangeLog\\|test/manual/etags"))) (outline-minor-mode))) Here is an updated patch (just rebased my local branch, some minor conflicts appeared in outline.el):