unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Chong Yidong <cyd@stupidchicken.com>
Cc: yamaoka@jpl.org, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: Slow Info startup
Date: Thu, 01 Dec 2005 17:46:44 -0500	[thread overview]
Message-ID: <87iru8wi3v.fsf@stupidchicken.com> (raw)
In-Reply-To: <878xv4h4l1.fsf@jurta.org> (Juri Linkov's message of "Thu, 01 Dec 2005 23:47:54 +0200")

Juri Linkov <juri@jurta.org> 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))

  reply	other threads:[~2005-12-01 22:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-30  1:40 Slow Info startup Katsumi Yamaoka
2005-11-30  2:38 ` Chong Yidong
2005-11-30  2:41   ` Chong Yidong
2005-11-30  2:48   ` Juri Linkov
2005-11-30  3:19   ` Katsumi Yamaoka
2005-12-01  6:05   ` Richard M. Stallman
2005-12-01 21:47     ` Juri Linkov
2005-12-01 22:46       ` Chong Yidong [this message]
2005-12-02  0:03         ` Juri Linkov
2005-12-02 18:21       ` Richard M. Stallman

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87iru8wi3v.fsf@stupidchicken.com \
    --to=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    --cc=yamaoka@jpl.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).