changeset 52767:92416cd1e028

(Info-mode): Revert previous change. (Info-escape-percent): New function. (Info-fontify-node): Use it.
author Lute Kamstra <lute@gnu.org>
date Mon, 06 Oct 2003 07:14:21 +0000
parents ada153c6900b
children 76ef58aaa536
files lisp/info.el
diffstat 1 files changed, 23 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/info.el	Sun Oct 05 23:38:15 2003 +0000
+++ b/lisp/info.el	Mon Oct 06 07:14:21 2003 +0000
@@ -2527,10 +2527,7 @@
   (make-local-variable 'Info-index-alternatives)
   (setq header-line-format
 	(if Info-use-header-line
-	    '(:eval
-	      (replace-regexp-in-string
-	       "%" "%%"
-	       (get-text-property (point-min) 'header-line)))
+	    '(:eval (get-text-property (point-min) 'header-line))
 	  nil)) ; so the header line isn't displayed
   (set (make-local-variable 'tool-bar-map) info-tool-bar-map)
   ;; This is for the sake of the invisible text we use handling titles.
@@ -2775,6 +2772,27 @@
   "Face for headers in Info menus."
   :group 'info)
 
+(defun Info-escape-percent (string)
+  "Double all occurrences of `%' in STRING.
+
+Return a new string with all `%' characters replaced by `%%'.
+Preserve text properties."
+  (let ((start 0)
+	(end (length string))
+	mb me m matches)
+    (save-match-data
+      (while (and (< start end) (string-match "%" string start))
+	(setq mb (match-beginning 0)
+	      me (1+ mb)
+	      m (substring string mb me)
+	      matches (cons m 
+			    (cons m 
+				  (cons (substring string start mb) 
+					matches)))
+	      start me))
+      (push (substring string start end) matches)
+      (apply #'concat (nreverse matches)))))
+
 (defun Info-fontify-menu-headers ()
   "Add the face `info-menu-header' to any header before a menu entry."
   (save-excursion
@@ -2868,7 +2886,7 @@
 		  (setq header (buffer-substring (point) header-end))))
 
 	      (put-text-property (point-min) (1+ (point-min))
-				 'header-line header)
+				 'header-line (Info-escape-percent header))
 	      ;; Hide the part of the first line
 	      ;; that is in the header, if it is just part.
 	      (unless (bobp)