[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Indirect buffers, org-store-link, and org-insert-link

From: Maxim Nikulin
Subject: Indirect buffers, org-store-link, and org-insert-link
Date: Fri, 21 Aug 2020 18:30:31 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

#+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 @ /home/test/src/emacs/org-mode/lisp/)

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 https://orgmode.org/list/8162z2tf8n.fsf_-_@gmail.com/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]