From: Juri Linkov <juri@jurta.org>
To: joakim@verona.se
Cc: 5669@debbugs.gnu.org
Subject: bug#5669: 23.1.50; auto-revert and image mode doesnt cooperate
Date: Tue, 02 Mar 2010 23:21:36 +0200 [thread overview]
Message-ID: <87ljeabjdf.fsf@mail.jurta.org> (raw)
In-Reply-To: <m3aaurtxh5.fsf@verona.se> (joakim@verona.se's message of "Tue, 02 Mar 2010 00:48:22 +0100")
> It seems auto-revert mode and image mode doesnt cooperate, at least for
> me.
>
> To reproduce:
> - create a jpeg image with gimp or something
> - open the same image with emacs
> - enable auto-revert for the image
> - save a changed image with gimp
>
> the buffer shows corruption, the images textual and visual
> representation is mixed.
The patch below should fix this. As you can see, it has to call
`(clear-image-cache)' to update the display. It seems `image-refresh'
in `image-toggle-display-image' is supposed to do this, but doesn't do.
I don't know if `image-refresh' was designed that way or not?
=== modified file 'lisp/image-mode.el'
--- lisp/image-mode.el 2010-02-09 19:22:31 +0000
+++ lisp/image-mode.el 2010-03-02 21:19:38 +0000
@@ -355,6 +355,7 @@ (defun image-mode ()
(image-mode-setup-winprops)
(add-hook 'change-major-mode-hook 'image-toggle-display-text nil t)
+ (add-hook 'after-revert-hook 'image-after-revert-hook nil t)
(run-mode-hooks 'image-mode-hook)
(message "%s" (concat
(substitute-command-keys
@@ -501,6 +502,15 @@ (defun image-toggle-display ()
(if (image-get-display-property)
(image-mode-as-text)
(image-mode)))
+
+(defun image-after-revert-hook ()
+ (when (image-get-display-property)
+ (image-toggle-display-text)
+ ;; FIXME: `image-refresh' in `image-toggle-display-image' currently
+ ;; doesn't update image display. Force this by clearing the image cache.
+ (clear-image-cache)
+ (image-toggle-display-image)))
+
\f
;;; Support for bookmark.el
(declare-function bookmark-make-record-default "bookmark"
--
Juri Linkov
http://www.jurta.org/emacs/
next prev parent reply other threads:[~2010-03-02 21:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-01 23:48 bug#5669: 23.1.50; auto-revert and image mode doesnt cooperate joakim
2010-03-02 21:21 ` Juri Linkov [this message]
2010-05-25 16:06 ` Juri Linkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ljeabjdf.fsf@mail.jurta.org \
--to=juri@jurta.org \
--cc=5669@debbugs.gnu.org \
--cc=joakim@verona.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).