unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* BUG: Emacs crashes due to org-mode parameter org-indent-mode
@ 2011-12-22 23:04 Gustav Wikström
  2011-12-23  8:23 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Gustav Wikström @ 2011-12-22 23:04 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1121 bytes --]

Hello dear Emacs developers!

I recently stumbled upon an org-mode related bug when upgrading to Emacs 24
on windows (Emacs-24.0.92).

The problem occurs when org-indent-mode is on in indirect buffers in an
org-mode file (after using the command "org-tree-to-indirect-buffer" (C-c
C-x b) on a headline with some sub-information) and org-cycle (tab) is done
on the first line. This breaks my emacs. I've reasoned out that emacs
crashes on the call to the c-function "overlay-put" when executing
org-cycle. I however don't have and debug-trace.. sorry for that.

The problem should be reproducible with the following:

- Start emacs without any initial settings (runemacs.exe -q)
- Open an org-mode file
- M-x org-indent-mode
- C-c C-x b on a heading in the file
- tab

My temporary fix for this is to not use org-indent-mode... Then everything
(almost ) works as intended. I would however be happy if I could start
using org-indent-mode again!

This is also posted on the org-mode list but due to the relation to
emacs-c-functions the question is moved to this forum.

Regards
Gustav Wikström

[-- Attachment #2: Type: text/html, Size: 1345 bytes --]

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

* Re: BUG: Emacs crashes due to org-mode parameter org-indent-mode
  2011-12-22 23:04 BUG: Emacs crashes due to org-mode parameter org-indent-mode Gustav Wikström
@ 2011-12-23  8:23 ` Eli Zaretskii
  2011-12-23  8:37   ` Gustav Wikström
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2011-12-23  8:23 UTC (permalink / raw)
  To: Gustav Wikström; +Cc: emacs-devel

> Date: Fri, 23 Dec 2011 00:04:17 +0100
> From: Gustav Wikström <gustav.erik@gmail.com>
> 
> The problem occurs when org-indent-mode is on in indirect buffers in an
> org-mode file (after using the command "org-tree-to-indirect-buffer" (C-c
> C-x b) on a headline with some sub-information) and org-cycle (tab) is done
> on the first line. This breaks my emacs. I've reasoned out that emacs
> crashes on the call to the c-function "overlay-put" when executing
> org-cycle. I however don't have and debug-trace.. sorry for that.
> 
> The problem should be reproducible with the following:
> 
> - Start emacs without any initial settings (runemacs.exe -q)
> - Open an org-mode file
> - M-x org-indent-mode
> - C-c C-x b on a heading in the file
> - tab

I tried this recipe on MS-Windows, both with Emacs 24.0.92 and with
the current trunk, with some random Org file I have, and I cannot
reproduce the crash.  In particular, TAB does what I expect: cycles
the tree display.

Could you please post a short Org file where you get the crash?  Also,
please make sure that the above is the _exact_ series of steps needed
to reproduce the crash.  Finally, please post all that to
bug-gnu-emacs@gnu.org (using "M-x report-emacs-bug RET", if possible),
so that the Emacs bug tracker files this as a bug report.

Thanks.




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

* Re: BUG: Emacs crashes due to org-mode parameter org-indent-mode
  2011-12-23  8:23 ` Eli Zaretskii
@ 2011-12-23  8:37   ` Gustav Wikström
  2011-12-23 10:22     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Gustav Wikström @ 2011-12-23  8:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1656 bytes --]

Missed one step in the reproduce-description, see now.

It is corrected below, do you still want me to resend the bug?

2011/12/23 Eli Zaretskii <eliz@gnu.org>

> > Date: Fri, 23 Dec 2011 00:04:17 +0100
> > From: Gustav Wikström <gustav.erik@gmail.com>
> >
> > The problem occurs when org-indent-mode is on in indirect buffers in an
> > org-mode file (after using the command "org-tree-to-indirect-buffer" (C-c
> > C-x b) on a headline with some sub-information) and org-cycle (tab) is
> done
> > on the first line. This breaks my emacs. I've reasoned out that emacs
> > crashes on the call to the c-function "overlay-put" when executing
> > org-cycle. I however don't have and debug-trace.. sorry for that.
> >
> > The problem should be reproducible with the following:
> >
> > - Start emacs without any initial settings (runemacs.exe -q)
> > - Open an org-mode file
> > - M-x org-indent-mode
> > - C-c C-x b on a heading in the file
>

- C-x 0 (close the direct buffer to make the indirect buffer the default
one)


> > - tab
>
> I tried this recipe on MS-Windows, both with Emacs 24.0.92 and with
> the current trunk, with some random Org file I have, and I cannot
> reproduce the crash.  In particular, TAB does what I expect: cycles
> the tree display.
>
> Could you please post a short Org file where you get the crash?  Also,
> please make sure that the above is the _exact_ series of steps needed
> to reproduce the crash.  Finally, please post all that to
> bug-gnu-emacs@gnu.org (using "M-x report-emacs-bug RET", if possible),
> so that the Emacs bug tracker files this as a bug report.
>
> Thanks.
>

