From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: Info enhancements Date: Tue, 16 Dec 2003 04:14:34 +0200 Organization: JURTA Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <87pteppkz9.fsf@mail.jurta.org> References: <87ekvahjnr.fsf@mail.jurta.org> <200312121424.hBCEO6V06218@f7.net> <874qw5k973.fsf@mail.jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1071544807 16855 80.91.224.253 (16 Dec 2003 03:20:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 16 Dec 2003 03:20:07 +0000 (UTC) Cc: emacs-devel@gnu.org, karl@freefriends.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Dec 16 04:20:02 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AW5kg-0006hg-00 for ; Tue, 16 Dec 2003 04:20:02 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AW5kf-0003JA-00 for ; Tue, 16 Dec 2003 04:20:01 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AW6gF-0007Yl-79 for emacs-devel@quimby.gnus.org; Mon, 15 Dec 2003 23:19:31 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AW6fw-0007YE-2H for emacs-devel@gnu.org; Mon, 15 Dec 2003 23:19:12 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AW6fQ-0007M0-5W for emacs-devel@gnu.org; Mon, 15 Dec 2003 23:19:11 -0500 Original-Received: from [64.246.52.22] (helo=ns5.tangramltd.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.24) id 1AW6fP-0007ID-Dz; Mon, 15 Dec 2003 23:18:39 -0500 Original-Received: from 80-235-33-247-dsl.mus.estpak.ee ([80.235.33.247] helo=mail.jurta.org) by ns5.tangramltd.com with esmtp (Exim 4.20) id 1AW5hu-0000hI-4s; Tue, 16 Dec 2003 05:17:10 +0200 Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Sat, 13 Dec 2003 10:17:57 -0500") User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ns5.tangramltd.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jurta.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:18707 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:18707 Richard Stallman writes: > I see no harm in letting it include anchors in completion, given that > it does handle anchor names. We could rename it "Info-goto" > to avoid the conflict between the name (which comes from a time > before there were anchors) and the functionality (which reflects > the existence of anchors). Yes, I remember that you already suggested two weeks ago to create a new function to go to any locator. This is the function that you suggest to name Info-goto. At the same time, Info-goto-node could be changed to go to node names only, and it makes sense to create also a new function Info-goto-anchor to go to anchors only. So, what do you think about this patch? It provides three functions Info-goto, Info-goto-node and Info-goto-anchor that differ only by their completion lists. I'm still unsure about keybindings to these functions. Maybe, "g" - for Info-goto-node, "G" - for Info-goto and no keybindings for Info-goto-anchor because Info-goto-anchor will be rarely used (actually, I added Info-goto-anchor because it was too easy to add it when a completion list creation function was changed to handle anchor and node names separately). =================================================================== *** emacs/lisp/info.el Fri Dec 12 03:29:35 2003 --- emacs/lisp/info.el Tue Dec 16 03:31:18 2003 *************** *** 227,233 **** "Buffer used for indirect tag tables.") (defvar Info-current-file-completions nil ! "Cached completion list for current Info file.") (defvar Info-index-alternatives nil "List of possible matches for last `Info-index' command.") --- 227,236 ---- "Buffer used for indirect tag tables.") (defvar Info-current-file-completions nil ! "Cached node completion list for current Info file.") ! ! (defvar Info-current-file-anchor-completions nil ! "Cached anchor completion list for current Info file.") (defvar Info-index-alternatives nil "List of possible matches for last `Info-index' command.") *************** *** 715,720 **** --- 718,724 ---- (setq Info-current-file nil Info-current-subfile nil Info-current-file-completions nil + Info-current-file-anchor-completions nil buffer-file-name nil) (erase-buffer) (if (eq filename t) *************** *** 1234,1248 **** ;; of the sort that is found in pointers in nodes. (defun Info-goto-node (nodename &optional fork) ! "Go to info node named NODENAME. Give just NODENAME or (FILENAME)NODENAME. ! If NODENAME is of the form (FILENAME)NODENAME, the node is in the Info file ! FILENAME; otherwise, NODENAME should be in the current Info file (or one of its sub-files). Completion is available, but only for node names in the current Info file. If FORK is non-nil (interactively with a prefix arg), show the node in a new info buffer. If FORK is a string, it is the name to use for the new buffer." ! (interactive (list (Info-read-node-name "Go to node: ") current-prefix-arg)) (info-initialize) (if fork (set-buffer --- 1238,1266 ---- ;; of the sort that is found in pointers in nodes. (defun Info-goto-node (nodename &optional fork) ! "Go to info node named NODENAME." ! (interactive (list (Info-read-node-name "Go to node: ") ! current-prefix-arg)) ! (Info-goto nodename fork)) ! ! (defun Info-goto-anchor (anchorname &optional fork) ! "Go to info anchor named ANCHORNAME." ! (interactive (list (Info-read-node-name "Go to anchor: " nil 'anchor) ! current-prefix-arg)) ! (Info-goto anchorname fork)) ! ! (defun Info-goto (nodename &optional fork) ! "Go to info node or anchor named NODENAME. ! Give just NODENAME or (FILENAME)NODENAME. If NODENAME is of the ! form (FILENAME)NODENAME, the node is in the Info file FILENAME; ! otherwise, NODENAME should be in the current Info file (or one of its sub-files). Completion is available, but only for node names in the current Info file. If FORK is non-nil (interactively with a prefix arg), show the node in a new info buffer. If FORK is a string, it is the name to use for the new buffer." ! (interactive (list (Info-read-node-name "Go to node or anchor: " nil t) ! current-prefix-arg)) (info-initialize) (if fork (set-buffer *************** *** 1300,1317 **** (t (test-completion string Info-read-node-completion-table predicate)))) ! (defun Info-read-node-name (prompt &optional default) (let* ((completion-ignore-case t) ! (Info-read-node-completion-table (Info-build-node-completions)) (nodename (completing-read prompt 'Info-read-node-name-1 nil t))) (if (equal nodename "") (or default ! (Info-read-node-name prompt)) nodename))) (defun Info-build-node-completions () (or Info-current-file-completions (let ((compl nil) ;; Bind this in case the user sets it to nil. (case-fold-search t) (node-regexp "Node: *\\([^,\n]*\\) *[,\n\t]")) --- 1318,1345 ---- (t (test-completion string Info-read-node-completion-table predicate)))) ! (defun Info-read-node-name (prompt &optional default anchor) (let* ((completion-ignore-case t) ! (node-completions (Info-build-node-completions)) ! ;; On the first call of `Info-build-node-completions' ! ;; it should set `Info-current-file-anchor-completions' ! (anchor-completions Info-current-file-anchor-completions) ! (Info-read-node-completion-table ! (append ! ;; Include node names if anchor is nil or t ! (if (not (eq anchor 'anchor)) node-completions) ! ;; Include anchor names if anchor is 'anchor or t ! (if anchor anchor-completions))) (nodename (completing-read prompt 'Info-read-node-name-1 nil t))) (if (equal nodename "") (or default ! (Info-read-node-name prompt anchor)) nodename))) (defun Info-build-node-completions () (or Info-current-file-completions (let ((compl nil) + (compl-anchors nil) ;; Bind this in case the user sets it to nil. (case-fold-search t) (node-regexp "Node: *\\([^,\n]*\\) *[,\n\t]")) *************** *** 1323,1332 **** (widen) (goto-char marker) (while (re-search-forward "\n\\(Node\\|Ref\\): \\(.*\\)\177" nil t) ! (or (string-equal "Ref" (match-string 1)) ! (setq compl (cons (list (match-string-no-properties 2)) ! compl))))) (widen) (goto-char (point-min)) ;; If the buffer begins with a node header, process that first. --- 1351,1363 ---- (widen) (goto-char marker) (while (re-search-forward "\n\\(Node\\|Ref\\): \\(.*\\)\177" nil t) ! (if (string-equal "Ref" (match-string 1)) ! (setq compl-anchors (cons (list (match-string-no-properties 2)) ! compl-anchors)) ! (setq compl ! (cons (list (match-string-no-properties 2)) ! compl))))) (widen) (goto-char (point-min)) ;; If the buffer begins with a node header, process that first. *************** *** 1342,1347 **** --- 1373,1379 ---- (cons (list (match-string-no-properties 1)) compl)))))))) (setq compl (cons '("*") compl)) + (set (make-local-variable 'Info-current-file-anchor-completions) compl-anchors) (set (make-local-variable 'Info-current-file-completions) compl)))) (defun Info-restore-point (hl) =================================================================== -- http://www.jurta.org/emacs/