all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* emacsclient: Different --eval for emacs as alternate editor?
@ 2013-02-23 14:09 Florian v. Savigny
  2013-02-28  8:36 ` ronaldo.mercado
  0 siblings, 1 reply; 7+ messages in thread
From: Florian v. Savigny @ 2013-02-23 14:09 UTC (permalink / raw)
  To: help-gnu-emacs


Hi there,

this is either a question about emacs(client) commandline invocation,
or one about bookmark.el:

I have been trying to write menu entries for Fvwm which would call
either emacsclient or emacs and would take me directy to an Emacs
bookmark. I have tried the following command line:

emacsclient -c -a emacs --eval '(bookmark-jump "name")'

This only works, however, when emacsclient does not have to call emacs
instead, i.e. only if Emacs is already running and bookmark-alist is
already set.

Basically, bookmark-jump is autoloaded, and when you call it when the
bookmark list has not been loaded yet (e.g. directly after Emacs
startup), it seems to take care of that when you call it
*interactively*. It does not do that, however, when called as
above. Thus, I conclude the trick is somehow buried in the functions
used in the (interactive ...) form of bookmark-jump, i.e.,
bookmark-jump does not seem to have been designed with non-interactive
use in mind.

I would think it clumsy, to say the least, to pass the following form
to --eval instead:

(progn
  (bookmark-load '~/.emacs.bmk' t) ; t: OVERWRITE
  (bookmark-jump "name"))

I would have to overwrite because when emacs is already running, any
newly loaded bookmarks are normally added to the list, which would
basically duplicate all the bookmarks (or worse, when this happens
several times in one session) if I did not use that argument. The
overwriting, on the other hand, would destroy any new bookmarks. So
both would be crap.

The solutions I can think of are to either 1) pass different lisp code
depending on whether emacs(server) is already running or not. (The
progn form above.) Is there a standard way of doing this? Or, 2) maybe
there is some way to tell bookmark-jump to load the default bookmark
file even when it is called non-interactively?

Can anybody help?

Thanks so much!

Florian






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

* RE: emacsclient: Different --eval for emacs as alternate editor?
  2013-02-23 14:09 emacsclient: Different --eval for emacs as alternate editor? Florian v. Savigny
@ 2013-02-28  8:36 ` ronaldo.mercado
  2013-02-28 18:15   ` Florian v. Savigny
  2013-02-28 18:26   ` emacsclient, -a emacs, and --eval (rephrased) Florian v. Savigny
  0 siblings, 2 replies; 7+ messages in thread
From: ronaldo.mercado @ 2013-02-28  8:36 UTC (permalink / raw)
  To: florian, help-gnu-emacs

Sorry no direct answer.

I had a somewhat similar problem when trying to call "org-cycle" from a macro. I wanted the equivalent behaviour of C-u C-u C-u M-x org-cycle

It did not work when called non interactively. I had a fruitless attempt at using call-interactively and ended up digging the source of org-mode to find out that under the hood it did an "show-all" which is how I solved my problem.

I'd be glad to know if call-interactively is meant to solve these kind of problems.

Regards
		
