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

Lines Matching +defs:temp +defs:directory

28 ;; Defines most of Emacs's file- and directory-handling functions,
54 (defcustom directory-abbrev-alist
58 FROM with TO when it appears in a directory name. This replacement is
59 done when setting up the default directory of a newly visited file.
63 They should be ordinary absolute directory names.
191 (defcustom temporary-file-directory
192 (file-name-as-directory
194 (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp"))
199 "The directory for writing temporary files."
201 :type 'directory)
203 (defcustom small-temporary-file-directory
205 "The directory for writing small temporary files.
206 If non-nil, this directory is used instead of `temporary-file-directory'
210 :type '(choice (const nil) directory))
257 "When cleaning directory, number of versions to keep."
339 ,(concat temporary-file-directory "\\2") t))
346 constructed by taking the directory part of the replaced file-name,
347 concatenated with the buffer file name with all directory separators
356 temporary directory (see the variable `temporary-file-directory') for
374 To visit the directory, `find-file' runs `find-directory-functions'."
378 (defcustom find-directory-functions '(cvs-dired-noselect dired-noselect)
379 "List of functions to try in sequence to visit a directory.
380 Each function is called with the directory name as the sole argument
563 (defun read-directory-name (prompt &optional dir default-dirname mustmatch initial)
564 "Read directory name, prompting with PROMPT and completing in directory DIR.
572 pre-inserted contents or if `insert-default-directory' is nil.)
573 Fourth arg MUSTMATCH non-nil means require existing directory's name.
576 DIR should be an absolute directory name. It defaults to
577 the value of `default-directory'."
579 (setq dir default-directory))
584 'file-directory-p))
589 "Show the current default directory."
591 (message "Directory %s" default-directory))
598 "Explode a search path into a list of directory names.
611 (file-name-as-directory
617 "Change current directory to given absolute file name DIR."
618 ;; Put the name into directory syntax now,
621 (setq dir (file-name-as-directory dir)))
623 (if (not (file-directory-p dir))
625 (error "%s is not a directory" dir)
626 (error "%s: no such directory" dir))
628 (setq default-directory dir)
632 "Make DIR become the current buffer's default directory.
635 `path-separator') when resolving a relative directory name.
638 (list (read-directory-name "Change default directory: "
639 default-directory default-directory
651 (if (file-directory-p f)
657 (error "No such directory found via CDPATH environment variable"))))
699 (string-dir (file-name-directory string)))
702 (setq dir default-directory))
704 (when (file-directory-p dir)
795 ;; reported by directory-files, but can be used to refer to files.)
825 (let ((dir (or (file-name-directory filename) default-directory))
827 ;; Get the truename of the directory.
828 (setq dirfile (directory-file-name dir))
829 ;; If these are equal, we have the (or a) root directory.
836 (new (file-name-as-directory (file-truename dirfile counter prev-dirs))))
841 (directory-file-name (file-name-directory (directory-file-name dir)))
844 (setq filename (directory-file-name dir)
852 ;; since the link may point to a directory name that uses links.
868 directory name is a symbolic link.
882 ;; target of any directory symlink.
891 (directory-file-name (file-name-directory newname))))
893 (setq newname (file-name-directory newname)))
894 (setq newname (expand-file-name tem (file-name-directory newname)))
898 (defun make-temp-file (prefix &optional dir-flag suffix)
901 of PREFIX, and expanding against `temporary-file-directory' if necessary),
905 If DIR-FLAG is non-nil, create a new empty directory instead of a file.
912 ;; Create temp files with strict access rights. It's easy to
919 (make-temp-name
920 (expand-file-name prefix temporary-file-directory)))
924 (make-directory file)
929 ;; `make-temp-name' and `write-region', let's try again.
1063 (read-file-name prompt nil default-directory mustmatch)))
1070 Interactively, the default if you just type RET is the current directory,
1091 Interactively, the default if you just type RET is the current directory,
1111 Interactively, the default if you just type RET is the current directory,
1195 file-dir (file-name-directory file)))
1222 file-dir (file-name-directory file)))
1237 (odir dired-directory)
1252 (setq dired-directory nil)
1262 (setq dired-directory odir)
1274 FILENAME (sans directory) is used unchanged if that name is free;
1287 "Regexp to match the automounter prefix in a directory name."
1292 "The user's homedir abbreviated according to `directory-abbrev-alist'.")
1295 "Return a version of FILENAME shortened using `directory-abbrev-alist'.
1296 This also substitutes \"~\" for the user's home directory (unless the
1297 home directory is a root directory) and removes automounter prefixes
1303 (file-exists-p (file-name-directory
1306 (let ((tail directory-abbrev-alist))
1307 ;; If any elt of directory-abbrev-alist matches this name,
1316 ;; give time for directory-abbrev-alist to be set properly.
1348 directory where the file was found. If you *do not* want that, add the logical
1433 (if (file-directory-p filename)
1436 'find-directory-functions
1440 (error "%s is a directory" filename))
1647 ;; On VMS, we may want to remember which directory in a search list
1651 (if (string-match ":" (file-name-directory filename))
1652 (setq logical (substring (file-name-directory filename)
1658 ;; Set buffer's default directory to that of the file.
1659 (setq default-directory (file-name-directory buffer-file-name))
1706 (if (file-directory-p filename)
1707 (signal 'file-error (list "Opening input file" "file is a directory"
1794 ((file-attributes (directory-file-name default-directory))
1795 "File not found and directory write-protected")
1796 ((file-exists-p (file-name-directory buffer-file-name))
1800 "Use M-x make-directory RET RET to create the directory and its parents"))))
1986 ;; .emacs or .gnus or .viper following a directory delimiter in
1990 ;; _emacs following a directory delimiter
2336 (let ((temp inhibit-first-line-modes-regexps)
2345 (while (and temp
2346 (not (string-match (car temp) name)))
2347 (setq temp (cdr temp)))
2348 (not temp))
2414 exec-directory
2477 (default-directory . stringp) ;; C source code
2674 (with-temp-buffer
2922 (setq default-directory (file-name-directory buffer-file-name))
2993 If you specify just a directory name as FILENAME, that means to use
2994 the default file name but in that directory. You can also yank
3008 (read-file-name "Write file: " default-directory
3011 default-directory)
3016 ;; If arg is just a directory,
3017 ;; use the default file name, but in that directory.
3018 (if (file-directory-p filename)
3019 (setq filename (concat (file-name-as-directory filename)
3060 ;; Thus we make the backups in the directory where the real file is.
3065 ;; (if (file-directory-p buffer-file-name)
3066 ;; (error "Cannot save buffer in directory %s" buffer-file-name))
3086 (not (file-writable-p (file-name-directory real-file-name)))
3126 ;; Create temp files with strict access rights. It's easy to
3161 ;; device/directory part of the file name.
3190 directory)
3193 (if (setq directory (file-name-directory filename))
3196 (concat directory (substring file 0 (match-beginning 0)))
3227 See also `backup-directory-alist'."
3232 (defcustom backup-directory-alist nil
3233 "Alist of filename patterns and backup directory names.
3237 are backed up into the same directory, the file names in this
3238 directory will be the full name of the file backed up with all
3239 directory separators changed to `!' to prevent clashes. This will not
3242 For the common case of all backups going into one directory, the alist
3244 directory name.
3247 is made in the original file's directory.
3253 (directory :tag "Backup directory name"))))
3257 Checks for files in `temporary-file-directory',
3258 `small-temporary-file-directory', and /tmp."
3259 (not (or (let ((comp (compare-strings temporary-file-directory 0 nil
3261 ;; Directory is under temporary-file-directory.
3263 (< comp (- (length temporary-file-directory)))))
3269 (if small-temporary-file-directory
3270 (let ((comp (compare-strings small-temporary-file-directory
3273 ;; Directory is under small-temporary-file-directory.
3275 (< comp (- (length small-temporary-file-directory)))))))))
3286 Otherwise a match for FILE is sought in `backup-directory-alist'; see
3287 the documentation of that variable. If the directory for the backup
3294 (concat (file-name-directory file)
3303 (let ((alist backup-directory-alist)
3304 elt backup-directory abs-backup-directory)
3308 (setq backup-directory (cdr elt)
3310 ;; If backup-directory is relative, it should be relative to the
3311 ;; file's directory. By expanding explicitly here, we avoid
3312 ;; depending on default-directory.
3313 (if backup-directory
3314 (setq abs-backup-directory
3315 (expand-file-name backup-directory
3316 (file-name-directory file))))
3317 (if (and abs-backup-directory (not (file-exists-p abs-backup-directory)))
3319 (make-directory abs-backup-directory 'parents)
3320 (file-error (setq backup-directory nil
3321 abs-backup-directory nil))))
3322 (if (null backup-directory)
3324 (if (file-name-absolute-p backup-directory)
3343 ;; Make the name unique by substituting directory
3350 backup-directory))
3352 (file-name-as-directory abs-backup-directory))))))
3381 Uses `backup-directory-alist' in the same way as does
3403 (file-name-directory basic-name))
3432 ;; (defun file-relative-name (filename &optional directory)
3433 ;; "Convert FILENAME to be relative to DIRECTORY (default: `default-directory').
3435 ;; when used with that default directory as the default.
3437 ;; when the file name and directory use different drive names)
3441 ;; (setq directory (file-name-as-directory
3442 ;; (expand-file-name (or directory default-directory))))
3449 ;; (substring directory 0 2))))
3452 ;; (fname-dir (file-name-as-directory fname)))
3453 ;; (while (and (not (string-match (concat "^" (regexp-quote directory)) fname-dir))
3454 ;; (not (string-match (concat "^" (regexp-quote directory)) fname)))
3455 ;; (setq directory (file-name-directory (substring directory 0 -1))
3460 ;; (if (string-match (concat "^" (regexp-quote directory)) fname)
3461 ;; ;; We matched within FNAME's directory part.
3468 ;; (concat (file-name-as-directory ancestor) rest)))
3469 ;; ;; We matched FNAME's directory equivalent.
3472 (defun file-relative-name (filename &optional directory)
3473 "Convert FILENAME to be relative to DIRECTORY (default: `default-directory').
3475 when used with that default directory as the default.
3479 (setq directory
3480 (file-name-as-directory (expand-file-name (or directory
3481 default-directory))))
3484 (dremote (file-remote-p directory)))
3491 (not (eq t (compare-strings filename 0 2 directory 0 2))))
3496 (filename-dir (file-name-as-directory filename)))
3499 (eq t (compare-strings filename-dir nil (length directory)
3500 directory nil nil case-fold-search))
3501 (eq t (compare-strings filename nil (length directory)
3502 directory nil nil case-fold-search))))
3503 (setq directory (file-name-directory (substring directory 0 -1))
3508 (if (eq t (compare-strings filename nil (length directory)
3509 directory nil nil case-fold-search))
3510 ;; We matched within FILENAME's directory part.
3512 (let ((rest (substring filename (length directory))))
3516 (concat (file-name-as-directory ancestor) rest)))
3517 ;; We matched FILENAME's directory equivalent.
3548 `dired-kept-versions' controls dired's clean-directory (.) command.
3641 (if (file-directory-p filename)
3643 ;; existing directory.
3644 (error "%s is a directory" filename)
3649 ;; non-existing directory.
3650 (let ((dir (file-name-directory filename)))
3651 (unless (file-directory-p dir)
3653 (error "%s is not a directory" dir)
3654 (error "%s: no such directory" dir)))))
3724 (let ((dir (file-name-directory buffer-file-name)))
3725 (if (not (file-directory-p dir))
3727 (error "%s is not a directory" dir)
3728 (error "%s: no such directory" dir))
3739 (let ((dir (file-name-directory buffer-file-name)))
3742 ;; If file is precious, write temp name, then rename it.
3749 ;; Create temp files with strict access rights. It's easy to
3757 ;; This code follows the example of make-temp-file,
3763 (make-temp-name
3771 ;; `make-temp-name' and `write-region', let's try again.
3785 ;; We succeeded in writing the temp file,
3817 (let ((tempfile (make-temp-file "buffer-content-")))
3991 ;; `make-backup-file-name' will get us the right directory for
3992 ;; ordinary or numeric backups. It might create a directory for
3993 ;; backups as a side-effect, according to `backup-directory-alist'.
3997 (dir (file-name-directory filename))
4029 (defun make-directory (dir &optional parents)
4030 "Create the directory DIR and any nonexistent parent dirs.
4031 Interactively, the default choice of directory to create
4032 is the current default directory for file names.
4033 That is useful when you have visited a file in a nonexistent directory.
4039 (list (read-file-name "Make directory: " default-directory default-directory
4042 ;; If default-directory is a remote directory,
4043 ;; make sure we find its make-directory handler.
4045 (let ((handler (find-file-name-handler dir 'make-directory)))
4047 (funcall handler 'make-directory dir parents)
4049 (make-directory-internal dir)
4050 (let ((dir (directory-file-name (expand-file-name dir)))
4054 dir (directory-file-name (file-name-directory dir))))
4056 (make-directory-internal (car create-list))
4269 (with-output-to-temp-buffer "*Directory*"
4276 ;; Use insert-directory-safely, not insert-directory,
4282 (insert-directory-safely file switches)
4283 (insert-directory-safely file-name switches))))
4306 (let ((dir (file-name-directory auto-save-list-file-prefix)))
4307 (unless (file-directory-p dir)
4308 (make-directory dir t))
4309 (unless (directory-files dir nil
4370 (file-name-directory autofile))))
4487 (file-name-directory result)
4506 (concat (file-name-directory buffer-file-name)
4509 (concat (file-name-directory filename)
4540 (make-temp-file
4547 ((file-writable-p default-directory) default-directory)
4555 ;; DOS/Windows filesystems. make-temp-file writes to the
4557 ;; make-temp-file is called.
4561 ;; make-temp-file creates the file,
4646 (defcustom list-directory-brief-switches
4648 "Switches for `list-directory' to pass to `ls' for brief listing."
4652 (defcustom list-directory-verbose-switches
4656 "Switches for `list-directory' to pass to `ls' for verbose listing."
4668 relative to the current default directory, `default-directory'.
4670 default directory. However, if FULL is non-nil, they are absolute."
4673 (dirpart (file-name-directory pattern))
4678 (mapcar 'file-name-as-directory
4679 (file-expand-wildcards (directory-file-name dirpart)))
4684 (file-directory-p (directory-file-name (car dirs))))
4692 (directory-files (or (car dirs) ".") full
4704 (defun list-directory (dirname &optional verbose)
4708 Actions controlled by variables `list-directory-brief-switches'
4709 and `list-directory-verbose-switches'."
4711 (list (read-file-name (if pfx "List directory (verbose): "
4712 "List directory (brief): ")
4713 nil default-directory nil)
4715 (let ((switches (if verbose list-directory-verbose-switches
4716 list-directory-brief-switches))
4718 (or dirname (setq dirname default-directory))
4720 (with-output-to-temp-buffer "*Directory*"
4728 (let ((wildcard (not (file-directory-p dirname))))
4729 (insert-directory dirname switches wildcard (not wildcard)))))
4730 ;; Finishing with-output-to-temp-buffer seems to clobber default-directory.
4732 (setq default-directory
4733 (if (file-directory-p dirname)
4734 (file-name-as-directory dirname)
4735 (file-name-directory dirname))))))
4783 (defvar insert-directory-program "ls"
4784 "Absolute or relative name of the `ls' program used by `insert-directory'.")
4786 (defcustom directory-free-space-program "df"
4790 if you want to specify options, use `directory-free-space-args'.
4799 (defcustom directory-free-space-args
4801 "Options to use when running `directory-free-space-program'."
4806 "Return the amount of free space on directory DIR's file system.
4809 fail. It returns also nil when DIR is a remote directory.
4812 program specified by `directory-free-space-program' if that is non-nil."
4821 (with-temp-buffer
4822 (when (and directory-free-space-program
4823 (eq 0 (call-process directory-free-space-program
4825 directory-free-space-args
4842 (defvar directory-listing-before-filename-regexp
4889 "Regular expression to match up to the file name in a directory listing.
4893 (defvar insert-directory-ls-version 'unknown)
4895 ;; insert-directory
4916 (defun insert-directory (file switches &optional wildcard full-directory-p)
4917 "Insert directory listing for FILE, formatted according to SWITCHES.
4922 Optional fourth arg FULL-DIRECTORY-P means file is a directory and
4925 This works by running a directory listing program
4926 whose name is in the variable `insert-directory-program'.
4932 `insert-directory-program', as any other option."
4933 ;; We need the directory in order to find the right handler.
4935 'insert-directory)))
4937 (funcall handler 'insert-directory file switches
4938 wildcard full-directory-p)
4940 (vms-read-directory file switches (current-buffer))
4943 ;; Read the actual directory using `insert-directory-program'.
4956 ;; Run ls in the directory part of the file pattern
4958 (let ((default-directory
4960 (file-name-directory file)
4961 (file-name-directory (expand-file-name file))))
4969 insert-directory-program
4985 ;; directory if FILE is a symbolic link.
4987 insert-directory-program nil t nil
5000 (if full-directory-p
5001 (concat (file-name-as-directory file) ".")
5005 ;; directory listing, even if `ls' returned nonzero.
5018 (eq insert-directory-ls-version 'unknown))
5021 ;; and set insert-directory-ls-version
5026 (with-temp-buffer
5047 (setq insert-directory-ls-version (or comparison '=)))
5048 (setq insert-directory-ls-version nil))))
5051 (when (and (eq 1 result) (eq insert-directory-ls-version '>))
5054 ;; If `insert-directory-program' failed, signal an error.
5058 ;; On non-Posix systems, we cannot open a directory, so
5062 (if (and (file-directory-p file)
5065 "Reading directory: \"%s %s -- %s\" exited with status %s"
5066 insert-directory-program
5070 (access-file file "Reading directory")
5071 (error "Listing directory failed but `access-file' worked")))
5077 ;; directory listed with "--dired", but without "-a"
5102 (let ((start (insert-directory-adj-pos
5105 (end (insert-directory-adj-pos
5158 (if full-directory-p
5167 (replace-match "total used in directory" nil nil nil 1)
5171 (defun insert-directory-adj-pos (pos error-lines)
5183 (defun insert-directory-safely (file switches
5184 &optional wildcard full-directory-p)
5185 "Insert directory listing for FILE, formatted according to SWITCHES.
5187 Like `insert-directory', but if FILE does not exist, it inserts a
5190 (insert-directory file switches wildcard full-directory-p)
5192 (insert (format "%s: No such file or directory\n" file))))
5254 (default-directory
5255 (if (eq operation 'insert-directory)
5256 (directory-file-name
5258 (unhandled-file-name-directory default-directory)))
5259 default-directory))
5268 (file-name-directory . nil)
5269 (file-name-as-directory . nil)
5270 (directory-file-name . nil)
5336 (define-key ctl-x-map "\C-d" 'list-directory)