0

I was looking around in foreign but public init.el files and setup a which-function-mode that use the headline instead of the modeline for it's content.

I couldn't find a use-package example for that and I am still not clear with lisp code. The which-function-mode now is used in nearly every buffer. But I want it only for pyhton (emacs in build).

How do I have to modify the use-package to achieve this goal?

;; ========= ;; Which Function Mode ;; ========= (use-package which-func :config (add-hook 'prog-mode-hook (lambda() (which-func-mode))) ;; replace nothing found symbol "???" (setq which-func-unknown "∅") ;; add to headline (setq-default header-line-format '((which-func-mode ("" which-func-format " ")))) ;; remove from modeline (setq mode-line-misc-info (delete '(which-function-mode (which-func-mode ("" which-func-format " "))) mode-line-misc-info)) ) 

1 Answer 1

1

If you want it only for python, just change prog-mode-hook to python-mode-hook

(use-package which-func :config (add-hook 'python-mode-hook 'which-func-mode) ;; replace nothing found symbol "???" (setq which-func-unknown "∅") ;; add to headline (setq-default header-line-format '((which-func-mode ("" which-func-format " ")))) ;; remove from modeline (setq mode-line-misc-info (delete '(which-function-mode (which-func-mode ("" which-func-format " "))) mode-line-misc-info))) 
2
  • Mhm... When python-mode is entered this activates the which-func-mode but for all buffers and not Python exclusive. I opened a new question about that. Commented Mar 18, 2022 at 10:01
  • @buhtz You can take a look at stackoverflow.com/questions/62080587/… Commented Mar 18, 2022 at 10:39

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.