summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el3
1 files changed, 3 insertions, 0 deletions
diff --git a/lisp/files.el b/lisp/files.el
index dc07a02473a..3782a794727 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1550,6 +1550,9 @@ This function is meant for the user to run interactively.
Don't call it from programs! Use `insert-file-contents' instead.
\(Its calling sequence is different; see its documentation)."
(interactive "fInsert file: ")
+ (if (file-directory-p filename)
+ (signal 'file-error (list "Opening input file" "file is a directory"
+ filename)))
(let ((tem (insert-file-contents filename)))
(push-mark (+ (point) (car (cdr tem))))))