aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2005-12-19 14:30:56 +0000
committerChong Yidong2005-12-19 14:30:56 +0000
commiteb0d286432b963396f7ce7c02bacfde2ce1623e0 (patch)
tree3616bc46438451920a5ffc6ac36bcf31549aa084
parentfaef8681cb65537b35429d2d611e45512b81f052 (diff)
downloademacs-eb0d286432b963396f7ce7c02bacfde2ce1623e0.tar.gz
emacs-eb0d286432b963396f7ce7c02bacfde2ce1623e0.zip
* longlines.el (longlines-mode): Wrap while widened.
(longlines-decode-region, longlines-encode-region): Compute max just once.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/longlines.el20
2 files changed, 18 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3c0382e7e82..954ff20d4e8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12005-12-19 Chong Yidong <cyd@stupidchicken.com>
2
3 * longlines.el (longlines-mode): Wrap while widened.
4 (longlines-decode-region, longlines-encode-region): Compute max
5 just once.
6
12005-12-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 72005-12-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 8
3 * cus-edit.el (mac): New group. 9 * cus-edit.el (mac): New group.
@@ -21,6 +27,7 @@
21 * emacs-lisp/cl-extra.el (cl-macroexpand-all): Fix code-walk for 27 * emacs-lisp/cl-extra.el (cl-macroexpand-all): Fix code-walk for
22 lexical-let when encountering ((lambda (...) ...) ...). 28 lexical-let when encountering ((lambda (...) ...) ...).
23 29
30>>>>>>> 1.8828
242005-12-17 Chong Yidong <cyd@stupidchicken.com> 312005-12-17 Chong Yidong <cyd@stupidchicken.com>
25 32
26 * progmodes/sh-script.el (sh-mode): 33 * progmodes/sh-script.el (sh-mode):
diff --git a/lisp/longlines.el b/lisp/longlines.el
index a3912a26ca7..5ec2f0d8db6 100644
--- a/lisp/longlines.el
+++ b/lisp/longlines.el
@@ -1,6 +1,6 @@
1;;; longlines.el --- automatically wrap long lines 1;;; longlines.el --- automatically wrap long lines
2 2
3;; Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc. 3;; Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
4 4
5;; Authors: Kai Grossjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> 5;; Authors: Kai Grossjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
6;; Alex Schroeder <alex@gnu.org> 6;; Alex Schroeder <alex@gnu.org>
@@ -127,8 +127,8 @@ are indicated with a symbol."
127 ;; longlines-wrap-lines that we'll never encounter from here 127 ;; longlines-wrap-lines that we'll never encounter from here
128 (save-restriction 128 (save-restriction
129 (widen) 129 (widen)
130 (longlines-decode-buffer)) 130 (longlines-decode-buffer)
131 (longlines-wrap-region (point-min) (point-max)) 131 (longlines-wrap-region (point-min) (point-max)))
132 (set-buffer-modified-p mod)) 132 (set-buffer-modified-p mod))
133 (when (and longlines-show-hard-newlines 133 (when (and longlines-show-hard-newlines
134 (not longlines-showing)) 134 (not longlines-showing))
@@ -327,10 +327,11 @@ If BEG and END are nil, the point and mark are used."
327 (if (null beg) (setq beg (point))) 327 (if (null beg) (setq beg (point)))
328 (if (null end) (setq end (mark t))) 328 (if (null end) (setq end (mark t)))
329 (save-excursion 329 (save-excursion
330 (goto-char (min beg end)) 330 (let ((reg-max (max beg end)))
331 (while (search-forward "\n" (max beg end) t) 331 (goto-char (min beg end))
332 (set-hard-newline-properties 332 (while (search-forward "\n" reg-max t)
333 (match-beginning 0) (match-end 0))))) 333 (set-hard-newline-properties
334 (match-beginning 0) (match-end 0))))))
334 335
335(defun longlines-decode-buffer () 336(defun longlines-decode-buffer ()
336 "Turn all newlines in the buffer into hard newlines." 337 "Turn all newlines in the buffer into hard newlines."
@@ -341,9 +342,10 @@ If BEG and END are nil, the point and mark are used."
341Hard newlines are left intact. The optional argument BUFFER exists for 342Hard newlines are left intact. The optional argument BUFFER exists for
342compatibility with `format-alist', and is ignored." 343compatibility with `format-alist', and is ignored."
343 (save-excursion 344 (save-excursion
344 (let ((mod (buffer-modified-p))) 345 (let ((reg-max (max beg end))
346 (mod (buffer-modified-p)))
345 (goto-char (min beg end)) 347 (goto-char (min beg end))
346 (while (search-forward "\n" (max (max beg end)) t) 348 (while (search-forward "\n" reg-max t)
347 (unless (get-text-property (match-beginning 0) 'hard) 349 (unless (get-text-property (match-beginning 0) 'hard)
348 (replace-match " "))) 350 (replace-match " ")))
349 (set-buffer-modified-p mod) 351 (set-buffer-modified-p mod)