From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Welle Subject: Re: two basic elisp questions Date: Fri, 22 Jul 2016 19:54:36 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQefQ-0006Fv-JF for emacs-orgmode@gnu.org; Fri, 22 Jul 2016 13:55:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQefM-0002Xp-8A for emacs-orgmode@gnu.org; Fri, 22 Jul 2016 13:55:19 -0400 Received: from plane.gmane.org ([80.91.229.3]:57069) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQefM-0002XY-1a for emacs-orgmode@gnu.org; Fri, 22 Jul 2016 13:55:16 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bQefK-0005dg-B6 for emacs-orgmode@gnu.org; Fri, 22 Jul 2016 19:55:14 +0200 Received: from dslb-088-066-015-139.088.066.pools.vodafone-ip.de ([88.66.15.139]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Jul 2016 19:55:14 +0200 Received: from mwe012008 by dslb-088-066-015-139.088.066.pools.vodafone-ip.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 22 Jul 2016 19:55:14 +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" To: emacs-orgmode@gnu.org Hello, Matt Price writes: > On Fri, Jul 22, 2016 at 11:38 AM, Matt Price wrote: > >> >> (2) Is it possible to set the default value for interactive file selection >> to something OTHER than the currect directory of the current buffer? >> Something like: >> >> (let >> ((base-dir "./Assignment1/")) >> (org-attach--attach)) >> >> I'd like to set different base directories when attaching files to >> subtrees of different first-level trees in a buffer. I guess I would set >> the value for the base directory with a property. >> > > OK, I made some progress on this: > > (let ((default-directory (concat default-directory "Assignment1/") )) > (call-interactively 'org-attach-attach)) > > However, I'd like to do something like: > > (let > ((parent-basedir nil)) > (save-excursion > (outline-up-heading) > (setq parent-basedir (org-get-entry "BASEDIR"))) > (let > ((default-directory (concat default-directory parent-basedir) )) > (call-interactively 'org-attach-attach ))) > > > > But there are errors I don't understand in this code. Any hints? Thanks > again! well, I guess the errors are too secret to share them with us? The first I can see is that org-get-entry doesn't need parameters. And the overall structure looks strange, but that could be just me ;). The reason for the current behaviour is the interactive form of org-attach-attach. Ad hoc I have no idea how to change that. What I would try is to (cd your-wanted-dir) before calling org-attach-attach. Maybe a bit of cleanup if useful after calling the function. Regards hmw