From d86a3084f6fb1940a8e1ddf6aab907acc4060e4b Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 27 Apr 2002 19:49:18 +0000 Subject: [PATCH] (insert-for-yank): Replace `category' property with whatever properties it stands for. (member-ignore-case): Ignore non-strings in LIST. --- lisp/ChangeLog | 7 +++++++ lisp/subr.el | 32 +++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bc9baeb74fe..9c06ede1d63 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2002-04-27 Richard M. Stallman + + * subr.el (insert-for-yank): Replace `category' property + with whatever properties it stands for. + + * subr.el (member-ignore-case): Ignore non-strings in LIST. + 2002-04-27 Miles Bader * faces.el (read-face-name): Format the prompt correctly when diff --git a/lisp/subr.el b/lisp/subr.el index afe5d3ebb02..6b9820f3e42 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -231,8 +231,11 @@ Unibyte strings are converted to multibyte for comparison." (defun member-ignore-case (elt list) "Like `member', but ignores differences in case and text representation. ELT must be a string. Upper-case and lower-case letters are treated as equal. -Unibyte strings are converted to multibyte for comparison." - (while (and list (not (eq t (compare-strings elt 0 nil (car list) 0 nil t)))) +Unibyte strings are converted to multibyte for comparison. +Non-strings in LIST are ignored." + (while (and list + (not (and (stringp (car list)) + (eq t (compare-strings elt 0 nil (car list) 0 nil t))))) (setq list (cdr list))) list) @@ -1282,10 +1285,29 @@ Otherwise just like (insert STRINGS...)." (apply 'insert strings) - (let ((inhibit-read-only t)) + (let ((inhibit-read-only t) + (end (point))) + + ;; Replace any `category' property with the properties it stands for. + (unless (memq yank-excluded-properties '(t nil)) + (save-excursion + (goto-char opoint) + (while (< (point) end) + (let ((cat (get-text-property (point) 'category)) + run-end) + (when cat + (setq run-end + (next-single-property-change (point) 'category nil end)) + (remove-list-of-text-properties (point) run-end '(category)) + (add-text-properties (point) run-end (symbol-plist cat)) + (goto-char (or run-end end))) + (setq run-end + (next-single-property-change (point) 'category nil end)) + (goto-char (or run-end end)))))) + (if (eq yank-excluded-properties t) - (set-text-properties opoint (point) nil) - (remove-list-of-text-properties opoint (point) + (set-text-properties opoint end nil) + (remove-list-of-text-properties opoint end yank-excluded-properties))))) (defun insert-buffer-substring-no-properties (buf &optional start end) -- 2.39.2