milkypostman / powerline

emacs powerline

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Buffer position (line numbers) missing on anything but wide buffers

mariusk opened this issue · comments

Is there any way to make current line number display a bit more persistent when using powerline? Typically I care a lot less about time and date than the current line number when editing files in emacs.. I typically structure my code to look great at around 80 chars or so, to be able to have multiple buffers open horizontally, but doing this with powerline means the line numbers disappear from the mode line.

you can modify the theme and change 'modeline-format' to be whatever you
want. powerline is really just a collection of functions to help create a
the modeline.

look in 'powerline-themes.el' and you can see a ton of examples which you
can customize.

On Wed, Sep 16, 2015 at 12:06 AM, Marius Kjeldahl notifications@github.com
wrote:

Is there any way to make current line number display a bit more persistent
when using powerline? Typically I care a lot less about time and date than
the current line number when editing files in emacs.. I typically structure
my code to look great at around 80 chars or so, to be able to have multiple
buffers open horizontally, but doing this with powerline means the line
numbers disappear from the mode line.


Reply to this email directly or view it on GitHub
#101.

Found it, hidden in global-mode-string. I can fix it at my end, but I wouldn't bet that everybody can. ;-)

FWIW, here's my updated default theme showing buffer positions on the left hand side instead:

(defun powerline-default-linenum-theme ()
  "Setup the default mode-line with line number lhs."
  (interactive)
  (setq-default mode-line-format
                '("%e"
                  (:eval
                   (let* ((active (powerline-selected-window-active))
                          (mode-line (if active 'mode-line 'mode-line-inactive))
                          (face1 (if active 'powerline-active1 'powerline-inactive1))
                          (face2 (if active 'powerline-active2 'powerline-inactive2))
                          (separator-left (intern (format "powerline-%s-%s"
                              (powerline-current-separator)
                                                          (car powerline-default-separator-dir))))
                          (separator-right (intern (format "powerline-%s-%s"
                                                           (powerline-current-separator)
                                                           (cdr powerline-default-separator-dir))))
                          (lhs (list (powerline-raw "%*" nil 'l)
                                     (powerline-raw "%4l" nil 'l)
                                     (powerline-raw ":" nil 'l)
                                     (powerline-raw "%3c" nil 'r)
                                     (when powerline-display-buffer-size
                                       (powerline-buffer-size nil 'l))
                                     (when powerline-display-mule-info
                                       (powerline-raw mode-line-mule-info nil 'l))
                                     (powerline-buffer-id nil 'l)
                                     (when (and (boundp 'which-func-mode) which-func-mode)
                                       (powerline-raw which-func-format nil 'l))
                                     (powerline-raw " ")
                                     (funcall separator-left mode-line face1)
                                     (when (boundp 'erc-modified-channels-object)
                                       (powerline-raw erc-modified-channels-object face1 'l))
                                     (powerline-major-mode face1 'l)
                                     (powerline-process face1)
                                     (powerline-minor-modes face1 'l)
                                     (powerline-narrow face1 'l)
                                     (powerline-raw " " face1)
                                     (funcall separator-left face1 face2)
                                     (powerline-vc face2 'r)
                                     (when (bound-and-true-p nyan-mode)
                                       (powerline-raw (list (nyan-create)) face2 'l))))
                          (rhs (list (powerline-raw global-mode-string face2 'r)
                                     (funcall separator-right face2 face1)
                                     (unless window-system
                                       (powerline-raw (char-to-string #xe0a1) face1 'l))
                                     (funcall separator-right face1 mode-line)
                                     (powerline-raw " ")
                                     (powerline-raw "%6p" nil 'r)
                                     (when powerline-display-hud
                                       (powerline-hud face2 face1)))))
                     (concat (powerline-render lhs)
                             (powerline-fill face2 (powerline-width rhs))
                             (powerline-render rhs)))))))