From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shintaro Katayama Subject: Patch: org-link-ignore-path-to-self Date: Wed, 27 Jul 2016 09:38:03 +0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7ba974d6b7339b05389ac6b7 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSLI8-0007hG-39 for emacs-orgmode@gnu.org; Wed, 27 Jul 2016 05:38:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSLI7-0004NB-6r for emacs-orgmode@gnu.org; Wed, 27 Jul 2016 05:38:16 -0400 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:37898) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSLI7-0004MO-0C for emacs-orgmode@gnu.org; Wed, 27 Jul 2016 05:38:15 -0400 Received: by mail-wm0-x233.google.com with SMTP id o80so53199222wme.1 for ; Wed, 27 Jul 2016 02:38:14 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --047d7ba974d6b7339b05389ac6b7 Content-Type: text/plain; charset=UTF-8 Hi, The attached patch enables to choose whether link contains a (file-)path to self, or not. One new variable "org-link-ignore-path-to-self" should be true as the original behavior (~ no path to self by org-insert-link). However, the path-to-self will remain when the value is nil. This feature is helpful, especially for org-journal - you can use org-insert-link from TODOs to journal entries in a journal; the links are preserved even after carryover. Regards, Shintaro --- /Users/shin/.emacs.d/elpa/org-20160711/org.el~ 2016-07-16 01:46:09.000000000 +0200 +++ /Users/shin/.emacs.d/elpa/org-20160711/org.el 2016-07-27 10:40:30.000000000 +0200 @@ -10386,6 +10386,7 @@ ;; option If yes, simplify the link by using only the search ;; option. (when (and buffer-file-name + org-link-ignore-path-to-self (string-match "^file:\\(.+?\\)::\\(.+\\)" link)) (let* ((path (match-string 1 link)) (case-fold-search nil) --047d7ba974d6b7339b05389ac6b7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

The attached patch enables to choos= e whether link contains a (file-)path to self, or not. One new variable &qu= ot;org-link-ignore-path-to-self" should be true as the original behavi= or (~ no path to self by org-insert-link). However, the path-to-self will r= emain when the value is nil.

This feature is helpf= ul, especially for org-journal - you can use org-insert-link from TODOs to = journal entries in a journal; the links are preserved even after carryover.=

Regards,
Shintaro

<= div>
--- /Users/shin/.emacs.d/elpa/org-20160711/org.el~ = =C2=A0 =C2=A0 =C2=A02016-07-16 01:46:09.000000000 +0200
+++ /User= s/shin/.emacs.d/elpa/org-20160711/org.el =C2=A0 =C2=A0 =C2=A0 2016-07-27 10= :40:30.000000000 +0200
@@ -10386,6 +10386,7 @@
=C2=A0 = =C2=A0 =C2=A0;; option If yes, simplify the link by using only the search
=C2=A0 =C2=A0 =C2=A0;; option.
=C2=A0 =C2=A0 =C2=A0(when= (and buffer-file-name
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0org-link-ignore-path-to-self
=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(string-match "^file:\\(.+?\\)::\\(.+\\= )" link))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(let* ((path (match-str= ing 1 link))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(cas= e-fold-search nil)

--047d7ba974d6b7339b05389ac6b7--