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


From: Chong Yidong
Subject: [Emacs-diffs] Changes to emacs/lisp/longlines.el
Date: Mon, 19 Dec 2005 14:30:56 +0000

Index: emacs/lisp/longlines.el
diff -u emacs/lisp/longlines.el:1.22 emacs/lisp/longlines.el:1.23
--- emacs/lisp/longlines.el:1.22        Tue Nov 29 23:54:47 2005
+++ emacs/lisp/longlines.el     Mon Dec 19 14:30:56 2005
@@ -1,6 +1,6 @@
 ;;; longlines.el --- automatically wrap long lines
 
-;; Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
 
 ;; Authors:    Kai Grossjohann <address@hidden>
 ;;             Alex Schroeder <address@hidden>
@@ -127,8 +127,8 @@
           ;; longlines-wrap-lines that we'll never encounter from here
          (save-restriction
            (widen)
-           (longlines-decode-buffer))
-          (longlines-wrap-region (point-min) (point-max))
+           (longlines-decode-buffer)
+           (longlines-wrap-region (point-min) (point-max)))
           (set-buffer-modified-p mod))
         (when (and longlines-show-hard-newlines
                    (not longlines-showing))
@@ -327,10 +327,11 @@
   (if (null beg) (setq beg (point)))
   (if (null end) (setq end (mark t)))
   (save-excursion
-    (goto-char (min beg end))
-    (while (search-forward "\n" (max beg end) t)
-      (set-hard-newline-properties
-       (match-beginning 0) (match-end 0)))))
+    (let ((reg-max (max beg end)))
+      (goto-char (min beg end))
+      (while (search-forward "\n" reg-max t)
+       (set-hard-newline-properties
+        (match-beginning 0) (match-end 0))))))
 
 (defun longlines-decode-buffer ()
   "Turn all newlines in the buffer into hard newlines."
@@ -341,9 +342,10 @@
 Hard newlines are left intact.  The optional argument BUFFER exists for
 compatibility with `format-alist', and is ignored."
   (save-excursion
-    (let ((mod (buffer-modified-p)))
+    (let ((reg-max (max beg end))
+         (mod (buffer-modified-p)))
       (goto-char (min beg end))
-      (while (search-forward "\n" (max (max beg end)) t)
+      (while (search-forward "\n" reg-max t)
         (unless (get-text-property (match-beginning 0) 'hard)
           (replace-match " ")))
       (set-buffer-modified-p mod)




reply via email to

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