From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Hendy Subject: Re: Handling errors in command line exporting of agenda? Date: Mon, 8 Aug 2011 16:27:49 -0500 Message-ID: References: <4691.1312835858@alphaville.americas.hpqcorp.net> <5653.1312837754@alphaville.americas.hpqcorp.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:43345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqXMW-0005mh-RZ for emacs-orgmode@gnu.org; Mon, 08 Aug 2011 17:27:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QqXMV-0001zp-KB for emacs-orgmode@gnu.org; Mon, 08 Aug 2011 17:27:52 -0400 Received: from mail-ey0-f171.google.com ([209.85.215.171]:48852) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqXMV-0001zZ-0U for emacs-orgmode@gnu.org; Mon, 08 Aug 2011 17:27:51 -0400 Received: by eyg24 with SMTP id 24so5645250eyg.30 for ; Mon, 08 Aug 2011 14:27:50 -0700 (PDT) In-Reply-To: <5653.1312837754@alphaville.americas.hpqcorp.net> 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: nicholas.dokos@hp.com Cc: emacs-orgmode On Mon, Aug 8, 2011 at 4:09 PM, Nick Dokos wrote: > John Hendy wrote: > >> On Mon, Aug 8, 2011 at 3:37 PM, Nick Dokos wrote= : >> > John Hendy wrote: >> > >> >> On Mon, Aug 8, 2011 at 1:59 PM, suvayu ali wrote: >> >> > Hi John, >> >> > >> >> > On Mon, Aug 8, 2011 at 8:53 PM, John Hendy wro= te: >> >> >>> If you can use wildcards to specify your files, it might be possi= ble by >> >> >>> just one extra call to --eval. Something like this might work: >> >> >>> >> >> >>> emacs --batch -l ~/.emacs --eval '(find-file-read-only "" t)' \ >> >> >>> =C2=A0 =C2=A0 =C2=A0--eval '(org-batch-agenda "w")' > ~/org/aux/a= genda-export.txt >> >> >>> >> >> >> >> >> >> Hmm. That might work. Everything I pull from is in ~/org... could = the >> >> >> wildcard simply be "~/*.org"? Forgive my emacs wildcard ignorance. >> >> > >> >> > As far as I know, emacs accepts any wildcard that is valid in the s= hell. >> >> > Since all your files are in ~/org, I would say try "~/org/*.org". T= he >> >> > '~/org/' limits it to files within your org directory and the '*.or= g'[1] >> >> > limits it to all files with a .org extension. >> > >> > Not true - if you want wildcards expanded, you have to do it yourself. >> > E.g. C-h f file-expand-wildcards >> > >> > ,---- >> > | file-expand-wildcards is a compiled Lisp function in `files.el'. >> > | >> > | (file-expand-wildcards PATTERN &optional FULL) >> > | >> > | Expand wildcard pattern PATTERN. >> > | This returns a list of file names which match the pattern. >> > | >> > | If PATTERN is written as an absolute file name, >> > | the values are absolute also. >> > | >> > | If PATTERN is written as a relative file name, it is interpreted >> > | relative to the current default directory, `default-directory'. >> > | The file names returned are normally also relative to the current >> > | default directory. =C2=A0However, if FULL is non-nil, they are absol= ute. >> > `---- >> > >> >> Thanks. I tried with this based on this new information: >> >> ,--- >> | =C2=A0emacs --batch -l ~/.emacs --eval '(find-file-read-only \ >> | (file-expand-wildcards "~/org/*.org") t)' \ >> | --eval '(org-batch-agenda "e")' > ~/org/aux/agenda-export.txt >> `--- >> >> But I get this error: >> ,--- >> | Wrong type argument: stringp, ("~/org/file1.org" "~/org/file2.org"... = etc.) >> `--- >> >> I'm assuming something about how I used this is returning the wrong data= type? > > Yes: > > | This returns a list of file names which match the pattern. > > so you have to loop over the list. Ah. Got it. I have no elisp-fu to figure that out. > > Nick > > PS. BTW, don't take this as an endorsement of the course you are > following. =C2=A0I don't have the time to think much about it, and I don'= t > have a better solution, but personally, I would try to find another > method: my knee-jerk reaction was to use emacsclient if emacs is running > (if not, fall back to emacs --batch: since no other instance is running, > you wouldn't have to deal with locking in that case). =C2=A0But that may = or > may not work - I just don't know. > Understood. I though the batch method would be great until all of this happened. All I want is some kind of agenda "snapshot generator" so I can have a visible reminder of that's going on always present, whether emacs is running or not. I'm running equipment and out of my office all the time. I don't live in emacs and don't even have it open unless I'm taking notes actively. Thus, having it on my wallpaper would be my ideal solution as a reminder of what I need to do. John >> >> As another option, if I run this and just respond with "p" when I'm >> asked about the lock (proceed), it works. I'm assuming that running >> agenda won't mess up an unsaved file, but that it just accesses it for >> todos and other information. If this is the case and an automatic >> "proceed" is safe... is there a way to pass some sort of "--force" >> option to emacs from the command line to override the lock when it's >> encountered? >> >> I'm running through cron and thus am not able to manually respond to the= prompt. >> >> >> Thanks, >> John >> >> > Nick >> > >> >> > >> >> >> >> Bummer, this is not working: >> >> >> >> ,--- >> >> | emacs -batch -l ~/.emacs -eval '(find-file-read-only "~/org/*.org" = t)' \ >> >> | -eval '(org-batch-agenda "e")' > ~/org/aux/agenda-export.txt >> >> `--- >> >> >> >> Do you see anything wrong with that? I guess I wonder what that first >> >> part will do as perhaps the org-batch-agenda command is not >> >> necessarily going to follow suit with the read-only command. As in, >> >> does the first eval command affect anything that the org-batch-agenda >> >> command is going to do? Is it trying to do the equivalent of opening >> >> up all *.org files in read-only buffers and then run the agenda >> >> export? >> >> >> >> >> >> Thanks, >> >> John >> >> > I hope this helps. :) >> >> > >> >> > Footnotes: >> >> > >> >> > [1] The asterisk (*) stands for zero or more characters. You can fi= nd >> >> > =C2=A0 =C2=A0more details in `man bash` under the heading "Pattern = Matching". >> >> > >> >> > -- >> >> > Suvayu >> >> > >> >> > Open source is the future. It sets us free. >> >> > >> >> >> > >> >