summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/emacs-lisp/bytecomp.el13
-rw-r--r--lisp/epa-file.el8
-rw-r--r--lisp/ffap.el11
-rw-r--r--lisp/files.el4
-rw-r--r--lisp/gnus/nnmaildir.el3
-rw-r--r--lisp/jka-compr.el9
-rw-r--r--lisp/net/ange-ftp.el16
-rw-r--r--lisp/progmodes/etags.el6
-rw-r--r--lisp/url/url-handlers.el5
9 files changed, 39 insertions, 36 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index c34ec5cae0d..428e21c7a39 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1892,12 +1892,13 @@ The value is non-nil if there were no errors, nil if errors."
(rename-file tempfile target-file t)
(or noninteractive (message "Wrote %s" target-file)))
;; This is just to give a better error message than write-region
- (signal 'file-error
- (list "Opening output file"
- (if (file-exists-p target-file)
- "Cannot overwrite file"
- "Directory not writable or nonexistent")
- target-file)))
+ (let ((exists (file-exists-p target-file)))
+ (signal (if exists 'file-error 'file-missing)
+ (list "Opening output file"
+ (if exists
+ "Cannot overwrite file"
+ "Directory not writable or nonexistent")
+ target-file))))
(kill-buffer (current-buffer)))
(if (and byte-compile-generate-call-tree
(or (eq t byte-compile-generate-call-tree)
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index ee502ef64a3..2303a085909 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -120,7 +120,7 @@ encryption is used."
(let ((error epa-file-error))
(save-window-excursion
(kill-buffer))
- (signal 'file-error
+ (signal (car error)
(cons "Opening input file" (cdr error)))))
(defvar last-coding-system-used)
@@ -161,7 +161,7 @@ encryption is used."
;; signal that as a non-file error
;; so that find-file-noselect-1 won't handle it.
;; Borrowed from jka-compr.el.
- (if (and (eq (car error) 'file-error)
+ (if (and (memq 'file-error (get (car error) 'error-conditions))
(equal (cadr error) "Searching for program"))
(error "Decryption program `%s' not found"
(nth 3 error)))
@@ -175,7 +175,7 @@ encryption is used."
'epa-file--find-file-not-found-function
nil t)
(epa-display-error context))
- (signal 'file-error
+ (signal (car error)
(cons "Opening input file" (cdr error)))))
(set-buffer buf) ;In case timer/filter changed/killed it (bug#16029)!
(setq-local epa-file-encrypt-to
@@ -272,7 +272,7 @@ If no one is selected, symmetric encryption will be performed. "
(epa-display-error context)
(if (setq entry (assoc file epa-file-passphrase-alist))
(setcdr entry nil))
- (signal 'file-error (cons "Opening output file" (cdr error)))))
+ (signal (car error) (cons "Opening output file" (cdr error)))))
(epa-file-run-real-handler
#'write-region
(list string nil file append visit lockname mustbenew))
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 7013e6e8ba4..3d7cebadcf6 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1510,9 +1510,9 @@ and the functions `ffap-file-at-point' and `ffap-url-at-point'."
;; expand-file-name fixes "~/~/.emacs" bug sent by CHUCKR.
(expand-file-name filename)))
;; User does not want to find a non-existent file:
- ((signal 'file-error (list "Opening file buffer"
- "No such file or directory"
- filename)))))))
+ ((signal 'file-missing (list "Opening file buffer"
+ "No such file or directory"
+ filename)))))))
;; Shortcut: allow {M-x ffap} rather than {M-x find-file-at-point}.
;;;###autoload
@@ -1888,7 +1888,10 @@ If `dired-at-point-require-prefix' is set, the prefix meaning is reversed."
(y-or-n-p "Directory does not exist, create it? "))
(make-directory filename)
(funcall ffap-directory-finder filename))
- ((error "No such file or directory `%s'" filename))))))
+ (t
+ (signal 'file-missing (list "Opening directory"
+ "No such file or directory"
+ filename)))))))
(defun dired-at-point-prompter (&optional guess)
;; Does guess and prompt step for find-file-at-point.
diff --git a/lisp/files.el b/lisp/files.el
index 12c6c14d534..8277877dee0 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5342,9 +5342,7 @@ This acts like (apply FN ARGS) except it returns NO-SUCH if it is
non-nil and if FN fails due to a missing file or directory."
(condition-case err
(apply fn args)
- (file-error
- (or (pcase err (`(,_ ,_ "No such file or directory" . ,_) no-such))
- (signal (car err) (cdr err))))))
+ (file-missing (or no-such (signal (car err) (cdr err))))))
(defun delete-directory (directory &optional recursive trash)
"Delete the directory named DIRECTORY. Does not follow symlinks.
diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el
index 21c83751e70..03cb445675c 100644
--- a/lisp/gnus/nnmaildir.el
+++ b/lisp/gnus/nnmaildir.el
@@ -371,8 +371,7 @@ This variable is set by `nnmaildir-request-article'.")
(string= (downcase (caddr err)) "too many links")))
(defun nnmaildir--enoent-p (err)
- (and (eq (car err) 'file-error)
- (string= (downcase (caddr err)) "no such file or directory")))
+ (eq (car err) 'file-missing))
(defun nnmaildir--eexist-p (err)
(eq (car err) 'file-already-exists))
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index a5556743eb3..d8137b10528 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -444,17 +444,18 @@ There should be no more than seven characters after the final `/'."
;; If the file we wanted to uncompress does not exist,
;; handle that according to VISIT as `insert-file-contents'
;; would, maybe signaling the same error it normally would.
- (if (and (eq (car error-code) 'file-error)
+ (if (and (eq (car error-code) 'file-missing)
(eq (nth 3 error-code) local-file))
(if visit
(setq notfound error-code)
- (signal 'file-error
+ (signal 'file-missing
(cons "Opening input file"
(nthcdr 2 error-code))))
;; If the uncompression program can't be found,
;; signal that as a non-file error
;; so that find-file-noselect-1 won't handle it.
- (if (and (eq (car error-code) 'file-error)
+ (if (and (memq 'file-error (get (car error-code)
+ 'error-conditions))
(equal (cadr error-code) "Searching for program"))
(error "Uncompression program `%s' not found"
(nth 3 error-code)))
@@ -487,7 +488,7 @@ There should be no more than seven characters after the final `/'."
(and
visit
notfound
- (signal 'file-error
+ (signal 'file-missing
(cons "Opening input file" (nth 2 notfound))))
;; This is done in insert-file-contents after we return.
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index d5c03e3f4ae..9ff9997e728 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -1533,12 +1533,11 @@ then kill the related FTP process."
(defun ange-ftp-barf-if-not-directory (directory)
(or (file-directory-p directory)
- (signal 'file-error
- (list "Opening directory"
- (if (file-exists-p directory)
- "Not a directory"
- "No such file or directory")
- directory))))
+ (let ((exists (file-exists-p directory)))
+ (signal (if exists 'file-error 'file-missing)
+ (list "Opening directory"
+ (if exists "Not a directory" "No such file or directory")
+ directory)))))
;;;; ------------------------------------------------------------
;;;; FTP process filter support.
@@ -3352,9 +3351,10 @@ system TYPE.")
(setq buffer-file-name filename)))
(setq last-coding-system-used coding-system-used)
(list filename size))
- (signal 'file-error
+ (signal 'file-missing
(list
"Opening input file"
+ "No such file or directory"
filename))))
(ange-ftp-real-insert-file-contents filename visit beg end replace))))
@@ -3663,7 +3663,7 @@ so return the size on the remote host exactly. See RFC 3659."
newname (expand-file-name newname))
(or (file-exists-p filename)
- (signal 'file-error
+ (signal 'file-missing
(list "Copy file" "No such file or directory" filename)))
;; canonicalize newname if a directory.
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index d37ab8a9817..7d4521c148d 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -307,9 +307,9 @@ file the tag was in."
(let ((tags-file-name file))
(save-excursion
(or (visit-tags-table-buffer file)
- (signal 'file-error (list "Visiting tags table"
- "No such file or directory"
- file)))
+ (signal 'file-missing (list "Visiting tags table"
+ "No such file or directory"
+ file)))
;; Set FILE to the expanded name.
(setq file tags-file-name)))
(if local
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index d3be880b382..0fada8d49d7 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -262,11 +262,12 @@ Fifth arg PRESERVE-UID-GID is ignored.
A prefix arg makes KEEP-TIME non-nil."
(if (and (file-exists-p newname)
(not ok-if-already-exists))
- (error "Opening output file: File already exists, %s" newname))
+ (signal 'file-already-exists (list "File exists" newname)))
(let ((buffer (url-retrieve-synchronously url))
(handle nil))
(if (not buffer)
- (error "Opening input file: No such file or directory, %s" url))
+ (signal 'file-missing (list "Opening URL" "No such file or directory"
+ url)))
(with-current-buffer buffer
(setq handle (mm-dissect-buffer t)))
(let ((mm-attachment-file-modes (default-file-modes)))