From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Ivan Kanis <ivan@kanis.fr>
Cc: Eli Zaretskii <eliz@gnu.org>,
Emacs Development List <emacs-devel@gnu.org>
Subject: Re: fill length of visual line mode
Date: Fri, 03 Oct 2014 17:20:07 -0400 [thread overview]
Message-ID: <jwvsij4rh30.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87vbo0ga6i.fsf_-_@kanis.fr> (Ivan Kanis's message of "Fri, 03 Oct 2014 22:39:17 +0200")
> 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
next prev parent reply other threads:[~2014-10-03 21:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-02 7:48 fill length of visual line mode Ivan Kanis
2014-10-02 15:16 ` Eli Zaretskii
2014-10-03 21:19 ` Johan Bockgård
2014-10-04 7:07 ` Eli Zaretskii
2014-10-04 17:16 ` Johan Bockgård
2014-10-02 15:50 ` Glenn Morris
2014-10-03 20:39 ` Ivan Kanis
2014-10-03 21:20 ` Stefan Monnier [this message]
2014-10-04 9:58 ` Harald Hanche-Olsen
2014-10-04 15:45 ` Drew Adams
2014-10-04 14:23 ` Ivan Kanis
2014-10-04 22:25 ` Stefan Monnier
2014-10-05 7:59 ` Ivan Kanis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvsij4rh30.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=ivan@kanis.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.