From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dima Kogan Subject: bug#22472: 25.0.50; org-mode: latex fragments can't be un-rendered after a revert Date: Wed, 03 Feb 2016 16:17:25 -0800 Message-ID: <87powd2usq.fsf@secretsauce.net> References: <874mdz9th5.fsf@secretsauce.net> <87oabyuwbf.fsf@free.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR7cd-0004XS-9J for emacs-orgmode@gnu.org; Wed, 03 Feb 2016 19:18:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aR7cY-000739-6r for emacs-orgmode@gnu.org; Wed, 03 Feb 2016 19:18:07 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:49930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aR7cY-000734-2z for emacs-orgmode@gnu.org; Wed, 03 Feb 2016 19:18:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aR7cX-0004aq-O6 for emacs-orgmode@gnu.org; Wed, 03 Feb 2016 19:18:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-reply-to: <87oabyuwbf.fsf@free.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bastien Guerry Cc: 22472@debbugs.gnu.org Hi. Thank you for replying. I just tried with the latest daily snapshot from org-mode.org, and this bug is still valid, although the problem at least becomes recoverable without killing and re-opening the org buffer. Bastien Guerry writes: > Dima Kogan writes: > >> 3. C-c C-x C-l >> >> This renders the latex fragment to show the equation graphically. It >> also tells the user (in the mini-buffer) that C-c C-c will remove the >> rendering, and go back to text > > Latest stable version from Org does not use C-c C-c to remove the > rendering. Indeed C-c C-c no longer does this. There're no instructions in the mini-buffer about how to unrender anymore. C-c C-x C-l is supposed unrender anything that's rendered, and this works. >> 4. M-x revert-buffer >> >> At this point I would expect the render to revert to text, but it >> doesn't. This isn't necessarily a bug. However... > > (Why would reverting the buffer unrender the LaTeX fragment if the > text file hasn't change?) The latest org-mode still keeps the renders on a revert. This is a bug because when a revert happens, emacs does not assume that the file hasn't changed. In fact, it COULD have changed, so keeping the (possibly out-of-date) render up is just wrong. Contrived example: 1. tst.org contains $\sqrt x$ 2. C-c C-x C-l to render it 3. in the shell (outside of emacs): perl -p -i -e s/sqrt/sin/ tst.org 4. M-x revert-buffer Observe that the render stays up, even though the latex the render represents is no longer there >> 5. C-c C-c >> >> Here I ask emacs to un-render the fragment, but it does nothing. If >> #4 isn't a bug, then this is definitely a bug. Right. But I can now use C-c C-x C-l again. Continuing instructions from above 5. C-c C-x C-l One would expect this to unrender the equation, but org thinks that it is not rendered, so it attempts to render it. You get a new render of \sin x 6. C-c C-x C-l This is now an unrender to get back to the new text So a revert puts emacs into an inconsistent state, where the equation is rendered, but the source may or may not be there anymore, and where org doesn't think there's a render there at all.