unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13365: 24.3.50; info node name completion busted
@ 2013-01-05 17:53 emacs18
  2013-01-05 22:39 ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: emacs18 @ 2013-01-05 17:53 UTC (permalink / raw)
  To: 13365

I use latest bzr trunk emacs that I compiled on linux.

Following is something I have done going back to emacs 18; launch
emacs, start info brower via C-h i, then type "g" to call
Info-goto-node, type "(emacs)" followed by RETURN.

Above no longer works.  Why?  Because we now have to use proper info
node name, i.e., I now have to type "(emacs)Top" instead of "(emacs)".
This is quite annoying to me.  IMHO a feature that has been around for
over 25 years is now busted.

This bug was introduced by Juri Linkov on Dec 27, 2012 via trunk
change set 11354.  The difff chunk in question is shown below.

I think this should be changed so that node names such as "(emacs)" is
allowed and interpreted same as if it was "(emacs)Top" as emacs has
done for over 25 years.


=== modified file 'lisp/info.el'
--- lisp/info.el	2012-12-08 23:12:08 +0000
+++ lisp/info.el	2012-12-27 20:42:02 +0000
@@ -1771,12 +1775,20 @@
      (substring string 1)
      predicate
      code))
-   ;; If a file name was given, then any node is fair game.
-   ((string-match "\\`(" string)
-    (cond
-     ((eq code nil) string)
-     ((eq code t) nil)
-     (t t)))
+   ;; If a file name was given, complete nodes in the file.
+   ((string-match "\\`(\\([^)]+\\))" string)
+    (let ((file0 (match-string 0 string))
+	  (file1 (match-string 1 string))
+	  (node (substring string (match-end 0))))
+      (completion-table-with-context
+       file0
+       (apply-partially
+	(lambda (string pred action)
+	  (complete-with-action
+	   action
+	   (Info-build-node-completions (Info-find-file file1))
+	   string pred)))
+       node predicate code)))
    ;; Otherwise use Info-read-node-completion-table.
    (t (complete-with-action
        code Info-read-node-completion-table string predicate))))





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#13365: 24.3.50; info node name completion busted
  2013-01-05 17:53 bug#13365: 24.3.50; info node name completion busted emacs18
@ 2013-01-05 22:39 ` Juri Linkov
  2013-01-06  3:58   ` emacs18
  0 siblings, 1 reply; 4+ messages in thread
From: Juri Linkov @ 2013-01-05 22:39 UTC (permalink / raw)
  To: emacs18; +Cc: 13365

> Following is something I have done going back to emacs 18; launch
> emacs, start info brower via C-h i, then type "g" to call
> Info-goto-node, type "(emacs)" followed by RETURN.
>
> Above no longer works.  Why?

Thanks for the report.  This change was a result of the discussion
in http://debbugs.gnu.org/12456

> I think this should be changed so that node names such as "(emacs)" is
> allowed and interpreted same as if it was "(emacs)Top" as emacs has
> done for over 25 years.

I agree there is no reason to not allow empty node names to be
interpreted as "Top", despite the fact that this feature is not
documented anywhere and has been available for years by mere chance
(note the phrase "any node is fair game" in the old comment).

This could be improved by the patch below that will also legitimate
this feature in the docstring of `Info-read-node-name' and in the
Info reader manual.

BTW, do you think that `g RET' (without specifying a filename)
should also go to the Top node of the current Info file?
Currently it just recursively repeats the same query
that is not quite standard behavior for the minibuffer.

