emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-capture does not fully clean up after C-c C-k
@ 2011-05-04 12:30 Leo
  2011-06-16  7:51 ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: Leo @ 2011-05-04 12:30 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I have one template as follows

 ("n" "Notes" entry (file "Notes.org") "* %?\n  %i" :prepend t)

Every time I `C-c C-k' to abort the capture, a blank line is inserted at
the front of file Notes.org.

orgmode 2011-04-29 from git on Emacs 23.3.50.

With best wishes,
Leo

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

* Re: org-capture does not fully clean up after C-c C-k
  2011-05-04 12:30 org-capture does not fully clean up after C-c C-k Leo
@ 2011-06-16  7:51 ` Carsten Dominik
  2011-06-16 18:44   ` Jason Dunsmore
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Carsten Dominik @ 2011-06-16  7:51 UTC (permalink / raw)
  To: Leo; +Cc: emacs-orgmode


On 4.5.2011, at 14:30, Leo wrote:

> Hello,
> 
> I have one template as follows
> 
> ("n" "Notes" entry (file "Notes.org") "* %?\n  %i" :prepend t)
> 
> Every time I `C-c C-k' to abort the capture, a blank line is inserted at
> the front of file Notes.org.

Hi Leo,

I am unable to reproduce this.  I do get an empty line the first time,
but when the empty line is already there, then there is no problem.

Do you find the insertion of this one empty line a problem?

- Carsten

> 
> orgmode 2011-04-29 from git on Emacs 23.3.50.
> 
> With best wishes,
> Leo
> 
> 

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

* Re: org-capture does not fully clean up after C-c C-k
  2011-06-16  7:51 ` Carsten Dominik
@ 2011-06-16 18:44   ` Jason Dunsmore
  2011-06-21  7:57     ` Carsten Dominik
  2011-06-18  1:06   ` Leo
  2011-07-11  9:45   ` Leo
  2 siblings, 1 reply; 10+ messages in thread
From: Jason Dunsmore @ 2011-06-16 18:44 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode, Leo

Carsten Dominik <carsten.dominik@gmail.com> writes:

> On 4.5.2011, at 14:30, Leo wrote:
>
>> Hello,
>> 
>> I have one template as follows
>> 
>> ("n" "Notes" entry (file "Notes.org") "* %?\n  %i" :prepend t)
>> 
>> Every time I `C-c C-k' to abort the capture, a blank line is inserted at
>> the front of file Notes.org.
>
> Hi Leo,
>
> I am unable to reproduce this.  I do get an empty line the first time,
> but when the empty line is already there, then there is no problem.
>
> Do you find the insertion of this one empty line a problem?

It's a significant problem for me.  I still use org-remember because 1)
org-capture inserts an extra blank line and 2) canceling a capture
doesn't work for some reason - I get the following message:

"org-capture-finalize: Capture process aborted, but target buffer could not be cleaned up correctly"

Both of these issues cause me to do manual clean up following every
capture.

Please let me know if there are fixes/workarounds for these issues.  I'd
like to finally make the switch to org-capture.

Regards,
Jason

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

* Re: org-capture does not fully clean up after C-c C-k
  2011-06-16  7:51 ` Carsten Dominik
  2011-06-16 18:44   ` Jason Dunsmore
@ 2011-06-18  1:06   ` Leo
  2011-07-11  9:45   ` Leo
  2 siblings, 0 replies; 10+ messages in thread
From: Leo @ 2011-06-18  1:06 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

On 2011-06-16 15:51 +0800, Carsten Dominik wrote:
> Hi Leo,
>
> I am unable to reproduce this.  I do get an empty line the first time,
> but when the empty line is already there, then there is no problem.
>
> Do you find the insertion of this one empty line a problem?
>
> - Carsten

I am running org-mode from git 2011-05-20 and I can still reproduce the
problem. I suspect this might be related to other things in my setup. I
will track it down later on.

Leo

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

