all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: 14645@debbugs.gnu.org
Subject: bug#14645: Keep highlighting face foreground
Date: Fri, 21 Jun 2013 02:03:17 +0300	[thread overview]
Message-ID: <87d2rgwfka.fsf@mail.jurta.org> (raw)
In-Reply-To: <87mwqn9g6g.fsf@mail.jurta.org> (Juri Linkov's message of "Wed, 19 Jun 2013 02:31:43 +0300")

> 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






  parent reply	other threads:[~2013-06-20 23:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-17 22:55 bug#14645: Keep highlighting face foreground Juri Linkov
2013-06-18 23:31 ` Juri Linkov
2013-06-19 23:14   ` Juri Linkov
2020-08-13 11:35     ` Lars Ingebrigtsen
2013-06-20 23:03   ` Juri Linkov [this message]
2020-08-13 11:32   ` Lars Ingebrigtsen
2020-08-13 23:44     ` Juri Linkov
2020-08-14  6:20       ` Eli Zaretskii
2020-08-14  9:50       ` Lars Ingebrigtsen
2020-08-13 11:27 ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d2rgwfka.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=14645@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.