unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Concerning emacsclient cmdline
@ 2015-02-08 16:44 Harry Putnam
  2015-02-08 17:26 ` Philipp Stephani
  0 siblings, 1 reply; 3+ messages in thread
From: Harry Putnam @ 2015-02-08 16:44 UTC (permalink / raw)
  To: help-gnu-emacs

Running SonOS (Openindiana, a solaris offshoot)

  GNU Emacs 24.3.1 (i386-pc-solaris2.10, X toolkit, Xaw scroll bars)
  of 2013-08-03 on unstable10x

I've been dinking around with a script that calls emacsclient and
having a problem figuring out the proper cmdline syntax.

There are several things being checked and several different calls to
emcaslient depending on other variables.

Where my problem comes is trying to open a file and --eval an expression
in the same command.

the script name is `emcl' the cmdline:  `./emcl ./it'

And the cmdline that gets run inside the script:
 emacsclient -c -a "" --eval '(load-file "/home/harry/.emacs-dir/client2SomeServer.el")' $@

When called it breaks with:
 *ERROR*: Symbol's value as variable is void: \./it

I've tried removeing "$@" and it opens without error but with no
filename 'it'  opened.

So I tried putting "$@" between "" and  `--eval'
The error is the same.

   *ERROR*: Symbol's value as variable is void: \./it

Can anyone say what is wrong here?

Perhaps the file call has to be an --eval too.  If so, how would that
be done?




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

* Re: Concerning emacsclient cmdline
  2015-02-08 16:44 Concerning emacsclient cmdline Harry Putnam
@ 2015-02-08 17:26 ` Philipp Stephani
  2015-02-09  2:03   ` Harry Putnam
  0 siblings, 1 reply; 3+ messages in thread
From: Philipp Stephani @ 2015-02-08 17:26 UTC (permalink / raw)
  To: Harry Putnam, help-gnu-emacs

Yes, --eval causes all arguments to be interpreted as Lisp expressions. The
following script should work (note that some contraptions are required to
let it deal with all kinds of filenames):

#!/bin/bash

set -o errexit -o nounset -o pipefail

declare -a args=()

for file
do
  # Use base64 encoding to deal with Lisp syntax in file names.
  # No herestring because that appends a newline.
  # No echo to deal with file names starting with dashes.
  encoded="$(printf '%s' "${file}" | base64)"
  args+=("(find-file (base64-decode-string \"${encoded}\"))")
done

emacsclient --eval '(load "/home/harry/.emacs-dir/client2SomeServer.el" t)'
"${args[@]}"


Harry Putnam <reader@newsguy.com> schrieb am Sun Feb 08 2015 at 17:45:24:

> Running SonOS (Openindiana, a solaris offshoot)
>
>   GNU Emacs 24.3.1 (i386-pc-solaris2.10, X toolkit, Xaw scroll bars)
>   of 2013-08-03 on unstable10x
>
> I've been dinking around with a script that calls emacsclient and
> having a problem figuring out the proper cmdline syntax.
>
> There are several things being checked and several different calls to
> emcaslient depending on other variables.
>
> Where my problem comes is trying to open a file and --eval an expression
> in the same command.
>
> the script name is `emcl' the cmdline:  `./emcl ./it'
>
> And the cmdline that gets run inside the script:
>  emacsclient -c -a "" --eval '(load-file "/home/harry/.emacs-dir/client2SomeServer.el")'
> $@
>
> When called it breaks with:
>  *ERROR*: Symbol's value as variable is void: \./it
>
> I've tried removeing "$@" and it opens without error but with no
> filename 'it'  opened.
>
> So I tried putting "$@" between "" and  `--eval'
> The error is the same.
>
>    *ERROR*: Symbol's value as variable is void: \./it
>
> Can anyone say what is wrong here?
>
> Perhaps the file call has to be an --eval too.  If so, how would that
> be done?
>
>
>


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

* Re: Concerning emacsclient cmdline
  2015-02-08 17:26 ` Philipp Stephani
@ 2015-02-09  2:03   ` Harry Putnam
  0 siblings, 0 replies; 3+ messages in thread
From: Harry Putnam @ 2015-02-09  2:03 UTC (permalink / raw)
  To: help-gnu-emacs

Philipp Stephani <p.stephani2@gmail.com> writes:

> Yes, --eval causes all arguments to be interpreted as Lisp expressions. The
> following script should work (note that some contraptions are required to
> let it deal with all kinds of filenames):
>
> #!/bin/bash
>
> set -o errexit -o nounset -o pipefail
>
> declare -a args=()
>
> for file
> do
>   # Use base64 encoding to deal with Lisp syntax in file names.
>   # No herestring because that appends a newline.
>   # No echo to deal with file names starting with dashes.
>   encoded="$(printf '%s' "${file}" | base64)"
>   args+=("(find-file (base64-decode-string \"${encoded}\"))")
> done
>
> emacsclient --eval '(load "/home/harry/.emacs-dir/client2SomeServer.el" t)'
> "${args[@]}"

Thanks for the input.. I guess that script works on your host?  What
OS are you on?

Here I get errors:
  cat it
  data
  
   ./emcl it
,----
|  t
|  ./emcl: line 17: (find-file (base64-decode-string "aXQ=")): command not found
`----

Then I thought perhaps you meant for emacsclient cmd to be all on one
line:

  emacsclient --eval '(load "/home/harry/.emacs-dir/client2SomeServer.el" t)' "${args[@]}"

Recieved the same  error

I'm running:
  SunOS 2x 5.11 oi_151a9 i86pc i386 i86pc (openindiana)
  
  bash 4.0.44(1)-release (i386-pc-solaris2.11)

  GNU Emacs 24.3.1 (i386-pc-solaris2.10, X toolkit, Xaw
  scroll bars) of 2013-08-03 on unstable10x
  
  My version of bsae64 is from a pkg:
  pkg:/file/gnu-coreutils@8.5-0.151.1.9
   base64 --version
   base64 (GNU coreutils) 8.5

Sorry to say I don't really know what all is supposed to be happening
in the script or maybe I could do more to get it going.

What I did do didn't seem to solve the mystery.  I encoded the file `./it' to
`./file' like this:
base64 it >file

file contains ZGF0YQo=

I evaluated `./file' inside emacs like:

  A-S-:
  eval: (base64-decode-string "ZGF0YQo=") <RET>

  Returns:
  `data'
  
So base64 seems to be working ok and emacs is able to decode it.
-------       -------       ---=---       -------       ------- 

I ran your script just as you posted it:

--8<---------------cut here---------------start------------->8---
#!/bin/bash

set -o errexit -o nounset -o pipefail

declare -a args=()

for file
do
  # Use base64 encoding to deal with Lisp syntax in file names.
  # No herestring because that appends a newline.
  # No echo to deal with file names starting with dashes.
  encoded="$(printf '%s' "${file}" | base64)"
  args+=("(find-file (base64-decode-string \"${encoded}\"))")
done

emacsclient --eval '(load "/home/harry/.emacs-dir/client2SomeServer.el" t)' 
"${args[@]}"
--8<---------------cut here---------------end--------------->8---





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

end of thread, other threads:[~2015-02-09  2:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-08 16:44 Concerning emacsclient cmdline Harry Putnam
2015-02-08 17:26 ` Philipp Stephani
2015-02-09  2:03   ` Harry Putnam

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