diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2005-11-01 06:23:08 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2005-11-01 06:23:08 +0000 |
commit | cd0cf71c4f41023a8d9c20b3a26e44b980992b5a (patch) | |
tree | b763cfec551254e2228335be4e218ed7a9a19109 /lisp/files.el | |
parent | c40bb1ba81a5df164f0b9b61e3480c55808717b7 (diff) | |
parent | 895725e10c0fb68ed21abb48183cc8843bcaadf3 (diff) | |
download | emacs-cd0cf71c4f41023a8d9c20b3a26e44b980992b5a.tar.gz emacs-cd0cf71c4f41023a8d9c20b3a26e44b980992b5a.tar.bz2 emacs-cd0cf71c4f41023a8d9c20b3a26e44b980992b5a.zip |
Merged from miles@gnu.org--gnu-2005 (patch 142-148, 615-628)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-615
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-616
Add lisp/mh-e/.arch-inventory
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-617
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-618
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-619
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-620
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-621
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-622
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-623
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-624
Update from CVS: lisp/smerge-mode.el: Add 'tools' to file keywords.
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-625
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-626
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-627
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-628
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-142
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-143
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-144
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-145
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-146
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-147
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-148
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-435
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/lisp/files.el b/lisp/files.el index 0065e45aecf..80f849e6ca2 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -861,6 +861,43 @@ it means chase no more than that many links and then stop." (setq count (1+ count)))) newname)) +(defun make-temp-file (prefix &optional dir-flag suffix) + "Create a temporary file. +The returned file name (created by appending some random characters at the end +of PREFIX, and expanding against `temporary-file-directory' if necessary), +is guaranteed to point to a newly created empty file. +You can then use `write-region' to write new data into the file. + +If DIR-FLAG is non-nil, create a new empty directory instead of a file. + +If SUFFIX is non-nil, add that at the end of the file name." + (let ((umask (default-file-modes)) + file) + (unwind-protect + (progn + ;; Create temp files with strict access rights. It's easy to + ;; loosen them later, whereas it's impossible to close the + ;; time-window of loose permissions otherwise. + (set-default-file-modes ?\700) + (while (condition-case () + (progn + (setq file + (make-temp-name + (expand-file-name prefix temporary-file-directory))) + (if suffix + (setq file (concat file suffix))) + (if dir-flag + (make-directory file) + (write-region "" nil file nil 'silent nil 'excl)) + nil) + (file-already-exists t)) + ;; the file was somehow created by someone else between + ;; `make-temp-name' and `write-region', let's try again. + nil) + file) + ;; Reset the umask. + (set-default-file-modes umask)))) + (defun recode-file-name (file coding new-coding &optional ok-if-already-exists) "Change the encoding of FILE's name from CODING to NEW-CODING. The value is a new name of FILE. @@ -4438,6 +4475,57 @@ program specified by `directory-free-space-program' if that is non-nil." (forward-word -1) (buffer-substring (point) end))))))))) +;; The following expression replaces `dired-move-to-filename-regexp'. +(defvar directory-listing-before-filename-regexp + (let* ((l "\\([A-Za-z]\\|[^\0-\177]\\)") + (l-or-quote "\\([A-Za-z']\\|[^\0-\177]\\)") + ;; In some locales, month abbreviations are as short as 2 letters, + ;; and they can be followed by ".". + ;; In Breton, a month name can include a quote character. + (month (concat l-or-quote l-or-quote "+\\.?")) + (s " ") + (yyyy "[0-9][0-9][0-9][0-9]") + (dd "[ 0-3][0-9]") + (HH:MM "[ 0-2][0-9][:.][0-5][0-9]") + (seconds "[0-6][0-9]\\([.,][0-9]+\\)?") + (zone "[-+][0-2][0-9][0-5][0-9]") + (iso-mm-dd "[01][0-9]-[0-3][0-9]") + (iso-time (concat HH:MM "\\(:" seconds "\\( ?" zone "\\)?\\)?")) + (iso (concat "\\(\\(" yyyy "-\\)?" iso-mm-dd "[ T]" iso-time + "\\|" yyyy "-" iso-mm-dd "\\)")) + (western (concat "\\(" month s "+" dd "\\|" dd "\\.?" s month "\\)" + s "+" + "\\(" HH:MM "\\|" yyyy "\\)")) + (western-comma (concat month s "+" dd "," s "+" yyyy)) + ;; Japanese MS-Windows ls-lisp has one-digit months, and + ;; omits the Kanji characters after month and day-of-month. + ;; On Mac OS X 10.3, the date format in East Asian locales is + ;; day-of-month digits followed by month digits. + (mm "[ 0-1]?[0-9]") + (east-asian + (concat "\\(" mm l "?" s dd l "?" s "+" + "\\|" dd s mm s "+" "\\)" + "\\(" HH:MM "\\|" yyyy l "?" "\\)"))) + ;; The "[0-9]" below requires the previous column to end in a digit. + ;; This avoids recognizing `1 may 1997' as a date in the line: + ;; -r--r--r-- 1 may 1997 1168 Oct 19 16:49 README + + ;; The "[BkKMGTPEZY]?" below supports "ls -alh" output. + ;; The ".*" below finds the last match if there are multiple matches. + ;; This avoids recognizing `jservice 10 1024' as a date in the line: + ;; drwxr-xr-x 3 jservice 10 1024 Jul 2 1997 esg-host + + ;; vc dired listings provide the state or blanks between file + ;; permissions and date. The state is always surrounded by + ;; parantheses: + ;; -rw-r--r-- (modified) 2005-10-22 21:25 files.el + ;; This is not supported yet. + (concat ".*[0-9][BkKMGTPEZY]?" s + "\\(" western "\\|" western-comma "\\|" east-asian "\\|" iso "\\)" + s "+")) + "Regular expression to match up to the file name in a directory listing. +The default value is designed to recognize dates and times +regardless of the language.") (defvar insert-directory-ls-version 'unknown) |