From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id pfwHMoa0P1/1LQAA0tVLHw (envelope-from ) for ; Fri, 21 Aug 2020 11:48:22 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id EPlGLYa0P19gYgAAbx9fmQ (envelope-from ) for ; Fri, 21 Aug 2020 11:48:22 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 4BCE79403A8 for ; Fri, 21 Aug 2020 11:48:22 +0000 (UTC) Received: from localhost ([::1]:55060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k95Wv-0003qy-4z for larch@yhetil.org; Fri, 21 Aug 2020 07:48:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k95Ft-0006GV-Li for emacs-orgmode@gnu.org; Fri, 21 Aug 2020 07:30:45 -0400 Received: from static.214.254.202.116.clients.your-server.de ([116.202.254.214]:33684 helo=ciao.gmane.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k95Fr-0001Ha-V8 for emacs-orgmode@gnu.org; Fri, 21 Aug 2020 07:30:45 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1k95Fn-0007rW-Fd for emacs-orgmode@gnu.org; Fri, 21 Aug 2020 13:30:39 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Maxim Nikulin Subject: Indirect buffers, org-store-link, and org-insert-link Date: Fri, 21 Aug 2020 18:30:31 +0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 X-Mozilla-News-Host: news://news.gmane.io:119 Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 07:30:39 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 43 X-Spam_score: 4.3 X-Spam_bar: ++++ X-Spam_report: (4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.41 X-TUID: yWWi3Hibl4UD #+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/