3

I use window-numbering package to switch between windows in emacs, however I am struggling to display window number in my mode-line, preferably in [#] format (i.e. [1], [2], [3] ...).

What variable can I use to append window number to my mode-line-format list? Please see below an example of my configuration.

(setq-default mode-line-format (list
    " "
    '(:eval (if (vc-backend buffer-file-name)
                (list
                 (propertize octicon-octoface 'face 'octicons-modeline)
                 (propertize " "              'face 'mode-line))))
   mode-line-mule-info
   'mode-line-modified
   "-  "
   'mode-line-buffer-identification
   "  (%l, %c)  "
   'mode-line-modes
   " -- "
   `(vc-mode vc-mode)
))

PS I've also tried a much newer winum package, with the same results...

2

You might try this (have not tested, because I don't installed window-numbering, it found it in source code https://github.com/nschum/window-numbering.el/blob/master/window-numbering.el#L228.)

(setq-default mode-line-format (list
                                " "
                                '(:eval (window-parameter (selected-window) 'ace-window-path))
                                '(:eval (if (vc-backend buffer-file-name)
                                            (list
                                             (propertize octicon-octoface 'face 'octicons-modeline)
                                             (propertize " "              'face 'mode-line))))
                                mode-line-mule-info
                                'mode-line-modified
                                "-  "
                                'mode-line-buffer-identification
                                "  (%l, %c)  "
                                'mode-line-modes
                                " -- "
                                `(vc-mode vc-mode)
                                ))
  • thanks for your response. I had switched to ace-window and tried adding (:eval (window-parameter (selected-window) 'ace-window-path)) to my modeline list, however this doesn't seem to have done anything. How would you add it to the config example that I have above? – olBc Feb 28 '18 at 21:24
  • Did you add ' before (:eval (window-parameter (selected-window) 'ace-window-path)). – stardiviner Mar 1 '18 at 4:37
  • I updated answer, and tested on my Emacs, it works fine. – stardiviner Mar 1 '18 at 4:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.