[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Slow Info startup
From: |
Chong Yidong |
Subject: |
Re: Slow Info startup |
Date: |
Thu, 01 Dec 2005 17:46:44 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Juri Linkov <address@hidden> writes:
> The old code uses `file-name-nondirectory' to remove directory part
> from absolute file names in the history before comparing them to the
> name extracted from a menu item or cross-reference. The new code uses
> `Info-find-file' to find the absolute file name of a menu item
> or cross-reference before comparing it to absolute file names in
> the history. `Info-find-file' is a quadratically slow function that
> iterates over `Info-directory-list' and `Info-suffix-list' to find the
> absolute Info file name. The `dir' node usually contains hundreds of
> menu items with non-absolute file names in parens, so `Info-find-file'
> gets called on each of them during fontification in the new code.
Actually, we only need to use file-name-nondirectory for Info node
names specifying other info files. This way, links within info files
will always be highlighted correctly, even for info session started
with Info-on-current-buffer (external links will still have the flaw
discussed previously).
*** emacs/lisp/info.el.~1.463.~ 2005-12-01 15:08:51.000000000 -0500
--- emacs/lisp/info.el 2005-12-01 17:36:50.000000000 -0500
***************
*** 3800,3819 ****
(and (not (equal (match-string
4) ""))
(match-string 4))
(match-string 2)))))
! (file Info-current-file)
(hl Info-history-list)
res)
! (if (string-match "(\\([^)]+\\))\\([^)]*\\)" node)
! (setq file (Info-find-file (match-string 1
node) t)
! node (if (equal (match-string 2 node)
"")
! "Top"
! (match-string 2 node))))
! (while hl
! (if (and (string-equal node (nth 1 (car hl)))
! (string-equal file (nth 0 (car hl))))
! (setq res (car hl) hl nil)
! (setq hl (cdr hl))))
! res))) 'info-xref-visited 'info-xref))
;; For multiline ref, unfontify newline and surrounding
whitespace
(save-excursion
(goto-char rbeg)
--- 3800,3830 ----
(and (not (equal (match-string
4) ""))
(match-string 4))
(match-string 2)))))
! (external-link-p
! (string-match "(\\([^)]+\\))\\([^)]*\\)"
node))
! (file (if external-link-p
! (match-string 1 node)
! Info-current-file))
(hl Info-history-list)
res)
! (if external-link-p
! (progn
! (setq node (if (equal (match-string 2 node)
"")
! "Top"
! (match-string 2 node)))
! (while hl
! (if (and (string-equal node (nth 1 (car
hl)))
! (string-equal file
!
(file-name-nondirectory
! (nth 0 (car hl)))))
! (setq res (car hl) hl nil)
! (setq hl (cdr hl)))))
! (while hl
! (if (and (string-equal node (nth 1 (car hl)))
! (string-equal file (nth 0 (car hl))))
! (setq res (car hl) hl nil)
! (setq hl (cdr hl)))))
! res))) 'info-xref-visited 'info-xref))
;; For multiline ref, unfontify newline and surrounding
whitespace
(save-excursion
(goto-char rbeg)
***************
*** 3902,3923 ****
;; Display visited menu items in a different face
(if (and Info-fontify-visited-nodes
(save-match-data
! (let ((node (if (equal (match-string 3) "")
! (match-string 1)
! (match-string 3)))
! (file Info-current-file)
! (hl Info-history-list)
! res)
! (if (string-match "(\\([^)]+\\))\\([^)]*\\)"
node)
! (setq file (Info-find-file (match-string 1
node) t)
! node (if (equal (match-string 2 node)
"")
! "Top"
! (match-string 2 node))))
! (while hl
! (if (and (string-equal node (nth 1 (car hl)))
! (string-equal file (nth 0 (car hl))))
! (setq res (car hl) hl nil)
! (setq hl (cdr hl))))
res))) 'info-xref-visited 'info-xref)))
(when (and not-fontified-p (memq Info-hide-note-references '(t
hide)))
(put-text-property (match-beginning 2) (1- (match-end 6))
--- 3913,3945 ----
;; Display visited menu items in a different face
(if (and Info-fontify-visited-nodes
(save-match-data
! (let* ((node (if (equal (match-string 3) "")
! (match-string 1)
! (match-string 3)))
! (external-link-p
! (string-match "(\\([^)]+\\))\\([^)]*\\)"
node))
! (file (if external-link-p
! (match-string 1 node)
! Info-current-file))
! (hl Info-history-list)
! res)
! (if external-link-p
! (progn
! (setq node (if (equal (match-string 2 node)
"")
! "Top"
! (match-string 2 node)))
! (while hl
! (if (and (string-equal node (nth 1 (car
hl)))
! (string-equal file
!
(file-name-nondirectory
! (nth 0 (car
hl)))))
! (setq res (car hl) hl nil)
! (setq hl (cdr hl)))))
! (while hl
! (if (and (string-equal node (nth 1 (car hl)))
! (string-equal file (nth 0 (car hl))))
! (setq res (car hl) hl nil)
! (setq hl (cdr hl)))))
res))) 'info-xref-visited 'info-xref)))
(when (and not-fontified-p (memq Info-hide-note-references '(t
hide)))
(put-text-property (match-beginning 2) (1- (match-end 6))