all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* C-RET errs
@ 2010-03-01 15:09 Leo
  2010-03-01 21:10 ` David Maus
  0 siblings, 1 reply; 6+ messages in thread
From: Leo @ 2010-03-01 15:09 UTC (permalink / raw)
  To: emacs-orgmode

Hello all,

I wonder if there's a cure for this error.

When I hit C-RET in a fresh org-mode buffer but not at the beginning, it
errs with something like this:

"Before first headline at position 2 in buffer *xyz*"

but M-RET does not err at all.

This is tested with org-mode that is part of Emacs 23.1.93.

Best wishes,

Leo

-- 
H A P P Y  H O L I D A Y S!

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

* Re: C-RET errs
  2010-03-01 15:09 C-RET errs Leo
@ 2010-03-01 21:10 ` David Maus
  2010-03-03 16:24   ` Leo
  0 siblings, 1 reply; 6+ messages in thread
From: David Maus @ 2010-03-01 21:10 UTC (permalink / raw)
  To: Leo; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 810 bytes --]

Leo wrote:
>Hello all,

>I wonder if there's a cure for this error.
>
>When I hit C-RET in a fresh org-mode buffer but not at the beginning, it
>errs with something like this:
>
>"Before first headline at position 2 in buffer *xyz*"
>
>but M-RET does not err at all.
>
>This is tested with org-mode that is part of Emacs 23.1.93.

Worked fine with

Org-mode version 6.33x

shipped with

GNU Emacs 23.1.92.1 (i486-pc-linux-gnu, GTK+ Version 2.18.7) of
 2010-02-24 on elegiac, modified by Debian

and can't be reproduced on my side with

Org-mode version 6.34trans (release_6.34c.160.gf000)

on

GNU Emacs 23.1.92.1 (i486-pc-linux-gnu, GTK+ Version 2.18.7) of
 2010-02-24 on elegiac, modified by Debian

HTH
 -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... maus.david@gmail.com

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

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

* Re: C-RET errs
  2010-03-01 21:10 ` David Maus
@ 2010-03-03 16:24   ` Leo
  2010-03-03 16:41     ` patch from master branch attached (was: C-RET errs) Leo
  2010-03-03 16:49     ` C-RET errs Leo
  0 siblings, 2 replies; 6+ messages in thread
From: Leo @ 2010-03-03 16:24 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode

On 2010-03-01 21:10 +0000, David Maus wrote:
> Worked fine with
>
> Org-mode version 6.33x
>
> shipped with
>
> GNU Emacs 23.1.92.1 (i486-pc-linux-gnu, GTK+ Version 2.18.7) of
>  2010-02-24 on elegiac, modified by Debian

Only if debian fixed this bug.

I can reproduce this bug on Gnu/Linux with these steps.

1. git clone --depth 1 git://repo.or.cz/org-mode.git
2. go into the lisp dir and start emacs like this: emacs -q -L .
3. goto the scratch buffer and 'M-x org-mode' and then 'C-RET'

> and can't be reproduced on my side with
>
> Org-mode version 6.34trans (release_6.34c.160.gf000)

That's indeed fixed with the master branch.

> on
>
> GNU Emacs 23.1.92.1 (i486-pc-linux-gnu, GTK+ Version 2.18.7) of
>  2010-02-24 on elegiac, modified by Debian

-- 
H A P P Y  H O L I D A Y S!

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

* patch from master branch attached (was: C-RET errs)
  2010-03-03 16:24   ` Leo
@ 2010-03-03 16:41     ` Leo
  2010-03-03 17:29       ` Carsten Dominik
  2010-03-03 16:49     ` C-RET errs Leo
  1 sibling, 1 reply; 6+ messages in thread
From: Leo @ 2010-03-03 16:41 UTC (permalink / raw)
  To: David Maus, Carsten Dominik; +Cc: emacs-orgmode

> Only if debian fixed this bug.
>
> I can reproduce this bug on Gnu/Linux with these steps.
>
> 1. git clone --depth 1 git://repo.or.cz/org-mode.git
> 2. go into the lisp dir and start emacs like this: emacs -q -L .
> 3. goto the scratch buffer and 'M-x org-mode' and then 'C-RET'

The following patch from the master branch should fix this bug. Carsten,
would you be able to fix it in Emacs upstream? Many thanks. Leo.

--- a/org.el    2010-03-03 16:36:22.000000000 +0000
+++ b/org.el	2010-03-03 16:37:09.000000000 +0000
@@ -5965,21 +5965,26 @@
 	 (save-match-data
 	   (looking-at "[ \t]*$")))))
 
-(defun org-insert-heading (&optional force-heading)
+(defun org-insert-heading (&optional force-heading invisible-ok)
   "Insert a new heading or item with same depth at point.
 If point is in a plain list and FORCE-HEADING is nil, create a new list item.
 If point is at the beginning of a headline, insert a sibling before the
 current headline.  If point is not at the beginning, do not split the line,
-but create the new headline after the current line."
-  (interactive "P")
-  (if (= (buffer-size) 0)
+but create the new headline after the current line.
+When INVISIBLE-OK is set, stop at invisible headlines when going back.
+This is important for non-interactive uses of the command."
+  (interactive "P")
+  (if (or (= (buffer-size) 0)
+	  (and (not (save-excursion (and (ignore-errors (org-back-to-heading invisible-ok))
+					 (org-on-heading-p))))
+	       (not (org-in-item-p))))
       (insert "\n* ")
     (when (or force-heading (not (org-insert-item)))
       (let* ((empty-line-p nil)
 	     (head (save-excursion
 		     (condition-case nil
 			 (progn
-			   (org-back-to-heading)
+			   (org-back-to-heading invisible-ok)
 			   (setq empty-line-p (org-previous-line-empty-p))
 			   (match-string 0))
 		       (error "*"))))

Diff finished.  Wed Mar  3 16:37:49 2010

-- 
H A P P Y  H O L I D A Y S!

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

* Re: C-RET errs
  2010-03-03 16:24   ` Leo
  2010-03-03 16:41     ` patch from master branch attached (was: C-RET errs) Leo
@ 2010-03-03 16:49     ` Leo
  1 sibling, 0 replies; 6+ messages in thread
