Commit eb0d2864 authored by Chong Yidong's avatar Chong Yidong
Browse files

* longlines.el (longlines-mode): Wrap while widened.

	(longlines-decode-region, longlines-encode-region): Compute max
	just once.
parent faef8681
2005-12-19 Chong Yidong <cyd@stupidchicken.com>
* longlines.el (longlines-mode): Wrap while widened.
(longlines-decode-region, longlines-encode-region): Compute max
just once.
2005-12-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 2005-12-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
   
* cus-edit.el (mac): New group. * cus-edit.el (mac): New group.
...@@ -21,6 +27,7 @@ ...@@ -21,6 +27,7 @@
* emacs-lisp/cl-extra.el (cl-macroexpand-all): Fix code-walk for * emacs-lisp/cl-extra.el (cl-macroexpand-all): Fix code-walk for
lexical-let when encountering ((lambda (...) ...) ...). lexical-let when encountering ((lambda (...) ...) ...).
   
>>>>>>> 1.8828
2005-12-17 Chong Yidong <cyd@stupidchicken.com> 2005-12-17 Chong Yidong <cyd@stupidchicken.com>
   
* progmodes/sh-script.el (sh-mode): * progmodes/sh-script.el (sh-mode):
......
;;; longlines.el --- automatically wrap long lines ;;; 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 <Kai.Grossjohann@CS.Uni-Dortmund.DE> ;; Authors: Kai Grossjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
;; Alex Schroeder <alex@gnu.org> ;; Alex Schroeder <alex@gnu.org>
...@@ -127,8 +127,8 @@ are indicated with a symbol." ...@@ -127,8 +127,8 @@ are indicated with a symbol."
;; longlines-wrap-lines that we'll never encounter from here ;; longlines-wrap-lines that we'll never encounter from here
(save-restriction (save-restriction
(widen) (widen)
(longlines-decode-buffer)) (longlines-decode-buffer)
(longlines-wrap-region (point-min) (point-max)) (longlines-wrap-region (point-min) (point-max)))
(set-buffer-modified-p mod)) (set-buffer-modified-p mod))
(when (and longlines-show-hard-newlines (when (and longlines-show-hard-newlines
(not longlines-showing)) (not longlines-showing))
...@@ -327,10 +327,11 @@ If BEG and END are nil, the point and mark are used." ...@@ -327,10 +327,11 @@ If BEG and END are nil, the point and mark are used."
(if (null beg) (setq beg (point))) (if (null beg) (setq beg (point)))
(if (null end) (setq end (mark t))) (if (null end) (setq end (mark t)))
(save-excursion (save-excursion
(goto-char (min beg end)) (let ((reg-max (max beg end)))
(while (search-forward "\n" (max beg end) t) (goto-char (min beg end))
(set-hard-newline-properties (while (search-forward "\n" reg-max t)
(match-beginning 0) (match-end 0))))) (set-hard-newline-properties
(match-beginning 0) (match-end 0))))))
(defun longlines-decode-buffer () (defun longlines-decode-buffer ()
"Turn all newlines in the buffer into hard newlines." "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." ...@@ -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 Hard newlines are left intact. The optional argument BUFFER exists for
compatibility with `format-alist', and is ignored." compatibility with `format-alist', and is ignored."
(save-excursion (save-excursion
(let ((mod (buffer-modified-p))) (let ((reg-max (max beg end))
(mod (buffer-modified-p)))
(goto-char (min beg end)) (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) (unless (get-text-property (match-beginning 0) 'hard)
(replace-match " "))) (replace-match " ")))
(set-buffer-modified-p mod) (set-buffer-modified-p mod)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment