;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994, 1995, 1996,
;; 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-;; 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
;; Maintainer: FSF
A list of elements of the form (FROM . TO), each meaning to replace
FROM with TO when it appears in a directory name. This replacement is
done when setting up the default directory of a newly visited file.
-*Every* FROM string should start with \"\\\\`\".
+
+FROM is matched against directory names anchored at the first
+character, so it should start with a \"\\\\`\", or, if directory
+names cannot have embedded newlines, with a \"^\".
FROM and TO should be equivalent names, which refer to the
same directory. Do not use `~' in the TO strings;
via absolute symbolic links. Make TO the name of the link, and FROM
the name it is linked to."
:type '(repeat (cons :format "%v"
- :value ("" . "")
+ :value ("\\`" . "")
(regexp :tag "From")
- (regexp :tag "To")))
+ (string :tag "To")))
:group 'abbrev
:group 'find-file)
This variable is relevant only if `backup-by-copying' is nil."
:type 'boolean
:group 'backup)
+(put 'backup-by-copying-when-mismatch 'permanent-local t)
(defcustom backup-by-copying-when-privileged-mismatch 200
"Non-nil means create backups by copying to preserve a privileged owner.
("\\.oak\\'" . scheme-mode)
("\\.sgml?\\'" . sgml-mode)
("\\.x[ms]l\\'" . xml-mode)
+ ("\\.dbk\\'" . xml-mode)
("\\.dtd\\'" . sgml-mode)
("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
("\\.js\\'" . js-mode) ; javascript-mode would be better
- ("\\.[ds]?v\\'" . verilog-mode)
+ ("\\.[ds]?vh?\\'" . verilog-mode)
;; .emacs or .gnus or .viper following a directory delimiter in
;; Unix, MSDOG or VMS syntax.
("[]>:/\\]\\..*\\(emacs\\|gnus\\|viper\\)\\'" . emacs-lisp-mode)
(left-margin . integerp) ;; C source code
(no-update-autoloads . booleanp)
(tab-width . integerp) ;; C source code
- (truncate-lines . booleanp))) ;; C source code
+ (truncate-lines . booleanp) ;; C source code
+ (word-wrap . booleanp))) ;; C source code
(put 'c-set-style 'safe-local-eval-function t)
specified. The actual value in the buffer may differ from VALUE,
if it is changed by the major or minor modes, or by the user.")
(make-variable-buffer-local 'file-local-variables-alist)
+(put 'file-local-variables-alist 'permanent-local t)
(defvar dir-local-variables-alist nil
"Alist of directory-local variable settings in the current buffer.
evaluates to a non-nil value with VAL as an argument."
(or (member (cons sym val) safe-local-variable-values)
(let ((safep (get sym 'safe-local-variable)))
- (and (functionp safep) (funcall safep val)))))
+ (and (functionp safep)
+ ;; If the function signals an error, that means it
+ ;; can't assure us that the value is safe.
+ (with-demoted-errors (funcall safep val))))))
(defun risky-local-variable-p (sym &optional ignored)
"Non-nil if SYM could be dangerous as a file-local variable.
(dremote (file-remote-p directory)))
(if ;; Conditions for separate trees
(or
- ;; Test for different drives on DOS/Windows
+ ;; Test for different filesystems on DOS/Windows
(and
;; Should `cygwin' really be included here? --stef
(memq system-type '(ms-dos cygwin windows-nt))
- (not (eq t (compare-strings filename 0 2 directory 0 2))))
+ (or
+ ;; Test for different drive letters
+ (not (eq t (compare-strings filename 0 2 directory 0 2)))
+ ;; Test for UNCs on different servers
+ (not (eq t (compare-strings
+ (progn
+ (if (string-match "\\`//\\([^:/]+\\)/" filename)
+ (match-string 1 filename)
+ ;; Windows file names cannot have ? in
+ ;; them, so use that to detect when
+ ;; neither FILENAME nor DIRECTORY is a
+ ;; UNC.
+ "?"))
+ 0 nil
+ (progn
+ (if (string-match "\\`//\\([^:/]+\\)/" directory)
+ (match-string 1 directory)
+ "?"))
+ 0 nil t)))))
;; Test for different remote file system identification
(not (equal fremote dremote)))
filename
(defconst directory-files-no-dot-files-regexp
"^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"
- "Regexp of file names excluging \".\" an \"..\".")
+ "Regexp matching any file name except \".\" and \"..\".")
(defun delete-directory (directory &optional recursive)
"Delete the directory named DIRECTORY. Does not follow symlinks.
(mapc
(lambda (file)
(let ((target (expand-file-name
- (file-name-nondirectory file) newname)))
- (if (file-directory-p file)
- (copy-directory file target keep-time parents)
- (copy-file file target t keep-time))))
+ (file-name-nondirectory file) newname))
+ (attrs (file-attributes file)))
+ (cond ((file-directory-p file)
+ (copy-directory file target keep-time parents))
+ ((stringp (car attrs)) ; Symbolic link
+ (make-symbolic-link (car attrs) target t))
+ (t
+ (copy-file file target t keep-time)))))
;; We do not want to copy "." and "..".
(directory-files directory 'full directory-files-no-dot-files-regexp))
(dired-unmark 1)
(dired-do-flagged-delete t)
(unwind-protect
- (save-excursion
+ (with-current-buffer buffer
;; Read in the auto-save-list file.
- (set-buffer buffer)
(erase-buffer)
(insert-file-contents file)
;; Loop thru the text of that file