emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Maxim Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Indirect buffers, org-store-link, and org-insert-link
Date: Fri, 21 Aug 2020 18:30:31 +0700	[thread overview]
Message-ID: <rhob8q$t26$1@ciao.gmane.io> (raw)

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

#+begin_abstract
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.
#+end_abstract

* 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
   :PROPERTIES:
   :CUSTOM_ID: reg_buf_target
   :END:

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
    :PROPERTIES:
    :CUSTOM_ID: indirect_buf_target
    :END:

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))
#+end_src

#+RESULTS:
: 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	other threads:[~2020-08-21 11:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 11:30 Maxim Nikulin [this message]
2020-08-28 14:54 ` [PATCH[ " Maxim Nikulin
2020-09-04 16:00   ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='rhob8q$t26$1@ciao.gmane.io' \
    --to=manikulin@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: Indirect buffers, org-store-link, and org-insert-link' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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