Re: Bug: (bug?) org-id-find-id-in-file doesn't close files after finding id [9.4 (9.4-7-g3eccc5-elpaplus @ ~/spacemacs/elpa/develop/org-plus-contrib-20200921/)]

2020-10-06 Thread Samuel Wales
thank you to both of you from me too.

i have noticed that the same problem occurs for me with refile targets
alist.  putting a file there seems to open the buffer for some reason
and not close it even if it had not been closed.  this might require a
refile or an id lookup or so.

however, it does not require doing anything with that file.

i frequently get org archive files sticking around.  i am guessing
this is due to id lookup.


On 10/6/20, Nicolas Goaziou  wrote:
> Hello,
>
> this nkk  writes:
>
>> when running org-id-find-id-in-file on an id and an unvisited file, the
>> buffer it creates to visit file isn't
>> closed after finding id.
>>
>> ** what should have happened
>> I was expecting it to close the buffer if the
>> file wasn't already visited by another buffer.
>>
>> Is this desired behavior?
>
> It depends. If MARKERP is non-nil, you certainly don't want to close the
> newly created buffer. Otherwise, it could be closed, indeed.
>
> I patched master along these lines. Thank you.
>
> Regards,
> --
> Nicolas Goaziou
>
>


-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html



Re: Bug: (bug?) org-id-find-id-in-file doesn't close files after finding id [9.4 (9.4-7-g3eccc5-elpaplus @ ~/spacemacs/elpa/develop/org-plus-contrib-20200921/)]

2020-10-06 Thread Nicolas Goaziou
Hello,

this nkk  writes:

> when running org-id-find-id-in-file on an id and an unvisited file, the
> buffer it creates to visit file isn't
> closed after finding id.
>
> ** what should have happened
> I was expecting it to close the buffer if the
> file wasn't already visited by another buffer.
>
> Is this desired behavior?

It depends. If MARKERP is non-nil, you certainly don't want to close the
newly created buffer. Otherwise, it could be closed, indeed.

I patched master along these lines. Thank you.

Regards,
-- 
Nicolas Goaziou



Bug: (bug?) org-id-find-id-in-file doesn't close files after finding id [9.4 (9.4-7-g3eccc5-elpaplus @ ~/spacemacs/elpa/develop/org-plus-contrib-20200921/)]

2020-09-24 Thread this nkk


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.

** what happened
when running org-id-find-id-in-file on an id and an unvisited file, the
buffer it creates to visit file isn't
closed after finding id.

** what should have happened
I was expecting it to close the buffer if the
file wasn't already visited by another buffer.

Is this desired behavior?

** background info and possible fix
I stumbled on this while looking at an issue with org-roam at
https://github.com/org-roam/org-roam/issues/1129.

For now a guard clause like the following in the calling function closes the
buffer if need be.

  (let (file-already-open-p return-val)
(setq file-already-open-p (find-buffer-visiting file))
(setq return-val (org-id-find-id-in-file id file markerp))
(unless file-already-open-p (kill-buffer (find-buffer-visiting file)))
(print return-val))

This logic can be propagated to the function to squash this possible
bug.


Emacs  : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22, 
cairo version 1.17.3)
 of 2020-08-20
Package: Org mode version 9.4 (9.4-7-g3eccc5-elpaplus @ 
~/spacemacs/elpa/develop/org-plus-contrib-20200921/)