# HG changeset patch # User Richard M. Stallman # Date 1111426956 0 # Node ID 391ee1dd9e7a45e374abd12b0af0134c1fda4176 # Parent 456199ab7d27d2122f9223b2cf97d88ba7cfbb2a Handle .xpm files too. (image-toggle-display): Preserve modification flag. diff -r 456199ab7d27 -r 391ee1dd9e7a lisp/image-mode.el --- 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)