emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Indirect buffers, org-store-link, and org-insert-link
@ 2020-08-21 11:30 Maxim Nikulin
  2020-08-28 14:54 ` [PATCH[ " Maxim Nikulin
  0 siblings, 1 reply; 3+ messages in thread
From: Maxim Nikulin @ 2020-08-21 11:30 UTC (permalink / raw)
  To: emacs-orgmode

#+TITLE: Indirect buffers, ~org-store-link~, and ~org-insert-link~

It is inconvenient to work with links pointing to =CUSTOM_ID= anchors
when indirect buffers are involved. Either file name is added to link
or appropriate link target is not stored at all.

* Introduction

I have tried to use indirect buffers (=C-u C-c C-x C-b=)
to quickly jump between 2 or 3 location in an org file.
The intention was to add some details to notes
and to cross-link them using =CUSTOM_ID= properties.
Unfortunately behavior of ~org-store-link~ and ~org-insert-link~
functions is not perfect in such use case.
~org-goto~ interface =C-u C-c C-j= is not a suitable
alternative to avoid indirect buffers especially when frame
is split into to windows and ~org-occur~ is invoked
to find something.

* Regular buffer link target
   :CUSTOM_ID: reg_buf_target

Save link to this section using
=M-x (org-store-link)=

* Link stored from regular buffer inserted to regular buffer

Insert link with =C-u C-u C-u C-c C-l=,
choose the one with =#= (it is the last one and
inserted by default) and clear link description

Actual result is just as the expected one:

: [[#reg_buf_target]]

I would like to get similar links while working with
indirect buffers containing parts of this file.

Store link once more if it was inserted without triple prefix

* Indirect buffer

Open an indirect buffer for this subtree
~M-x (org-tree-to-indirect-buffer)~
and switch to it

** Link inserted to indirect buffer
    :CUSTOM_ID: indirect_buf_target

Insert link stored from the regular buffer.
Actual result:
: [[file:indirect-link.org::#reg_buf_target]]
Expected result: no file name since link inserted
to the same file
: [[#reg_buf_target]]

Run =M-x org-store-link= to push link to this header.

** Link copied from indirect buffer and inserted to indirect buffer

=C-u C-u C-u C-c C-l= to insert link to previous section

Actual result: only link to header text is available for insertion.

Expected result: there is no problem to choose and to insert link as
: [[#indirect_buf_target]]

Close indirect buffer.

* Link stored in indirect buffer and inserted to regular buffer

Obviously, since a link with =CUSTOM_ID= anchor was not created
inside indirect buffer, it is impossible to create here a link as

: [[#indirect_buf_target]]

using completion menu.

* Version

#+begin_src emacs-lisp
   (concat (emacs-version)
	  "\n" (org-version nil 't))

: GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14)
:  of 2020-03-26, modified by Debian
: Org mode version 9.3.7 (release_9.3.7-716-g312a64 @ 

Is it possible to mark indirect buffers (add some
properties, etc.) in such way that there will be
no problems to obtain and compare file name
in ~org-store-link~ and ~org-insert-link~ functions?

P.S. Maybe links to header text were fixed in 

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

end of thread, other threads:[~2020-09-04 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-21 11:30 Indirect buffers, org-store-link, and org-insert-link Maxim Nikulin
2020-08-28 14:54 ` [PATCH[ " Maxim Nikulin
2020-09-04 16:00   ` Bastien

Code repositories for project(s) associated with this public inbox


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