From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: little elisp help?
Date: Thu, 03 Jul 2014 08:44:33 -0400 [thread overview]
Message-ID: <87a98qboi6.fsf@gmail.com> (raw)
In-Reply-To: CAP4qtYJZMnGCPyEcncueNsSA8FQWa6NODf1ZjwEbjndTUst5vA@mail.gmail.com
tom <scrawler@gmail.com> writes:
> this
>
> (setq org-link-abbrev-alist
> '(("foo" . "file:/path/to/%s.txt")))
>
> allow me to do this
>
> [[foo:file to open]]
>
> but it creates a file with spaces in the name. so I'd like to replace "%s" with "%(myfun)".
>
> with your example, how can I get "foo bar loo" from
>
> [[foo:foo bar loo]]
>
> see what I mean?
>
Using Thorsten's suggestion
--8<---------------cut here---------------start------------->8---
(setq org-link-abbrev-alist
'(("foo" . "file:/path/to/%(foobar).txt")))
(defun foobar (x)
(replace-regexp-in-string "[[:space:]]" "_" x))
--8<---------------cut here---------------end--------------->8---
will turn
[[foo:foo bar loo]]
to
[[file:/path/to/foo_bar__loo.txt]]
when you click on it.
--
Nick
next prev parent reply other threads:[~2014-07-03 12:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-02 20:20 little elisp help? tom
2014-07-02 20:31 ` Thorsten Jolitz
2014-07-02 22:09 ` tom
2014-07-03 12:44 ` Nick Dokos [this message]
2014-07-03 18:36 ` tom
2014-07-02 22:54 ` Eric Abrahamsen
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=87a98qboi6.fsf@gmail.com \
--to=ndokos@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).