all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jason Vas Dias <jason.vas.dias@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: how to invoke 'server-visit-files' function from emacsclient -e ?
Date: Wed, 12 Oct 2016 15:34:17 +0100	[thread overview]
Message-ID: <CALyZvKxMRQqGkyUMouuHhGqROethqWFNnNoA4No96HVDet3GFw@mail.gmail.com> (raw)

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



             reply	other threads:[~2016-10-12 14:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12 14:34 Jason Vas Dias [this message]
2016-10-12 19:40 ` how to invoke 'server-visit-files' function from emacsclient -e ? Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALyZvKxMRQqGkyUMouuHhGqROethqWFNnNoA4No96HVDet3GFw@mail.gmail.com \
    --to=jason.vas.dias@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.