emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: inline image display not working when org-indent-mode active, follow-up
@ 2010-08-05  2:19 Erik Iverson
  2010-08-05  8:34 ` Martin Pohlack
  0 siblings, 1 reply; 5+ messages in thread
From: Erik Iverson @ 2010-08-05  2:19 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: mp26

Hello,

I am using the latest org pulled from git.

In the past few weeks, I found that the overlays of inline images in my org-mode 
files would flash quickly and then be deleted when using org-indent-mode. This 
also happened when re-running an org-babel source block that generates graphical 
output, even without org-indent-mode turned on. [1]

I believe I've tracked this down to the following patch,

http://www.mail-archive.com/emacs-orgmode@gnu.org/msg25738.html

What I think is happening, is that org-indent-mode (or alternatively, the 
org-babel result insertion process) must be triggering the 
org-display-inline-modification-hook, which deletes the overlay. This 
intuitively makes sense to me in both cases.

I do not know how to fix this unfortunately, but I think this is the correct 
diagnosis.  For now, I've simply removed the function hook from the ov 
modification-hooks, and all seems well.

[1] http://www.mail-archive.com/emacs-orgmode@gnu.org/msg27500.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: inline image display not working when org-indent-mode active, follow-up
  2010-08-05  2:19 Bug: inline image display not working when org-indent-mode active, follow-up Erik Iverson
@ 2010-08-05  8:34 ` Martin Pohlack
  2010-08-05 13:00   ` Erik Iverson
  2010-08-06  4:56   ` Erik Iverson
  0 siblings, 2 replies; 5+ messages in thread
From: Martin Pohlack @ 2010-08-05  8:34 UTC (permalink / raw)
  To: Erik Iverson; +Cc: emacs-orgmode

Hi,

On 05.08.2010 04:19, Erik Iverson wrote:
> Hello,
>
> I am using the latest org pulled from git.
>
> In the past few weeks, I found that the overlays of inline images in my org-mode
> files would flash quickly and then be deleted when using org-indent-mode. This
> also happened when re-running an org-babel source block that generates graphical
> output, even without org-indent-mode turned on. [1]
>
> I believe I've tracked this down to the following patch,
>
> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg25738.html
>
> What I think is happening, is that org-indent-mode (or alternatively, the
> org-babel result insertion process) must be triggering the
> org-display-inline-modification-hook, which deletes the overlay. This
> intuitively makes sense to me in both cases.
>
> I do not know how to fix this unfortunately, but I think this is the correct
> diagnosis.  For now, I've simply removed the function hook from the ov
> modification-hooks, and all seems well.

If a functions want to elide trigger the modification hooks it should
bind: inhibit-modification-hooks.

 From 
http://www.gnu.org/software/emacs/elisp/html_node/Special-Properties.html:

> modification-hooks
>     If a character has the property modification-hooks, then its
>     value should be a list of functions; modifying that character
>     calls all of those functions. Each function receives two
>     arguments: the beginning and end of the part of the buffer being
>     modified. Note that if a particular modification hook function
>     appears on several characters being modified by a single
>     primitive, you can't predict how many times the function will be
>     called.
>
>     If these functions modify the buffer, they should bind
>     inhibit-modification-hooks to t around doing so, to avoid
>     confusing the internal mechanism that calls these hooks.
>
>     Overlays also support the modification-hooks property, but the
>     details are somewhat different (see Overlay Properties).

Could you try to find out the path from where these modifications
occur, insert a relevant bind there, and see if this helps?

