emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111034: * longlines.el (longlines-wr


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111034: * longlines.el (longlines-wrap-line, longlines-encode-region): Preserve text properties.
Date: Fri, 30 Nov 2012 14:56:51 +0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111034
fixes bug: http://debbugs.gnu.org/1425
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Fri 2012-11-30 14:56:51 +0800
message:
  * longlines.el (longlines-wrap-line, longlines-encode-region): Preserve text 
properties.
modified:
  lisp/ChangeLog
  lisp/longlines.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-11-30 04:44:52 +0000
+++ b/lisp/ChangeLog    2012-11-30 06:56:51 +0000
@@ -1,3 +1,8 @@
+2012-11-30  Chong Yidong  <address@hidden>
+
+       * longlines.el (longlines-wrap-line, longlines-encode-region):
+       Preserve text properties (Bug#1425).
+
 2012-11-30  OKAZAKI Tetsurou  <address@hidden>  (tiny change)
 
        * vc/vc.el (vc-register): Allow registering a file which is

=== modified file 'lisp/longlines.el'
--- a/lisp/longlines.el 2012-01-19 07:21:25 +0000
+++ b/lisp/longlines.el 2012-11-30 06:56:51 +0000
@@ -278,7 +278,7 @@
 If wrapping is performed, point remains on the line.  If the line does
 not need to be wrapped, move point to the next line and return t."
   (if (longlines-set-breakpoint)
-      (progn (insert-before-markers ?\n)
+      (progn (insert-before-markers-and-inherit ?\n)
             (backward-char 1)
              (delete-char -1)
             (forward-char 1)
@@ -384,8 +384,12 @@
          (mod (buffer-modified-p)))
       (goto-char (min beg end))
       (while (search-forward "\n" reg-max t)
-        (unless (get-text-property (match-beginning 0) 'hard)
-          (replace-match " ")))
+       (let ((pos (match-beginning 0)))
+         (unless (get-text-property pos 'hard)
+           (goto-char (1+ pos))
+           (insert-and-inherit " ")
+           (delete-region pos (1+ pos))
+           (remove-text-properties pos (1+ pos) 'hard))))
       (set-buffer-modified-p mod)
       end)))
 


reply via email to

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