0

Emacs 26.1 I use smart mode line: https://github.com/Malabarba/smart-mode-line

Here result: enter image description here

Nice. It's work fine.

But I need to show % near rows and columns. Something like this:

712:93 (17%)

Is it possible?

2
  • https://www.gnu.org/software/emacs/manual/html_node/elisp/Mode-Line-Data.html
    – Drew
    Nov 2, 2018 at 14:52
  • I this tutorial I can't find how set %p near "line-number:column-number" Nov 3, 2018 at 14:04

1 Answer 1

0

EDIT I loaded up smart-mode-line myself, and took a more in depth look.

As a smart-mode-line user you'll need to edit your theme. Using the default smart-mode-line-powerline-theme.el as an example, at line 80 you'll find sml/position-percentage. Move this whole line up to line 63 ie: just below sml/line-number. This should get the effect you want.

Note that smart-mode-line uses the Customize facility. It may be easier (and saner) to make these changes there. Unfortunately you can't change the mode line format there. Only the faces.

To change the mode line format you'll want to study Mode Line Format from the GNU Emacs Lisp Reference Manual. Pay special attention to the variables mode-line-format and mode-line-position. You'll need to move mode-line-position to where you want it with in mode-line-format. You can customize mode-line-format if you wish. You can reach its customize group by doing: Meta+x customize-group Return mode-line Return

It may just be easier to request that an easy way to reorder the mode line be added to smart-line-mode.

5
  • Change source not help. But how by Customize I can change percent position on smart-mode-line? Nov 8, 2018 at 12:43
  • @Alexei please see my edits. What you want is doable, but probably not simple.
    – nega
    Nov 8, 2018 at 16:01
  • What do you mean "MOVE"? How I can move any settings? I think I can ONLY CHANGE any settings. Not move. Nov 9, 2018 at 8:23
  • mode-line-format is an ordered list that represents the order of the items in your mode line. If you want to move an item on your mode line, you have to move that item's symbol in mode-line-format. In other words change mode-line-format so it's in a different order.
    – nega
    Nov 9, 2018 at 15:32
  • Yes. I change "mode-line-format" and now percent is exact after row:column. ("%e" mode-line-front-space "%p" mode-line-mule-info mode-line-client mode-line-modified mode-line-remote mode-line-frame-identification mode-line-buffer-identification sml/pos-id-separator (vc-mode vc-mode) sml/pre-modes-separator mode-line-modes mode-line-misc-info mode-line-end-spaces). I remove default item "mode-line-front-space" and add item "%p". But the question is why , by default "mode-line-front-space" is a position percentage? Nov 10, 2018 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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