aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim F. Storm <[email protected]>2002-04-21 17:00:41 +0000
committerKim F. Storm <[email protected]>2002-04-21 17:00:41 +0000
commit3b8690f6157419fbe33113ec50356249a01f3b77 (patch)
treec10271848df99abd52d5a3980b5ffa85a853b29b
parent6036654ee8ea9bb2a78a5eca6e6455160b3552f2 (diff)
(insert-buffer-substring-no-properties): New function.
(insert-buffer-substring-as-yank): New function.
-rw-r--r--lisp/subr.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index c4e4d3a73a..afe5d3ebb0 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -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)))))
+
;; Synchronous shell commands.