From: Leo @ 2010-03-03 16:49 UTC (permalink / raw)
  To: emacs-orgmode

On 2010-03-03 16:24 +0000, Leo wrote:
> I can reproduce this bug on Gnu/Linux with these steps.
>
> 1. git clone --depth 1 git://repo.or.cz/org-mode.git

BTW, I wrote too hastily. you should also switch to tag release_6.33f in
order to actually see the bug. Master branch fixed this bug.

> 2. go into the lisp dir and start emacs like this: emacs -q -L .
> 3. goto the scratch buffer and 'M-x org-mode' and then 'C-RET'

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

* Re: patch from master branch attached (was: C-RET errs)
  2010-03-03 16:41     ` patch from master branch attached (was: C-RET errs) Leo
@ 2010-03-03 17:29       ` Carsten Dominik
  0 siblings, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2010-03-03 17:29 UTC (permalink / raw)
  To: Leo; +Cc: emacs-orgmode

Hi Leo,

feel free to fix this in Emacs - I will update Emacs only after the  
next Emacs release - it is too much work for me to make partial fixes.

- Carsten

On Mar 3, 2010, at 5:41 PM, Leo wrote:

>> Only if debian fixed this bug.
>>
>> I can reproduce this bug on Gnu/Linux with these steps.
>>
>> 1. git clone --depth 1 git://repo.or.cz/org-mode.git
>> 2. go into the lisp dir and start emacs like this: emacs -q -L .
>> 3. goto the scratch buffer and 'M-x org-mode' and then 'C-RET'
>
> The following patch from the master branch should fix this bug.  
> Carsten,
> would you be able to fix it in Emacs upstream? Many thanks. Leo.
>
> --- a/org.el    2010-03-03 16:36:22.000000000 +0000
> +++ b/org.el	2010-03-03 16:37:09.000000000 +0000
> @@ -5965,21 +5965,26 @@
> 	 (save-match-data
> 	   (looking-at "[ \t]*$")))))
>
> -(defun org-insert-heading (&optional force-heading)
> +(defun org-insert-heading (&optional force-heading invisible-ok)
>   "Insert a new heading or item with same depth at point.
> If point is in a plain list and FORCE-HEADING is nil, create a new  
> list item.
> If point is at the beginning of a headline, insert a sibling before  
> the
> current headline.  If point is not at the beginning, do not split  
> the line,
> -but create the new headline after the current line."
> -  (interactive "P")
> -  (if (= (buffer-size) 0)
> +but create the new headline after the current line.
> +When INVISIBLE-OK is set, stop at invisible headlines when going  
> back.
> +This is important for non-interactive uses of the command."
> +  (interactive "P")
> +  (if (or (= (buffer-size) 0)
> +	  (and (not (save-excursion (and (ignore-errors (org-back-to- 
> heading invisible-ok))
> +					 (org-on-heading-p))))
> +	       (not (org-in-item-p))))
>       (insert "\n* ")
>     (when (or force-heading (not (org-insert-item)))
>       (let* ((empty-line-p nil)
> 	     (head (save-excursion
> 		     (condition-case nil
> 			 (progn
> -			   (org-back-to-heading)
> +			   (org-back-to-heading invisible-ok)
> 			   (setq empty-line-p (org-previous-line-empty-p))
> 			   (match-string 0))
> 		       (error "*"))))
>
> Diff finished.  Wed Mar  3 16:37:49 2010
>
> -- 
> H A P P Y  H O L I D A Y S!

- Carsten

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

end of thread, other threads:[~2010-03-03 17:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-01 15:09 C-RET errs Leo
2010-03-01 21:10 ` David Maus
2010-03-03 16:24   ` Leo
2010-03-03 16:41     ` patch from master branch attached (was: C-RET errs) Leo
2010-03-03 17:29       ` Carsten Dominik
2010-03-03 16:49     ` C-RET errs Leo

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.