to derive a new remote file name from an existing one. For
example, if FILE is \"/sudo::/path/to/file\" then
- \(concat \(file-remote-p FILE) \"/bin/sh\")
+ (concat (file-remote-p FILE) \"/bin/sh\")
returns a remote file name for file \"/bin/sh\" that has the
same remote identifier as FILE but expanded; a name such as
(user-error "Aborted"))
(and (buffer-modified-p) buffer-file-name
(not (yes-or-no-p
- (format "Kill and replace buffer `%s' without saving it? "
- (buffer-name))))
+ (format-message "Kill and replace buffer `%s' without saving it? "
+ (buffer-name))))
(user-error "Aborted"))
(let ((obuf (current-buffer))
(ofile buffer-file-name)
"Alist mapping interpreter names to major modes.
This is used for files whose first lines match `auto-mode-interpreter-regexp'.
Each element looks like (REGEXP . MODE).
-If \\\\`REGEXP\\\\' matches the name (minus any directory part) of
+If REGEXP matches the entire name (minus any directory part) of
the interpreter specified in the first line of a script, enable
major mode MODE.
(setq hack-local-variables--warned-lexical t)
(display-warning
:warning
- (format "%s: `lexical-binding' at end of file unreliable"
- (file-name-nondirectory
- (or buffer-file-name ""))))))
+ (format-message
+ "%s: `lexical-binding' at end of file unreliable"
+ (file-name-nondirectory
+ (or buffer-file-name ""))))))
(t
(ignore-errors
(push (cons (if (eq var 'eval)
(since (nth 2 o)))
(message "%s is obsolete%s; %s"
var (if since (format " (since %s)" since))
- (if (stringp instead) instead
- (format "use `%s' instead" instead)))))))
+ (if (stringp instead)
+ (substitute-command-keys instead)
+ (format-message "use `%s' instead" instead)))))))
(defun hack-one-local-variable (var val)
"Set local variable VAR with value VAL.
However, the mode will not be changed if
\(1) a local variables list or the `-*-' line specifies a major mode, or
\(2) the current major mode is a \"special\" mode,
-\ not suitable for ordinary files, or
+ not suitable for ordinary files, or
\(3) the new file name does not particularly specify any mode."
:type 'boolean
:group 'editing-basics)
(not (and (eq (framep-on-display) 'ns)
(listp last-nonmenu-event)
use-dialog-box))
- (or (y-or-n-p (format "File `%s' exists; overwrite? " filename))
+ (or (y-or-n-p (format-message
+ "File `%s' exists; overwrite? " filename))
(user-error "Canceled")))
(set-visited-file-name filename (not confirm))))
(set-buffer-modified-p t)
"Set extended attributes of file FILENAME to ATTRIBUTES.
ATTRIBUTES must be an alist of file attributes as returned by
-`file-extended-attributes'."
- (dolist (elt attributes)
- (let ((attr (car elt))
- (val (cdr elt)))
- (cond ((eq attr 'acl)
- (set-file-acl filename val))
- ((eq attr 'selinux-context)
- (set-file-selinux-context filename val))))))
+`file-extended-attributes'.
+Value is t if the function succeeds in setting the attributes."
+ (let (result rv)
+ (dolist (elt attributes)
+ (let ((attr (car elt))
+ (val (cdr elt)))
+ (cond ((eq attr 'acl)
+ (setq rv (set-file-acl filename val)))
+ ((eq attr 'selinux-context)
+ (setq rv (set-file-selinux-context filename val))))
+ (setq result (or result rv))))
+
+ result))
\f
(defun backup-buffer ()
"Make a backup of the disk file visited by the current buffer, if appropriate.
;; Signal an error if the user specified the name of an
;; existing directory.
(error "%s is a directory" filename)
- (unless (y-or-n-p (format "File `%s' exists; overwrite? "
- filename))
+ (unless (y-or-n-p (format-message
+ "File `%s' exists; overwrite? "
+ filename))
(error "Canceled"))))
(set-visited-file-name filename)))
(or (verify-visited-file-modtime (current-buffer))
(expand-file-name buffer-file-name))))
(unless (file-exists-p dir)
(if (y-or-n-p
- (format "Directory `%s' does not exist; create? " dir))
+ (format-message
+ "Directory `%s' does not exist; create? " dir))
(make-directory dir t)
(error "Canceled")))
(setq setmodes (basic-save-buffer-1))))
(list dir
(if (directory-files dir nil directory-files-no-dot-files-regexp)
(y-or-n-p
- (format "Directory `%s' is not empty, really %s? "
- dir (if trashing "trash" "delete")))
+ (format-message "Directory `%s' is not empty, really %s? "
+ dir (if trashing "trash" "delete")))
nil)
(null current-prefix-arg))))
;; If default-directory is a remote directory, make sure we find its
Non-file buffers need a custom function"
(and buffer-file-name
(file-readable-p buffer-file-name)
+ (not (buffer-modified-p (current-buffer)))
(not (verify-visited-file-modtime (current-buffer)))))
(defvar buffer-stale-function #'buffer-stale--default-function