# HG changeset patch # User Kim F. Storm # Date 1019408441 0 # Node ID f5b7b7055a64aee9777307361e9eed2edaa65fa5 # Parent c4139de15915ece1c0414cb1f6bec0c9b9cd036f (insert-buffer-substring-no-properties): New function. (insert-buffer-substring-as-yank): New function. diff -r c4139de15915 -r f5b7b7055a64 lisp/subr.el --- a/lisp/subr.el Sun Apr 21 16:30:28 2002 +0000 +++ b/lisp/subr.el Sun Apr 21 17:00:41 2002 +0000 @@ -1287,6 +1287,31 @@ (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.