HTH,
Martin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: inline image display not working when org-indent-mode active, follow-up
  2010-08-05  8:34 ` Martin Pohlack
@ 2010-08-05 13:00   ` Erik Iverson
  2010-08-06  4:56   ` Erik Iverson
  1 sibling, 0 replies; 5+ messages in thread
From: Erik Iverson @ 2010-08-05 13:00 UTC (permalink / raw)
  To: Martin Pohlack; +Cc: emacs-orgmode

On 08/05/2010 03:34 AM, Martin Pohlack wrote:
> Hi,
>
> On 05.08.2010 04:19, Erik Iverson wrote:
>> Hello,
>>
>> I am using the latest org pulled from git.
>>
>> In the past few weeks, I found that the overlays of inline images in
>> my org-mode
>> files would flash quickly and then be deleted when using
>> org-indent-mode.

<snip>

>
> If a functions want to elide trigger the modification hooks it should
> bind: inhibit-modification-hooks.
>
>  From
> http://www.gnu.org/software/emacs/elisp/html_node/Special-Properties.html:
>
>> modification-hooks
>> If a character has the property modification-hooks, then its
>> value should be a list of functions; modifying that character
>> calls all of those functions. Each function receives two
>> arguments: the beginning and end of the part of the buffer being
>> modified. Note that if a particular modification hook function
>> appears on several characters being modified by a single
>> primitive, you can't predict how many times the function will be
>> called.
>>
>> If these functions modify the buffer, they should bind
>> inhibit-modification-hooks to t around doing so, to avoid
>> confusing the internal mechanism that calls these hooks.
>>
>> Overlays also support the modification-hooks property, but the
>> details are somewhat different (see Overlay Properties).
>
> Could you try to find out the path from where these modifications
> occur, insert a relevant bind there, and see if this helps?

I will try to track this down, yes.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bug: inline image display not working when org-indent-mode active, follow-up
  2010-08-05  8:34 ` Martin Pohlack
  2010-08-05 13:00   ` Erik Iverson
@ 2010-08-06  4:56   ` Erik Iverson
  2010-08-06 10:55     ` Carsten Dominik
  1 sibling, 1 reply; 5+ messages in thread
From: Erik Iverson @ 2010-08-06  4:56 UTC (permalink / raw)
  To: Martin Pohlack; +Cc: emacs-orgmode

On 08/05/2010 03:34 AM, Martin Pohlack wrote:
> Hi,
>
> On 05.08.2010 04:19, Erik Iverson wrote:
>> In the past few weeks, I found that the overlays of inline images in
>> my org-mode
>> files would flash quickly and then be deleted when using
>> org-indent-mode. This
>> also happened when re-running an org-babel source block that generates
>> graphical
>> output, even without org-indent-mode turned on.[1]
>>
>> I believe I've tracked this down to the following patch,
>>
>> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg25738.html

<snip>

> If a functions want to elide trigger the modification hooks it should
> bind: inhibit-modification-hooks.

<snip>

> Could you try to find out the path from where these modifications
> occur, insert a relevant bind there, and see if this helps?

OK, seems like I got it!

Issue 1:

The overlays would disappear when org-indent-mode was turned on.

Solution:

Simply bind inhibit-modification-hooks in org-indent-refresh-section. Do other 
functions in org-indent.el need this?  Possibly, but it seems like this worked 
in my basic testing.

diff --git a/lisp/org-indent.el b/lisp/org-indent.el
index 45865d1..f6b0487 100644
--- a/lisp/org-indent.el
+++ b/lisp/org-indent.el
@@ -251,7 +251,7 @@ Assumes that BEG is at the beginning of a line."
  Point is assumed to be at the beginning of a headline."
    (interactive)
    (when org-indent-mode
-    (let (beg end)
+    (let ((beg end) (inhibit-modification-hooks t))
        (save-excursion
  	(when (ignore-errors (org-back-to-heading))
  	  (setq beg (point))


Issue 2:

The overlays would quickly appear, then disappear when running an org-babel 
source block that generates graphical output, say, in R.

This was actually tracked down to using pabbrev.el [2] in my org buffers.  Ugh. 
Since this isn't org related, there's nothing in org to fix, but on the very 
small chance someone else ever has their inline images disappearing in org-mode, 
and uses pabbrev mode, I fixed it by simply binding inhibit-modification-hooks 
in the let block in pabbrev-mark-add-word.

[2] http://homepages.cs.ncl.ac.uk/phillip.lord/download/emacs/pabbrev.el

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Bug: inline image display not working when org-indent-mode active, follow-up
  2010-08-06  4:56   ` Erik Iverson
@ 2010-08-06 10:55     ` Carsten Dominik
  0 siblings, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2010-08-06 10:55 UTC (permalink / raw)
  To: Erik Iverson; +Cc: Martin Pohlack, emacs-orgmode

Hi Eric, Martin,

thanks for tracking this down!  I fixed the part in org-indent.el, at  
a slightly
different location that Erik's proposal
(in org-indent-add-properties and in org-indent-remove-properties)

Thanks!

- Carsten

On Aug 6, 2010, at 6:56 AM, Erik Iverson wrote:

> On 08/05/2010 03:34 AM, Martin Pohlack wrote:
>> Hi,
>>
>> On 05.08.2010 04:19, Erik Iverson wrote:
>>> In the past few weeks, I found that the overlays of inline images in
>>> my org-mode
>>> files would flash quickly and then be deleted when using
>>> org-indent-mode. This
>>> also happened when re-running an org-babel source block that  
>>> generates
>>> graphical
>>> output, even without org-indent-mode turned on.[1]
>>>
>>> I believe I've tracked this down to the following patch,
>>>
>>> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg25738.html
>
> <snip>
>
>> If a functions want to elide trigger the modification hooks it should
>> bind: inhibit-modification-hooks.
>
> <snip>
>
>> Could you try to find out the path from where these modifications
>> occur, insert a relevant bind there, and see if this helps?
>
> OK, seems like I got it!
>
> Issue 1:
> <
> The overlays would disappear when org-indent-mode was turned on.
>
> Solution:
>
> Simply bind inhibit-modification-hooks in org-indent-refresh- 
> section. Do other functions in org-indent.el need this?  Possibly,  
> but it seems like this worked in my basic testing.
>
> diff --git a/lisp/org-indent.el b/lisp/org-indent.el
> index 45865d1..f6b0487 100644
> --- a/lisp/org-indent.el
> +++ b/lisp/org-indent.el
> @@ -251,7 +251,7 @@ Assumes that BEG is at the beginning of a line."
> Point is assumed to be at the beginning of a headline."
>   (interactive)
>   (when org-indent-mode
> -    (let (beg end)
> +    (let ((beg end) (inhibit-modification-hooks t))
>       (save-excursion
> 	(when (ignore-errors (org-back-to-heading))
> 	  (setq beg (point))
>
>
> Issue 2:
>
> The overlays would quickly appear, then disappear when running an  
> org-babel source block that generates graphical output, say, in R.
>
> This was actually tracked down to using pabbrev.el [2] in my org  
> buffers.  Ugh. Since this isn't org related, there's nothing in org  
> to fix, but on the very small chance someone else ever has their  
> inline images disappearing in org-mode, and uses pabbrev mode, I  
> fixed it by simply binding inhibit-modification-hooks in the let  
> block in pabbrev-mark-add-word.
>
> [2] http://homepages.cs.ncl.ac.uk/phillip.lord/download/emacs/pabbrev.el
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-08-06 10:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-05  2:19 Bug: inline image display not working when org-indent-mode active, follow-up Erik Iverson
2010-08-05  8:34 ` Martin Pohlack
2010-08-05 13:00   ` Erik Iverson
2010-08-06  4:56   ` Erik Iverson
2010-08-06 10:55     ` Carsten Dominik

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).