emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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-25  0:16 this nkk
  2020-10-06 10:15 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: this nkk @ 2020-09-25  0:16 UTC (permalink / raw)
  To: emacs-orgmode


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


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

end of thread, other threads:[~2020-10-06 21:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-25  0:16 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/)] this nkk
2020-10-06 10:15 ` Nicolas Goaziou
2020-10-06 21:36   ` Samuel Wales

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