From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Slow Info startup Date: Thu, 01 Dec 2005 17:46:44 -0500 Message-ID: <87iru8wi3v.fsf@stupidchicken.com> References: <878xv6zwqa.fsf@stupidchicken.com> <878xv4h4l1.fsf@jurta.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1133477356 18973 80.91.229.2 (1 Dec 2005 22:49:16 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 1 Dec 2005 22:49:16 +0000 (UTC) Cc: yamaoka@jpl.org, rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 01 23:49:13 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EhxDN-0008P9-UL for ged-emacs-devel@m.gmane.org; Thu, 01 Dec 2005 23:47:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EhxDL-0004Bo-EH for ged-emacs-devel@m.gmane.org; Thu, 01 Dec 2005 17:47:43 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EhxBz-0003jV-0X for emacs-devel@gnu.org; Thu, 01 Dec 2005 17:46:19 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EhxBk-0003ct-Gx for emacs-devel@gnu.org; Thu, 01 Dec 2005 17:46:18 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EhxBk-0003cj-5l for emacs-devel@gnu.org; Thu, 01 Dec 2005 17:46:04 -0500 Original-Received: from [18.19.6.82] (helo=localhost.localdomain) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EhxBb-0000sn-A8; Thu, 01 Dec 2005 17:45:55 -0500 Original-Received: by localhost.localdomain (Postfix, from userid 1000) id 29689120800; Thu, 1 Dec 2005 17:46:44 -0500 (EST) Original-To: Juri Linkov In-Reply-To: <878xv4h4l1.fsf@jurta.org> (Juri Linkov's message of "Thu, 01 Dec 2005 23:47:54 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:46860 Archived-At: Juri Linkov 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))