emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tom <scrawler@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: little elisp help?
Date: Thu, 3 Jul 2014 13:36:29 -0500	[thread overview]
Message-ID: <CAP4qtY+bTEu3ydLOvDteOC7xnAjxMQO-CL4eBbPPpGNSutZ1VA@mail.gmail.com> (raw)
In-Reply-To: <87a98qboi6.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 977 bytes --]

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.  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
>
>
>

[-- Attachment #2: Type: text/html, Size: 1729 bytes --]

  reply	other threads:[~2014-07-03 18:36 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
2014-07-03 18:36       ` tom [this message]
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=CAP4qtY+bTEu3ydLOvDteOC7xnAjxMQO-CL4eBbPPpGNSutZ1VA@mail.gmail.com \
    --to=scrawler@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).