diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2006-07-14 05:56:32 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2006-07-14 05:56:32 +0000 |
commit | 99715bbc447eb633e45ffa23b87284771ce3ac74 (patch) | |
tree | 3a8a53dfe3dbdd9f8e36965e9f043eae522d3c0e /lisp/files.el | |
parent | 556b89447234f15d1784a23dadbfe429464463a8 (diff) | |
parent | 763bb2d43615bc3ae816422f965d76d5e1ae4bdd (diff) | |
download | emacs-99715bbc447eb633e45ffa23b87284771ce3ac74.tar.gz |
Merged from emacs@sv.gnu.org.
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-331
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-332
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-333
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-334
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-335
Add note about "link" button-class to etc/TODO
* emacs@sv.gnu.org/emacs--devo--0--patch-336
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-337
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-338
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-339
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-340
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-341
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-342
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-343
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-344
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-345
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-346
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-347
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-348
Update for ERC 5.1.3.
* emacs@sv.gnu.org/emacs--devo--0--patch-349
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-350
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/gnus--rel--5.10--patch-111
Update from CVS: texi/gnus.texi (Summary Buffer Lines): Fix typo.
* emacs@sv.gnu.org/gnus--rel--5.10--patch-112
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-113
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-114
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-572
Diffstat (limited to 'lisp/files.el')
-rw-r--r-- | lisp/files.el | 130 |
1 files changed, 63 insertions, 67 deletions
diff --git a/lisp/files.el b/lisp/files.el index 8940b687246..315c11de529 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -488,7 +488,7 @@ This variable does not affect the use of major modes specified in a -*- line.") (defcustom enable-local-eval 'maybe - "*Control processing of the \"variable\" `eval' in a file's local variables. + "Control processing of the \"variable\" `eval' in a file's local variables. The value can be t, nil or something else. A value of t means obey `eval' variables; nil means ignore them; anything else means query." @@ -691,7 +691,7 @@ PATH-AND-SUFFIXES is a pair of lists, (DIRECTORIES . SUFFIXES)." (when (file-directory-p dir) (dolist (file (file-name-all-completions (file-name-nondirectory string) dir)) - (push (if string-dir (concat string-dir file) file) names) + (add-to-list 'names (if string-dir (concat string-dir file) file)) (when (string-match suffix file) (setq file (substring file 0 (match-beginning 0))) (push (if string-dir (concat string-dir file) file) names))))) @@ -1192,7 +1192,11 @@ If the current buffer now contains an empty file that you just visited \(presumably by mistake), use this command to visit the file you really want. Interactively, or if WILDCARDS is non-nil in a call from Lisp, -expand wildcards (if any) and replace the file with multiple files." +expand wildcards (if any) and replace the file with multiple files. + +If the current buffer is an indirect buffer, or the base buffer +for one or more indirect buffers, the other buffer(s) are not +killed." (interactive (let ((file buffer-file-name) (file-name nil) @@ -1275,48 +1279,49 @@ Choose the buffer's name using `generate-new-buffer-name'." This also substitutes \"~\" for the user's home directory and removes automounter prefixes (see the variable `automount-dir-prefix')." ;; Get rid of the prefixes added by the automounter. - (if (and automount-dir-prefix - (string-match automount-dir-prefix filename) - (file-exists-p (file-name-directory - (substring filename (1- (match-end 0)))))) - (setq filename (substring filename (1- (match-end 0))))) - (let ((tail directory-abbrev-alist)) - ;; If any elt of directory-abbrev-alist matches this name, - ;; abbreviate accordingly. - (while tail - (if (string-match (car (car tail)) filename) + (save-match-data + (if (and automount-dir-prefix + (string-match automount-dir-prefix filename) + (file-exists-p (file-name-directory + (substring filename (1- (match-end 0)))))) + (setq filename (substring filename (1- (match-end 0))))) + (let ((tail directory-abbrev-alist)) + ;; If any elt of directory-abbrev-alist matches this name, + ;; abbreviate accordingly. + (while tail + (if (string-match (car (car tail)) filename) + (setq filename + (concat (cdr (car tail)) (substring filename (match-end 0))))) + (setq tail (cdr tail))) + ;; Compute and save the abbreviated homedir name. + ;; We defer computing this until the first time it's needed, to + ;; give time for directory-abbrev-alist to be set properly. + ;; We include a slash at the end, to avoid spurious matches + ;; such as `/usr/foobar' when the home dir is `/usr/foo'. + (or abbreviated-home-dir + (setq abbreviated-home-dir + (let ((abbreviated-home-dir "$foo")) + (concat "^" (abbreviate-file-name (expand-file-name "~")) + "\\(/\\|$\\)")))) + + ;; If FILENAME starts with the abbreviated homedir, + ;; make it start with `~' instead. + (if (and (string-match abbreviated-home-dir filename) + ;; If the home dir is just /, don't change it. + (not (and (= (match-end 0) 1) + (= (aref filename 0) ?/))) + ;; MS-DOS root directories can come with a drive letter; + ;; Novell Netware allows drive letters beyond `Z:'. + (not (and (or (eq system-type 'ms-dos) + (eq system-type 'cygwin) + (eq system-type 'windows-nt)) + (save-match-data + (string-match "^[a-zA-`]:/$" filename))))) (setq filename - (concat (cdr (car tail)) (substring filename (match-end 0))))) - (setq tail (cdr tail))) - ;; Compute and save the abbreviated homedir name. - ;; We defer computing this until the first time it's needed, to - ;; give time for directory-abbrev-alist to be set properly. - ;; We include a slash at the end, to avoid spurious matches - ;; such as `/usr/foobar' when the home dir is `/usr/foo'. - (or abbreviated-home-dir - (setq abbreviated-home-dir - (let ((abbreviated-home-dir "$foo")) - (concat "^" (abbreviate-file-name (expand-file-name "~")) - "\\(/\\|$\\)")))) - - ;; If FILENAME starts with the abbreviated homedir, - ;; make it start with `~' instead. - (if (and (string-match abbreviated-home-dir filename) - ;; If the home dir is just /, don't change it. - (not (and (= (match-end 0) 1) - (= (aref filename 0) ?/))) - ;; MS-DOS root directories can come with a drive letter; - ;; Novell Netware allows drive letters beyond `Z:'. - (not (and (or (eq system-type 'ms-dos) - (eq system-type 'cygwin) - (eq system-type 'windows-nt)) - (save-match-data - (string-match "^[a-zA-`]:/$" filename))))) - (setq filename - (concat "~" - (substring filename (match-beginning 1) (match-end 1)) - (substring filename (match-end 0))))) - filename)) + (concat "~" + (match-string 1 filename) + (substring filename (match-end 0))))) + filename))) (defcustom find-file-not-true-dirname-list nil "*List of logical names for which visiting shouldn't save the true dirname. @@ -1627,9 +1632,7 @@ Do you want to revisit the file normally now? ") (not (member logical find-file-not-true-dirname-list))) (setq buffer-file-name buffer-file-truename)) (if find-file-visit-truename - (setq buffer-file-name - (setq filename - (expand-file-name buffer-file-truename)))) + (setq buffer-file-name (expand-file-name buffer-file-truename))) ;; Set buffer's default directory to that of the file. (setq default-directory (file-name-directory buffer-file-name)) ;; Turn off backup files for certain file names. Since @@ -2437,11 +2440,9 @@ n -- to ignore the local variables list.") (insert " "))) (princ (car elt) buf) (insert " : ") - (if (stringp (cdr elt)) - ;; Make strings with embedded whitespace easier to read. - (let ((print-escape-newlines t)) - (prin1 (cdr elt) buf)) - (princ (cdr elt) buf)) + ;; Make strings with embedded whitespace easier to read. + (let ((print-escape-newlines t)) + (prin1 (cdr elt) buf)) (insert "\n")) (setq prompt (format "Please type %s%s: " @@ -2512,9 +2513,7 @@ and VAL is the specified value." ;; There used to be a downcase here, ;; but the manual didn't say so, ;; and people want to set var names that aren't all lc. - (let ((key (intern (buffer-substring - (match-beginning 1) - (match-end 1)))) + (let ((key (intern (match-string 1))) (val (save-restriction (narrow-to-region (point) end) (read (current-buffer))))) @@ -2753,17 +2752,16 @@ It is dangerous if either of these conditions are met: (defun hack-one-local-variable (var val) "Set local variable VAR with value VAL." (cond ((eq var 'mode) - (funcall (intern (concat (downcase (symbol-name val)) - "-mode")))) + (funcall (intern (concat (downcase (symbol-name val)) "-mode")))) ((eq var 'eval) (save-excursion (eval val))) - (t (make-local-variable var) - ;; Make sure the string has no text properties. - ;; Some text properties can get evaluated in various ways, - ;; so it is risky to put them on with a local variable list. - (if (stringp val) - (set-text-properties 0 (length val) nil val)) - (set var val)))) + (t + ;; Make sure the string has no text properties. + ;; Some text properties can get evaluated in various ways, + ;; so it is risky to put them on with a local variable list. + (if (stringp val) + (set-text-properties 0 (length val) nil val)) + (set (make-local-variable var) val)))) (defcustom change-major-mode-with-file-name t @@ -4221,9 +4219,7 @@ This command is used in the special Dired buffer created by (setq autofile (buffer-substring-no-properties (point) - (save-excursion - (end-of-line) - (point)))) + (line-end-position))) (setq thisfile (expand-file-name (substring |