From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Passing values by reference to src-blocks Date: Tue, 24 Jun 2014 23:01:25 -0400 Message-ID: <87vbrpbsii.fsf@gmail.com> References: <87wqc5srtf.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzdV0-0002QC-Jw for emacs-orgmode@gnu.org; Tue, 24 Jun 2014 23:03:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzdUu-0003B0-MV for emacs-orgmode@gnu.org; Tue, 24 Jun 2014 23:03:50 -0400 Received: from mail-qg0-x22c.google.com ([2607:f8b0:400d:c04::22c]:48041) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzdUu-0003Au-HE for emacs-orgmode@gnu.org; Tue, 24 Jun 2014 23:03:44 -0400 Received: by mail-qg0-f44.google.com with SMTP id j107so1132401qga.17 for ; Tue, 24 Jun 2014 20:03:43 -0700 (PDT) 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: Thorsten Jolitz Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Thorsten Jolitz writes: > Hi List, > > this does not work, although I would think it should (at least if there > is no typo or so): > I think everything is doing what it is supposed to from an Org-mode perspective, see below (with different functions). --=-=-= Content-Type: text/x-org Content-Disposition: inline; filename=example.org #+name: plus-foo #+header: :var buf-file=(buffer-file-name) #+begin_src emacs-lisp (concat buf-file "+foo") #+end_src #+RESULTS: plus-foo : /tmp/example.org+foo #+name: project-name #+header: :exports none #+header: :var root-dir=plus-foo(buf-file=(buffer-file-name)) #+begin_src emacs-lisp (concat root-dir "+bar") #+end_src #+RESULTS: project-name : /tmp/example.org+foo+bar --=-=-= Content-Type: text/plain > > ,---- > | #+name: project-root > | #+header: :var buf-file=(buffer-file-name) > | #+begin_src emacs-lisp > | (file-name-directory > | (directory-file-name > | (file-name-directory buf-file))) > | #+end_src > `---- > > #+results: project-root > : /home/tj/News/drafts/ > > ,---- > | #+name: project-name > | #+header: :exports none > | #+header: :var root-dir=project-root(buf-file=(buffer-file-name)) > | #+begin_src emacs-lisp > | (mapconcat > | 'capitalize > | (split-string > | (file-name-nondirectory root-dir) > | "-" 'OMIT-NULLS) > | " ") > | #+end_src > `---- > > #+results: project-name > > Wrong usage of :var or limitations of header arguments? This is to be expected. The two blocks above compose to something like #+begin_src emacs-lisp (file-name-nondirectory (file-name-directory (directory-file-name (file-name-directory (buffer-file-name))))) #+end_src Calling `file-name-nondirectory' on the results of `file-name-directory' seems like it should give you an empty string. Best, -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D (see https://u.fsf.org/yw) --=-=-=--