* Re: org-capture does not fully clean up after C-c C-k
  2011-06-16 18:44   ` Jason Dunsmore
@ 2011-06-21  7:57     ` Carsten Dominik
  2011-07-22 16:15       ` Jason Dunsmore
  0 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2011-06-21  7:57 UTC (permalink / raw)
  To: Jason Dunsmore; +Cc: emacs-orgmode, Leo

Hi Jason,


On Jun 16, 2011, at 8:44 PM, Jason Dunsmore wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
> 
>> On 4.5.2011, at 14:30, Leo wrote:
>> 
>>> Hello,
>>> 
>>> I have one template as follows
>>> 
>>> ("n" "Notes" entry (file "Notes.org") "* %?\n  %i" :prepend t)
>>> 
>>> Every time I `C-c C-k' to abort the capture, a blank line is inserted at
>>> the front of file Notes.org.
>> 
>> Hi Leo,
>> 
>> I am unable to reproduce this.  I do get an empty line the first time,
>> but when the empty line is already there, then there is no problem.
>> 
>> Do you find the insertion of this one empty line a problem?
> 
> It's a significant problem for me.  I still use org-remember because 1)
> org-capture inserts an extra blank line

Do you also mean at the beginning of the file, or elsewhere?

> and 2) canceling a capture
> doesn't work for some reason - I get the following message:
> 
> "org-capture-finalize: Capture process aborted, but target buffer could not be cleaned up correctly"


can you make a minimal example to demonstrate this issue?
I would like to fix it.

> 
> Both of these issues cause me to do manual clean up following every
> capture.
> 
> Please let me know if there are fixes/workarounds for these issues.  I'd
> like to finally make the switch to org-capture.



> 
> Regards,
> Jason

- Carsten

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

* Re: org-capture does not fully clean up after C-c C-k
  2011-06-16  7:51 ` Carsten Dominik
  2011-06-16 18:44   ` Jason Dunsmore
  2011-06-18  1:06   ` Leo
@ 2011-07-11  9:45   ` Leo
  2011-07-11 23:00     ` Bastien
  2 siblings, 1 reply; 10+ messages in thread
From: Leo @ 2011-07-11  9:45 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

On 2011-06-16 15:51 +0800, Carsten Dominik wrote:
> Hi Leo,
>
> I am unable to reproduce this.  I do get an empty line the first time,
> but when the empty line is already there, then there is no problem.
>
> Do you find the insertion of this one empty line a problem?
>
> - Carsten

Sorry for the long delay. I can reproduce this in Emacs -q with

  (setq org-blank-before-new-entry '((heading)))

Leo

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

* Re: org-capture does not fully clean up after C-c C-k
  2011-07-11  9:45   ` Leo
@ 2011-07-11 23:00     ` Bastien
  2011-07-12  4:26       ` Leo
  0 siblings, 1 reply; 10+ messages in thread
From: Bastien @ 2011-07-11 23:00 UTC (permalink / raw)
  To: Leo; +Cc: emacs-orgmode

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

Hi Leo,

Leo <sdl.web@gmail.com> writes:

> On 2011-06-16 15:51 +0800, Carsten Dominik wrote:
>> Hi Leo,
>>
>> I am unable to reproduce this.  I do get an empty line the first time,
>> but when the empty line is already there, then there is no problem.
>>
>> Do you find the insertion of this one empty line a problem?
>>
>> - Carsten
>
> Sorry for the long delay. I can reproduce this in Emacs -q with
>
>   (setq org-blank-before-new-entry '((heading)))

Please let me know if the attached patch fixes this issue.

Thanks,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-capture.el-Fix-bug-about-insert-blank-line-when-.patch --]
[-- Type: text/x-patch, Size: 2215 bytes --]

From 38334f29f4c949cad76c199433f60250a824878d Mon Sep 17 00:00:00 2001
From: Bastien Guerry <bzg@altern.org>
Date: Tue, 12 Jul 2011 00:57:57 +0200
Subject: [PATCH] org-capture.el: Fix bug about insert blank line when
 aborting.

