emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r100215: CUA mode: Fix use of `filter


From: Juanma Barranquero
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100215: CUA mode: Fix use of `filter-buffer-substring' (rework previous change).
Date: Mon, 10 May 2010 16:37:59 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100215
committer: Juanma Barranquero <address@hidden>
branch nick: trunk
timestamp: Mon 2010-05-10 16:37:59 +0200
message:
  CUA mode: Fix use of `filter-buffer-substring' (rework previous change).
  
  * emulation/cua-base.el (cua--filter-buffer-noprops): New function.
    (cua-repeat-replace-region):
  * emulation/cua-rect.el (cua--extract-rectangle, cua-incr-rectangle):
  * emulation/cua-gmrk.el (cua-copy-region-to-global-mark)
   (cua-cut-region-to-global-mark): Use it.
modified:
  lisp/ChangeLog
  lisp/emulation/cua-base.el
  lisp/emulation/cua-gmrk.el
  lisp/emulation/cua-rect.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-05-10 02:07:58 +0000
+++ b/lisp/ChangeLog    2010-05-10 14:37:59 +0000
@@ -1,3 +1,12 @@
+2010-05-10  Juanma Barranquero  <address@hidden>
+
+       Fix use of `filter-buffer-substring' (rework previous change).
+       * emulation/cua-base.el (cua--filter-buffer-noprops): New function.
+       (cua-repeat-replace-region):
+       * emulation/cua-rect.el (cua--extract-rectangle, cua-incr-rectangle):
+       * emulation/cua-gmrk.el (cua-copy-region-to-global-mark)
+       (cua-cut-region-to-global-mark): Use it.
+
 2010-05-09  Michael R. Mauger  <address@hidden>
 
        * progmodes/sql.el: Version 2.1

=== modified file 'lisp/emulation/cua-base.el'
--- a/lisp/emulation/cua-base.el        2010-05-07 00:46:09 +0000
+++ b/lisp/emulation/cua-base.el        2010-05-10 14:37:59 +0000
@@ -780,6 +780,10 @@
     (setq mark-active nil)
     (run-hooks 'deactivate-mark-hook)))
 
+(defun cua--filter-buffer-noprops (start end)
+  (let ((str (filter-buffer-substring start end)))
+    (set-text-properties 0 (length str) nil str)
+    str))
 
 ;; The current register prefix
 (defvar cua--register nil)
@@ -1039,10 +1043,7 @@
                    (setq s (car u))
                  (setq s (car u) e (cdr u)))))))
          (cond ((and s e (<= s e) (= s (mark t)))
-                (setq cua--repeat-replace-text
-                      (filter-buffer-substring s e))
-                (set-text-properties 0 (length cua--repeat-replace-text)
-                                     nil cua--repeat-replace-text))
+                (setq cua--repeat-replace-text (cua--filter-buffer-noprops s 
e)))
                ((and (null s) (eq u elt)) ;; nothing inserted
                 (setq cua--repeat-replace-text
                       ""))

=== modified file 'lisp/emulation/cua-gmrk.el'
--- a/lisp/emulation/cua-gmrk.el        2010-05-07 00:46:09 +0000
+++ b/lisp/emulation/cua-gmrk.el        2010-05-10 14:37:59 +0000
@@ -137,9 +137,8 @@
       (let ((src-buf (current-buffer)))
        (save-excursion
          (if (equal (marker-buffer cua--global-mark-marker) src-buf)
-             (let ((text (filter-buffer-substring start end)))
+             (let ((text (cua--filter-buffer-noprops start end)))
                (goto-char (marker-position cua--global-mark-marker))
-               (set-text-properties 0 (length text) text)
                (insert text))
            (set-buffer (marker-buffer cua--global-mark-marker))
            (goto-char (marker-position cua--global-mark-marker))
@@ -162,11 +161,10 @@
              (if (and (< start (marker-position cua--global-mark-marker))
                       (< (marker-position cua--global-mark-marker) end))
                  (message "Can't move region into itself")
-               (let ((text (filter-buffer-substring start end))
+               (let ((text (cua--filter-buffer-noprops start end))
                      (p1 (copy-marker start))
                      (p2 (copy-marker end)))
                  (goto-char (marker-position cua--global-mark-marker))
-                 (set-text-properties 0 (length text) text)
                  (insert text)
                  (cua--activate-global-mark)
                  (delete-region (marker-position p1) (marker-position p2))

=== modified file 'lisp/emulation/cua-rect.el'
--- a/lisp/emulation/cua-rect.el        2010-04-14 00:33:32 +0000
+++ b/lisp/emulation/cua-rect.el        2010-05-10 14:37:59 +0000
@@ -625,7 +625,7 @@
     (if (not (cua--rectangle-virtual-edges))
        (cua--rectangle-operation nil nil nil nil nil ; do not tabify
          '(lambda (s e l r)
-            (setq rect (cons (filter-buffer-substring s e nil t) rect))))
+            (setq rect (cons (cua--filter-buffer-noprops s e) rect))))
       (cua--rectangle-operation nil 1 nil nil nil ; do not tabify
        '(lambda (s e l r v)
           (let ((copy t) (bs 0) (as 0) row)
@@ -643,7 +643,7 @@
               (setq as (- r (max (current-column) l))
                     e (point)))
                     (setq row (if (and copy (> e s))
-                          (filter-buffer-substring s e nil t)
+                          (cua--filter-buffer-noprops s e)
                         ""))
             (when (> bs 0)
               (setq row (concat (make-string bs ?\s) row)))
@@ -1124,12 +1124,12 @@
      '(lambda (s e l r)
         (cond
          ((re-search-forward "0x\\([0-9a-fA-F]+\\)" e t)
-          (let* ((txt (filter-buffer-substring (match-beginning 1) (match-end 
1) nil t))
+          (let* ((txt (cua--filter-buffer-noprops (match-beginning 1) 
(match-end 1)))
                  (n (string-to-number txt 16))
                  (fmt (format "0x%%0%dx" (length txt))))
             (replace-match (format fmt (+ n increment)))))
          ((re-search-forward "\\( *-?[0-9]+\\)" e t)
-          (let* ((txt (filter-buffer-substring (match-beginning 1) (match-end 
1) nil t))
+          (let* ((txt (cua--filter-buffer-noprops (match-beginning 1) 
(match-end 1)))
                  (prefix (if (= (aref txt 0) ?0) "0" ""))
                  (n (string-to-number txt 10))
                  (fmt (format "%%%s%dd" prefix (length txt))))


reply via email to

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