]> code.delx.au - gnu-emacs/commitdiff
(insert-for-yank): Replace `category' property
authorRichard M. Stallman <rms@gnu.org>
Sat, 27 Apr 2002 19:49:18 +0000 (19:49 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 27 Apr 2002 19:49:18 +0000 (19:49 +0000)
with whatever properties it stands for.

(member-ignore-case): Ignore non-strings in LIST.

lisp/ChangeLog
lisp/subr.el

index bc9baeb74fe37c51b5c8ecc318427809a5594b6f..9c06ede1d63ddfff4bfaedd8c14e7b1f2a2c80bb 100644 (file)
@@ -1,3 +1,10 @@
+2002-04-27  Richard M. Stallman  <rms@gnu.org>
+
+       * 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  <miles@gnu.org>
 
        * faces.el (read-face-name): Format the prompt correctly when
index afe5d3ebb02114fdc5ba31e1ff9ff5ee8c50392a..6b9820f3e42c5e0be58d8700b00a6094fa096fa7 100644 (file)
@@ -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)