all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
@ 2020-01-01 23:12 Miguel Morin
  2020-01-02 22:46 ` Nicolas Goaziou
  2020-02-05  6:30 ` Bastien
  0 siblings, 2 replies; 14+ messages in thread
From: Miguel Morin @ 2020-01-01 23:12 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

TL;DR: starting a capture item and deleting the new lines at the end of the capture buffer gobbles the next heading, and refiling moves the gobbled heading along with the new capture item.

I asked on emacs.stackexchange and found no solution:

https://emacs.stackexchange.com/questions/53526/org-mode-refiling-gobbles-a-newline-and-absorbs-the-next-heading

In the course of fixing this, I found another bug in using the hook `org-capture-before-finalize-hook`, which adds text at the beginning and end of the org buffer and not in the beggining and end of the capture item.

Full details, copied from the StackExchange thread:

I often have this problem in Org mode: I write an item with org-capture, refile it, and days later I see a result like this:

<pre>
*** TODO some task
some notes** StackExchange
</pre>

I believe that the problem is that org capture inserts the text into the buffer, and if the item does not end with a newline, it gobbles the delimiter to the next heading and both get refiled together.

I already added two newlines to my capture template to minimize this problem. My capture template is:

``` lisp
(setq org-capture-templates
      '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Reminders")
	 "* TODO %?\n\n"))
```

If I try a new item with `C-c c t` and type something, I see it appear in the main buffer. If I delete the newline at the end, the newline is deleted in the buffer too and gobbles the next line. Deleting further characters in the capture buffer does not delete them from the main buffer.

I think I could add a hook such as `(add-hook 'org-capture-before-finalize-hook ...)` but I'm not sure how to include a newline and how to do it before refiling, to avoid the next item being refiled with the captured item.

How can I fix this problem?

**Update**: Following @Aquaactress's suggestions, I tried two methods. Both fail and the versions may be important:

<pre>
Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)
GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109)) of 2019-09-02
</pre>

In the first method, I added `:empty-lines` in the org-capture template:

```lisp
(setq org-capture-before-finalize-hook nil)

(setq org-capture-templates
      '(("t" "Todo" entry (file+headline "~/test.org" "heading 1")
	 "* TODO %?\n" :empty-lines 1)))
```

The result in screenshots is below: I add a capture item, delete newlines from the end of the org-capture buffer, and refile. The heading next to the refiled item is gobbled:

[![Empty lines method, step 1 - create an org-capture item][1]][1]

[![Empty lines method, step 2 - delete lines from end of org-capture buffer][2]][2]

[![Empty lines method, step 3 - refile][3]][3]

In the second method, I added a function that inserts new lines at the beginning and end of the org capture buffer (for exposition, I also add `hello world!` to show that these insertions go at the beginning and end of the whole org buffer, not the org-capture buffer):

```lisp
(setq org-capture-before-finalize-hook nil)

(defun +org|insert-newlines ()
  (beginning-of-buffer) (insert "\nhello world!\n")
  (end-of-buffer) (insert "\nhello world!\n"))

(add-hook 'org-capture-before-finalize-hook #'+org|insert-newlines)

(setq org-capture-templates
      '(("t" "Todo" entry (file+headline "~/test.org" "heading 1")
	 "* TODO %?\n" :empty-lines 1)))
```

The result in screenshots is below: I add a capture item, delete newlines from the end of the org-capture buffer, and refile. The heading next to the refiled item is gobbled and the lines inserted go at the beginning and end of the buffer, instead of the org-capture buffer.

[![Insert lines method, step 1 - add org-capture item][4]][4]

[![Insert lines method, step 2 - delete newlines from end of org-capture buffer][5]][5]

[![Insert lines method, step 3 - refile][6]][6]

  [1]: https://i.stack.imgur.com/6cUlo.png
  [2]: https://i.stack.imgur.com/GPwg8.png
  [3]: https://i.stack.imgur.com/tzAJI.png
  [4]: https://i.stack.imgur.com/xcKva.png
  [5]: https://i.stack.imgur.com/g5sIT.png
  [6]: https://i.stack.imgur.com/D1H8l.png
  [7]: https://i.stack.imgur.com/l6a55.png

------------------------------------------------------------------------



