[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fill length of visual line mode
From: |
Stefan Monnier |
Subject: |
Re: fill length of visual line mode |
Date: |
Fri, 03 Oct 2014 17:20:07 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
> It just boils down to setting the right margin. I have to hide the right
> fringe or it looks wrong.
Better to swap the margin and the fringe with fringes-outside-margins.
> (defun ivan-gnus-hack-visual-line-length ()
> "Set visual line length by expanding the right margin of the
> buffer’s window."
> (let ((window (selected-window)))
> (select-window (car (get-buffer-window-list gnus-article-buffer)))
> (set-window-margins nil 0 (- (window-width) 80))
> (set-window-fringes (selected-window) 8 0)
> (visual-line-mode)
> (select-window window)))
You want to use `with-selection-window' above.
Additionally, the above will lose its effect if you hide the window and
show it again: you'd need to do it via window-configuration-change-hook.
Other problem: if window-width is smaller than 80 (which I gather is
your target fill-column in the above code), you end up setting
a negative margin.
> It just feels hackish and wrong. The right thing I feel is to use
> fill-column.
I'm not opposed to a patch that would let it obey fill-column
(optionally). But it does beg the question: what if the window is
smaller than fill-column? Should it then fill at the window's edge or
should it continue as if truncate-lines is set?
Stefan