• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/

Lines Matching +defs:file +defs:exists

9 ;; This file is part of GNU Emacs.
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
62 It is better to write a Texinfo file and generate the Info file from that,
236 file, so be prepared for a few surprises if you enable this feature."
284 (defvar Info-current-file nil
285 "Info file that Info is now looking at, or nil.
286 This is the name that was specified in Info, not the actual file name.
287 It doesn't contain directory names or file name extensions added by Info.")
291 It is nil if current Info file is not split into subfiles.")
297 "Marker pointing at beginning of current Info file's tag table.
298 Marker points nowhere if file has no tag table.")
303 (defvar Info-current-file-completions nil
304 "Cached completion list for current Info file.")
306 (defvar Info-file-supports-index-cookies nil
307 "Non-nil if current Info file supports index cookies.")
323 ;; The MS-DOS list should work both when long file names are
324 ;; supported (Windows 9X), and when only 8+3 file names are available.
366 "List of file name suffixes and associated decoding commands.
367 Each entry should be (SUFFIX . STRING); the file is given to
378 ;; First, on MS-DOS with no long file names support, delete some of
380 (defun info-insert-file-contents-1 (filename suffix lfn)
381 (if lfn ; long file names are supported
383 (let* ((sans-exts (file-name-sans-extension filename))
400 (defun info-file-exists-p (filename)
401 (and (file-exists-p filename)
402 (not (file-directory-p filename))))
404 (defun info-insert-file-contents (filename &optional visit)
405 "Insert the contents of an Info file in the current buffer.
406 Do the right thing if the file has been compressed or zipped."
408 (lfn (if (fboundp 'msdos-long-file-names)
409 (msdos-long-file-names)
411 (check-short (and (fboundp 'msdos-long-file-names)
414 (if (info-file-exists-p filename)
415 ;; FILENAME exists--see if that name contains a suffix.
427 (setq fullname (info-insert-file-contents-1 filename
429 (if (info-file-exists-p fullname)
431 ;; If we found a file with a suffix, set DECODER
435 ;; the short variant of a long file name as well.
437 (setq fullname (info-insert-file-contents-1 filename
439 (if (info-file-exists-p fullname)
451 (insert-file-contents-literally fullname visit)
454 (default-directory (or (file-name-directory fullname)
460 (insert-file-contents fullname visit))))
464 (let ((source (expand-file-name "info/" source-directory))
466 (expand-file-name "info/" installation-directory)
468 (let ((infodir (expand-file-name
471 (if (file-exists-p infodir)
473 (setq infodir (expand-file-name
476 (and (file-exists-p infodir)
480 (if (and sibling (file-exists-p sibling))
493 (expand-file-name "lib-src/"
495 (not (file-exists-p alternative)))
520 (defun info-other-window (&optional file-or-node)
523 (list (read-file-name "Info file name: " nil nil t))))
525 (info file-or-node)))
529 ;;;###autoload (put 'info 'info-file "emacs")
531 (defun info (&optional file-or-node buffer)
533 Optional argument FILE-OR-NODE specifies the file to examine;
538 the default buffer name is *info*. If BUFFER exists,
543 this command to read a file name from the minibuffer.
552 (read-file-name "Info file name: " nil nil t))
558 (if file-or-node
564 (if (and (stringp file-or-node) (string-match "(.*)" file-or-node))
565 file-or-node
566 (concat "(" file-or-node ")")))
617 (defun Info-find-file (filename &optional noerror)
619 Optional second argument NOERROR, if t, means if file is not found
625 (setq filename (substitute-in-file-name filename))
634 (if (file-name-absolute-p filename)
636 ;; absolute file name
642 ;; Search the directory list for file FILENAME.
644 (setq temp (expand-file-name filename (car dirs)))
646 (expand-file-name (downcase filename) (car dirs)))
649 (lfn (if (fboundp 'msdos-long-file-names)
650 (msdos-long-file-names)
653 (cond ((info-file-exists-p
654 (info-insert-file-contents-1
657 ((info-file-exists-p
658 (info-insert-file-contents-1
661 ((and (fboundp 'msdos-long-file-names)
663 (info-file-exists-p
664 (info-insert-file-contents-1
673 (error "Info file %s does not exist" filename)))
682 (setq filename (Info-find-file filename))
687 Info-current-file
689 (cons (list Info-current-file Info-current-node (point))
705 (set (make-local-variable 'Info-current-file)
706 (or buffer-file-name
707 ;; If called on a non-file buffer, make a fake file name.
720 (let ((old-filename Info-current-file)
726 (new-history (and Info-current-file
727 (list Info-current-file Info-current-node (point)))))
731 (if (and (equal old-filename Info-current-file)
741 ;; only add to the history when coming from a different file+node
825 (equal Info-current-file filename)
827 (setq Info-current-file nil
829 Info-current-file-completions nil
830 buffer-file-name nil)
842 (info-insert-file-contents filename nil)
843 (setq default-directory (file-name-directory filename))))
856 (set (make-local-variable 'Info-file-supports-index-cookies) found))
858 ;; See whether file has a tag table. Record the location if yes.
867 ;; Is this an indirect file?
890 (setq Info-current-file
905 ;; 4. Node *not* found in tag table, but found in file
906 ;; 5. Node *not* in tag table, and *not* in file
910 ;; Search file for a suitable node.
929 ;; If this is an indirect file, determine which
930 ;; file really holds this node and read it in.
962 ;; No such anchor in tag table or node in tag table or file
968 (let ((new-history (list Info-current-file
989 ;; Cache the contents of the (virtual) dir file, once we have merged
997 ;; Record the file attributes of all the files from which we
999 (defvar Info-dir-file-attributes nil)
1001 (defvar Info-dir-file-name nil)
1008 (if (and Info-dir-contents Info-dir-file-attributes
1013 (let ((curr (file-attributes
1015 (file-truename (car elt)))))
1021 Info-dir-file-attributes))))
1029 (dir-file-attrs nil)
1036 ;; Search the directory list for the directory file.
1038 (let ((truename (file-truename (expand-file-name (car dirs)))))
1040 (member (directory-file-name truename) dirs-done)
1043 (let* (file
1046 (progn (setq file (expand-file-name "dir" truename))
1047 (file-attributes file))
1048 (progn (setq file (expand-file-name "DIR" truename))
1049 (file-attributes file))
1050 (progn (setq file (expand-file-name "dir.info" truename))
1051 (file-attributes file))
1052 (progn (setq file (expand-file-name "DIR.INFO" truename))
1053 (file-attributes file)))))
1056 (cons (directory-file-name truename)
1065 (insert-file-contents file)
1066 (set (make-local-variable 'Info-dir-file-name)
1067 file)
1069 (push (cons file attrs) dir-file-attrs))
1073 (file-name-as-directory (car dirs))))
1079 ;; Distinguish the dir file that comes with Emacs from all the
1086 ;; Insert the entire original dir file as a start; note that we've
1112 (message "No `top' node in %s" Info-dir-file-name)))))
1144 ;; If none exists, add one.
1158 (set (make-local-variable 'Info-dir-file-attributes) dir-file-attrs)))
1232 ;; NODEPOS is either a position (in the Info file as a whole,
1265 (setq buffer-file-name nil)
1268 (info-insert-file-contents lastfilename)
1291 ;; into the Info file for handling images.
1323 (let* ((image-file (if src (if (file-name-absolute-p src) src
1326 (image (if (file-exists-p image-file)
1327 (create-image image-file)
1394 (let ((new-history (list Info-current-file Info-current-node)))
1417 (if (stringp Info-current-file)
1419 "%" "%%" (file-name-nondirectory Info-current-file))
1420 (format "*%S*" Info-current-file))
1441 If NODENAME is of the form (FILENAME)NODENAME, the node is in the Info file
1442 FILENAME; otherwise, NODENAME should be in the current Info file (or one of
1444 Completion is available, but only for node names in the current Info file.
1471 "Virtual completion table for file names input in Info node names.
1476 (string-dir (file-name-directory string))
1478 (if (file-name-absolute-p string)
1479 (list (file-name-directory string))
1484 (if string-dir (setq dir (expand-file-name string-dir dir)))
1485 (when (file-directory-p dir)
1486 (dolist (file (file-name-all-completions
1487 (file-name-nondirectory string) dir))
1488 ;; If the file name has no suffix or a standard suffix,
1490 (and (or (null (file-name-extension file))
1491 (string-match suffix file))
1493 (not (string-match "-[0-9]+\\'" file))
1495 (not (string-match "~\\'" file))
1496 (push (if string-dir (concat string-dir file) file) names))
1497 ;; If the file name ends in a standard suffix,
1499 (when (string-match suffix file)
1500 (setq file (substring file 0 (match-beginning 0)))
1501 (push (if string-dir (concat string-dir file) file) names)))))
1512 ;; First complete embedded file names.
1514 (let ((file (substring string 1)))
1517 (let ((comp (try-completion file 'Info-read-node-name-2
1524 (all-completions file 'Info-read-node-name-2
1528 ;; If a file name was given, then any node is fair game.
1561 (or Info-current-file-completions
1594 (set (make-local-variable 'Info-current-file-completions) compl))))
1600 (if (and (equal (nth 0 (car hl)) Info-current-file)
1634 (ofile Info-current-file)
1645 ;; Hide Info file header for backward search
1735 ;; Hide Info file header for backward search
1792 (equal ofile Info-current-file))
1855 (Info-isearch-pop-state cmd ',Info-current-file ',Info-current-node)))
1857 (defun Info-isearch-pop-state (cmd file node)
1858 (or (and (equal Info-current-file file)
1860 (progn (Info-find-node file node) (sit-for 0))))
1888 Submatch 2 if non-nil is the parenthesized file name part of the node name.
1892 "\\(\\(([^)]+)\\)?" ;Node name can start with a file name.
1918 (defun Info-up (&optional same-file)
1920 If SAME-FILE is non-nil, do not move to a different Info file."
1926 (old-file Info-current-file)
1928 (and same-file
1930 (error "Up node is in another Info file"))
1934 (if (and (stringp old-file)
1938 (concat "\n\\*[^:]+: +(" (file-name-nondirectory old-file) ")")
1952 (cons (list Info-current-file Info-current-node (point))
1990 (let ((curr-file Info-current-file)
2002 (let ((file (nth 0 (car hl)))
2004 (if (and (equal file curr-file)
2007 (if (stringp file)
2009 (propertize (or (file-name-directory file) "") 'invisible t)
2010 (file-name-nondirectory file)
2017 "Go to a node with table of contents of the current Info file.
2020 (if (stringp Info-current-file)
2021 (let ((curr-file (substring-no-properties Info-current-file))
2026 (node-list (Info-build-toc curr-file)))
2031 (insert "*Note Top: (" curr-file ")Top.\n")
2034 node-list 0 curr-file))
2039 (setq Info-current-file 'toc Info-current-node "Top")
2052 (defun Info-insert-toc (nodes node-list level curr-file)
2060 (insert "*Note " (car nodes) ": (" curr-file ")" (car nodes) ".\n")
2061 (Info-insert-toc (nth 2 node) node-list (1+ level) curr-file)
2064 (defun Info-build-toc (file)
2067 (let* ((file (and (stringp file) (Info-find-file file)))
2068 (default-directory (or (and (stringp file)
2069 (file-name-directory file))
2071 (main-file (and (stringp file) file))
2074 (while (or main-file subfiles)
2075 (or main-file (message "Searching subfile %s..." (car subfiles)))
2077 (info-insert-file-contents (or main-file (car subfiles)))
2086 (when (and (not (Info-index-node nodename file))
2118 (if main-file
2127 main-file nil))
2310 (if (and (equal (nth 0 Info-complete-cache) Info-current-file)
2338 (list Info-current-file Info-current-node
2435 "Go to the Top node of this file."
2440 "Go to the final node in this file."
2493 (error "First node in file"))
2724 (defun Info-index-nodes (&optional file)
2726 If FILE is omitted, it defaults to the current Info file.
2728 file and its subfiles for nodes with the index cookie. Then try
2732 (or file (setq file Info-current-file))
2733 (or (assoc file Info-index-nodes)
2735 (and (member file '("dir" apropos history toc))
2736 (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
2737 (not (stringp file))
2738 (if Info-file-supports-index-cookies
2740 (let* ((default-directory (or (and (stringp file)
2741 (file-name-directory
2742 (setq file (Info-find-file file))))
2745 (main-file file) subfiles nodes node)
2748 (while (or main-file subfiles)
2750 (info-insert-file-contents (or main-file (car subfiles)))
2757 (if main-file
2766 main-file nil))
2771 Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
2780 (Info-find-node file "Top")
2793 Info-index-nodes (cons (cons file nodes) Info-index-nodes)))
2795 ;; If file has no index nodes, still add it to the cache
2796 (setq Info-index-nodes (cons (cons file nil) Info-index-nodes)))
2797 (cdr (assoc file Info-index-nodes)))
2799 (defun Info-index-node (&optional node file)
2802 If FILE is nil, check the current Info file."
2804 (assoc (or file Info-current-file) Info-index-nodes))
2805 (member (or node Info-current-node) (Info-index-nodes file))
2807 ;; and file is not in the cache of index nodes
2808 (if Info-file-supports-index-cookies
2839 (if (equal Info-current-file "dir")
2846 (if (equal Info-current-file "dir")
2955 (current-file Info-current-file)
2959 ;; current-node and current-file are nil when they invoke info-apropos
2964 (setq current-file Info-current-file)
2976 (if (setq nodes (Info-index-nodes (Info-find-file manual)))
2995 (Info-find-node current-file current-node)
3241 :help "Go to top node of file"]
3243 :help "Go to final node in this file"]
3247 :help "Search for regular expression in this Info file"]
3297 (equal (list Info-current-file Info-current-node)
3351 (setq Info-menu-last-node (list Info-current-file Info-current-node)))
3359 The name of the Info file is prepended to the node name in parentheses.
3364 (let ((node (if (stringp Info-current-file)
3365 (concat "(" (file-name-nondirectory Info-current-file) ")"
3369 (unless (stringp Info-current-file)
3371 Info-current-file Info-current-node)))
3407 \\[Info-top-node] Go to the Top node of this file.
3408 \\[Info-final-node] Go to the final node in this file.
3417 \\[Info-toc] Go to table of contents of the current Info file.
3431 \\[Info-search] Search through this Info file for specified regexp,
3433 \\[Info-search-case-sensitively] Search through this Info file for specified regexp case-sensitively.
3445 \\[universal-argument] \\[info] Move to new Info file with completion.
3457 (make-local-variable 'Info-current-file)
3551 (y-or-n-p "Save the file? ")
3564 (defvar Info-file-list-for-emacs
3586 An element can be a file name, or a list of the form (PREFIX . FILE)
3587 where PREFIX is a name prefix and FILE is the file to look in.
3588 If the element is just a file name, the file name also serves as the prefix.")
3592 The `info-file' property of COMMAND says which Info manual to search.
3593 If COMMAND has no property, the variable `Info-file-list-for-emacs'
3603 (info-file "emacs")) ;default
3604 ;; Determine which Info file this command is documented in.
3605 (if (get command 'info-file)
3606 (setq info-file (get command 'info-file))
3609 (let ((file-list Info-file-list-for-emacs))
3610 (while file-list
3611 (let* ((elt (car file-list))
3615 (file (if (consp elt) (cdr elt) elt))
3620 (setq info-file file file-list nil))
3621 (setq file-list (cdr file-list))))))
3622 (Info-find-node info-file "Top")
3634 (cons (list Info-current-file
3647 ;;;###autoload (put 'Info-goto-emacs-command-node 'info-file "emacs")
3652 or in another manual found via COMMAND's `info-file' property or
3653 the variable `Info-file-list-for-emacs'.
3689 ;;;###autoload (put 'Info-goto-emacs-key-command-node 'info-file "emacs")
3696 or in another manual found via COMMAND's `info-file' property or
3697 the variable `Info-file-list-for-emacs'."
3910 (file (if external-link-p
3911 (file-name-nondirectory
3913 Info-current-file))
3922 (equal file
3925 (file-name-nondirectory
3943 ;; Unhide the file name of the external reference in parens
4024 (file (if external-link-p
4025 (file-name-nondirectory
4027 Info-current-file))
4036 (equal file
4039 (file-name-nondirectory
4050 ;; Unhide the file name in parens
4176 (Info-speedbar-fetch-file-nodes (or node '"(dir)top"))))
4220 (cond ((string-match "+" text) ;we have to expand this file
4234 (defun Info-speedbar-fetch-file-nodes (nodespec)
4236 NODESPEC is a string of the form: (file)node."
4271 "Create a speedbar display to help navigation in an Info file.
4279 (dolist (mess '("^First node in file$"
4302 "Auxiliary information to be saved in desktop file."
4303 (unless (member Info-current-file '(apropos history toc nil))
4304 (list Info-current-file Info-current-node)))
4306 (defun Info-restore-desktop-buffer (desktop-buffer-file-name
4309 "Restore an Info buffer specified in a desktop file."