* org-capture.el (org-capture-finalize): bugfix about
inserted blank line when killing the capture buffer and
`org-blank-before-new-entry' tells to not insert anything
before a heading.

Thanks to Leo for reporting this.
---
 lisp/org-capture.el |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index d547f3d..dd74ecc 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -551,6 +551,9 @@ captured item after finalizing."
 	      (m2 (org-capture-get :end-marker 'local)))
 	  (if (and m1 m2 (= m1 beg) (= m2 end))
 	      (progn
+		(setq m2 (if (cdr (assoc 'heading org-blank-before-new-entry))
+			     m2 (1+ m2))
+		      m2 (if (< (point-max) m2) (point-max) m2))
 		(setq abort-note 'clean)
 		(kill-region m1 m2))
 	    (setq abort-note 'dirty)))
@@ -576,16 +579,14 @@ captured item after finalizing."
 		   (org-at-table-p))
 	  (if (org-table-get-stored-formulas)
 	      (org-table-recalculate 'all) ;; FIXME: Should we iterate???
-	    (org-table-align)))
-	)
+	    (org-table-align))))
       ;; Store this place as the last one where we stored something
       ;; Do the marking in the base buffer, so that it makes sense after
       ;; the indirect buffer has been killed.
       (org-capture-bookmark-last-stored-position)
 
       ;; Run the hook
-      (run-hooks 'org-capture-before-finalize-hook)
-      )
+      (run-hooks 'org-capture-before-finalize-hook))
 
     ;; Kill the indirect buffer
     (save-buffer)
@@ -665,7 +666,8 @@ already gone.  Any prefix argument will be passed to the refile command."
   (interactive)
   ;; FIXME: This does not do the right thing, we need to remove the new stuff
   ;; By hand it is easy: undo, then kill the buffer
-  (let ((org-note-abort t) (org-capture-before-finalize-hook nil))
+  (let ((org-note-abort t) 
+	(org-capture-before-finalize-hook nil))
     (org-capture-finalize)))
 
 (defun org-capture-goto-last-stored ()
-- 
1.7.5.2


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

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

* Re: org-capture does not fully clean up after C-c C-k
  2011-07-11 23:00     ` Bastien
@ 2011-07-12  4:26       ` Leo
  2011-07-12  7:19         ` Bastien
  0 siblings, 1 reply; 10+ messages in thread
From: Leo @ 2011-07-12  4:26 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

On 2011-07-12 07:00 +0800, Bastien wrote:
[snipped 14 lines]
>> Sorry for the long delay. I can reproduce this in Emacs -q with
>>
>>   (setq org-blank-before-new-entry '((heading)))
>
> Please let me know if the attached patch fixes this issue.
>
> Thanks,

Yes, it fixes this issue.

Leo

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

* Re: org-capture does not fully clean up after C-c C-k
  2011-07-12  4:26       ` Leo
@ 2011-07-12  7:19         ` Bastien
  0 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2011-07-12  7:19 UTC (permalink / raw)
  To: Leo; +Cc: emacs-orgmode

Hi Leo,

Leo <sdl.web@gmail.com> writes:

> Yes, it fixes this issue.

I applied the patch, then.

Thanks for confirming,

-- 
 Bastien

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

* Re: org-capture does not fully clean up after C-c C-k
  2011-06-21  7:57     ` Carsten Dominik
@ 2011-07-22 16:15       ` Jason Dunsmore
  0 siblings, 0 replies; 10+ messages in thread
From: Jason Dunsmore @ 2011-07-22 16:15 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Jason Dunsmore, emacs-orgmode, Leo

Carsten Dominik <carsten.dominik@gmail.com> writes:

>>> I am unable to reproduce this.  I do get an empty line the first time,
>>> but when the empty line is already there, then there is no problem.
>>> 
>>> Do you find the insertion of this one empty line a problem?
>> 
>> It's a significant problem for me.  I still use org-remember because 1)
>> org-capture inserts an extra blank line
>
> Do you also mean at the beginning of the file, or elsewhere?
>
>> and 2) canceling a capture
>> doesn't work for some reason - I get the following message:
>> 
>> "org-capture-finalize: Capture process aborted, but target buffer could not be cleaned up correctly"
>
> can you make a minimal example to demonstrate this issue?
> I would like to fix it.

While attempting to make a minimal example of this, I narrowed down the
problem to using ":unnarrowed t" in my org-capture-templates.  Since I
removed it, there is no extra line and the buffer gets cleaned up when I
type C-c C-k.  I've finally made the switch to org-capture.  Thanks!

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

end of thread, other threads:[~2011-07-22 16:15 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04 12:30 org-capture does not fully clean up after C-c C-k Leo
2011-06-16  7:51 ` Carsten Dominik
2011-06-16 18:44   ` Jason Dunsmore
2011-06-21  7:57     ` Carsten Dominik
2011-07-22 16:15       ` Jason Dunsmore
2011-06-18  1:06   ` Leo
2011-07-11  9:45   ` Leo
2011-07-11 23:00     ` Bastien
2011-07-12  4:26       ` Leo
2011-07-12  7:19         ` Bastien

Code repositories for project(s) associated with this 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).