From: Chong Yidong Date: Mon, 19 Dec 2005 14:30:56 +0000 (+0000) Subject: * longlines.el (longlines-mode): Wrap while widened. X-Git-Tag: emacs-pretest-22.0.90~5190 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=eb0d286432b963396f7ce7c02bacfde2ce1623e0;p=emacs.git * longlines.el (longlines-mode): Wrap while widened. (longlines-decode-region, longlines-encode-region): Compute max just once. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3c0382e7e82..954ff20d4e8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2005-12-19 Chong Yidong + + * longlines.el (longlines-mode): Wrap while widened. + (longlines-decode-region, longlines-encode-region): Compute max + just once. + 2005-12-19 YAMAMOTO Mitsuharu * cus-edit.el (mac): New group. @@ -21,6 +27,7 @@ * emacs-lisp/cl-extra.el (cl-macroexpand-all): Fix code-walk for lexical-let when encountering ((lambda (...) ...) ...). +>>>>>>> 1.8828 2005-12-17 Chong Yidong * 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 @@ ;;; 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 ;; Alex Schroeder @@ -127,8 +127,8 @@ are indicated with a symbol." ;; 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 BEG and END are nil, the point and mark are used." (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 @@ If BEG and END are nil, the point and mark are used." 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)