changeset 44900:e4975d9c93ff

(insert-for-yank): Replace `category' property with whatever properties it stands for. (member-ignore-case): Ignore non-strings in LIST.
author Richard M. Stallman <rms@gnu.org>
date Sat, 27 Apr 2002 19:48:40 +0000
parents ebddb2618c17
children 433a658ae752
files lisp/subr.el
diffstat 1 files changed, 27 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Sat Apr 27 13:10:05 2002 +0000
+++ b/lisp/subr.el	Sat Apr 27 19:48:40 2002 +0000
@@ -231,8 +231,11 @@
 (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 @@
 
     (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)