Emacs  : GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109))
 of 2019-09-02
Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)

current state:
==============
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
		     org-src-mode-configure-edit-buffer)
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
		   [add-hook change-major-mode-hook org-show-block-all append
		    local]
		   5]
		 #[0 "\300\301\302\303\304$\207"
		   [add-hook change-major-mode-hook org-babel-show-result-all
		    append local]
		   5]
		 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-bibtex-headline-format-function #[257 "\300\x01\236A\207" [:title] 3 "\n\n(fn ENTRY)"]
 org-babel-pre-tangle-hook '(save-buffer)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
		      org-babel-header-arg-expand)
 org-occur-hook '(org-first-headline-recenter)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
		  org-cycle-show-empty-lines
		  org-optimize-window-after-visibility-change)
 org-speed-command-hook '(org-speed-command-activate
			  org-babel-speed-command-activate)
 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("id" :follow org-id-open)
		       ("rmail" :follow org-rmail-open :store
			org-rmail-store-link)
		       ("mhe" :follow org-mhe-open :store org-mhe-store-link)
		       ("irc" :follow org-irc-visit :store org-irc-store-link)
		       ("info" :follow org-info-open :export org-info-export
			:store org-info-store-link)
		       ("gnus" :follow org-gnus-open :store
			org-gnus-store-link)
		       ("docview" :follow org-docview-open :export
			org-docview-export :store org-docview-store-link)
		       ("bibtex" :follow org-bibtex-open :store
			org-bibtex-store-link)
		       ("bbdb" :follow org-bbdb-open :export org-bbdb-export
			:complete org-bbdb-complete-link :store
			org-bbdb-store-link)
		       ("w3m" :store org-w3m-store-link) ("file+sys")
		       ("file+emacs") ("doi" :follow org--open-doi-link)
		       ("elisp" :follow org--open-elisp-link)
		       ("file" :complete org-file-complete-link)
		       ("ftp" :follow
			(lambda (path) (browse-url (concat "ftp:" path))))
		       ("help" :follow org--open-help-link)
		       ("http" :follow
			(lambda (path) (browse-url (concat "http:" path))))
		       ("https" :follow
			(lambda (path) (browse-url (concat "https:" path))))
		       ("mailto" :follow
			(lambda (path) (browse-url (concat "mailto:" path))))
		       ("news" :follow
			(lambda (path) (browse-url (concat "news:" path))))
		       ("shell" :follow org--open-shell-link))
 )

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

* Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
  2020-01-01 23:12 Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)] Miguel Morin
@ 2020-01-02 22:46 ` Nicolas Goaziou
  2020-01-09  7:54   ` Miguel Morin
  2020-02-05  6:30 ` Bastien
  1 sibling, 1 reply; 14+ messages in thread
From: Nicolas Goaziou @ 2020-01-02 22:46 UTC (permalink / raw)
  To: Miguel Morin; +Cc: emacs-orgmode

Hello,

Miguel Morin <blind.pew@cantab.net> writes:

> TL;DR: starting a capture item and deleting the new lines at the end
> of the capture buffer gobbles the next heading, and refiling moves the
> gobbled heading along with the new capture item.

I'm confused. Your bug title is about refiling, yet, all your message is
about setting up capture in various ways.

Could you update Org (Org 9.3.1 has been released last week) and try
again? Also, could you provide an ECM demonstrating how to reproduce the
issue in a simple way, not necessarily how you tried to work around
it ? :)

Thank you.

Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
  2020-01-02 22:46 ` Nicolas Goaziou
@ 2020-01-09  7:54   ` Miguel Morin
  2020-01-09 16:40     ` Nicolas Goaziou
  2020-02-11 11:38     ` Bastien
  0 siblings, 2 replies; 14+ messages in thread
From: Miguel Morin @ 2020-01-09  7:54 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Hello,

I put "refiling" in the title as that is the moment when things go awry, so I noticed it when I refiled items.

I updated Org to 9.3.1 and confirm that the bug is still present. Because I got some compatibility problems, I tested it with `emacs -q`, in which I didn't have email, and then drafted the email after reverting to the built-in 9.1.9.

Below is the relevant part to reproduce the bug. What do you mean by ECM? Error Correction Mode? Engineering Change Management?

Regards,

Miguel

Start a file at `~/test.org` with:

```
* heading 1

