From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: Word wrapping and long lines Date: Fri, 19 Sep 2008 04:03:26 +0200 Message-ID: <48D3086E.9070902@gmail.com> References: <48D2D293.1050409@gmail.com> <87vdwt3uck.fsf@cyd.mit.edu> <48D2EB33.7000104@gmail.com> <877i99kkg0.fsf@cyd.mit.edu> <48D30073.10108@gmail.com> <87y71ogblz.fsf@catnip.gol.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1221789832 22391 80.91.229.12 (19 Sep 2008 02:03:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Sep 2008 02:03:52 +0000 (UTC) Cc: Chong Yidong , Emacs Devel To: Miles Bader Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 19 04:04:48 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KgVMV-0000xY-6j for ged-emacs-devel@m.gmane.org; Fri, 19 Sep 2008 04:04:47 +0200 Original-Received: from localhost ([127.0.0.1]:48202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KgVLU-00033c-0m for ged-emacs-devel@m.gmane.org; Thu, 18 Sep 2008 22:03:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KgVLQ-00032p-CT for emacs-devel@gnu.org; Thu, 18 Sep 2008 22:03:40 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KgVLO-000327-Qf for emacs-devel@gnu.org; Thu, 18 Sep 2008 22:03:40 -0400 Original-Received: from [199.232.76.173] (port=38133 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KgVLO-000324-N4 for emacs-devel@gnu.org; Thu, 18 Sep 2008 22:03:38 -0400 Original-Received: from ch-smtp01.sth.basefarm.net ([80.76.149.212]:44530) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KgVLJ-0000W3-Ud; Thu, 18 Sep 2008 22:03:34 -0400 Original-Received: from c83-254-151-87.bredband.comhem.se ([83.254.151.87]:61843 helo=[127.0.0.1]) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1KgVLI-0006CV-42; Fri, 19 Sep 2008 04:03:32 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 In-Reply-To: <87y71ogblz.fsf@catnip.gol.com> X-Enigmail-Version: 0.95.7 X-Antivirus: avast! (VPS 080918-0, 2008-09-18), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.151.87 X-Scan-Result: No virus found in message 1KgVLI-0006CV-42. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1KgVLI-0006CV-42 5cde396ea375081b4fb1888156d625c4 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6? (barebone, rare!) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:103953 Archived-At: Miles Bader wrote: > "Lennart Borgman (gmail)" writes: >> Maybe something like this can be used: > ... >> (define-minor-mode wrap-to-fill-mode > > A clever idea, but... > (1) _centering_ the display like that is bizarre and unpleasant > (2) Having the margin be on the other side of the fringe is kind of > annoying; personally, when I want a bunch of whitespace on the right, I > want it to be whitespace, without the "barrier" the fringe represents. > > But maybe it's a good start... > > -Miles I do not know what to do about the barrier, but this takes care of the left margin. (defun set-wrap-to-fill-values () "Use `fill-column' display columns in buffer windows." (let ((buf-windows (get-buffer-window-list (current-buffer)))) (dolist (win buf-windows) (if wrap-to-fill-mode (let* ((edges (window-edges win)) (win-width (- (nth 2 edges) (nth 0 edges))) (extra-width (- win-width fill-column)) (left-marg (if wrap-to-fill-left-marg wrap-to-fill-left-marg (- (/ extra-width 2) 1))) (right-marg (- win-width fill-column left-marg)) (win-margs (window-margins win)) (old-left (or (car win-margs) 0)) (old-right (or (cdr win-margs) 0))) (unless (> left-marg 0) (setq left-marg 0)) (unless (> right-marg 0) (setq right-marg 0)) (unless (and (= old-left left-marg) (= old-right right-marg)) (set-window-margins win left-marg right-marg))) (set-window-buffer win (current-buffer)))))) (defcustom wrap-to-fill-left-marg nil "Left margin handling for `wrap-to-fill-mode'. Used by `wrap-to-fill-mode'. If nil then center the display columns. Otherwise it should be a number which will be the left margin." :type '(choice (const :tag "Center" nil) (integer :tag "Left margin")) :group 'emacs) (make-variable-buffer-local 'wrap-to-fill-left-marg) (define-minor-mode wrap-to-fill-mode "Use `fill-column' display columns in buffer windows. By default the display columns are centered, but see the option `wrap-to-fill-left-marg'. Note: When turning this on `visual-line-mode' is also turned on. This is not reset when turning off this mode." :group 'emacs (if wrap-to-fill-mode (progn (add-hook 'window-configuration-change-hook 'set-wrap-to-fill-values nil t) (visual-line-mode 1)) (remove-hook 'window-configuration-change-hook 'set-wrap-to-fill-values t)) (set-wrap-to-fill-values))