emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/longlines.el,v


From: Chong Yidong
Subject: [Emacs-diffs] Changes to emacs/lisp/longlines.el,v
Date: Wed, 17 Oct 2007 02:50:23 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      07/10/17 02:50:23

Index: longlines.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/longlines.el,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- longlines.el        7 Aug 2007 16:10:20 -0000       1.38
+++ longlines.el        17 Oct 2007 02:50:23 -0000      1.39
@@ -55,7 +55,11 @@
   "Non-nil means wrapping and filling happen at the edge of the window.
 Otherwise, `fill-column' is used, regardless of the window size.  This
 does not work well when the buffer is displayed in multiple windows
-with differing widths."
+with differing widths.
+
+If the value is an integer, that specifies the distance from the
+right edge of the window at which wrapping occurs.  For any other
+non-nil value, wrapping occurs 2 characters from the right edge."
   :group 'longlines
   :type 'boolean)
 
@@ -117,8 +121,14 @@
             'longlines-search-function)
         (add-to-list 'buffer-substring-filters 'longlines-encode-string)
         (when longlines-wrap-follows-window-size
+         (let ((dw (if (and (integerp longlines-wrap-follows-window-size)
+                            (>= longlines-wrap-follows-window-size 0)
+                            (< longlines-wrap-follows-window-size
+                               (window-width)))
+                       longlines-wrap-follows-window-size
+                     2)))
           (set (make-local-variable 'fill-column)
-               (- (window-width) window-min-width))
+                (- (window-width) dw)))
           (add-hook 'window-configuration-change-hook
                     'longlines-window-change-function nil t))
         (let ((buffer-undo-list t)
@@ -415,9 +425,14 @@
 (defun longlines-window-change-function ()
   "Re-wrap the buffer if the window width has changed.
 This is called by `window-configuration-change-hook'."
-  (when (/= fill-column (- (window-width) window-min-width))
-    (setq fill-column (- (window-width) window-min-width))
-    (longlines-wrap-region (point-min) (point-max))))
+  (let ((dw (if (and (integerp longlines-wrap-follows-window-size)
+                    (>= longlines-wrap-follows-window-size 0)
+                    (< longlines-wrap-follows-window-size (window-width)))
+               longlines-wrap-follows-window-size
+             2)))
+    (when (/= fill-column (- (window-width) dw))
+      (setq fill-column (- (window-width) dw))
+      (longlines-wrap-region (point-min) (point-max)))))
 
 ;; Isearch
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]