* heading 2
  
* heading 3
```

Set this capture template:

```
(setq org-capture-templates
      '(("t" "Todo" entry (file+headline "~/test.org" "heading 1")
	 "* TODO %?\n")))
```

add a capture item, delete newlines from the end of the org-capture buffer, and refile to "heading 3". The heading next to the refiled item is gobbled and both the org-capture item and the gobbled "heading 2" move to "heading 3".

[![Empty lines method, step 1 - create an org-capture item][1]][1]

[![Empty lines method, step 2 - delete lines from end of org-capture buffer][2]][2]

[![Empty lines method, step 3 - refile][3]][3]

  [1]: https://i.stack.imgur.com/6cUlo.png
  [2]: https://i.stack.imgur.com/GPwg8.png
  [3]: https://i.stack.imgur.com/tzAJI.png


On Thu, 02 Jan 2020 at 22:46 WET, Nicolas Goaziou wrote:

> Hello,
>
> Miguel Morin <blind.pew@cantab.net> writes:
>
>> TL;DR: starting a capture item and deleting the new lines at the end
>> of the capture buffer gobbles the next heading, and refiling moves the
>> gobbled heading along with the new capture item.
>
> I'm confused. Your bug title is about refiling, yet, all your message is
> about setting up capture in various ways.
>
> Could you update Org (Org 9.3.1 has been released last week) and try
> again? Also, could you provide an ECM demonstrating how to reproduce the
> issue in a simple way, not necessarily how you tried to work around
> it ? :)
>
> Thank you.
>
> Regards,

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

* Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
  2020-01-09  7:54   ` Miguel Morin
@ 2020-01-09 16:40     ` Nicolas Goaziou
  2020-01-09 22:11       ` Miguel Morin
  2020-02-11 11:38     ` Bastien
  1 sibling, 1 reply; 14+ messages in thread
From: Nicolas Goaziou @ 2020-01-09 16:40 UTC (permalink / raw)
  To: Miguel Morin; +Cc: emacs-orgmode

Hello,

Miguel Morin <blind.pew@cantab.net> writes:

> I put "refiling" in the title as that is the moment when things go awry, so I noticed it when I refiled items.
>
> I updated Org to 9.3.1 and confirm that the bug is still present. Because I got some compatibility problems, I tested it with `emacs -q`, in which I didn't have email, and then drafted the email after reverting to the built-in 9.1.9.
>
> Below is the relevant part to reproduce the bug. What do you mean by
> ECM? Error Correction Mode? Engineering Change Management?

Complete Minimal Example, using French wording order, which is more or
less what you did provide.

> Start a file at `~/test.org` with:
>
> ```
> * heading 1
>
> * heading 2
>   
> * heading 3
> ```
>
> Set this capture template:
>
> ```
> (setq org-capture-templates
>       '(("t" "Todo" entry (file+headline "~/test.org" "heading 1")
> 	 "* TODO %?\n")))
> ```
>
> add a capture item, delete newlines from the end of the org-capture buffer, and refile to "heading 3". The heading next to the refiled item is gobbled and both the org-capture item and the gobbled "heading 2" move to "heading 3".
>
> [![Empty lines method, step 1 - create an org-capture item][1]][1]
>
> [![Empty lines method, step 2 - delete lines from end of org-capture buffer][2]][2]
>
> [![Empty lines method, step 3 - refile][3]][3]
>
>   [1]: https://i.stack.imgur.com/6cUlo.png
>   [2]: https://i.stack.imgur.com/GPwg8.png
>   [3]: https://i.stack.imgur.com/tzAJI.png

FWIW, I cannot reproduce it with your recipe. Maybe someone else could.

Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
  2020-01-09 16:40     ` Nicolas Goaziou
@ 2020-01-09 22:11       ` Miguel Morin
  2020-01-11 15:58         ` Nicolas Goaziou
  0 siblings, 1 reply; 14+ messages in thread
From: Miguel Morin @ 2020-01-09 22:11 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

It's interesting that you are unable to reproduce the result. I have Emacs 26.3 (9.0) on macOS Mojave 10.14.6. I have reproduced it with `emacs -q`, so the problem is not my init file. Then I don't know what the culprit is and am curious and available to try things to find it.

