changeset 35854:a8fd9112792b

(insert-image-file): When visiting an image, suppress the cursor in the image buffer.
author Miles Bader <miles@gnu.org>
date Fri, 02 Feb 2001 13:09:42 +0000
parents 774df19dd335
children 6b4581bb1cfa
files lisp/image-file.el
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/image-file.el	Fri Feb 02 13:09:26 2001 +0000
+++ b/lisp/image-file.el	Fri Feb 02 13:09:42 2001 +0000
@@ -110,6 +110,7 @@
     (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 @@
 			;; 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)