From 837daa0d4170134e8b94735ff757a33f235c6c8d Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 21 Mar 2005 17:42:36 +0000 Subject: [PATCH] Handle .xpm files too. (image-toggle-display): Preserve modification flag. --- lisp/image-mode.el | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lisp/image-mode.el b/lisp/image-mode.el index b5b0f7731dc..0d2b221ee8b 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -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 @@ and showing the image as an image." (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 @@ and showing the image as an image." ;; 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) -- 2.39.2