emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* problem with find-file in --eval from command line
@ 2011-08-24 17:31 Herbert Sitz
  2011-08-24 17:54 ` Achim Gratz
  0 siblings, 1 reply; 8+ messages in thread
From: Herbert Sitz @ 2011-08-24 17:31 UTC (permalink / raw)
  To: emacs-orgmode

I'm trying to start emacs from the command line and using an --eval section to
open a file and do some operations.  I'm having a problem with the Linux version.

Here's how I do it without error using the strange quoting in Windows:


--->  emacs --eval ^"( find-file c:/users/myname/somefile.org\^" )^"

In Linux I'm not sure how to do the quoting.  I tried this:

--->  emacs --eval "( find-file "/home/somefile.org" )"

And I get the error:

   Symbols' value as variable is void:  /home/somefile\.org

It seems there's some problem with the period in the filename, but maybe it's
more than that.  Can anyone explain how to properly quote the Linux commandline
version?  (File comes up fine if I just do find-file in a running emacs.)

Thanks,

Herb

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with find-file in --eval from command line
  2011-08-24 17:31 problem with find-file in --eval from command line Herbert Sitz
@ 2011-08-24 17:54 ` Achim Gratz
  2011-08-24 18:11   ` Herbert Sitz
  2011-08-24 18:48   ` Viktor Rosenfeld
  0 siblings, 2 replies; 8+ messages in thread
From: Achim Gratz @ 2011-08-24 17:54 UTC (permalink / raw)
  To: emacs-orgmode

Herbert Sitz <hsitz@nwlink.com> writes:
> In Linux I'm not sure how to do the quoting.  I tried this:
>
> --->  emacs --eval "( find-file "/home/somefile.org" )"

Provided you don't use any completely exotic shell, that is what Emacs
gets to see:

( find-file /home/somefile.org )

> And I get the error:
>
>    Symbols' value as variable is void:  /home/somefile\.org
>
> It seems there's some problem with the period in the filename, but maybe it's
> more than that.  Can anyone explain how to properly quote the Linux commandline
> version?  (File comes up fine if I just do find-file in a running emacs.)

A safe way to quote this particular invocation:

emacs --eval '( find-file "/home/somefile.org" )'

This only works in tcsh

emacs --eval "( find-file \\"/home/somefile.org\\" ) "

Bash needs this instead

emacs --eval "( find-file "'"'"/home/somefile.org"'"'" ) "

THere may be other solutions for bash, but I never really got the hang
of their quoting rules.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with find-file in --eval from command line
  2011-08-24 17:54 ` Achim Gratz
@ 2011-08-24 18:11   ` Herbert Sitz
  2011-08-24 18:48   ` Viktor Rosenfeld
  1 sibling, 0 replies; 8+ messages in thread
From: Herbert Sitz @ 2011-08-24 18:11 UTC (permalink / raw)
  To: emacs-orgmode

Achim Gratz <Stromeko <at> nexgo.de> writes:

> 
> Bash needs this instead
> 
> emacs --eval "( find-file "'"'"/home/somefile.org"'"'" ) "
> 
> THere may be other solutions for bash, but I never really got the hang
> of their quoting rules.
> 
> Regards,
> Achim.


Achim -- 

Thanks a lot, that Bash version works great.  I'll have to check into quoting
rules for the Linux shells.

Regards,

Herb

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with find-file in --eval from command line
  2011-08-24 17:54 ` Achim Gratz
  2011-08-24 18:11   ` Herbert Sitz
@ 2011-08-24 18:48   ` Viktor Rosenfeld
  2011-08-25  1:45     ` Herbert Sitz
  2011-08-26 12:45     ` Eric S Fraga
  1 sibling, 2 replies; 8+ messages in thread
From: Viktor Rosenfeld @ 2011-08-24 18:48 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

This works on Bash (tested on 4.2.10) and should be easy to remember:

  emacs --eval "(find-file \"/home/somefile.org\" )"

Cheers,
Viktor

Achim Gratz wrote:

