* how to invoke 'server-visit-files' function from emacsclient -e ?
@ 2016-10-12 14:34 Jason Vas Dias
2016-10-12 19:40 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Jason Vas Dias @ 2016-10-12 14:34 UTC (permalink / raw
To: help-gnu-emacs
Good day -
I am trying to write a shell script that will accept a list of ( file
name, line number ) pairs
and get the user's running emacs process to visit each file, scroll to
the line number, and
wait for the user to press 'C-x+#' (invoke the 'server-edit' function)
before allowing
the next file to be visited .
Since emacsclient does most of this (except scrolling to the line number,
a very important feature for this application) , I am attempting to
use its '-e'
option to get it to request the running emacs to invoke the 'server-visit-files'
function , which happily accepts a (line #, column#) pair to move the cursor to.
I can get it to do most of this, but am having no luck convincing emacs that
the server-visit-files function's second PROC argument is a process -
just passing the
process ID does not work:
$ ( set -x; # must use exec here so emaclient's pid is $BASHPID
exec emacsclient -e \
'(server-visit-files (assoc "'${PWD}'/a_file" '"'"'(124 0))
['"$BASHPID"' ] )'
)
+ exec emacsclient -e '(server-visit-files (assoc "/tmp/a_file"
'\''(124 0)) [ 21027 ] )'
*ERROR*: Wrong type argument: processp, [21027]
(same thing happens if the PROC argument is not a vector, or if quoted).
There seems to be no way of specifying an external process , not run by emacs,
as being a LISP object for which the 'processp' "C" function will
return 't' - is this
the case ?
There also seems to be no way of getting emacsclient to load a file in
the users
running emacs and scroll to a given line number:
$ emacsclient /tmp/a_file -e '(goto-line 124)'
*ERROR*: Symbol's value as variable is void: /tmp/a_file
It seems the '-e' argument causes emacsclient to assume every argument
(including
arguments preceding the '-e') are lisp expressions.
Is there any way of constructing an emacs LISP 'PROC' object given an
arbitrary PID
of a process not initiated by emacs ?
Can anyone suggest a way of acheiving the desired result:
- loading one of many files into a running emacs , causing emacs to
scroll to a given line number
in that file, and then waiting for user to press 'C-x #' before
allowing the next file to be loaded ?
If not, please consider modifyinh emacsclient to accept a new 'line
number to scroll to' option.
Any responses gratefully received.
Thanks, Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: how to invoke 'server-visit-files' function from emacsclient -e ?
2016-10-12 14:34 how to invoke 'server-visit-files' function from emacsclient -e ? Jason Vas Dias
@ 2016-10-12 19:40 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2016-10-12 19:40 UTC (permalink / raw
To: help-gnu-emacs
> From: Jason Vas Dias <jason.vas.dias@gmail.com>
> Date: Wed, 12 Oct 2016 15:34:17 +0100
>
> I am trying to write a shell script that will accept a list of ( file
> name, line number ) pairs
> and get the user's running emacs process to visit each file, scroll to
> the line number, and
> wait for the user to press 'C-x+#' (invoke the 'server-edit' function)
> before allowing
> the next file to be visited .
>
> Since emacsclient does most of this (except scrolling to the line number,
> a very important feature for this application) , [...]
??? Invoking emacsclient with the +LINE argument causes Emacs to
scroll to the specified line. So I'm not sure why you need to do
anything beyond invoking emacsclient. There must be some details you
didn't tell.
> Can anyone suggest a way of acheiving the desired result:
> - loading one of many files into a running emacs , causing emacs to
> scroll to a given line number
> in that file, and then waiting for user to press 'C-x #' before
> allowing the next file to be loaded ?
Just
emacsclient +LINE1 FILE1 +LINE2 FILE2 ...
should do what you want. It does for me.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-12 19:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-12 14:34 how to invoke 'server-visit-files' function from emacsclient -e ? Jason Vas Dias
2016-10-12 19:40 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.