bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14645: Keep highlighting face foreground


From: Juri Linkov
Subject: bug#14645: Keep highlighting face foreground
Date: Fri, 21 Jun 2013 02:03:17 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (x86_64-pc-linux-gnu)

> This patch uses `add-face-text-property' to merge the `info-index-match'
> face with the `info-xref' face.

Using the text property `face' instead of `font-lock-face'
might break something, so a better patch below removes
the text properties `face info-index-match' from the Info buffer
and replaces them with `font-lock-face info-index-match'
in `Info-virtual-index-find-node'.  And `Info-fontify-node'
merges them with its `font-lock-face' text properties using
`font-lock-prepend-text-property'.  Here is a summary:

1. `Info-index' puts `info-index-match face' on index strings.
2. `Info-virtual-index-find-node' inserts them into the Info buffer.
3. It also converts text properties `face info-index-match' to
   `font-lock-face info-index-match' in the Info buffer.
4. `Info-fontify-node' prepends `font-lock-face info-xref' to links.

=== modified file 'lisp/info.el'
--- lisp/info.el        2013-05-27 22:42:11 +0000
+++ lisp/info.el        2013-06-20 22:59:01 +0000
@@ -3417,7 +3439,19 @@ (defun Info-virtual-index-find-node (fil
                            (nth 1 entry)
                            (if (nth 3 entry)
                                (format " (line %s)" (nth 3 entry))
-                             ""))))))
+                             ""))))
+         ;; Convert text properties `face info-index-match' to
+         ;; `font-lock-face info-index-match'.
+         (save-excursion
+           (let ((beg (text-property-any (point-min) (point-max) 'face 
'info-index-match))
+                 (end nil)
+                 (inhibit-read-only t))
+             (while beg
+               (goto-char beg)
+               (when (setq end (next-single-property-change beg 'face))
+                 (font-lock-prepend-text-property beg end 'font-lock-face 
'info-index-match)
+                 (remove-text-properties beg end '(face info-index-match)))
+               (setq beg (text-property-any end (point-max) 'face 
'info-index-match)))))))
     ;; Else, Generate a list of previous search results
     (let ((nodes (reverse Info-virtual-index-nodes)))
       (insert (format "\n\^_\nFile: %s,  Node: %s,  Up: Top\n\n"
@@ -3532,7 +3567,19 @@ (defun Info-apropos-find-node (_filename
                            (nth 2 entry)
                            (if (nth 3 entry)
                                (format " (line %s)" (nth 3 entry))
-                             "")))))))))
+                             ""))))
+         ;; Convert text properties `face info-index-match' to
+         ;; `font-lock-face info-index-match'.
+         (save-excursion
+           (let ((beg (text-property-any (point-min) (point-max) 'face 
'info-index-match))
+                 (end nil)
+                 (inhibit-read-only t))
+             (while beg
+               (goto-char beg)
+               (when (setq end (next-single-property-change beg 'face))
+                 (font-lock-prepend-text-property beg end 'font-lock-face 
'info-index-match)
+                 (remove-text-properties beg end '(face info-index-match)))
+               (setq beg (text-property-any end (point-max) 'face 
'info-index-match))))))))))
 
 (defun Info-apropos-matches (string)
   "Collect STRING matches from all known Info files on your system.
@@ -4755,7 +4811,7 @@ (defun Info-fontify-node ()
             (when (or not-fontified-p fontify-visited-p)
               (setq rbeg (match-beginning 2)
                     rend (match-end 2))
-              (put-text-property
+              (font-lock-prepend-text-property
                rbeg rend
                'font-lock-face
                ;; Display visited nodes in a different face
@@ -4874,7 +4930,7 @@ (defun Info-fontify-node ()
                               "mouse-2: go to this node")
                  'mouse-face 'highlight)))
              (when (or not-fontified-p fontify-visited-p)
-               (put-text-property
+               (font-lock-prepend-text-property
                 (match-beginning 1) (match-end 1)
                  'font-lock-face
                  ;; Display visited menu items in a different face






reply via email to

[Prev in Thread] Current Thread [Next in Thread]