--- /home/mp26/src/emacs/lisp/iimage.el 2009-11-21 12:03:13.000000000 +0100 +++ iimage.el 2010-04-18 23:24:10.000000000 +0200 @@ -109,6 +109,19 @@ (defalias 'iimage-locate-file 'locate-file) +(defun iimage-modification-hook (beg end) + "Remove display property if a display region is modified." + ;;(debug-print "ii1 begin %d, end %d\n" beg end) + (let ((inhibit-modification-hooks t) + (beg (previous-single-property-change end 'display + nil (line-beginning-position))) + (end (next-single-property-change beg 'display + nil (line-end-position)))) + (when (and beg end (plist-get (text-properties-at beg) 'display)) + ;;(debug-print "ii2 begin %d, end %d\n" beg end) + (remove-text-properties beg end + '(display nil modification-hooks nil))))) + (defun iimage-mode-buffer (arg) "Display/undisplay images. With numeric ARG, display the images if and only if ARG is positive." @@ -128,9 +141,12 @@ iimage-mode-image-search-path)))) (if ing (add-text-properties (match-beginning 0) (match-end 0) - (list 'display (create-image file))) - (remove-text-properties (match-beginning 0) (match-end 0) - '(display))))))) + (list 'display (create-image file) + 'modification-hooks + (list 'iimage-modification-hook))) + (remove-list-of-text-properties + (match-beginning 0) (match-end 0) + '(display modification-hooks))))))) (set-buffer-modified-p modp))) ;;;###autoload