comparison lisp/info.el @ 404:2f8bb876ab1d r21-2-32

Import from CVS: tag r21-2-32
author cvs
date Mon, 13 Aug 2007 11:16:07 +0200
parents a86b2b5e0111
children de805c49cfc1
comparison
equal deleted inserted replaced
403:9f011ab08d48 404:2f8bb876ab1d
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of 20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 ;; General Public License for more details. 22 ;; General Public License for more details.
23 23
24 ;; You should have received a copy of the GNU General Public License 24 ;; You should have received a copy of the GNU General Public License
25 ;; along with XEmacs; see the file COPYING. If not, write to the 25 ;; along with XEmacs; see the file COPYING. If not, write to the
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
27 ;; Boston, MA 02111-1307, USA. 27 ;; Boston, MA 02111-1307, USA.
28 28
29 ;;; Synched up with: Not synched with FSF. 29 ;;; Synched up with: Not synched with FSF.
30 30
306 ;; 306 ;;
307 ;; Added automatic dir/localdir (re)building capability for directories that 307 ;; Added automatic dir/localdir (re)building capability for directories that
308 ;; contain none or when it has become older than info files in the same 308 ;; contain none or when it has become older than info files in the same
309 ;; directory. 309 ;; directory.
310 310
311 ;; Modified 1998-09-23 by Didier Verna <verna@inf.enst.fr> 311 ;; Modified 1998-09-23 by Didier Verna <didier@xemacs.org>
312 ;; 312 ;;
313 ;; Use the new macro `with-search-caps-disable-folding' 313 ;; Use the new macro `with-search-caps-disable-folding'
314 314
315 ;; Code: 315 ;; Code:
316 (eval-when-compile 316 (eval-when-compile
400 use any existing `dir' or `localdir' file and ignore info 400 use any existing `dir' or `localdir' file and ignore info
401 directories containing none 401 directories containing none
402 `always' auto-generate a directory listing ignoring existing 402 `always' auto-generate a directory listing ignoring existing
403 `dir' and `localdir' files 403 `dir' and `localdir' files
404 `if-missing', the default, auto-generates a directory listing 404 `if-missing', the default, auto-generates a directory listing
405 if no `dir' or `localdir' file is present. Otherwise the 405 if no `dir' or `localdir' file is present. Otherwise the
406 contents of any of these files is used instead. 406 contents of any of these files is used instead.
407 `if-outdated' auto-generates a directory listing if the `dir' 407 `if-outdated' auto-generates a directory listing if the `dir'
408 and `localdir' are either inexistent or outdated (touched 408 and `localdir' are either inexistent or outdated (touched
409 less recently than an info file in the same directory)." 409 less recently than an info file in the same directory)."
410 :type '(choice (const :tag "never" never) 410 :type '(choice (const :tag "never" never)
411 (const :tag "always" always) 411 (const :tag "always" always)
412 (const :tag "if-missing" if-missing) 412 (const :tag "if-missing" if-missing)
413 (const :tag "if-outdated" if-outdated)) 413 (const :tag "if-outdated" if-outdated))
414 :group 'info) 414 :group 'info)
415 415
416 (defcustom Info-save-auto-generated-dir 'never 416 (defcustom Info-save-auto-generated-dir 'never
417 "*Whether an auto-generated info directory listing should be saved. 417 "*Whether an auto-generated info directory listing should be saved.
418 Possible values are: 418 Possible values are:
419 nil or `never', the default, auto-generated info directory 419 nil or `never', the default, auto-generated info directory
420 information will never be saved. 420 information will never be saved.
421 `always', auto-generated info directory information will be saved to 421 `always', auto-generated info directory information will be saved to
422 a `dir' file in the same directory overwriting it if it exists 422 a `dir' file in the same directory overwriting it if it exists
423 `conservative', auto-generated info directory information will be saved 423 `conservative', auto-generated info directory information will be saved
424 to a `dir' file in the same directory but the user is asked before 424 to a `dir' file in the same directory but the user is asked before
425 overwriting any existing file." 425 overwriting any existing file."
426 :type '(choice (const :tag "never" never) 426 :type '(choice (const :tag "never" never)
427 (const :tag "always" always) 427 (const :tag "always" always)
428 (const :tag "conservative" conservative)) 428 (const :tag "conservative" conservative))
429 :group 'info) 429 :group 'info)
461 (defface info-xref '((t (:bold t))) 461 (defface info-xref '((t (:bold t)))
462 "Face used for cross-references in info." 462 "Face used for cross-references in info."
463 :group 'info-faces) 463 :group 'info-faces)
464 464
465 ;; Is this right for NT? .zip, with -c for to stdout, right? 465 ;; Is this right for NT? .zip, with -c for to stdout, right?
466 (defvar Info-suffix-list '( ("" . nil) 466 (defvar Info-suffix-list '( ("" . nil)
467 (".info" . nil) 467 (".info" . nil)
468 (".info.bz2" . "bzip2 -dc %s") 468 (".info.bz2" . "bzip2 -dc %s")
469 (".info.gz" . "gzip -dc %s") 469 (".info.gz" . "gzip -dc %s")
470 (".info-z" . "gzip -dc %s") 470 (".info-z" . "gzip -dc %s")
471 (".info.Z" . "uncompress -c %s") 471 (".info.Z" . "uncompress -c %s")
535 This is the file .../info/dir, which contains the topmost node of the 535 This is the file .../info/dir, which contains the topmost node of the
536 Info hierarchy. The first time you invoke Info you start off 536 Info hierarchy. The first time you invoke Info you start off
537 looking at that node, which is (dir)Top. 537 looking at that node, which is (dir)Top.
538  538 
539 File: dir Node: Top This is the top of the INFO tree 539 File: dir Node: Top This is the top of the INFO tree
540 This (the Directory node) gives a menu of major topics. 540 This (the Directory node) gives a menu of major topics.
541 541
542 * Menu: The list of major topics begins on the next line. 542 * Menu: The list of major topics begins on the next line.
543 543
544 ") 544 ")
545 545
605 ;; empty filename is simple case 605 ;; empty filename is simple case
606 ((null filename) 606 ((null filename)
607 (Info-find-file-node nil nodename no-going-back tryfile line)) 607 (Info-find-file-node nil nodename no-going-back tryfile line))
608 ;; Convert filename to lower case if not found as specified. 608 ;; Convert filename to lower case if not found as specified.
609 ;; Expand it, look harder... 609 ;; Expand it, look harder...
610 ((let (temp temp-downcase found 610 ((let (temp temp-downcase found
611 (fname (substitute-in-file-name filename))) 611 (fname (substitute-in-file-name filename)))
612 (let ((dirs (cond 612 (let ((dirs (cond
613 ((string-match "^\\./" fname) ; If specified name starts with `./' 613 ((string-match "^\\./" fname) ; If specified name starts with `./'
614 (list default-directory)) ; then just try current directory. 614 (list default-directory)) ; then just try current directory.
615 ((file-name-absolute-p fname) 615 ((file-name-absolute-p fname)
626 (if (equal temp-downcase temp) (setq temp-downcase nil)) 626 (if (equal temp-downcase temp) (setq temp-downcase nil))
627 ;; Try several variants of specified name. 627 ;; Try several variants of specified name.
628 ;; Try downcasing, appending a suffix, or both. 628 ;; Try downcasing, appending a suffix, or both.
629 (setq found (Info-suffixed-file temp temp-downcase)) 629 (setq found (Info-suffixed-file temp temp-downcase))
630 (setq dirs (cdr dirs))) 630 (setq dirs (cdr dirs)))
631 (if found 631 (if found
632 (progn (setq filename (expand-file-name found)) 632 (progn (setq filename (expand-file-name found))
633 t)))) 633 t))))
634 (Info-find-file-node filename nodename no-going-back tryfile line)) 634 (Info-find-file-node filename nodename no-going-back tryfile line))
635 ;; Look for a URL. This pattern is stolen from w3.el to prevent 635 ;; Look for a URL. This pattern is stolen from w3.el to prevent
636 ;; loading it if we won't need it. 636 ;; loading it if we won't need it.
868 (set-buffer (or buf 868 (set-buffer (or buf
869 (generate-new-buffer 869 (generate-new-buffer
870 (if (string-match "localdir" file) 870 (if (string-match "localdir" file)
871 "localdir" 871 "localdir"
872 "info dir")))) 872 "info dir"))))
873 (if (not buf) 873 (if (not buf)
874 (insert-file-contents file)) 874 (insert-file-contents file))
875 (if (string-match "localdir" (buffer-name)) 875 (if (string-match "localdir" (buffer-name))
876 (setq lbuffers (cons (current-buffer) lbuffers)) 876 (setq lbuffers (cons (current-buffer) lbuffers))
877 (setq buffers (cons (current-buffer) buffers))) 877 (setq buffers (cons (current-buffer) buffers)))
878 (if attrs 878 (if attrs
879 (setq Info-dir-file-attributes 879 (setq Info-dir-file-attributes
880 (cons (cons file attrs) 880 (cons (cons file attrs)
881 Info-dir-file-attributes))))))) 881 Info-dir-file-attributes)))))))
882 (or (cdr dirs) (setq Info-dir-contents-directory (car dirs))) 882 (or (cdr dirs) (setq Info-dir-contents-directory (car dirs)))
883 (setq dirs (cdr dirs)))) 883 (setq dirs (cdr dirs))))
884 884
885 ;; ensure that the localdir files are inserted last, and reverse 885 ;; ensure that the localdir files are inserted last, and reverse
886 ;; the list of them so that when they get pushed in, they appear 886 ;; the list of them so that when they get pushed in, they appear
887 ;; in the same order they got specified in the path, from top to 887 ;; in the same order they got specified in the path, from top to
888 ;; bottom. 888 ;; bottom.
889 (nconc buffers (reverse lbuffers)) 889 (nconc buffers (reverse lbuffers))
890 890
891 (or buffers 891 (or buffers
892 (error "Can't find the Info directory node")) 892 (error "Can't find the Info directory node"))
893 ;; Distinguish the dir file that comes with Emacs from all the 893 ;; Distinguish the dir file that comes with Emacs from all the
894 ;; others. Yes, that is really what this is supposed to do. 894 ;; others. Yes, that is really what this is supposed to do.
895 ;; If it doesn't work, fix it. 895 ;; If it doesn't work, fix it.
954 (search-forward "\n\^_" nil 'move) 954 (search-forward "\n\^_" nil 'move)
955 (beginning-of-line) 955 (beginning-of-line)
956 (setq end (point)) 956 (setq end (point))
957 (setq nodes (cons (list nodename other beg end) nodes)))))) 957 (setq nodes (cons (list nodename other beg end) nodes))))))
958 (setq others (cdr others)))) 958 (setq others (cdr others))))
959 959
960 ;; Add to the main menu a menu item for each other node. 960 ;; Add to the main menu a menu item for each other node.
961 (re-search-forward "^\\* Menu:" nil t) 961 (re-search-forward "^\\* Menu:" nil t)
962 (forward-line 1) 962 (forward-line 1)
963 (let ((menu-items '("top")) 963 (let ((menu-items '("top"))
964 (nodes nodes) 964 (nodes nodes)
1014 (unless (or (not (file-exists-p (file-name-directory file))) 1014 (unless (or (not (file-exists-p (file-name-directory file)))
1015 (null (directory-files (file-name-directory file) nil "\\.info"))) 1015 (null (directory-files (file-name-directory file) nil "\\.info")))
1016 (if (not (find-buffer-visiting file)) 1016 (if (not (find-buffer-visiting file))
1017 (if (not (file-exists-p file)) 1017 (if (not (file-exists-p file))
1018 (if (or (eq Info-auto-generate-directory 'always) 1018 (if (or (eq Info-auto-generate-directory 'always)
1019 (eq Info-auto-generate-directory 'if-missing)) 1019 (eq Info-auto-generate-directory 'if-missing))
1020 (Info-build-dir-anew (file-name-directory file))) 1020 (Info-build-dir-anew (file-name-directory file)))
1021 (if (or (eq Info-auto-generate-directory 'always) 1021 (if (or (eq Info-auto-generate-directory 'always)
1022 (and (eq Info-auto-generate-directory 'if-outdated) 1022 (and (eq Info-auto-generate-directory 'if-outdated)
1023 (Info-dir-outdated-p file))) 1023 (Info-dir-outdated-p file)))
1024 (Info-rebuild-dir file)))))) 1024 (Info-rebuild-dir file))))))
1032 directory has been modified more recently." 1032 directory has been modified more recently."
1033 (let ((dir-mod-time (nth 5 (file-attributes file))) 1033 (let ((dir-mod-time (nth 5 (file-attributes file)))
1034 f-mod-time 1034 f-mod-time
1035 newer) 1035 newer)
1036 (setq Info-dir-newer-info-files nil) 1036 (setq Info-dir-newer-info-files nil)
1037 (mapcar 1037 (mapcar
1038 #'(lambda (f) 1038 #'(lambda (f)
1039 (prog2 1039 (prog2
1040 (setq f-mod-time (nth 5 (file-attributes f))) 1040 (setq f-mod-time (nth 5 (file-attributes f)))
1041 (setq newer (or (> (car f-mod-time) (car dir-mod-time)) 1041 (setq newer (or (> (car f-mod-time) (car dir-mod-time))
1042 (and (= (car f-mod-time) (car dir-mod-time)) 1042 (and (= (car f-mod-time) (car dir-mod-time))
1043 (> (car (cdr f-mod-time)) (car (cdr dir-mod-time)))))) 1043 (> (car (cdr f-mod-time)) (car (cdr dir-mod-time))))))
1044 (if (and (file-readable-p f) 1044 (if (and (file-readable-p f)
1045 newer) 1045 newer)
1046 (setq Info-dir-newer-info-files 1046 (setq Info-dir-newer-info-files
1047 (cons f Info-dir-newer-info-files))))) 1047 (cons f Info-dir-newer-info-files)))))
1048 (directory-files (file-name-directory file) 1048 (directory-files (file-name-directory file)
1049 'fullname 1049 'fullname
1050 ".*\\.info\\(\\.gz\\|\\.bz2\\|\\.Z\\|-z\\|\\.zip\\)?$" 1050 ".*\\.info\\(\\.gz\\|\\.bz2\\|\\.Z\\|-z\\|\\.zip\\)?$"
1051 'nosort 1051 'nosort
1080 (while (re-search-forward "^\\* \\([^:]+\\):\\([ \t]*(\\([^)]*\\))\\w*\\.\\|:\\)" nil t) 1080 (while (re-search-forward "^\\* \\([^:]+\\):\\([ \t]*(\\([^)]*\\))\\w*\\.\\|:\\)" nil t)
1081 (setq entry (list (match-string 2) 1081 (setq entry (list (match-string 2)
1082 (match-string 1) 1082 (match-string 1)
1083 (downcase (or (match-string 3) 1083 (downcase (or (match-string 3)
1084 (match-string 1))))) 1084 (match-string 1)))))
1085 (setq entry 1085 (setq entry
1086 (cons (nreverse 1086 (cons (nreverse
1087 (cdr 1087 (cdr
1088 (nreverse 1088 (nreverse
1089 (split-string 1089 (split-string
1090 (buffer-substring 1090 (buffer-substring
1091 (re-search-forward "[ \t]*" nil t) 1091 (re-search-forward "[ \t]*" nil t)
1092 (or (and (re-search-forward "^[^ \t]" nil t) 1092 (or (and (re-search-forward "^[^ \t]" nil t)
1093 (goto-char (match-beginning 0))) 1093 (goto-char (match-beginning 0)))
1094 (point-max))) 1094 (point-max)))
1095 "[ \t]*\n[ \t]*")))) 1095 "[ \t]*\n[ \t]*"))))
1106 (setq len (length (concat (car e) 1106 (setq len (length (concat (car e)
1107 (car (cdr e))))) 1107 (car (cdr e)))))
1108 (if (> len description-col) 1108 (if (> len description-col)
1109 (setq description-col len))) 1109 (setq description-col len)))
1110 entries) 1110 entries)
1111 (setq description-col (+ 5 description-col)) 1111 (setq description-col (+ 5 description-col))
1112 (mapcar #'(lambda (e) 1112 (mapcar #'(lambda (e)
1113 (setq e (cdr e)) ; Drop filename 1113 (setq e (cdr e)) ; Drop filename
1114 (insert "* " (car e) ":" (car (cdr e))) 1114 (insert "* " (car e) ":" (car (cdr e)))
1115 (setq e (car (cdr (cdr e)))) 1115 (setq e (car (cdr (cdr e))))
1116 (while e 1116 (while e
1121 (insert "\n"))) 1121 (insert "\n")))
1122 1122
1123 1123
1124 (defun Info-build-dir-anew (directory) 1124 (defun Info-build-dir-anew (directory)
1125 "Build info directory information for DIRECTORY. 1125 "Build info directory information for DIRECTORY.
1126 The generated directory listing may be saved to a `dir' according 1126 The generated directory listing may be saved to a `dir' according
1127 to the value of `Info-save-auto-generated-dir'" 1127 to the value of `Info-save-auto-generated-dir'"
1128 (save-excursion 1128 (save-excursion
1129 (let* ((dirfile (expand-file-name "dir" directory)) 1129 (let* ((dirfile (expand-file-name "dir" directory))
1130 (to-temp (or (null Info-save-auto-generated-dir) 1130 (to-temp (or (null Info-save-auto-generated-dir)
1131 (eq Info-save-auto-generated-dir 'never) 1131 (eq Info-save-auto-generated-dir 'never)
1132 (and (not (file-writable-p dirfile)) 1132 (and (not (file-writable-p dirfile))
1133 (message "File not writable %s. Using temporary." dirfile)))) 1133 (message "File not writable %s. Using temporary." dirfile))))
1134 (info-files 1134 (info-files
1135 (directory-files directory 1135 (directory-files directory
1136 'fullname 1136 'fullname
1137 ".*\\.info\\(.gz\\|.Z\\|-z\\|.zip\\)?$" 1137 ".*\\.info\\(.gz\\|.Z\\|-z\\|.zip\\)?$"
1138 nil 1138 nil
1139 t))) 1139 t)))
1143 (set-buffer (find-file-noselect dirfile t)) 1143 (set-buffer (find-file-noselect dirfile t))
1144 (setq buffer-read-only nil) 1144 (setq buffer-read-only nil)
1145 (erase-buffer) 1145 (erase-buffer)
1146 (insert Info-dir-prologue 1146 (insert Info-dir-prologue
1147 "Info files in " directory ":\n\n") 1147 "Info files in " directory ":\n\n")
1148 (Info-dump-dir-entries 1148 (Info-dump-dir-entries
1149 (mapcar 1149 (mapcar
1150 #'(lambda (f) 1150 #'(lambda (f)
1151 (or (Info-extract-dir-entry-from f) 1151 (or (Info-extract-dir-entry-from f)
1152 (list 'dummy 1152 (list 'dummy
1153 (progn 1153 (progn
1154 (string-match "\\(.*\\)\\.info\\(.gz\\|.Z\\|-z\\|.zip\\)?$" 1154 (string-match "\\(.*\\)\\.info\\(.gz\\|.Z\\|-z\\|.zip\\)?$"
1155 (file-name-nondirectory f)) 1155 (file-name-nondirectory f))
1156 (capitalize (match-string 1 (file-name-nondirectory f)))) 1156 (capitalize (match-string 1 (file-name-nondirectory f))))
1157 ":" 1157 ":"
1158 (list Info-no-description-string)))) 1158 (list Info-no-description-string))))
1159 info-files)) 1159 info-files))
1165 (message "Creating %s...done" dirfile))))) 1165 (message "Creating %s...done" dirfile)))))
1166 1166
1167 1167
1168 (defun Info-rebuild-dir (file) 1168 (defun Info-rebuild-dir (file)
1169 "Build info directory information in the directory of dir FILE. 1169 "Build info directory information in the directory of dir FILE.
1170 Description of info files are merged from the info files in the 1170 Description of info files are merged from the info files in the
1171 directory and the contents of FILE with the description in info files 1171 directory and the contents of FILE with the description in info files
1172 taking precedence over descriptions in FILE. 1172 taking precedence over descriptions in FILE.
1173 The generated directory listing may be saved to a `dir' according to 1173 The generated directory listing may be saved to a `dir' according to
1174 the value of `Info-save-auto-generated-dir' " 1174 the value of `Info-save-auto-generated-dir' "
1175 (save-excursion 1175 (save-excursion
1176 (save-restriction 1176 (save-restriction
1177 (let (dir-section-contents dir-full-contents 1177 (let (dir-section-contents dir-full-contents
1178 dir-entry 1178 dir-entry
1179 file-dir-entry 1179 file-dir-entry
1180 mark next-section 1180 mark next-section
1181 not-first-section 1181 not-first-section
1182 (to-temp 1182 (to-temp
1183 (or (null Info-save-auto-generated-dir) 1183 (or (null Info-save-auto-generated-dir)
1184 (eq Info-save-auto-generated-dir 'never) 1184 (eq Info-save-auto-generated-dir 'never)
1185 (and (eq Info-save-auto-generated-dir 'always) 1185 (and (eq Info-save-auto-generated-dir 'always)
1186 (not (file-writable-p file)) 1186 (not (file-writable-p file))
1187 (message "File not writable %s. Using temporary." file)) 1187 (message "File not writable %s. Using temporary." file))
1188 (and (eq Info-save-auto-generated-dir 'conservative) 1188 (and (eq Info-save-auto-generated-dir 'conservative)
1189 (or (and (not (file-writable-p file)) 1189 (or (and (not (file-writable-p file))
1190 (message "File not writable %s. Using temporary." file)) 1190 (message "File not writable %s. Using temporary." file))
1191 (not (y-or-n-p 1191 (not (y-or-n-p
1192 (message "%s is outdated. Overwrite ? " 1192 (message "%s is outdated. Overwrite ? "
1193 file)))))))) 1193 file))))))))
1194 (set-buffer (find-file-noselect file t)) 1194 (set-buffer (find-file-noselect file t))
1195 (setq buffer-read-only nil) 1195 (setq buffer-read-only nil)
1196 (if to-temp 1196 (if to-temp
1197 (message "Rebuilding temporary %s..." file) 1197 (message "Rebuilding temporary %s..." file)
1230 (file-name-nondirectory file))) 1230 (file-name-nondirectory file)))
1231 dir-full-contents)) 1231 dir-full-contents))
1232 (if file-dir-entry 1232 (if file-dir-entry
1233 (setq dir-section-contents (cons file-dir-entry 1233 (setq dir-section-contents (cons file-dir-entry
1234 dir-section-contents)) 1234 dir-section-contents))
1235 (setq dir-section-contents 1235 (setq dir-section-contents
1236 (cons (list 'dummy 1236 (cons (list 'dummy
1237 (capitalize (file-name-sans-extension 1237 (capitalize (file-name-sans-extension
1238 (file-name-nondirectory file))) 1238 (file-name-nondirectory file)))
1239 ":" 1239 ":"
1240 (list Info-no-description-string)) 1240 (list Info-no-description-string))
1241 dir-section-contents)))))) 1241 dir-section-contents))))))
1242 Info-dir-newer-info-files) 1242 Info-dir-newer-info-files)
1243 (delete-region (point-min) (point-max)) 1243 (delete-region (point-min) (point-max))
1244 (Info-dump-dir-entries (nreverse dir-section-contents)) 1244 (Info-dump-dir-entries (nreverse dir-section-contents))
1245 (widen) 1245 (widen)
1257 (set-buffer-modified-p nil) 1257 (set-buffer-modified-p nil)
1258 (message "Rebuilding temporary %s...done" file)) 1258 (message "Rebuilding temporary %s...done" file))
1259 (save-buffer) 1259 (save-buffer)
1260 (message "Rebuilding %s...done" file)))))) 1260 (message "Rebuilding %s...done" file))))))
1261 1261
1262 ;;;###autoload 1262 ;;;###autoload
1263 (defun Info-batch-rebuild-dir () 1263 (defun Info-batch-rebuild-dir ()
1264 "(Re)build info `dir' files in the directories remaining on the command line. 1264 "(Re)build info `dir' files in the directories remaining on the command line.
1265 Use this from the command line, with `-batch'; 1265 Use this from the command line, with `-batch';
1266 it won't work in an interactive Emacs. 1266 it won't work in an interactive Emacs.
1267 Each file is processed even if an error occurred previously. 1267 Each file is processed even if an error occurred previously.
1277 (if (not (file-directory-p (car command-line-args-left))) 1277 (if (not (file-directory-p (car command-line-args-left)))
1278 (message "Warning: Skipped %s. Not a directory." 1278 (message "Warning: Skipped %s. Not a directory."
1279 (car command-line-args-left)) 1279 (car command-line-args-left))
1280 (setq dir (expand-file-name "dir" (car command-line-args-left))) 1280 (setq dir (expand-file-name "dir" (car command-line-args-left)))
1281 (setq localdir (expand-file-name "localdir" (car command-line-args-left))) 1281 (setq localdir (expand-file-name "localdir" (car command-line-args-left)))
1282 (cond 1282 (cond
1283 ((file-exists-p dir) 1283 ((file-exists-p dir)
1284 (Info-rebuild-dir dir)) 1284 (Info-rebuild-dir dir))
1285 ((file-exists-p localdir) 1285 ((file-exists-p localdir)
1286 (Info-rebuild-dir localdir)) 1286 (Info-rebuild-dir localdir))
1287 (t 1287 (t
1585 (forward-line 1) 1585 (forward-line 1)
1586 (let ((beg (point))) 1586 (let ((beg (point)))
1587 (forward-line 1) 1587 (forward-line 1)
1588 (if (re-search-backward "Node: *\\([^,\n]*\\) *[,\n\t]" 1588 (if (re-search-backward "Node: *\\([^,\n]*\\) *[,\n\t]"
1589 beg t) 1589 beg t)
1590 (setq compl 1590 (setq compl
1591 (cons (list (buffer-substring (match-beginning 1) 1591 (cons (list (buffer-substring (match-beginning 1)
1592 (match-end 1))) 1592 (match-end 1)))
1593 compl)))))))) 1593 compl))))))))
1594 (setq Info-current-file-completions compl)))) 1594 (setq Info-current-file-completions compl))))
1595 1595
1665 (or (and (equal onode Info-current-node) 1665 (or (and (equal onode Info-current-node)
1666 (equal ofile Info-current-file)) 1666 (equal ofile Info-current-file))
1667 (Info-history-add ofile onode opoint))))) 1667 (Info-history-add ofile onode opoint)))))
1668 1668
1669 ;; Extract the value of the node-pointer named NAME. 1669 ;; Extract the value of the node-pointer named NAME.
1670 ;; If there is none, use ERRORNAME in the error message; 1670 ;; If there is none, use ERRORNAME in the error message;
1671 ;; if ERRORNAME is nil, just return nil. 1671 ;; if ERRORNAME is nil, just return nil.
1672 (defun Info-extract-pointer (name &optional errorname) 1672 (defun Info-extract-pointer (name &optional errorname)
1673 (save-excursion 1673 (save-excursion
1674 (goto-char (point-min)) 1674 (goto-char (point-min))
1675 (forward-line 4) 1675 (forward-line 4)
1941 (setq item nil)))) 1941 (setq item nil))))
1942 (list item)))) 1942 (list item))))
1943 ;; there is a problem here in that if several menu items have the same 1943 ;; there is a problem here in that if several menu items have the same
1944 ;; name you can only go to the node of the first with this command. 1944 ;; name you can only go to the node of the first with this command.
1945 (Info-goto-node (Info-extract-menu-item menu-item) nil t)) 1945 (Info-goto-node (Info-extract-menu-item menu-item) nil t))
1946 1946
1947 (defun Info-extract-menu-item (menu-item &optional noerror) 1947 (defun Info-extract-menu-item (menu-item &optional noerror)
1948 (save-excursion 1948 (save-excursion
1949 (goto-char (point-min)) 1949 (goto-char (point-min))
1950 (if (let ((case-fold-search t)) 1950 (if (let ((case-fold-search t))
1951 (search-forward "\n* menu:" nil t)) 1951 (search-forward "\n* menu:" nil t))
2290 ;;;###autoload 2290 ;;;###autoload
2291 (defun Info-elisp-ref (func) 2291 (defun Info-elisp-ref (func)
2292 "Look up an Emacs Lisp function in the Elisp manual in the Info system. 2292 "Look up an Emacs Lisp function in the Elisp manual in the Info system.
2293 This command is designed to be used whether you are already in Info or not." 2293 This command is designed to be used whether you are already in Info or not."
2294 (interactive (let ((fn (function-at-point)) 2294 (interactive (let ((fn (function-at-point))
2295 (enable-recursive-minibuffers t) 2295 (enable-recursive-minibuffers t)
2296 val) 2296 val)
2297 (setq val (completing-read 2297 (setq val (completing-read
2298 (format "Look up Emacs Lisp function%s: " 2298 (format "Look up Emacs Lisp function%s: "
2299 (if fn 2299 (if fn
2300 (format " (default %s)" fn) 2300 (format " (default %s)" fn)
2997 "Construct a menu of Info commands. 2997 "Construct a menu of Info commands.
2998 Adds an entry for the node at EVENT, or under point if EVENT is omitted. 2998 Adds an entry for the node at EVENT, or under point if EVENT is omitted.
2999 Used to construct the menubar submenu and popup menu." 2999 Used to construct the menubar submenu and popup menu."
3000 (or event (setq event (point))) 3000 (or event (setq event (point)))
3001 (let ((case-fold-search t) 3001 (let ((case-fold-search t)
3002 (xref-regexp (concat "\\*" 3002 (xref-regexp (concat "\\*"
3003 (regexp-quote Info-footnote-tag) 3003 (regexp-quote Info-footnote-tag)
3004 "[ \n\t]*\\([^:]*\\):")) 3004 "[ \n\t]*\\([^:]*\\):"))
3005 up-p prev-p next-p menu xrefs subnodes in) 3005 up-p prev-p next-p menu xrefs subnodes in)
3006 (save-excursion 3006 (save-excursion
3007 ;; `one-space' fixes "Notes:" xrefs that are split across lines. 3007 ;; `one-space' fixes "Notes:" xrefs that are split across lines.