I am very new to the world of Emacs and therefore I'd like to ask of everyone to be kind, not that I am expecting any flame or hate. (just a reminder)

I was recently recommended to use visual-fill-column-mode by someone in the Emacs matrix room after asking if Emacs had a soft wrap feature and let me tell you, that feature is amazing! One thing that bothers me though is when I set (setq visual-fill-column-center-text t) and enable display-line-numbers-mode, the numbers line moves alongside the text similar to what is shown below.

Picture showing number line when visual-fill-column is enabled.

Because of this I thought I should ask if it was possible to prevent this behavior and have the number line remain displayed on the left side of my Emacs frame. (similar to what it looks like prior to the setq)

1 Answer 1


As to the built-in line numbers that have been available since Emacs 26 [display-line-numbers-mode], it is not possible to display line numbers within the window margin or to the left of the window margin -- the built-in line numbers are displayed inside the text area. The deprecated Lisp versions of line numbers display within the window margin [linum and nlinum], and it is likely possible to configure/tweak them so that the numbers are left-aligned.

The following is a link to a helpful diagram of the window layout:


The following is a quote from the commentary of visual-fill-column-mode describing how the mode modifies the window-margin(s) to achieve the visual effect:


;;; Commentary:

;; `visual-fill-column-mode' is a small Emacs minor mode that mimics the effect
;; of `fill-column' in `visual-line-mode'.  Instead of wrapping lines at the
;; window edge, which is the standard behaviour of `visual-line-mode', it wraps
;; lines at `fill-column' (or `visual-fill-column-width', if set).  This is
;; accomplished by widening the margins, which narrows the text area.  When the
;; window size changes, the margins are adjusted automatically.
;; When `visual-fill-column-center-text' is set, the text is centered in the
;; window.  This can also be used in combination with `auto-fill-mode' instead
;; of `visual-line-mode', or in programming modes.
  • That is unfortunate. :/ I wonder if the maintainers of display-line-numbers are interested in changing the current number line implementation to something similar to the deprecated versions. (linium | nlinum) Commented Jan 19 at 15:44
  • Here is a link to the emacs-develintroduction of native line numbers by Eli Zaretskii on June 17, 2017: lists.gnu.org/archive/html/emacs-devel/2017-06/msg00318.html The thread contains discussion as to advantages v. disadvantages of using the text area versus the display margin; e.g., support for line numbers with bidirectional text. My recollection is that there was also a thread on reddit / emacs at same time, which if that thread still exists, may contain additional interesting discussion.
    – lawlist
    Commented Jan 19 at 22:29
  • Here is a link to an interesting rant by Eli Z. in response to my bug report as the Lisp implementation linum on June 15, 2014 -- three (3) years before Eli wrote the native implementation: lists.gnu.org/archive/html/bug-gnu-emacs/2014-06/msg00562.html
    – lawlist
    Commented Jan 19 at 22:43
  • Thank you for linking the two discussions! I am going to read them now! :) Commented Jan 25 at 3:07
  • 1
    Alright, so from my experience nlinum-relative was not as quick as I'd hoped it would be, but it was exactly what I wanted it to be. The performance side alone had me go back to display-line-numbers and disable it in org-mode instead of using an alternative. I guess I'll have to wait it out until I learn some elisp or find an alternative solution to this problem. Nonetheless, appreciate the help! :) Commented Jan 25 at 3:10

Your Answer

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

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