Miguel


On Thu, 09 Jan 2020 at 16:40 WET, Nicolas Goaziou wrote:

> Hello,
>
> Miguel Morin <blind.pew@cantab.net> writes:
>
>> I put "refiling" in the title as that is the moment when things go awry, so I noticed it when I refiled items.
>>
>> I updated Org to 9.3.1 and confirm that the bug is still present. Because I got some compatibility problems, I tested it with `emacs -q`, in which I didn't have email, and then drafted the email after reverting to the built-in 9.1.9.
>>
>> Below is the relevant part to reproduce the bug. What do you mean by
>> ECM? Error Correction Mode? Engineering Change Management?
>
> Complete Minimal Example, using French wording order, which is more or
> less what you did provide.
>
>> Start a file at `~/test.org` with:
>>
>> ```
>> * heading 1
>>
>> * heading 2
>>   
>> * heading 3
>> ```
>>
>> Set this capture template:
>>
>> ```
>> (setq org-capture-templates
>>       '(("t" "Todo" entry (file+headline "~/test.org" "heading 1")
>> 	 "* TODO %?\n")))
>> ```
>>
>> add a capture item, delete newlines from the end of the org-capture buffer, and refile to "heading 3". The heading next to the refiled item is gobbled and both the org-capture item and the gobbled "heading 2" move to "heading 3".
>>
>> [![Empty lines method, step 1 - create an org-capture item][1]][1]
>>
>> [![Empty lines method, step 2 - delete lines from end of org-capture buffer][2]][2]
>>
>> [![Empty lines method, step 3 - refile][3]][3]
>>
>>   [1]: https://i.stack.imgur.com/6cUlo.png
>>   [2]: https://i.stack.imgur.com/GPwg8.png
>>   [3]: https://i.stack.imgur.com/tzAJI.png
>
> FWIW, I cannot reproduce it with your recipe. Maybe someone else could.
>
> Regards,

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

* Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
  2020-01-09 22:11       ` Miguel Morin
@ 2020-01-11 15:58         ` Nicolas Goaziou
  2020-01-11 20:13           ` Samuel Wales
  2020-01-12  7:55           ` Miguel Morin
  0 siblings, 2 replies; 14+ messages in thread
From: Nicolas Goaziou @ 2020-01-11 15:58 UTC (permalink / raw)
  To: Miguel Morin; +Cc: emacs-orgmode

Hello,

Miguel Morin <blind.pew@cantab.net> writes:

> It's interesting that you are unable to reproduce the result. I have
> Emacs 26.3 (9.0) on macOS Mojave 10.14.6. I have reproduced it with
> `emacs -q`, so the problem is not my init file. Then I don't know what
> the culprit is and am curious and available to try things to find it.

OK. I can reproduce it. Actually, this is a _visual_ problem, the
document is not mangled at all. If you do S-TAB on the document you will
notice that everything is at the right place.

I'm not saying there is no bug, but it is much less bad than I thought.
I have no clue about the reason for this.

Regards,

-- 
Nicolas Goaziou

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

* Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
  2020-01-11 15:58         ` Nicolas Goaziou
@ 2020-01-11 20:13           ` Samuel Wales
  2020-01-12  7:55           ` Miguel Morin
  1 sibling, 0 replies; 14+ messages in thread
From: Samuel Wales @ 2020-01-11 20:13 UTC (permalink / raw)
  To: Miguel Morin, emacs-orgmode

dunno if this is useful but i encounter mangled visibility all the
time.  concatenated headings and ellipsis at top of screen are the two
that i can think of that are most common.  undo-tree might cause the
concatenated headings.


On 1/11/20, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Hello,
>
> Miguel Morin <blind.pew@cantab.net> writes:
>
>> It's interesting that you are unable to reproduce the result. I have
>> Emacs 26.3 (9.0) on macOS Mojave 10.14.6. I have reproduced it with
>> `emacs -q`, so the problem is not my init file. Then I don't know what
>> the culprit is and am curious and available to try things to find it.
>
> OK. I can reproduce it. Actually, this is a _visual_ problem, the
> document is not mangled at all. If you do S-TAB on the document you will
> notice that everything is at the right place.
>
> I'm not saying there is no bug, but it is much less bad than I thought.
> I have no clue about the reason for this.
>
> Regards,
>
> --
> Nicolas Goaziou
>
>


-- 
The Kafka Pandemic

What is misopathy?
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html

The disease DOES progress. MANY people have died from it. And ANYBODY
can get it at any time.

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

* Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
  2020-01-11 15:58         ` Nicolas Goaziou
  2020-01-11 20:13           ` Samuel Wales
@ 2020-01-12  7:55           ` Miguel Morin
  1 sibling, 0 replies; 14+ messages in thread