> -----Original Message-----
> From: help-gnu-emacs-bounces+ronaldo.mercado=diamond.ac.uk@gnu.org
> [mailto:help-gnu-emacs-bounces+ronaldo.mercado=diamond.ac.uk@gnu.org]
> On Behalf Of Florian v. Savigny
> Sent: 23 February 2013 14:09
> To: help-gnu-emacs@gnu.org
> Subject: emacsclient: Different --eval for emacs as alternate editor?
> 
> 
> Hi there,
> 
> this is either a question about emacs(client) commandline invocation,
> or one about bookmark.el:
> 
> I have been trying to write menu entries for Fvwm which would call
> either emacsclient or emacs and would take me directy to an Emacs
> bookmark. I have tried the following command line:
> 
> emacsclient -c -a emacs --eval '(bookmark-jump "name")'
> 
> This only works, however, when emacsclient does not have to call emacs
> instead, i.e. only if Emacs is already running and bookmark-alist is
> already set.
> 
> Basically, bookmark-jump is autoloaded, and when you call it when the
> bookmark list has not been loaded yet (e.g. directly after Emacs
> startup), it seems to take care of that when you call it
> *interactively*. It does not do that, however, when called as above.
> Thus, I conclude the trick is somehow buried in the functions used in
> the (interactive ...) form of bookmark-jump, i.e., bookmark-jump does
> not seem to have been designed with non-interactive use in mind.
> 
> I would think it clumsy, to say the least, to pass the following form
> to --eval instead:
> 
> (progn
>   (bookmark-load '~/.emacs.bmk' t) ; t: OVERWRITE
>   (bookmark-jump "name"))
> 
> I would have to overwrite because when emacs is already running, any
> newly loaded bookmarks are normally added to the list, which would
> basically duplicate all the bookmarks (or worse, when this happens
> several times in one session) if I did not use that argument. The
> overwriting, on the other hand, would destroy any new bookmarks. So
> both would be crap.
> 
> The solutions I can think of are to either 1) pass different lisp code
> depending on whether emacs(server) is already running or not. (The
> progn form above.) Is there a standard way of doing this? Or, 2) maybe
> there is some way to tell bookmark-jump to load the default bookmark
> file even when it is called non-interactively?
> 
> Can anybody help?
> 
> Thanks so much!
> 
> Florian
> 
> 
> 


--
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom







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

* Re: emacsclient: Different --eval for emacs as alternate editor?
  2013-02-28  8:36 ` ronaldo.mercado
@ 2013-02-28 18:15   ` Florian v. Savigny
  2013-02-28 18:26   ` emacsclient, -a emacs, and --eval (rephrased) Florian v. Savigny
  1 sibling, 0 replies; 7+ messages in thread
From: Florian v. Savigny @ 2013-02-28 18:15 UTC (permalink / raw)
  To: ronaldo.mercado; +Cc: help-gnu-emacs


Hi Ronaldo,

thanks for your answer. It's good to at least learn you're not
alone...

I tried out using call-interactively, but at least in the case of
bookmark-jump, it does not seem to work to fool the function into
thinking it is being called interactively and fed args 1, 2, 3 to the
prompts that its (interactive ...) form normally generates. Rather, it
seems to make the function think that there is a user waiting to input
something, i.e. it starts displaying its prompts. Reading the
documentation more closely, I realise I could have known that, as the
optional arguments have a different meaning anyway.

Regards,

Florian






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

* emacsclient, -a emacs, and --eval (rephrased)
  2013-02-28  8:36 ` ronaldo.mercado
  2013-02-28 18:15   ` Florian v. Savigny
@ 2013-02-28 18:26   ` Florian v. Savigny
  2013-02-28 18:33     ` "Jérôme M. Berger"
  2013-03-03 16:53     ` PJ Weisberg
  1 sibling, 2 replies; 7+ messages in thread
From: Florian v. Savigny @ 2013-02-28 18:26 UTC (permalink / raw)
  To: help-gnu-emacs


Encouraged by Ronaldos post, I thought I might rephrase one aspect of
my problem, hoping this might lead to the (or some) solution:

When I call

emacsclient -a emacs --eval "(rmail)"

Emacs will start up and run rmail if it is started as emacsclient
(i.e. if emacs and its server are already running). But when started
as emacs, it starts by opening a new file called "(rmail)".

This is confusing to me, as the --eval option is documented for both
emacsclient and emacs, leading me to think both should interpret it in
the same way.

This seems basic enough - can anybody explain to me what I am missing
here? 

Thanks so much in advance!

Florian




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

