0

I modified my mode-line, but now which-function-mode stopped working: nothing is displayed. Code:

(setq mode-line-position
      (list '(:eval (propertize "L%l " 'face nil 'help-echo "Line number"))
            '(:eval (propertize "C%C " 'face nil 'help-echo "Column number"))
            (list -3 (propertize "%P" 'face nil 'help-echo "Position in buffer"))
            '(:eval (when (buffer-file-name)
                      (propertize "  %I" 'face 'font-lock-variable-name-face
                                  'help-echo "Buffer size")))))

(setq mode-line-modified
      (list '(:eval (propertize "%*" 'face nil 'help-echo
                                "Buffer read-only and modification indicator"))
            '(:eval (propertize "%+" 'face nil 'help-echo
                                "Buffer read-only and modification indicator"))))

(setq mode-line-buffer-identification
      (list '(:eval (propertize "%12b" 'face 'mode-line-buffer-id
                                'help-echo default-directory))))

(setq-default mode-line-format
              (list "%e"
                    mode-line-position "  "
                    mode-line-modified "  "
                    mode-line-buffer-identification "  "
                    mode-line-modes "  "
                    mode-line-misc-info
                    ))

(which-function-mode)

which-function-mode uses mode-line-misc-info, which I did not modify. Its value is

((which-function-mode
  (which-func-mode
   (#1="" which-func-format " ")))
 (global-mode-string
  (#1# global-mode-string " ")))

Why isn't it showing anything then? (Nothing is displayed if Emacs is started with this code as ~/.emacs.)

Drew
  • 75,699
  • 9
  • 109
  • 225
GrB
  • 207
  • 1
  • 6

1 Answers1

0

Don't evaluate list when you set mode-line-format. Use ' instead of list:

(setq-default mode-line-format
              '("%e"
                mode-line-position "  "
                mode-line-modified "  "
                mode-line-buffer-identification "  "
                mode-line-modes "  "
                mode-line-misc-info
                ))

At the moment you set mode-line-format there are no which-function-mode related code in the mode-line-misc-info.

See Quoting.

muffinmad
  • 2,250
  • 7
  • 11