From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: fill length of visual line mode Date: Fri, 03 Oct 2014 17:20:07 -0400 Message-ID: References: <87oatu6hfn.fsf@kanis.fr> <87oatu6hfn.fsf@kanis.fr> <87vbo0ga6i.fsf_-_@kanis.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1412371270 8855 80.91.229.3 (3 Oct 2014 21:21:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 3 Oct 2014 21:21:10 +0000 (UTC) Cc: Eli Zaretskii , Emacs Development List To: Ivan Kanis Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Oct 03 23:21:03 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XaAHc-0006bw-JU for ged-emacs-devel@m.gmane.org; Fri, 03 Oct 2014 23:21:00 +0200 Original-Received: from localhost ([::1]:41398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XaAHc-00076F-36 for ged-emacs-devel@m.gmane.org; Fri, 03 Oct 2014 17:21:00 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33912) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XaAH2-00070v-O7 for emacs-devel@gnu.org; Fri, 03 Oct 2014 17:20:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XaAGv-0008H4-9b for emacs-devel@gnu.org; Fri, 03 Oct 2014 17:20:24 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:31738) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XaAGn-0008E9-II; Fri, 03 Oct 2014 17:20:09 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArYGAIDvNVNFxKjo/2dsb2JhbABZgwaDSlK/a4EXF3SCJQEBAQECASMzIwULCxoCGA4CAhQYDSSIBAivG6J+F4EpjVEHgm+BSQSpGYFqg0wh X-IPAS-Result: ArYGAIDvNVNFxKjo/2dsb2JhbABZgwaDSlK/a4EXF3SCJQEBAQECASMzIwULCxoCGA4CAhQYDSSIBAivG6J+F4EpjVEHgm+BSQSpGYFqg0wh X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="91624158" Original-Received: from 69-196-168-232.dsl.teksavvy.com (HELO pastel.home) ([69.196.168.232]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Oct 2014 17:20:08 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 5BDDB8597; Fri, 3 Oct 2014 17:20:07 -0400 (EDT) In-Reply-To: <87vbo0ga6i.fsf_-_@kanis.fr> (Ivan Kanis's message of "Fri, 03 Oct 2014 22:39:17 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:174957 Archived-At: > 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=E2=80=99s 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