[-- Attachment #2: Type: text/html, Size: 2324 bytes --]

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

* Re: BUG: Emacs crashes due to org-mode parameter org-indent-mode
  2011-12-23  8:37   ` Gustav Wikström
@ 2011-12-23 10:22     ` Eli Zaretskii
  2011-12-23 12:27       ` Bastien
  2011-12-23 14:57       ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2011-12-23 10:22 UTC (permalink / raw)
  To: Gustav Wikström; +Cc: emacs-devel

> Date: Fri, 23 Dec 2011 09:37:08 +0100
> From: Gustav Wikström <gustav.erik@gmail.com>
> Cc: emacs-devel@gnu.org
> 
> Missed one step in the reproduce-description, see now.
> [...]
> > > - Start emacs without any initial settings (runemacs.exe -q)
> > > - Open an org-mode file
> > > - M-x org-indent-mode
> > > - C-c C-x b on a heading in the file
> >
> 
> - C-x 0 (close the direct buffer to make the indirect buffer the default
> one)
> 
> 
> > > - tab

OK, now I can reproduce this, thanks.  It's a display-related bug, I
will look into it.

> It is corrected below, do you still want me to resend the bug?

Yes, please send all this information via report-emacs-bug.  We track
all Emacs bugs via the bug tracker.




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

* Re: BUG: Emacs crashes due to org-mode parameter org-indent-mode
  2011-12-23 10:22     ` Eli Zaretskii
@ 2011-12-23 12:27       ` Bastien
  2011-12-23 14:57       ` Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Bastien @ 2011-12-23 12:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Gustav Wikström, emacs-devel

Eli Zaretskii <eliz@gnu.org> writes:

> OK, now I can reproduce this, thanks.  It's a display-related bug, I
> will look into it.

Thanks for taking care of this!

-- 
 Bastien



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

* Re: BUG: Emacs crashes due to org-mode parameter org-indent-mode
  2011-12-23 10:22     ` Eli Zaretskii
  2011-12-23 12:27       ` Bastien
@ 2011-12-23 14:57       ` Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2011-12-23 14:57 UTC (permalink / raw)
  To: gustav.erik; +Cc: emacs-devel

> Date: Fri, 23 Dec 2011 12:22:36 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> > Date: Fri, 23 Dec 2011 09:37:08 +0100
> > From: Gustav Wikström <gustav.erik@gmail.com>
> > Cc: emacs-devel@gnu.org
> > 
> > Missed one step in the reproduce-description, see now.
> > [...]
> > > > - Start emacs without any initial settings (runemacs.exe -q)
> > > > - Open an org-mode file
> > > > - M-x org-indent-mode
> > > > - C-c C-x b on a heading in the file
> > >
> > 
> > - C-x 0 (close the direct buffer to make the indirect buffer the default
> > one)
> > 
> > 
> > > > - tab
> 
> OK, now I can reproduce this, thanks.  It's a display-related bug, I
> will look into it.

Fixed in revision 106726 on the trunk.  If you can build your own
Emacs, the patch is below.

I saw no bug report yet, but when I see it, I will close it with this
information.

Thanks.

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2011-12-10 19:54:45 +0000
+++ src/xdisp.c	2011-12-23 14:51:51 +0000
@@ -4090,10 +4090,11 @@ handle_invisible_prop (struct it *it)
 	  while (invis_p);
 
 	  /* The position newpos is now either ZV or on visible text.  */
-	  if (it->bidi_p && newpos < ZV)
+	  if (it->bidi_p)
 	    {
 	      EMACS_INT bpos = CHAR_TO_BYTE (newpos);
-	      int on_newline = FETCH_BYTE (bpos) == '\n';
+	      int on_newline =
+		bpos == ZV_BYTE || FETCH_BYTE (bpos) == '\n';
 	      int after_newline =
 		newpos <= BEGV || FETCH_BYTE (bpos - 1) == '\n';
 
@@ -4111,16 +4112,16 @@ handle_invisible_prop (struct it *it)
 
 		  SET_TEXT_POS (tpos, newpos, bpos);
 		  reseat_1 (it, tpos, 0);
-		  /* If we reseat on a newline, we need to prep the
+		  /* If we reseat on a newline/ZV, we need to prep the
 		     bidi iterator for advancing to the next character
-		     after the newline, keeping the current paragraph
+		     after the newline/EOB, keeping the current paragraph
 		     direction (so that PRODUCE_GLYPHS does TRT wrt
 		     prepending/appending glyphs to a glyph row).  */
 		  if (on_newline)
 		    {
 		      it->bidi_it.first_elt = 0;
 		      it->bidi_it.paragraph_dir = pdir;
-		      it->bidi_it.ch = '\n';
+		      it->bidi_it.ch = (bpos == ZV_BYTE) ? -1 : '\n';
 		      it->bidi_it.nchars = 1;
 		      it->bidi_it.ch_len = 1;
 		    }





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

end of thread, other threads:[~2011-12-23 14:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-22 23:04 BUG: Emacs crashes due to org-mode parameter org-indent-mode Gustav Wikström
2011-12-23  8:23 ` Eli Zaretskii
2011-12-23  8:37   ` Gustav Wikström
2011-12-23 10:22     ` Eli Zaretskii
2011-12-23 12:27       ` Bastien
2011-12-23 14:57       ` Eli Zaretskii

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).