emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Info fails to find history.info


From: Juri Linkov
Subject: Re: Info fails to find history.info
Date: Tue, 07 Feb 2006 12:54:32 +0200
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

> But why did you originally write the code to use these special strings?

Initially I implemented a different approach with using special Info
buffers with names "*info-history*" and "*info-toc*".  But later when the
Info-apropos patch was installed with a different approach I rewrote
Info-history and Info-toc to use the same approach.  I guess using the
special file name "apropos" was modelled after the special file name "dir".
So I did the same and added special file names "history" and "toc".

It seems the virtual file name "dir" doesn't cause any problem since
authors are aware of this special file name and don't use the file name
"dir".  But other file names cause problems as already reported "history"
and there is a possibility of real file names "toc" and "apropos".

> Do users ever enter them?

I can't imagine a situation where users might want to enter them.  E.g.
`C-u C-h i history RET' to get a history list doesn't make much sense to me.

>     1. Use symbols for the file name argument of `Info-find-node'
>        for virtual Info files:
>        e.g. use   (Info-find-node 'apropos "Index")
>        instead of (Info-find-node "apropos" "Index")
>
> That seems clean to me.

But this solution has one big drawback: using symbols as argument of
`Info-find-node' means that symbols will be used in the variable
`Info-current-file', and this requires adding special handling in many
places in info.el.  What is worse, it will break code in users' Info hooks.

OTOH, using unlikely file names has a smaller risk to cause more bugs
just before the release.  Good candidates for virtual file names are
"*apropos*", "*history*" and "*toc*":

Index: lisp/info.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/info.el,v
retrieving revision 1.474
diff -u -r1.474 info.el
--- lisp/info.el        4 Feb 2006 12:12:00 -0000       1.474
+++ lisp/info.el        7 Feb 2006 10:50:54 -0000
@@ -622,11 +622,11 @@
        (cond
         ((string= (downcase filename) "dir")
          (setq found t))
-        ((string= filename "apropos")
+        ((string= filename "*apropos*")
          (setq found 'apropos))
-        ((string= filename "history")
+        ((string= filename "*history*")
          (setq found 'history))
-        ((string= filename "toc")
+        ((string= filename "*toc*")
          (setq found 'toc))
         (t
          (let ((dirs (if (string-match "^\\./" filename)
@@ -891,9 +891,9 @@
               (setq Info-current-file
                    (cond
                     ((eq filename t) "dir")
-                    ((eq filename 'apropos) "apropos")
-                    ((eq filename 'history) "history")
-                    ((eq filename 'toc) "toc")
+                    ((eq filename 'apropos) "*apropos*")
+                    ((eq filename 'history) "*history*")
+                    ((eq filename 'toc) "*toc*")
                     (t filename)))
              ))
         ;; Use string-equal, not equal, to ignore text props.
@@ -1983,7 +1989,7 @@
                      (file-name-nondirectory file)
                       ")" node ".\n"))
             (setq hl (cdr hl))))))
-    (Info-find-node "history" "Top")
+    (Info-find-node "*history*" "Top")
     (goto-char (or p (point-min)))))
 
 (defun Info-toc ()
@@ -2008,7 +2014,7 @@
           (let ((Info-hide-note-references 'hide)
                 (Info-fontify-visited-nodes nil))
             (Info-mode)
-            (setq Info-current-file "toc" Info-current-node "Top")
+            (setq Info-current-file "*toc*" Info-current-node "Top")
             (goto-char (point-min))
             (narrow-to-region (or (re-search-forward "\n[\^_\f]\n" nil t)
                                   (point-min))
@@ -2018,7 +2024,7 @@
       (goto-char (point-min))
       (if (setq p (search-forward (concat "*Note " curr-node ":") nil t))
           (setq p (- p (length curr-node) 2))))
-    (Info-find-node "toc" "Top")
+    (Info-find-node "*toc*" "Top")
     (goto-char (or p (point-min)))))
 
 (defun Info-insert-toc (nodes node-list level curr-file)
@@ -2682,7 +2688,7 @@
   (or file (setq file Info-current-file))
   (or (assoc file Info-index-nodes)
       ;; Skip virtual Info files
-      (and (member file '("dir" "history" "toc" "apropos"))
+      (and (member file '("dir" "*history*" "*toc*" "*apropos*"))
            (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
       (not (stringp file))
       (if Info-file-supports-index-cookies
@@ -2943,7 +2949,7 @@
                     (if (nth 3 entry)
                         (concat " (line " (nth 3 entry) ")")
                       "")))))
-       (Info-find-node "apropos" "Index")
+       (Info-find-node "*apropos*" "Index")
        (setq Info-complete-cache nil)))))
 
 (defun Info-undefined ()
@@ -4208,7 +4214,7 @@
 
 (defun Info-desktop-buffer-misc-data (desktop-dirname)
   "Auxiliary information to be saved in desktop file."
-  (if (not (member Info-current-file '("apropos" "history" "toc")))
+  (if (not (member Info-current-file '("*apropos*" "*history*" "*toc*")))
       (list Info-current-file Info-current-node)))
 
 (defun Info-restore-desktop-buffer (desktop-buffer-file-name

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]