* Re: emacsclient, -a emacs, and --eval (rephrased)
  2013-02-28 18:26   ` emacsclient, -a emacs, and --eval (rephrased) Florian v. Savigny
@ 2013-02-28 18:33     ` "Jérôme M. Berger"
  2013-03-03 16:53     ` PJ Weisberg
  1 sibling, 0 replies; 7+ messages in thread
From: "Jérôme M. Berger" @ 2013-02-28 18:33 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 900 bytes --]

Florian v. Savigny wrote:
> Encouraged by Ronaldos post, I thought I might rephrase one aspect of
> my problem, hoping this might lead to the (or some) solution:
> 
> When I call
> 
> emacsclient -a emacs --eval "(rmail)"
> 
> Emacs will start up and run rmail if it is started as emacsclient
> (i.e. if emacs and its server are already running). But when started
> as emacs, it starts by opening a new file called "(rmail)".
> 
> This is confusing to me, as the --eval option is documented for both
> emacsclient and emacs, leading me to think both should interpret it in
> the same way.
> 
> This seems basic enough - can anybody explain to me what I am missing
> here? 
> 
> Thanks so much in advance!
> 
	I have the same issue with
emacsclient -a emacs --eval "(raise-frame)"

		Jerome
-- 
mailto:jeberger@free.fr
http://jeberger.free.fr
Jabber: jeberger@jabber.fr


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: emacsclient, -a emacs, and --eval (rephrased)
  2013-02-28 18:26   ` emacsclient, -a emacs, and --eval (rephrased) Florian v. Savigny
  2013-02-28 18:33     ` "Jérôme M. Berger"
@ 2013-03-03 16:53     ` PJ Weisberg
  2013-03-04 22:43       ` Ludwig, Mark
  1 sibling, 1 reply; 7+ messages in thread
From: PJ Weisberg @ 2013-03-03 16:53 UTC (permalink / raw)
  To: Florian v. Savigny; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 944 bytes --]

On Feb 28, 2013 10:26 AM, "Florian v. Savigny" <florian@fsavigny.de> wrote:
>
>
> Encouraged by Ronaldos post, I thought I might rephrase one aspect of
> my problem, hoping this might lead to the (or some) solution:
>
> When I call
>
> emacsclient -a emacs --eval "(rmail)"
>
> Emacs will start up and run rmail if it is started as emacsclient
> (i.e. if emacs and its server are already running). But when started
> as emacs, it starts by opening a new file called "(rmail)".
>
> This is confusing to me, as the --eval option is documented for both
> emacsclient and emacs, leading me to think both should interpret it in
> the same way.
>
> This seems basic enough - can anybody explain to me what I am missing
> here?
>
> Thanks so much in advance!

Not an answer to your question, but it might be helpful to know that if
your alternate editor is "" , then emacsclient will start the emacs server
and try again to run your original command.

[-- Attachment #2: Type: text/html, Size: 1211 bytes --]

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

* RE: emacsclient, -a emacs, and --eval (rephrased)
  2013-03-03 16:53     ` PJ Weisberg
@ 2013-03-04 22:43       ` Ludwig, Mark
  0 siblings, 0 replies; 7+ messages in thread
From: Ludwig, Mark @ 2013-03-04 22:43 UTC (permalink / raw)
  To: PJ Weisberg; +Cc: help-gnu-emacs@gnu.org

> From: PJ Weisberg, Sunday, March 03, 2013 10:53 AM
> 
> Not an answer to your question, but it might be helpful to know
> that if your alternate editor is "" , then emacsclient will
> start the emacs server and try again to run your original
> command.

This does not work on Windows.  (I assume it does work on UNIX....)

Cheers,
Mark




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

end of thread, other threads:[~2013-03-04 22:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-23 14:09 emacsclient: Different --eval for emacs as alternate editor? Florian v. Savigny
2013-02-28  8:36 ` ronaldo.mercado
2013-02-28 18:15   ` Florian v. Savigny
2013-02-28 18:26   ` emacsclient, -a emacs, and --eval (rephrased) Florian v. Savigny
2013-02-28 18:33     ` "Jérôme M. Berger"
2013-03-03 16:53     ` PJ Weisberg
2013-03-04 22:43       ` Ludwig, Mark

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.