emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] little elisp help?


From: Nick Dokos
Subject: Re: [O] little elisp help?
Date: Thu, 03 Jul 2014 08:44:33 -0400
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3.50 (gnu/linux)

tom <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]