summaryrefslogtreecommitdiff
path: root/lisp/info.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2001-10-10 14:37:17 +0000
committerMiles Bader <miles@gnu.org>2001-10-10 14:37:17 +0000
commitb20d850cd9e221773faff0079cb9ba0d96b0d6b3 (patch)
tree4db2baa129499333e5182c4706801a8705d63c6b /lisp/info.el
parent43b4c30ec6df4f83e7afdf42399472f41b9f9204 (diff)
downloademacs-b20d850cd9e221773faff0079cb9ba0d96b0d6b3.tar.gz
(Info-insert-dir): Don't call `Info-fontify-menu-headers'.
(Info-fontify-node): Don't fontify the node if it's already been done.
Diffstat (limited to 'lisp/info.el')
-rw-r--r--lisp/info.el152
1 files changed, 78 insertions, 74 deletions
diff --git a/lisp/info.el b/lisp/info.el
index c6fe420a1eb..1317d14db66 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -901,7 +901,6 @@ a case-insensitive match is tried."
(while buffers
(kill-buffer (car buffers))
(setq buffers (cdr buffers)))
- (if Info-fontify (Info-fontify-menu-headers))
(goto-char (point-min))
(if problems
(message "Composing main Info directory...problems encountered, see `*Messages*'")
@@ -2553,80 +2552,85 @@ the variable `Info-file-list-for-emacs'."
'face 'info-menu-header)))))
(defun Info-fontify-node ()
- (save-excursion
- (let ((buffer-read-only nil)
- (case-fold-search t))
- (goto-char (point-min))
- (when (looking-at "^File: [^,: \t]+,?[ \t]+")
- (goto-char (match-end 0))
- (while (looking-at "[ \t]*\\([^:, \t\n]+\\):[ \t]+\\([^:,\t\n]+\\),?")
+ ;; Only fontify the node if it hasn't already been done. [We pass in
+ ;; LIMIT arg to `next-property-change' because it seems to search past
+ ;; (point-max).]
+ (unless (< (next-property-change (point-min) nil (point-max))
+ (point-max))
+ (save-excursion
+ (let ((buffer-read-only nil)
+ (case-fold-search t))
+ (goto-char (point-min))
+ (when (looking-at "^File: [^,: \t]+,?[ \t]+")
(goto-char (match-end 0))
- (let* ((nbeg (match-beginning 2))
- (nend (match-end 2))
- (tbeg (match-beginning 1))
- (tag (buffer-substring tbeg (match-end 1))))
- (if (string-equal tag "Node")
- (put-text-property nbeg nend 'face 'info-header-node)
- (put-text-property nbeg nend 'face 'info-header-xref)
- (put-text-property nbeg nend 'mouse-face 'highlight)
- (put-text-property tbeg nend
- 'help-echo
- (concat "Go to node "
- (buffer-substring nbeg nend)))
- (let ((fun (cdr (assoc tag '(("Prev" . Info-prev)
- ("Next" . Info-next)
- ("Up" . Info-up))))))
- (when fun
- (let ((keymap (make-sparse-keymap)))
- (define-key keymap [header-line mouse-1] fun)
- (define-key keymap [header-line mouse-2] fun)
- (put-text-property tbeg nend 'local-map keymap))))
- ))))
- (goto-char (point-min))
- (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\|\\.+\\)$"
- nil t)
- (let ((c (preceding-char))
- face)
- (cond ((= c ?*) (setq face 'Info-title-1-face))
- ((= c ?=) (setq face 'Info-title-2-face))
- ((= c ?-) (setq face 'Info-title-3-face))
- (t (setq face 'Info-title-4-face)))
- (put-text-property (match-beginning 1) (match-end 1)
- 'face face))
- ;; This is a serious problem for trying to handle multiple
- ;; frame types at once. We want this text to be invisible
- ;; on frames that can display the font above.
- (when (memq (framep (selected-frame)) '(x pc w32 mac))
- (add-text-properties (match-end 1) (match-end 2)
- '(invisible t intangible t))
- (add-text-properties (1- (match-end 1)) (match-end 2)
- '(intangible t))))
- (goto-char (point-min))
- (while (re-search-forward "\\*Note[ \n\t]+\\([^:]*\\):" nil t)
- (if (= (char-after (1- (match-beginning 0))) ?\") ; hack
- nil
- (add-text-properties (match-beginning 1) (match-end 1)
- '(face info-xref
- mouse-face highlight
- help-echo "mouse-2: go to this node"))))
- (goto-char (point-min))
- (if (and (search-forward "\n* Menu:" nil t)
- (not (string-match "\\<Index\\>" Info-current-node))
- ;; Don't take time to annotate huge menus
- (< (- (point-max) (point)) Info-fontify-maximum-menu-size))
- (let ((n 0))
- (while (re-search-forward "^\\* +\\([^:\t\n]*\\):" nil t)
- (setq n (1+ n))
- (if (memq n '(5 9)) ; visual aids to help with 1-9 keys
- (put-text-property (match-beginning 0)
- (1+ (match-beginning 0))
- 'face 'info-menu-5))
- (add-text-properties (match-beginning 1) (match-end 1)
- '(face info-xref
- mouse-face highlight
- help-echo "mouse-2: go to this node")))))
- (Info-fontify-menu-headers)
- (set-buffer-modified-p nil))))
+ (while (looking-at "[ \t]*\\([^:, \t\n]+\\):[ \t]+\\([^:,\t\n]+\\),?")
+ (goto-char (match-end 0))
+ (let* ((nbeg (match-beginning 2))
+ (nend (match-end 2))
+ (tbeg (match-beginning 1))
+ (tag (buffer-substring tbeg (match-end 1))))
+ (if (string-equal tag "Node")
+ (put-text-property nbeg nend 'face 'info-header-node)
+ (put-text-property nbeg nend 'face 'info-header-xref)
+ (put-text-property nbeg nend 'mouse-face 'highlight)
+ (put-text-property tbeg nend
+ 'help-echo
+ (concat "Go to node "
+ (buffer-substring nbeg nend)))
+ (let ((fun (cdr (assoc tag '(("Prev" . Info-prev)
+ ("Next" . Info-next)
+ ("Up" . Info-up))))))
+ (when fun
+ (let ((keymap (make-sparse-keymap)))
+ (define-key keymap [header-line mouse-1] fun)
+ (define-key keymap [header-line mouse-2] fun)
+ (put-text-property tbeg nend 'local-map keymap))))
+ ))))
+ (goto-char (point-min))
+ (while (re-search-forward "\n\\([^ \t\n].+\\)\n\\(\\*+\\|=+\\|-+\\|\\.+\\)$"
+ nil t)
+ (let ((c (preceding-char))
+ face)
+ (cond ((= c ?*) (setq face 'Info-title-1-face))
+ ((= c ?=) (setq face 'Info-title-2-face))
+ ((= c ?-) (setq face 'Info-title-3-face))
+ (t (setq face 'Info-title-4-face)))
+ (put-text-property (match-beginning 1) (match-end 1)
+ 'face face))
+ ;; This is a serious problem for trying to handle multiple
+ ;; frame types at once. We want this text to be invisible
+ ;; on frames that can display the font above.
+ (when (memq (framep (selected-frame)) '(x pc w32 mac))
+ (add-text-properties (match-end 1) (match-end 2)
+ '(invisible t intangible t))
+ (add-text-properties (1- (match-end 1)) (match-end 2)
+ '(intangible t))))
+ (goto-char (point-min))
+ (while (re-search-forward "\\*Note[ \n\t]+\\([^:]*\\):" nil t)
+ (if (= (char-after (1- (match-beginning 0))) ?\") ; hack
+ nil
+ (add-text-properties (match-beginning 1) (match-end 1)
+ '(face info-xref
+ mouse-face highlight
+ help-echo "mouse-2: go to this node"))))
+ (goto-char (point-min))
+ (if (and (search-forward "\n* Menu:" nil t)
+ (not (string-match "\\<Index\\>" Info-current-node))
+ ;; Don't take time to annotate huge menus
+ (< (- (point-max) (point)) Info-fontify-maximum-menu-size))
+ (let ((n 0))
+ (while (re-search-forward "^\\* +\\([^:\t\n]*\\):" nil t)
+ (setq n (1+ n))
+ (if (memq n '(5 9)) ; visual aids to help with 1-9 keys
+ (put-text-property (match-beginning 0)
+ (1+ (match-beginning 0))
+ 'face 'info-menu-5))
+ (add-text-properties (match-beginning 1) (match-end 1)
+ '(face info-xref
+ mouse-face highlight
+ help-echo "mouse-2: go to this node")))))
+ (Info-fontify-menu-headers)
+ (set-buffer-modified-p nil)))))
;; When an Info buffer is killed, make sure the associated tags buffer