summaryrefslogtreecommitdiff
path: root/lisp/image-file.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2001-02-02 13:11:39 +0000
committerMiles Bader <miles@gnu.org>2001-02-02 13:11:39 +0000
commit33155ffbf64fea0a2e1d32e6d820b1cbc69a647e (patch)
treedc5dddb245328e0cbee8a8f9ba4c271efd9f06cd /lisp/image-file.el
parent1b66ab0e17a5dbb860545b9b13c4008a1ce5222b (diff)
downloademacs-33155ffbf64fea0a2e1d32e6d820b1cbc69a647e.tar.gz
(insert-image-file): When visiting an image, suppress the cursor in the
image buffer.
Diffstat (limited to 'lisp/image-file.el')
-rw-r--r--lisp/image-file.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/image-file.el b/lisp/image-file.el
index 87314f3b90c..afee88d1346 100644
--- a/lisp/image-file.el
+++ b/lisp/image-file.el
@@ -110,6 +110,7 @@ the command `insert-file-contents'."
(when (and (or (null beg) (zerop beg)) (null end))
(let* ((ibeg (point))
(iend (+ (point) (cadr rval)))
+ (visitingp (and visit (= ibeg (point-min)) (= iend (point-max))))
(data
(string-make-unibyte
(buffer-substring-no-properties ibeg iend)))
@@ -122,11 +123,13 @@ the command `insert-file-contents'."
;; This a cheap attempt to make the whole buffer
;; read-only when we're visiting the file (as
;; opposed to just inserting it).
- ,@(and visit
- (= ibeg (point-min))
- (= iend (point-max))
+ ,@(and visitingp
'(read-only t front-sticky (read-only))))))
- (add-text-properties ibeg iend props)))
+ (add-text-properties ibeg iend props)
+ (when visitingp
+ ;; Inhibit the cursor when the buffer contains only an image,
+ ;; because cursors look very strange on top of images.
+ (setq cursor-type nil))))
rval))
(defun image-file-handler (operation &rest args)