Remote Emacs article: Allow spaces in filenames and realpath -m.
This commit is contained in:
parent
0693d3a51d
commit
3d33203774
|
@ -141,17 +141,25 @@ for p in "${@}"; do
|
||||||
# Use local server, for use with --sudo.
|
# Use local server, for use with --sudo.
|
||||||
local=1
|
local=1
|
||||||
else
|
else
|
||||||
|
# Setting field separator to newline so that filenames with spaces will
|
||||||
|
# not be split up into 2 array elements.
|
||||||
|
OLDIFS=${IFS}
|
||||||
|
IFS=$'\n'
|
||||||
|
|
||||||
if [[ $(id -u) -eq 0 || ${sudo} -eq 1 ]]; then
|
if [[ $(id -u) -eq 0 || ${sudo} -eq 1 ]]; then
|
||||||
if [[ ${local} -eq 0 ]]; then
|
if [[ ${local} -eq 0 ]]; then
|
||||||
params+=( "/ssh:$(hostname -f)|sudo:$(hostname -f):"$(readlink -f ${p}) )
|
params+=( "/ssh:$(hostname -f)|sudo:$(hostname -f):"$(realpath -m "${p}") )
|
||||||
else
|
else
|
||||||
params+=( "/sudo:localhost:"$(readlink -f ${p}) )
|
params+=( "/sudo:localhost:"$(realpath -m "${p}") )
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
params+=( "/ssh:$(hostname -f):"$(readlink -f ${p}) )
|
params+=( "/ssh:$(hostname -f):"$(realpath "${p}") )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
IFS=${OLDIFS}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
emacsclient -f ~/.emacs.d/server/server "${params[@]}"
|
emacsclient -f ~/.emacs.d/server/server "${params[@]}"
|
||||||
{{< / highlight >}}
|
{{< / highlight >}}
|
||||||
----
|
----
|
||||||
|
@ -219,4 +227,6 @@ echo 'Defaults env_keep += "SSH_CONNECTION"' >> /etc/sudoers.d/ssh_vars
|
||||||
|
|
||||||
== Updates
|
== Updates
|
||||||
|
|
||||||
* Updated on 2019-05-12 to include the `-f` argument for emacsclient.
|
* Updated 2019-05-12: Add `-f` argument to emacsclient.
|
||||||
|
* Updated 2019-10-06: Support files with spaces in emacsremote and allow to
|
||||||
|
open files the user can't read (for use with emacsremote --sudo).
|
||||||
|
|
Loading…
Reference in New Issue