From: Miguel Morin @ 2020-01-12  7:55 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

Hello,

For me, with my version, it is more than a visual problem. Before refiling, the Org buffer is:

```
* heading 1

** TODO test* heading 2

* heading 3
  
```

and after refiling to `heading 3`, it is:

```
* heading 1

* heading 3


** TODO test* heading 2
  
```

Doing `S-TAB` on the document does not change it in my version.

Regards,

Miguel

On Sat, 11 Jan 2020 at 15:58 WET, Nicolas Goaziou wrote:

> Hello,
>
> Miguel Morin <blind.pew@cantab.net> writes:
>
>> It's interesting that you are unable to reproduce the result. I have
>> Emacs 26.3 (9.0) on macOS Mojave 10.14.6. I have reproduced it with
>> `emacs -q`, so the problem is not my init file. Then I don't know what
>> the culprit is and am curious and available to try things to find it.
>
> OK. I can reproduce it. Actually, this is a _visual_ problem, the
> document is not mangled at all. If you do S-TAB on the document you will
> notice that everything is at the right place.
>
> I'm not saying there is no bug, but it is much less bad than I thought.
> I have no clue about the reason for this.
>
> Regards,

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

* Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
  2020-01-01 23:12 Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)] Miguel Morin
  2020-01-02 22:46 ` Nicolas Goaziou
@ 2020-02-05  6:30 ` Bastien
  2020-02-11 15:34   ` Miguel Morin
  1 sibling, 1 reply; 14+ messages in thread
From: Bastien @ 2020-02-05  6:30 UTC (permalink / raw)
  To: Miguel Morin; +Cc: emacs-orgmode

Hi Miguel,

I made a change in Org maint branch that could somehow impact the
issue you reported.  Can you test and see if it does?

Morin <blind.pew@cantab.net> writes:

> In the course of fixing this, I found another bug in using the hook
> `org-capture-before-finalize-hook`, which adds text at the beginning
> and end of the org buffer and not in the beggining and end of the
> capture item.

If this is really another bug, please fill a different bug report for
it, it helps us track all issues separately.

Thanks,

-- 
 Bastien

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

* Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
  2020-01-09  7:54   ` Miguel Morin
  2020-01-09 16:40     ` Nicolas Goaziou
@ 2020-02-11 11:38     ` Bastien
  2020-02-14 22:22       ` Miguel Morin
  1 sibling, 1 reply; 14+ messages in thread
From: Bastien @ 2020-02-11 11:38 UTC (permalink / raw)
  To: Miguel Morin; +Cc: emacs-orgmode, Nicolas Goaziou

Hi Miguel,

Miguel Morin <blind.pew@cantab.net> writes:

> delete newlines from the end of the org-capture buffer

I can reproduce your problem when I do delete newlines
from the end of the capture buffer, but I don't see why
I would delete newlines.

Is this just some casual cleanup on your side or do you
have a compelling reason for deleting those lines?

-- 
 Bastien

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

* Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
  2020-02-05  6:30 ` Bastien
@ 2020-02-11 15:34   ` Miguel Morin
  2020-02-11 16:44     ` Bastien
  0 siblings, 1 reply; 14+ messages in thread
From: Miguel Morin @ 2020-02-11 15:34 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Hi Bastien,

Yes, it works! I appreciate your work, thank you very much.

I tested the code with the Org 9.3.3 and confirm that the first issue I reported is fixed: now when I run `org-capture` and delete lines at the end of the org-capture buffer I cannot delete the newline that in the org buffer separates the capture item from the next heading.

The other issue I reported is still there, i.e. running this code:

