From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: little elisp help? Date: Thu, 03 Jul 2014 08:44:33 -0400 Message-ID: <87a98qboi6.fsf@gmail.com> References: <874myzy02u.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47984) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2gNo-0004p4-MX for emacs-orgmode@gnu.org; Thu, 03 Jul 2014 08:45:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2gNf-0008Kn-2L for emacs-orgmode@gnu.org; Thu, 03 Jul 2014 08:45:00 -0400 Received: from plane.gmane.org ([80.91.229.3]:44050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2gNe-0008KY-Ri for emacs-orgmode@gnu.org; Thu, 03 Jul 2014 08:44:50 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1X2gNd-0002OA-0m for emacs-orgmode@gnu.org; Thu, 03 Jul 2014 14:44:49 +0200 Received: from pool-98-110-160-12.bstnma.fios.verizon.net ([98.110.160.12]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 03 Jul 2014 14:44:49 +0200 Received: from ndokos by pool-98-110-160-12.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 03 Jul 2014 14:44:49 +0200 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 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