From mboxrd@z Thu Jan 1 00:00:00 1970 From: tom Subject: Re: little elisp help? Date: Thu, 3 Jul 2014 13:36:29 -0500 Message-ID: References: <874myzy02u.fsf@gmail.com> <87a98qboi6.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c1f7e283260c04fd4e4921 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2ls6-0001HW-BL for emacs-orgmode@gnu.org; Thu, 03 Jul 2014 14:36:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2lry-0006lQ-6f for emacs-orgmode@gnu.org; Thu, 03 Jul 2014 14:36:38 -0400 Received: from mail-oa0-x234.google.com ([2607:f8b0:4003:c02::234]:49278) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2lry-0006lK-1F for emacs-orgmode@gnu.org; Thu, 03 Jul 2014 14:36:30 -0400 Received: by mail-oa0-f52.google.com with SMTP id j17so669419oag.25 for ; Thu, 03 Jul 2014 11:36:29 -0700 (PDT) In-Reply-To: <87a98qboi6.fsf@gmail.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --001a11c1f7e283260c04fd4e4921 Content-Type: text/plain; charset=ISO-8859-1 Nick, that did the trick. Thanks very much everybody. On Thu, Jul 3, 2014 at 7:44 AM, Nick Dokos wrote: > tom 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 > > > --001a11c1f7e283260c04fd4e4921 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Nick, that did the trick. Thanks very much everybody.


On Thu, Jul = 3, 2014 at 7:44 AM, Nick Dokos <ndokos@gmail.com> wrote:
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. =A0so I'd like to r= eplace "%s" with "%(myfun)".
>
> with your example, how can I get "foo bar =A0loo" from
>
> [[foo:foo bar =A0loo]]
>
> 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)
=A0 (replace-regexp-in-string "[[:space:]]" "_" x))
--8<---------------cut here---------------end--------------->8---

will turn

[[foo:foo bar =A0loo]]

to

[[file:/path/to/foo_bar__loo.txt]]

when you click on it.
--
Nick



--001a11c1f7e283260c04fd4e4921--