From: Matthew Lundin <mdl@imapmail.org>
To: Mirko Vukovic <mirko.vukovic@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: How to occasionally store link as file.org+headline
Date: Tue, 18 Feb 2020 18:28:38 -0600 [thread overview]
Message-ID: <878skzzah5.fsf@fastmail.fm> (raw)
In-Reply-To: <CAO73BAARdUoW8LYGJvoWgzRvGAP7VYN+=RjAAWT2MZSNNU9DZQ@mail.gmail.com>
Mirko Vukovic <mirko.vukovic@gmail.com> 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
prev parent reply other threads:[~2020-02-19 0:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-14 16:48 How to occasionally store link as file.org+headline Mirko Vukovic
2020-02-19 0:28 ` Matthew Lundin [this message]
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=878skzzah5.fsf@fastmail.fm \
--to=mdl@imapmail.org \
--cc=emacs-orgmode@gnu.org \
--cc=mirko.vukovic@gmail.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public 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).