]> git.eshelyaron.com Git - emacs.git/commitdiff
(insert-buffer-substring-no-properties): New function.
authorKim F. Storm <storm@cua.dk>
Sun, 21 Apr 2002 17:00:41 +0000 (17:00 +0000)
committerKim F. Storm <storm@cua.dk>
Sun, 21 Apr 2002 17:00:41 +0000 (17:00 +0000)
(insert-buffer-substring-as-yank): New function.

lisp/subr.el

index c4e4d3a73ae852d84a74defe218374f99b322053..afe5d3ebb02114fdc5ba31e1ff9ff5ee8c50392a 100644 (file)
@@ -1287,6 +1287,31 @@ Otherwise just like (insert STRINGS...)."
          (set-text-properties opoint (point) nil)
        (remove-list-of-text-properties opoint (point)
                                        yank-excluded-properties)))))
+
+(defun insert-buffer-substring-no-properties (buf &optional start end)
+  "Insert before point a substring of buffer BUFFER, without text properties.
+BUFFER may be a buffer or a buffer name.
+Arguments START and END are character numbers specifying the substring.
+They default to the beginning and the end of BUFFER."
+  (let ((opoint (point)))
+    (insert-buffer-substring buf start end)
+    (let ((inhibit-read-only t))
+      (set-text-properties opoint (point) nil))))
+
+(defun insert-buffer-substring-as-yank (buf &optional start end)
+  "Insert before point a part of buffer BUFFER, stripping some text properties.
+BUFFER may be a buffer or a buffer name.  Arguments START and END are
+character numbers specifying the substring.  They default to the
+beginning and the end of BUFFER.  Strip text properties from the
+inserted text according to `yank-excluded-properties'."
+  (let ((opoint (point)))
+    (insert-buffer-substring buf start end)
+    (let ((inhibit-read-only t))
+      (if (eq yank-excluded-properties t)
+         (set-text-properties opoint (point) nil)
+       (remove-list-of-text-properties opoint (point)
+                                       yank-excluded-properties)))))
+
 \f
 ;; Synchronous shell commands.