changeset 60780:391ee1dd9e7a

Handle .xpm files too. (image-toggle-display): Preserve modification flag.
author Richard M. Stallman <rms@gnu.org>
date Mon, 21 Mar 2005 17:42:36 +0000
parents 456199ab7d27
children 4dec7a239cfa
files lisp/image-mode.el
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/image-mode.el	Mon Mar 21 17:41:41 2005 +0000
+++ b/lisp/image-mode.el	Mon Mar 21 17:42:36 2005 +0000
@@ -43,6 +43,7 @@
 ;;;###autoload (push '("\\.tiff\\'" . image-mode) auto-mode-alist)
 ;;;###autoload (push '("\\.tif\\'" . image-mode) auto-mode-alist)
 ;;;###autoload (push '("\\.xbm\\'" . image-mode) auto-mode-alist)
+;;;###autoload (push '("\\.xpm\\'" . image-mode) auto-mode-alist)
 ;;;###autoload (push '("\\.pbm\\'" . image-mode) auto-mode-alist)
 ;;;###autoload (push '("\\.pgm\\'" . image-mode) auto-mode-alist)
 ;;;###autoload (push '("\\.ppm\\'" . image-mode) auto-mode-alist)
@@ -75,10 +76,12 @@
   (interactive)
   (if (get-text-property (point-min) 'display)
       (let ((inhibit-read-only t)
-	    (buffer-undo-list t))
+	    (buffer-undo-list t)
+	    (modified (buffer-modified-p)))
 	(remove-list-of-text-properties (point-min) (point-max)
 					'(display intangible read-nonsticky
 						  read-only front-sticky))
+	(set-buffer-modified-p modified)
 	(kill-local-variable 'cursor-type)
 	(kill-local-variable 'truncate-lines)
 	(message "Repeat this command to go back to displaying the image"))
@@ -97,8 +100,10 @@
 		      ;; read-only when we're visiting the file (as
 		      ;; opposed to just inserting it).
 		      read-only t front-sticky (read-only)))
-	   (buffer-undo-list t))
+	   (buffer-undo-list t)
+	   (modified (buffer-modified-p)))
       (add-text-properties (point-min) (point-max) props)
+      (set-buffer-modified-p modified)
       ;; Inhibit the cursor when the buffer contains only an image,
       ;; because cursors look very strange on top of images.
       (setq cursor-type nil)