]> code.delx.au - gnu-emacs/blobdiff - lisp/info.el
(font-lock-extra-managed-props, font-lock-keywords, font-lock-maximum-size,
[gnu-emacs] / lisp / info.el
index 2d03190b6067e8719a355adbf27e86db858a51bc..4c40e187c03d7c265dfd020f5dd54026970f1b1f 100644 (file)
@@ -1076,7 +1076,7 @@ a case-insensitive match is tried."
       ;; Insert the entire original dir file as a start; note that we've
       ;; already saved its default directory to use as the default
       ;; directory for the whole concatenation.
-      (goto-char (prog1 (point) (insert-buffer-substring buffer)))
+      (save-excursion (insert-buffer-substring buffer))
 
       ;; Look at each of the other buffers one by one.
       (dolist (other others)
@@ -1770,9 +1770,11 @@ If DIRECTION is `backward', search in the reverse direction."
       (lambda (string &optional bound noerror count)
        (if isearch-word
            (Info-search (concat "\\b" (replace-regexp-in-string
-                                       "\\W+" "\\\\W+"
+                                       "\\W+" "\\W+"
                                        (replace-regexp-in-string
-                                        "^\\W+\\|\\W+$" "" string)) "\\b")
+                                        "^\\W+\\|\\W+$" "" string)
+                                       nil t)
+                                "\\b")
                         bound noerror count
                         (unless isearch-forward 'backward))
          (Info-search (if isearch-regexp string (regexp-quote string))
@@ -3255,6 +3257,8 @@ With a zero prefix arg, put the name inside a function call to `info'."
 
 (defvar tool-bar-map)
 
+;; Autoload cookie needed by desktop.el
+;;;###autoload
 (defun Info-mode ()
   "Info mode provides commands for browsing through the Info documentation tree.
 Documentation in Info is divided into \"nodes\", each of which discusses
@@ -3583,27 +3587,6 @@ the variable `Info-file-list-for-emacs'."
          (t
           (Info-goto-emacs-command-node command)))))
 \f
-(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)))))
-
 (defvar Info-next-link-keymap
   (let ((keymap (make-sparse-keymap)))
     (define-key keymap [header-line mouse-1] 'Info-next)
@@ -3695,7 +3678,11 @@ Preserve text properties."
                                 (buffer-substring (point) header-end)))
                 (setq header (buffer-substring (point) header-end))))
             (put-text-property (point-min) (1+ (point-min))
-                               'header-line (Info-escape-percent header))
+                               'header-line
+                              (replace-regexp-in-string
+                               "%"
+                               ;; Preserve text properties on duplicated `%'.
+                               (lambda (s) (concat s s)) header))
             ;; Hide the part of the first line
             ;; that is in the header, if it is just part.
             (unless (bobp)
@@ -4179,7 +4166,6 @@ BUFFER is the buffer speedbar is requesting buttons for."
   (if (not (member Info-current-file '("apropos" "history" "toc")))
       (list Info-current-file Info-current-node)))
 
-;;;###autoload
 (defun Info-restore-desktop-buffer (desktop-buffer-file-name
                                     desktop-buffer-name
                                     desktop-buffer-misc)
@@ -4193,6 +4179,9 @@ BUFFER is the buffer speedbar is requesting buttons for."
     (Info-find-node first second)
     (current-buffer))))
 
+(add-to-list 'desktop-buffer-mode-handlers
+            '(Info-mode . Info-restore-desktop-buffer))
+
 (provide 'info)
 
 ;; arch-tag: f2480fe2-2139-40c1-a49b-6314991164ac