```
(defun +org|insert-newlines ()
  (beginning-of-buffer) (insert "\nhello world!\n")
  (end-of-buffer) (insert "\nhello world!\n"))
+org|insert-newlines


(add-hook 'org-capture-before-finalize-hook #'+org|insert-newlines)
(+org|insert-newlines)
```

will insert "hello world!" at the beginning and end of the org buffer and not the org-capture buffer. I'm not sure if this is intended, and I never use this feature anyway. So I'm happy to close this matter here.

Miguel


On Wed, 05 Feb 2020 at 06:30 WET, Bastien wrote:

> Hi Miguel,
>
> I made a change in Org maint branch that could somehow impact the
> issue you reported.  Can you test and see if it does?
>
> Morin <blind.pew@cantab.net> writes:
>
>> In the course of fixing this, I found another bug in using the hook
>> `org-capture-before-finalize-hook`, which adds text at the beginning
>> and end of the org buffer and not in the beggining and end of the
>> capture item.
>
> If this is really another bug, please fill a different bug report for
> it, it helps us track all issues separately.
>
> Thanks,

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

* Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
  2020-02-11 15:34   ` Miguel Morin
@ 2020-02-11 16:44     ` Bastien
  0 siblings, 0 replies; 14+ messages in thread
From: Bastien @ 2020-02-11 16:44 UTC (permalink / raw)
  To: Miguel Morin; +Cc: emacs-orgmode

Hi Miguel,

Miguel Morin <blind.pew@cantab.net> writes:

> will insert "hello world!" at the beginning and end of the org buffer
> and not the org-capture buffer. I'm not sure if this is intended, and
> I never use this feature anyway. So I'm happy to close this matter
> here.

Okay, thanks for confirming the main issue is gone.

-- 
 Bastien

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

* Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
  2020-02-11 11:38     ` Bastien
@ 2020-02-14 22:22       ` Miguel Morin
  2020-02-16 10:32         ` Bastien
  0 siblings, 1 reply; 14+ messages in thread
From: Miguel Morin @ 2020-02-14 22:22 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Nicolas Goaziou

I have no compelling reason to delete those lines, it just sometimes happens that I do delete when I do a quick capture, and then they wreak havoc in my main org buffer. No longer, thanks to you!

Miguel


On Tue, 11 Feb 2020 at 11:38 WET, Bastien wrote:

> Hi Miguel,
>
> Miguel Morin <blind.pew@cantab.net> writes:
>
>> delete newlines from the end of the org-capture buffer
>
> I can reproduce your problem when I do delete newlines
> from the end of the capture buffer, but I don't see why
> I would delete newlines.
>
> Is this just some casual cleanup on your side or do you
> have a compelling reason for deleting those lines?

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

* Re: Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]
  2020-02-14 22:22       ` Miguel Morin
@ 2020-02-16 10:32         ` Bastien
  0 siblings, 0 replies; 14+ messages in thread
From: Bastien @ 2020-02-16 10:32 UTC (permalink / raw)
  To: Miguel Morin; +Cc: emacs-orgmode, Nicolas Goaziou

Hi Miguel,

Miguel Morin <blind.pew@cantab.net> writes:

> I have no compelling reason to delete those lines, it just sometimes
> happens that I do delete when I do a quick capture, and then they
> wreak havoc in my main org buffer. No longer, thanks to you!

Glad the change can still whatever habits you have.

Best,

-- 
 Bastien

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

end of thread, other threads:[~2020-02-16 10:32 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-01 23:12 Bug: refiling gobbles a newline and absorbs the next heading [9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)] Miguel Morin
2020-01-02 22:46 ` Nicolas Goaziou
2020-01-09  7:54   ` Miguel Morin
2020-01-09 16:40     ` Nicolas Goaziou
2020-01-09 22:11       ` Miguel Morin
2020-01-11 15:58         ` Nicolas Goaziou
2020-01-11 20:13           ` Samuel Wales
2020-01-12  7:55           ` Miguel Morin
2020-02-11 11:38     ` Bastien
2020-02-14 22:22       ` Miguel Morin
2020-02-16 10:32         ` Bastien
2020-02-05  6:30 ` Bastien
2020-02-11 15:34   ` Miguel Morin
2020-02-11 16:44     ` Bastien

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.