=== modified file 'lisp/info.el'
--- lisp/info.el	2013-01-03 00:36:36 +0000
+++ lisp/info.el	2013-01-05 22:39:39 +0000
@@ -1712,7 +1712,9 @@ (defun Info-goto-node (nodename &optiona
 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.
+Completion is available for node names in the current Info file as well as
+in the Info file FILENAME after the closing parenthesis in (FILENAME).
+Empty NODENAME in (FILENAME) defaults to the node `Top'.
 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."
@@ -1802,6 +1804,9 @@ (defun Info-read-node-name-1 (string pre
     (let ((file0 (match-string 0 string))
 	  (file1 (match-string 1 string))
 	  (node (substring string (match-end 0))))
+      (if (and (equal node "") (eq code 'lambda))
+	  ;; Empty node name is permitted that means "Top".
+	  t
       (completion-table-with-context
        file0
        (apply-partially
@@ -1810,7 +1815,7 @@ (defun Info-read-node-name-1 (string pre
 	   action
 	   (Info-build-node-completions (Info-find-file file1))
 	   string pred)))
-       node predicate code)))
+	 node predicate code))))
    ;; Otherwise use Info-read-node-completion-table.
    (t (complete-with-action
        code Info-read-node-completion-table string predicate))))
@@ -1819,7 +1824,9 @@ (defun Info-read-node-name-1 (string pre
 (defun Info-read-node-name (prompt)
   "Read an Info node name with completion, prompting with PROMPT.
 A node name can have the form \"NODENAME\", referring to a node
-in the current Info file, or \"(FILENAME)NODENAME\"."
+in the current Info file, or \"(FILENAME)NODENAME\", referring to
+a node in FILENAME.  \"(FILENAME)\" is a short format to go to the
+node `Top' in FILENAME."
   (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)))

=== modified file 'doc/misc/info.texi'
--- doc/misc/info.texi	2013-01-01 09:11:05 +0000
+++ doc/misc/info.texi	2013-01-05 22:39:36 +0000
@@ -1079,7 +1079,8 @@ (@pxref{Emacs Info Variables}).
 node name by putting it at the front, in parentheses.  Thus,
 @kbd{g(dir)Top@key{RET}} would go to the Info Directory node, which is
 the node @samp{Top} in the Info file @file{dir}.  Likewise,
-@kbd{g(emacs)Top@key{RET}} goes to the top node of the Emacs manual.
+@kbd{g(emacs)Top@key{RET}} or just @kbd{g(emacs)@key{RET}} goes to the
+top node of the Emacs manual.
 
   The node name @samp{*} specifies the whole file.  So you can look at
 all of the current file by typing @kbd{g*@key{RET}} or all of any






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#13365: 24.3.50; info node name completion busted
  2013-01-05 22:39 ` Juri Linkov
@ 2013-01-06  3:58   ` emacs18
  2013-01-08  0:12     ` Juri Linkov
  0 siblings, 1 reply; 4+ messages in thread
From: emacs18 @ 2013-01-06  3:58 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 13365

Juri Linkov <juri@jurta.org> writes:

> BTW, do you think that `g RET' (without specifying a filename)
> should also go to the Top node of the current Info file?
> Currently it just recursively repeats the same query
> that is not quite standard behavior for the minibuffer.

I'm not sure.  To me `g RET' does not make sense.  The user has not made
his/her selection so I think we should disallow it or just force the
user to make a valid selection.  I don't know what the "standard
behavior" is these days, so I'll trust that you will know what is best.

I tested the change of list/info.el that you provded.
It seems to do exactly what I hoped it would do.

Thanks for such a quick fix.
Thanks also for taking time to improve the manual.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#13365: 24.3.50; info node name completion busted
  2013-01-06  3:58   ` emacs18
@ 2013-01-08  0:12     ` Juri Linkov
  0 siblings, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2013-01-08  0:12 UTC (permalink / raw)
  To: emacs18; +Cc: 13365-done

> I tested the change of list/info.el that you provded.
> It seems to do exactly what I hoped it would do.
> Thanks for such a quick fix.
> Thanks also for taking time to improve the manual.

Thanks for confirming the fix.  It is installed now and bug#13365 is closed.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-08  0:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-05 17:53 bug#13365: 24.3.50; info node name completion busted emacs18
2013-01-05 22:39 ` Juri Linkov
2013-01-06  3:58   ` emacs18
2013-01-08  0:12     ` Juri Linkov

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).