From 1098fab11bb0816ec447a6d6a20bf5524cf26133 Mon Sep 17 00:00:00 2001 From: Gerard Vermeulen Date: Wed, 7 Feb 2024 13:15:50 +0100 Subject: [PATCH] Tweak the `which-function-mode' section --- README.org | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/README.org b/README.org index 355c4d0..7253d3a 100644 --- a/README.org +++ b/README.org @@ -4745,10 +4745,11 @@ it for this buffer is by typing {{{kbd(C-c C-e t U)}}} to export the it to a :CUSTOM_ID: sec:which-function-mode :END: -The post [[https://codelearn.me/2024/02/02/emacs-which-function-mode.html][Emacs: which-function-mode]] claims that ~which-function-mode~ works in +Listing [[lst:setup-which-function-mode]] sets ~which-function-mode~ options. The +post [[https://codelearn.me/2024/02/02/emacs-which-function-mode.html][Emacs: which-function-mode]] claims that ~which-function-mode~ works in ~org-mode~. This is true in case all document headlines are simple, but is not true in case document headlines contain links. The code in listing -[[lst:setup-which-function-mode]] has stolen ideas from the following links: +[[lst:define-for-which-func-functions]] has stolen ideas from the following links: - [[https://list.orgmode.org/20240205.141235.268481480563517065.teika@gmx.com/][Show current org-mode headline in frame header]]. - [[https://emacs.stackexchange.com/questions/30894/][Show current org-mode headline in modeline]]. @@ -4756,8 +4757,21 @@ true in case document headlines contain links. The code in listing #+caption: Setup ~which-function-mode~. #+name: lst:setup-which-function-mode #+begin_src emacs-lisp -n :results silent -;; https://emacs.stackexchange.com/questions/30894/ +(setopt which-func-modes '(emacs-lisp-mode org-mode pdf-view-mode)) + +;; It looks like `python-mode' does nothing when they it is an element +;; of `which-func-modes'. + +;; (setopt which-func-modes t) + ;; (setopt which-func-display 'header) ;; AFAIU, fails on my system. +#+end_src + +#+caption[Define functions for ~which-func-functions~]: +#+caption: Define functions for ~which-func-functions~. +#+name: lst:define-for-which-func-functions +#+begin_src emacs-lisp -n :results silent +;; https://emacs.stackexchange.com/questions/30894/ (defvar which-func-functions nil) (defun which-func-org-function ()