Tweak `which-function-mode' setup code.

This commit is contained in:
Gerard Vermeulen 2024-02-07 11:01:34 +01:00
parent c2fd64717e
commit 18c8cd3e53

View File

@ -4743,8 +4743,7 @@ true in case document headlines contain links. The code in listing
#+name: lst:setup-which-function-mode
#+begin_src emacs-lisp -n :results silent
;; https://emacs.stackexchange.com/questions/30894/
;; https://list.orgmode.org/20240205.141235.268481480563517065.teika@gmx.com/
;; (setopt which-func-display 'header) ;; AFAIU, fails on my system.
(defvar which-func-functions nil)
(defun which-func-org-function ()
@ -4781,6 +4780,8 @@ Return \"Front Matter\" when point is above the first headline."
(hl-page 0)
(old-title "Front Matter")
(new-title old-title))
;; Return the first headline on a page which is better than nothing.
;; I can't do better, since `pdf-view-mode' has no notion of point.
(while (and (< hl-index hl-count) (< hl-page current-page))
(setq old-title new-title)
(setq hl-page (alist-get 'page (nth hl-index outline)))