unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Word wrapping and long lines
Date: Fri, 19 Sep 2008 03:29:23 +0200	[thread overview]
Message-ID: <48D30073.10108@gmail.com> (raw)
In-Reply-To: <877i99kkg0.fsf@cyd.mit.edu>

Chong Yidong wrote:
> "Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> 
>>> Longlines mode will hopefully be phased out as its functionality is
>>> replaced by visual-line-mode.
>> But what about wrapping at some specific width (like longlines-mode
>> does), is that not implemented yet?
> 
> No.

Maybe something like this can be used:

(defun set-wrap-to-fill-values ()
  "Center `fill-column' display columns in buffer windows."
  (let ((buf-windows (get-buffer-window-list (current-buffer))))
    (dolist (win buf-windows)
      (let* ((edges (window-edges win))
             (win-width (- (nth 2 edges) (nth 0 edges)))
             (extra-width (- win-width fill-column))
             (left-marg (- (/ extra-width 2) 1))
             (right-marg (- win-width fill-column left-marg))
             (old-left left-margin-width)
             (old-right right-margin-width)
             )
        (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))))))

(define-minor-mode wrap-to-fill-mode
  "Center `fill-column' display columns in buffer windows."
  :group 'emacs
  (if wrap-to-fill-mode
      (add-hook 'window-configuration-change-hook
'set-wrap-to-fill-values nil t)
    (remove-hook 'window-configuration-change-hook
'set-wrap-to-fill-values t)))





  reply	other threads:[~2008-09-19  1:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 22:13 Word wrapping and long lines Lennart Borgman (gmail)
2008-09-18 23:30 ` Chong Yidong
2008-09-18 23:58   ` Lennart Borgman (gmail)
2008-09-19  1:12     ` Chong Yidong
2008-09-19  1:29       ` Lennart Borgman (gmail) [this message]
2008-09-19  1:36         ` Miles Bader
2008-09-19  2:03           ` Lennart Borgman (gmail)
2008-09-19  2:06             ` Lennart Borgman (gmail)
2008-09-19  2:28               ` Miles Bader
2008-09-19  2:37                 ` Lennart Borgman (gmail)
2008-09-19  2:43                 ` Stefan Monnier
2008-09-19  2:53                   ` Miles Bader
2008-09-20 10:45                 ` Johan Bockgård
2008-09-20 15:51     ` Johan Bockgård

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48D30073.10108@gmail.com \
    --to=lennart.borgman@gmail.com \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).