From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id CCw0KQcbSV+KWwAA0tVLHw (envelope-from ) for ; Fri, 28 Aug 2020 14:56:07 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id uMoRJQcbSV8ofQAAB5/wlQ (envelope-from ) for ; Fri, 28 Aug 2020 14:56:07 +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 0634F9404CB for ; Fri, 28 Aug 2020 14:56:07 +0000 (UTC) Received: from localhost ([::1]:52416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBfnR-0003F6-12 for larch@yhetil.org; Fri, 28 Aug 2020 10:56:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60386) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBfmQ-0001y5-Tm for emacs-orgmode@gnu.org; Fri, 28 Aug 2020 10:55:02 -0400 Received: from static.214.254.202.116.clients.your-server.de ([116.202.254.214]:34412 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 1kBfmO-0001JH-W4 for emacs-orgmode@gnu.org; Fri, 28 Aug 2020 10:55:02 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1kBfmK-0002F8-HV for emacs-orgmode@gnu.org; Fri, 28 Aug 2020 16:54:56 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Maxim Nikulin Subject: [PATCH[ Re: Indirect buffers, org-store-link, and org-insert-link Date: Fri, 28 Aug 2020 21:54:50 +0700 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------336946A7711A735B669B0730" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: 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/28 09:42:12 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 28 X-Spam_score: 2.8 X-Spam_bar: ++ X-Spam_report: (2.8 / 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=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-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: dE/TeVvn0X0I This is a multi-part message in MIME format. --------------336946A7711A735B669B0730 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit It seems I have managed to fix store/insert link for indirect buffers by applying changes similar to https://orgmode.org/list/8162z2tf8n.fsf_-_@gmail.com/ to another couple of code fragments. Due to monkey-typing approach I am unsure that I have not broken something else. --------------336946A7711A735B669B0730 Content-Type: text/x-patch; charset=UTF-8; name="indirect-buffer-links.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="indirect-buffer-links.patch" >From 3d42f1e659b2c797629e6c041b38ae67dbe099a1 Mon Sep 17 00:00:00 2001 From: Max Nikulin Date: Fri, 28 Aug 2020 14:49:03 +0000 Subject: [PATCH] ol.el: Fix store and insert link in indirect buffer * lisp/ol.el(org-store-link): Store link with CUSTOM_ID anchor in indirect buffer. (org-insert-link): Do not add file name to search and CUSTOM_ID links pointed to the same file when called from indirect buffer. When a subtree was open in an indirect buffer, wrong argument of `abbreviate-file-name' prevented storing link to a CUSTOM_ID anchor. Internal link to a header line or to a CUSTOM_ID anchor was created with file name instead of concise form. This is a follow up of 784e5f1488. TINYCHANGE --- lisp/ol.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/ol.el b/lisp/ol.el index 76a9aca2b..951bb74e7 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -1699,8 +1699,10 @@ non-nil." (push (list link desc) org-stored-links) (message "Stored: %s" (or desc link)) (when custom-id - (setq link (concat "file:" (abbreviate-file-name - (buffer-file-name)) "::#" custom-id)) + (setq link (concat "file:" + (abbreviate-file-name + (buffer-file-name (buffer-base-buffer))) + "::#" custom-id)) (push (list link desc) org-stored-links))) (car org-stored-links))))) @@ -1841,13 +1843,14 @@ Use TAB to complete link prefixes, then RET for type-specific completion support ;; Check if we are linking to the current file with a search ;; option If yes, simplify the link by using only the search ;; option. - (when (and buffer-file-name + (when (and (buffer-file-name (buffer-base-buffer)) (let ((case-fold-search nil)) (string-match "\\`file:\\(.+?\\)::" link))) (let ((path (match-string-no-properties 1 link)) (search (substring-no-properties link (match-end 0)))) (save-match-data - (when (equal (file-truename buffer-file-name) (file-truename path)) + (when (equal (file-truename (buffer-file-name (buffer-base-buffer))) + (file-truename path)) ;; We are linking to this same file, with a search option (setq link search))))) -- 2.17.1 --------------336946A7711A735B669B0730--