unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org, karl@freefriends.org
Subject: Re: Info enhancements
Date: Tue, 16 Dec 2003 04:14:34 +0200	[thread overview]
Message-ID: <87pteppkz9.fsf@mail.jurta.org> (raw)
In-Reply-To: <E1AVBWn-000733-Gn@fencepost.gnu.org> (Richard Stallman's message of "Sat, 13 Dec 2003 10:17:57 -0500")

Richard Stallman <rms@gnu.org> 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))))
  \f
  (defun Info-restore-point (hl)
===================================================================

-- 
http://www.jurta.org/emacs/

  reply	other threads:[~2003-12-16  2:14 UTC|newest]

Thread overview: 245+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-28  1:26 terminal escapes in Info files? Karl Berry
2003-10-28 10:51 ` Alper Ersoy
2003-10-28 13:48   ` Oliver Scholz
2003-10-30 10:42     ` Alper Ersoy
2003-11-10 13:01       ` HTML as info format (was: terminal escapes in Info files?) Oliver Scholz
2003-11-17 13:29         ` HTML as info format Juri Linkov
2003-11-18  7:01           ` Richard Stallman
2003-11-18 14:54             ` Changes to Texinfo DTD [Was: Re: HTML as info format] Robert J. Chassell
2003-11-18 15:59               ` Changes to Texinfo DTD Oliver Scholz
2003-11-18 21:03                 ` Robert J. Chassell
2003-11-18 21:18                   ` Nic Ferrier
2003-11-19 12:38                     ` Robert J. Chassell
2003-11-19 13:18                       ` Nic Ferrier
2003-11-20 10:37                   ` Oliver Scholz
2003-11-20 16:55                     ` Robert J. Chassell
2003-11-20 18:19                       ` Oliver Scholz
2003-11-20 20:32                         ` Nic Ferrier
2003-11-20 22:05                           ` Oliver Scholz
2003-11-20 22:51                             ` Nic Ferrier
2003-11-21  2:13                             ` Robert J. Chassell
2003-11-21  8:49                               ` Nic Ferrier
2003-11-21  2:10                           ` Robert J. Chassell
2003-11-21  7:57                             ` Nic Ferrier
2003-11-24  7:57                               ` Juri Linkov
2003-11-24  9:32                                 ` Nic Ferrier
2003-11-22 21:19                           ` Richard Stallman
2003-11-22 21:41                             ` Nic Ferrier
2003-11-22 21:42                               ` Miles Bader
2003-11-22 21:56                                 ` Nic Ferrier
2003-11-24  7:55                                   ` Juri Linkov
2003-11-24  9:25                                     ` Why XSLT in Emacs Lisp? (was Re: Changes to Texinfo DTD) Nic Ferrier
2003-11-24 13:04                                       ` Why XSLT in Emacs Lisp? Alex Schroeder
2003-11-23 17:14                                 ` Changes to Texinfo DTD Robert J. Chassell
2003-11-24  7:54                                 ` Juri Linkov
2003-11-24 16:19                                   ` Luc Teirlinck
2003-11-24 22:32                                     ` Robert J. Chassell
2003-11-24 22:31                                       ` Miles Bader
2003-11-25  5:22                                     ` Juri Linkov
2003-11-25 16:48                                       ` Luc Teirlinck
2003-11-25 21:59                                         ` Juri Linkov
2003-11-25 23:32                                           ` Luc Teirlinck
2003-11-25 19:54                                       ` Luc Teirlinck
2003-11-25 21:48                                         ` Juri Linkov
2003-11-26  1:08                                           ` Luc Teirlinck
2003-12-02  6:42                                     ` Eli Zaretskii
2003-12-03  1:47                                       ` Luc Teirlinck
2003-12-03 16:18                                         ` Eli Zaretskii
2003-12-04  2:53                                           ` Luc Teirlinck
2003-12-04  7:58                                             ` Eli Zaretskii
2003-12-04  2:54                                           ` Luc Teirlinck
2003-12-04  8:04                                             ` Eli Zaretskii
2003-12-04  9:39                                               ` Oliver Scholz
2003-12-04 11:48                                                 ` Oliver Scholz
2003-12-04 15:35                                                 ` Eli Zaretskii
2003-12-04  8:19                                             ` Oliver Scholz
2003-12-04 13:49                                             ` Robert J. Chassell
2003-12-05  0:11                                             ` Richard Stallman
2003-12-05  9:49                                               ` Kim F. Storm
2003-12-06 16:11                                                 ` Alfred M. Szmidt
2003-12-06 17:11                                                   ` Eli Zaretskii
2003-12-09 16:47                                                     ` Alfred M. Szmidt
2003-12-10  7:25                                                       ` Eli Zaretskii
2003-12-04  3:35                                           ` Luc Teirlinck
2003-12-04  8:12                                             ` Eli Zaretskii
2003-11-22 23:59                               ` Stefan Monnier
2003-11-23  0:05                                 ` Nic Ferrier
2003-11-23 14:16                                   ` Oliver Scholz
2003-11-23 15:11                                     ` Nic Ferrier
2003-11-24 16:22                               ` Richard Stallman
2003-11-20 18:24                       ` Karl Eichwalder
2003-11-24 16:23                     ` Richard Stallman
2003-12-02  7:08           ` HTML as info format Eli Zaretskii
2003-12-01 10:38             ` Info enhancements Juri Linkov
2003-12-02  3:34               ` Luc Teirlinck
2003-12-02 10:54                 ` Juri Linkov
2003-12-02  4:43               ` Luc Teirlinck
2003-12-02 10:18               ` Info enhancements (was: Re: HTML as info format) Juri Linkov
2003-12-02 17:27                 ` Eli Zaretskii
2003-12-02 19:26                   ` Karl Berry
2003-12-03  5:38                     ` Info enhancements Juri Linkov
2003-12-03 13:27                       ` Karl Berry
2003-12-03 15:46                         ` Robert J. Chassell
2003-12-20  5:34                         ` Juri Linkov
2003-12-20 14:57                           ` Karl Berry
2003-12-03 17:16                     ` Info enhancements (was: Re: HTML as info format) Richard Stallman
2003-12-02 21:22               ` Info enhancements Reiner Steib
2003-12-03  3:54                 ` `s' (regex) search [was Re: Info enhancements] Harry Putnam
2003-12-03  5:47                   ` Eli Zaretskii
2003-12-03  9:42                     ` Harry Putnam
2003-12-03 11:31                       ` Eli Zaretskii
2003-12-03 11:56                         ` Harry Putnam
2003-12-03 16:27                           ` Eli Zaretskii
2003-12-03 19:13                             ` Harry Putnam
2003-12-04  8:34                               ` Eli Zaretskii
2003-12-03  5:04                 ` Info enhancements Juri Linkov
2004-09-01 16:42                   ` Reiner Steib
2004-09-01 20:55                     ` Juri Linkov
2004-09-02 19:02                       ` Richard Stallman
2003-12-03  0:33               ` Kim F. Storm
2003-12-03  6:43                 ` Juri Linkov
2003-12-12  2:08               ` Juri Linkov
2003-12-12 14:24                 ` Karl Berry
2003-12-12 17:14                   ` Eli Zaretskii
2003-12-12 19:23                     ` Stefan Monnier
2003-12-13 10:12                       ` Eli Zaretskii
2003-12-13 23:15                         ` Richard Stallman
2003-12-12 21:38                   ` Juri Linkov
2003-12-13 15:17                     ` Richard Stallman
2003-12-16  2:14                       ` Juri Linkov [this message]
2003-12-17  3:28                         ` Richard Stallman
2003-12-18  3:03                           ` Juri Linkov
2003-12-18 16:59                             ` Richard Stallman
2003-12-19 14:03                             ` Luc Teirlinck
2003-12-20  5:27                               ` Juri Linkov
2003-12-13 15:48                     ` Eli Zaretskii
2003-12-15  2:35                 ` Richard Stallman
2003-12-15  6:01                   ` Eli Zaretskii
2003-12-15 20:06                     ` Richard Stallman
2003-12-16  3:00                     ` Juri Linkov
2003-12-16 12:12                       ` Kim F. Storm
2003-12-17  3:28                         ` Richard Stallman
2003-12-17  3:28                       ` Richard Stallman
2004-07-01 21:07               ` non-blocking socket io: data limit on read? Nic Ferrier
2003-10-28 16:19   ` terminal escapes in Info files? Stefan Monnier
2003-10-29 19:02     ` Richard Stallman
2003-10-29 19:47       ` David Kastrup
2003-10-29 21:43         ` Eli Zaretskii
2003-10-29 22:39           ` David Kastrup
2003-10-30  6:03             ` Eli Zaretskii
2003-10-30 18:00         ` Richard Stallman
2003-10-29 19:01   ` Richard Stallman
2003-10-29 19:45     ` Alper Ersoy
2003-10-29 19:42       ` Eli Zaretskii
2003-10-30 18:00       ` Richard Stallman
2003-10-29 19:02 ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2003-12-03 19:42 Info enhancements Karl Berry
2003-12-03 19:58 ` Robert J. Chassell
2003-12-04  7:07   ` Juri Linkov
2003-12-04 13:12     ` Robert J. Chassell
2003-12-04 15:29       ` Eli Zaretskii
2003-12-04 16:44       ` Karl Berry
2003-12-04 20:13         ` Robert J. Chassell
2003-12-06 21:01           ` Kai Grossjohann
2003-12-07  5:41             ` Eli Zaretskii
2003-12-07 14:49               ` Kai Grossjohann
2003-12-07 15:25                 ` Eli Zaretskii
2003-12-07 16:42                   ` Kai Grossjohann
2003-12-07 18:35                     ` Eli Zaretskii
2003-12-08 19:28                       ` Richard Stallman
2003-12-08 19:43                         ` Stefan Monnier
2003-12-05 14:09         ` Juri Linkov
2003-12-05 14:26           ` Karl Berry
2003-12-05 15:57             ` Juri Linkov
2003-12-05 17:44               ` Eli Zaretskii
2003-12-06  0:15                 ` Juri Linkov
2003-12-06  9:46                   ` Eli Zaretskii
2003-12-05 18:02               ` Luc Teirlinck
2003-12-05 22:33                 ` Luc Teirlinck
2003-12-05 22:36                   ` Luc Teirlinck
2003-12-05 23:52                   ` Juri Linkov
2003-12-06  9:43                     ` Eli Zaretskii
2003-12-06 16:45                       ` Luc Teirlinck
2003-12-06 17:15                         ` Eli Zaretskii
2003-12-06 18:25                           ` Luc Teirlinck
2003-12-07 17:19                             ` Richard Stallman
2003-12-06 17:50                         ` Luc Teirlinck
2003-12-07  0:23                       ` Luc Teirlinck
2003-12-07  2:19                     ` Luc Teirlinck
2003-12-07  2:31                       ` Luc Teirlinck
2003-12-07 17:31                         ` Juri Linkov
2003-12-07 17:44                           ` Luc Teirlinck
2003-12-07 18:00                           ` Luc Teirlinck
2003-12-07 18:32                           ` Eli Zaretskii
2003-12-07 18:57                             ` Luc Teirlinck
2003-12-07 19:27                               ` Juri Linkov
2003-12-08  6:48                                 ` Eli Zaretskii
2003-12-08  6:45                               ` Eli Zaretskii
2003-12-08  9:51                                 ` Juri Linkov
2003-12-09  3:34                                 ` Luc Teirlinck
2003-12-09 10:06                                   ` Eli Zaretskii
2003-12-10  2:56                                     ` Luc Teirlinck
2003-12-10  8:06                                       ` Eli Zaretskii
2003-12-10  3:03                                     ` Luc Teirlinck
2003-12-06  0:27                 ` Juri Linkov
2003-12-07 17:19                   ` Richard Stallman
2003-12-07 21:21                     ` Juri Linkov
2003-12-08  6:58                       ` Eli Zaretskii
2003-12-08 10:12                         ` Juri Linkov
2003-12-08 10:29                           ` Miles Bader
2003-12-08 10:46                             ` Juri Linkov
2003-12-08 11:40                               ` Eli Zaretskii
2003-12-08 14:09                                 ` Juri Linkov
2003-12-09 11:53                                   ` Kim F. Storm
2003-12-08 17:05                                 ` Luc Teirlinck
2003-12-09 10:08                                   ` Eli Zaretskii
2003-12-08 10:35                           ` Eli Zaretskii
2003-12-05 18:27           ` Karl Berry
2003-12-05 20:44             ` Luc Teirlinck
2003-12-05 21:00               ` Luc Teirlinck
2003-12-06  9:11               ` Eli Zaretskii
2003-12-07 17:59               ` Juri Linkov
2003-12-06  1:27             ` Juri Linkov
2003-12-06  9:38               ` Eli Zaretskii
2003-12-07 15:43                 ` Juri Linkov
2003-12-06 14:49               ` Karl Berry
2003-12-06 15:31                 ` Eli Zaretskii
2003-12-06 21:40                 ` Luc Teirlinck
2003-12-06 22:38                   ` Luc Teirlinck
2003-12-07  5:45                   ` Eli Zaretskii
2003-12-07 20:00                 ` Juri Linkov
2003-12-08  6:56                   ` Eli Zaretskii
2003-12-09 21:48                     ` Richard Stallman
2003-12-07 17:19               ` Richard Stallman
2003-12-07 18:44                 ` Luc Teirlinck
2003-12-07 19:00                   ` Luc Teirlinck
2003-12-07 21:54                   ` Juri Linkov
2003-12-07 22:01                     ` Luc Teirlinck
2003-12-09 21:49                     ` Richard Stallman
2003-12-08 19:28                   ` Richard Stallman
2003-12-10  3:29                     ` Luc Teirlinck
2003-12-10 15:48                       ` Richard Stallman
2003-12-08  5:46                 ` Luc Teirlinck
2003-12-08 17:34                   ` Luc Teirlinck
2003-12-09 21:48                   ` Richard Stallman
2003-12-04 15:50     ` Stefan Monnier
2003-12-05  0:11     ` Richard Stallman
2003-12-04 22:55 Karl Berry
2003-12-06 14:49 Karl Berry
2003-12-06 19:36 Karl Berry
2003-12-06 19:53 ` Luc Teirlinck
2003-12-06 20:38   ` Luc Teirlinck
2003-12-06 20:30 ` Luc Teirlinck
2003-12-07  0:53 Karl Berry
2003-12-07  5:46 ` Eli Zaretskii
2003-12-07  0:56 Karl Berry
2003-12-07  0:59 Karl Berry
2003-12-07  5:47 ` Eli Zaretskii
2003-12-07 13:42   ` Luc Teirlinck
2003-12-08  0:01     ` Kim F. Storm
2003-12-08 10:28       ` Juri Linkov
2003-12-09 21:48         ` Richard Stallman
2003-12-10  7:37           ` Eli Zaretskii
2003-12-11 14:45             ` Richard Stallman
2003-12-07  1:20 Karl Berry
2003-12-07  5:50 ` Eli Zaretskii

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=87pteppkz9.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    --cc=karl@freefriends.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).