From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Lundin Subject: Re: How to occasionally store link as file.org+headline Date: Tue, 18 Feb 2020 18:28:38 -0600 Message-ID: <878skzzah5.fsf@fastmail.fm> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:50419) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j4DEJ-0002br-Ab for emacs-orgmode@gnu.org; Tue, 18 Feb 2020 19:28:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j4DEI-0001jd-A0 for emacs-orgmode@gnu.org; Tue, 18 Feb 2020 19:28:43 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:44145) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j4DEI-0001ic-3T for emacs-orgmode@gnu.org; Tue, 18 Feb 2020 19:28:42 -0500 In-Reply-To: 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-mx.org@gnu.org Sender: "Emacs-orgmode" To: Mirko Vukovic , emacs-orgmode@gnu.org Mirko Vukovic writes: > For most of my links, I want to use the ID generated by orgmode > i.e., (setq org-id-link-to-org-use-id t) > > But occasionally, for targets that are not part of my agenda files, I want > to store a link of the type file:path.org::*headline > > I wrote the following function to accomplish that: > > (defun org-store-file+headline () > "Store link as file + headline" > (interactive) > (let ((org-id-link-to-org-use-id nil)) > (org-store-link nil t))) > > This function works (lightly tested). > > But is there a built-in way, such as using prefixes or arguments to > org-store-link? I browsed the code for it, but that function is several > hundred lines long, and I gave up. I think the function is the best option, as the logic of whether to store ids (based on the value of org-id-link-to-org-use-id) is hard-coded into org-store-link and can't be changed through arguments. You could always create a custom function and bind it to 'C-c l' in org-mode: (defun my-org-store-org-link (arg) "Store a link org mode. When there is a prefix arg, use file+headline format" (interactive "P") (let ((org-id-link-to-org-use-id (not arg))) (org-store-link nil t))) Best, Matt