> Bash needs this instead
> 
> emacs --eval "( find-file "'"'"/home/somefile.org"'"'" ) "
> 
> THere may be other solutions for bash, but I never really got the hang
> of their quoting rules.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with find-file in --eval from command line
  2011-08-24 18:48   ` Viktor Rosenfeld
@ 2011-08-25  1:45     ` Herbert Sitz
  2011-08-26 12:45     ` Eric S Fraga
  1 sibling, 0 replies; 8+ messages in thread
From: Herbert Sitz @ 2011-08-25  1:45 UTC (permalink / raw)
  To: emacs-orgmode

Viktor Rosenfeld <listuser36 <at> googlemail.com> writes:
> 
> This works on Bash (tested on 4.2.10) and should be easy to remember:
> 
>   emacs --eval "(find-file \"/home/somefile.org\" )"
> 
> Cheers,
> Viktor

I thought I had tried already that but I hadn't.  Thanks Viktor. 

 -- Herb

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with find-file in --eval from command line
  2011-08-24 18:48   ` Viktor Rosenfeld
  2011-08-25  1:45     ` Herbert Sitz
@ 2011-08-26 12:45     ` Eric S Fraga
  2011-08-26 15:16       ` Achim Gratz
  1 sibling, 1 reply; 8+ messages in thread
From: Eric S Fraga @ 2011-08-26 12:45 UTC (permalink / raw)
  To: emacs-orgmode

Viktor Rosenfeld <listuser36@googlemail.com> writes:

> Hi,
>
> This works on Bash (tested on 4.2.10) and should be easy to remember:
>
>   emacs --eval "(find-file \"/home/somefile.org\" )"

The even simpler solution worked for me:

  emacs --eval '(find-file "/home/somefile.org")'

with bash (4.1-3) on Debian Linux (testing+unstable).  Not sure why
others have needed so many escapes on quotes...  note that I'm enclosing
the sexp in single quotes.  Has something changed in bash from 4.1 to
4.2?

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.7 (release_7.7.205.gce02a)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with find-file in --eval from command line
  2011-08-26 12:45     ` Eric S Fraga
@ 2011-08-26 15:16       ` Achim Gratz
  2011-08-26 16:03         ` Eric S Fraga
  0 siblings, 1 reply; 8+ messages in thread
From: Achim Gratz @ 2011-08-26 15:16 UTC (permalink / raw)
  To: emacs-orgmode

Eric S Fraga <e.fraga@ucl.ac.uk> writes:
> The even simpler solution worked for me:
>
>   emacs --eval '(find-file "/home/somefile.org")'

...as I had already said (this also has the charm of working in other
shells, like tcsh).

> with bash (4.1-3) on Debian Linux (testing+unstable).  Not sure why
> others have needed so many escapes on quotes...  note that I'm enclosing
> the sexp in single quotes.  Has something changed in bash from 4.1 to
> 4.2?

For this simple example it's a wash, but sometimes you can't use single
quotes (for instance if you want to have variable expansion) and then
you will still need to know how to escape stuff.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

DIY Stuff:
http://Synth.Stromeko.net/DIY.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with find-file in --eval from command line
  2011-08-26 15:16       ` Achim Gratz
@ 2011-08-26 16:03         ` Eric S Fraga
  0 siblings, 0 replies; 8+ messages in thread
From: Eric S Fraga @ 2011-08-26 16:03 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

Achim Gratz <Stromeko@nexgo.de> writes:

> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>> The even simpler solution worked for me:
>>
>>   emacs --eval '(find-file "/home/somefile.org")'
>
> ...as I had already said (this also has the charm of working in other
> shells, like tcsh).

Ah, sorry, I missed that!

>> with bash (4.1-3) on Debian Linux (testing+unstable).  Not sure why
>> others have needed so many escapes on quotes...  note that I'm enclosing
>> the sexp in single quotes.  Has something changed in bash from 4.1 to
>> 4.2?
>
> For this simple example it's a wash, but sometimes you can't use single
> quotes (for instance if you want to have variable expansion) and then
> you will still need to know how to escape stuff.

Indeed!
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.7 (release_7.7.205.gce02a)

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-08-26 16:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-24 17:31 problem with find-file in --eval from command line Herbert Sitz
2011-08-24 17:54 ` Achim Gratz
2011-08-24 18:11   ` Herbert Sitz
2011-08-24 18:48   ` Viktor Rosenfeld
2011-08-25  1:45     ` Herbert Sitz
2011-08-26 12:45     ` Eric S Fraga
2011-08-26 15:16       ` Achim Gratz
2011-08-26 16:03         ` Eric S Fraga

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