[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Concerning emacsclient cmdline
From: |
Harry Putnam |
Subject: |
Re: Concerning emacsclient cmdline |
Date: |
Sun, 08 Feb 2015 21:03:49 -0500 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) |
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---