From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#5669: 23.1.50; auto-revert and image mode doesnt cooperate Date: Tue, 02 Mar 2010 23:21:36 +0200 Organization: JURTA Message-ID: <87ljeabjdf.fsf@mail.jurta.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1267568632 29816 80.91.229.12 (2 Mar 2010 22:23:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 2 Mar 2010 22:23:52 +0000 (UTC) Cc: 5669@debbugs.gnu.org To: joakim@verona.se Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 02 23:23:46 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NmaV6-0003TR-5n for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Mar 2010 23:23:43 +0100 Original-Received: from localhost ([127.0.0.1]:39319 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmaV3-0005L6-B6 for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Mar 2010 17:23:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nma2t-0007t5-0i for bug-gnu-emacs@gnu.org; Tue, 02 Mar 2010 16:54:27 -0500 Original-Received: from [140.186.70.92] (port=45791 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nma2h-0007ng-VH for bug-gnu-emacs@gnu.org; Tue, 02 Mar 2010 16:54:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nma2W-0007Ki-Co for bug-gnu-emacs@gnu.org; Tue, 02 Mar 2010 16:54:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34016) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nma2W-0007KZ-B9 for bug-gnu-emacs@gnu.org; Tue, 02 Mar 2010 16:54:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1NmZdK-0001NA-A6; Tue, 02 Mar 2010 16:28:02 -0500 X-Loop: bug-gnu-emacs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 02 Mar 2010 21:28:02 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: followup 5669 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 5669-submit@debbugs.gnu.org id=B5669.12675652785257 (code B ref 5669); Tue, 02 Mar 2010 21:28:02 +0000 Original-Received: (at 5669) by debbugs.gnu.org; 2 Mar 2010 21:27:58 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NmZdG-0001Mg-17 for submit@debbugs.gnu.org; Tue, 02 Mar 2010 16:27:58 -0500 Original-Received: from smtp-out3.starman.ee ([85.253.0.5] helo=mx1.starman.ee) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NmZd2-0001MA-HY for 5669@debbugs.gnu.org; Tue, 02 Mar 2010 16:27:56 -0500 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Original-Received: from mail.starman.ee (62.65.209.49.cable.starman.ee [62.65.209.49]) by mx1.starman.ee (Postfix) with ESMTP id 0AF0E3F4127; Tue, 2 Mar 2010 23:27:33 +0200 (EET) In-Reply-To: (joakim@verona.se's message of "Tue, 02 Mar 2010 00:48:22 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.93 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 02 Mar 2010 16:28:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:35388 Archived-At: > 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))) + ;;; Support for bookmark.el (declare-function bookmark-make-record-default "bookmark" -- Juri Linkov http://www.jurta.org/emacs/