all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Best practices for launching Emacs on Windows 7/8
@ 2013-02-18 19:59 Ludwig, Mark
  2013-02-19 18:44 ` "Jérôme M. Berger"
  0 siblings, 1 reply; 8+ messages in thread
From: Ludwig, Mark @ 2013-02-18 19:59 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

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

What are the best practices for using/launching Emacs as Server
on Windows 7/8?

For example, on Windows Vista, I used to be able to make a file
association with .TXT files that invoked emacsclient with the
--alternate-editor=runemacs option so that if Emacs wasn't
running, it would be launched.

In Windows 7 and 8, the GUI simply does not allow any options.  I
am not sure if I could hack the registry directly to stuff the
options in there, but since the GUI no longer supports it, I fear
the underlying support might not be there either.  I have
considered trying to associate .TXT with something like a
Emacs.BAT/Emacs.CMD file that could invoke emacsclient with
options, but this has its own problems, and seems like a bad idea
for ultimately launching a "windows mode" program Emacs.exe
(which is not a "command line mode" program).

I am wondering what others do.

Perhaps I'm expecting too much automation, for example, the idea
that if Emacs Server isn't already running, it gets launched
seamlessly?

Thanks!
Mark

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

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

* Re: Best practices for launching Emacs on Windows 7/8
@ 2013-02-19 17:36 Buchs, Kevin
  0 siblings, 0 replies; 8+ messages in thread
From: Buchs, Kevin @ 2013-02-19 17:36 UTC (permalink / raw)
  To: help-gnu-emacs, Ludwig, Mark

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

Mark,

 

I use a .BAT file for the file association. However, a large percentage
of the time I use that, the client starts up and does not find the
already running server and it will try to start another server (in my
.emacs). So, I end up not using the association. Most often I drag and
drop files into the always open emacs window.

 

It is possible to make the file association have arguments (emacsclient
-alter...), but I've only found this can be done by editing the registry
via regedit. 

 

What are the problems you see with having a .BAT file? 

 

I know there are some nice tools out there that are windows programs
that can launch other windows programs with arguments. Maybe that would
make you feel better.

 

Kevin Buchs | Senior Engineer | SPPDG <http://www.mayo.edu/sppdg>  |
507-538-5459 | buchs.kevin@mayo.edu

Mayo Clinic | 200 First Street SW | Rochester, MN 55905 |
http://www.mayo.edu <http://www.mayo.edu/> 

 

 

-------------------------

What are the best practices for using/launching Emacs as Server on
Windows 7/8?

 

For example, on Windows Vista, I used to be able to make a file
association with .TXT files that invoked emacsclient with the
--alternate-editor=runemacs option so that if Emacs wasn't running, it
would be launched.

 

In Windows 7 and 8, the GUI simply does not allow any options.  I am not
sure if I could hack the registry directly to stuff the options in
there, but since the GUI no longer supports it, I fear the underlying
support might not be there either.  I have considered trying to
associate .TXT with something like a Emacs.BAT/Emacs.CMD file that could
invoke emacsclient with options, but this has its own problems, and
seems like a bad idea for ultimately launching a "windows mode" program
Emacs.exe (which is not a "command line mode" program).

 


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

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

* Re: Best practices for launching Emacs on Windows 7/8
  2013-02-18 19:59 Ludwig, Mark
@ 2013-02-19 18:44 ` "Jérôme M. Berger"
  0 siblings, 0 replies; 8+ messages in thread
From: "Jérôme M. Berger" @ 2013-02-19 18:44 UTC (permalink / raw)
  To: help-gnu-emacs

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

Ludwig, Mark wrote:
> What are the best practices for using/launching Emacs as Server
> on Windows 7/8?
> 
> For example, on Windows Vista, I used to be able to make a file
> association with .TXT files that invoked emacsclient with the
> --alternate-editor=runemacs option so that if Emacs wasn't
> running, it would be launched.
> 
> In Windows 7 and 8, the GUI simply does not allow any options.  I
> am not sure if I could hack the registry directly to stuff the
> options in there, but since the GUI no longer supports it, I fear
> the underlying support might not be there either.  I have
> considered trying to associate .TXT with something like a
> Emacs.BAT/Emacs.CMD file that could invoke emacsclient with
> options, but this has its own problems, and seems like a bad idea
> for ultimately launching a "windows mode" program Emacs.exe
> (which is not a "command line mode" program).
> 
> I am wondering what others do.
> 
> Perhaps I'm expecting too much automation, for example, the idea
> that if Emacs Server isn't already running, it gets launched
> seamlessly?
> 
	I use emacsclient with the --alternate-editor=runemacs option in
Windows 7. Can't remember for sure how I set it up (I'm at home on
Linux right now), but I'm sure I did it from the GUI without any
fancy registry editing or stuff. IIRC you need to first create the
shortcut without specifying command line options, then go to the
shortcut properties (with A-RET or the context menu) where you
should find a field to add the options (can't remember whether there
is a specific field or whether you can add the options directly
after the executable name).

		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] 8+ messages in thread

* Re: Best practices for launching Emacs on Windows 7/8
       [not found] <mailman.20310.1361217600.855.help-gnu-emacs@gnu.org>
@ 2013-02-20 13:36 ` Jason Rumney
  2013-02-21 15:23   ` Ludwig, Mark
  2013-02-21 15:56   ` Ludwig, Mark
  0 siblings, 2 replies; 8+ messages in thread
From: Jason Rumney @ 2013-02-20 13:36 UTC (permalink / raw)
  To: gnu.emacs.help; +Cc: help-gnu-emacs@gnu.org

On Tuesday, 19 February 2013 03:59:43 UTC+8, Ludwig, Mark  wrote:

> For example, on Windows Vista, I used to be able to make a file
> association with .TXT files that invoked emacsclient with the
> --alternate-editor=runemacs option so that if Emacs wasn't
> running, it would be launched.
> 
> In Windows 7 and 8, the GUI simply does not allow any options.

Setting ALTERNATE_EDITOR as an environment variable is an alternative to using the command line option.  At least in Windows 7 environment variables are still accessible from the Advanced properties of "My Computer".



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

* Re: Best practices for launching Emacs on Windows 7/8
@ 2013-02-20 16:30 Buchs, Kevin
  0 siblings, 0 replies; 8+ messages in thread
From: Buchs, Kevin @ 2013-02-20 16:30 UTC (permalink / raw)
  To: help-gnu-emacs, J?r?me M. Berger

Jerome, 

I think Mark was speaking of setting up a file association, so, for
example, all files with .TXT extension will open emacsclient. That is
the part that is restricted in Win-7 or worse. Setting up a shortcut is
still easy to do, like you describe.

Kevin Buchs | Senior Engineer | SPPDG | 507-538-5459 |
buchs.kevin@mayo.edu
Mayo Clinic | 200 First Street SW | Rochester, MN 55905 |
http://www.mayo.edu

-----Original Message-----
	I use emacsclient with the --alternate-editor=runemacs option in
Windows 7. Can't remember for sure how I set it up (I'm at home on Linux
right now), but I'm sure I did it from the GUI without any fancy
registry editing or stuff. IIRC you need to first create the shortcut
without specifying command line options, then go to the shortcut
properties (with A-RET or the context menu) where you should find a
field to add the options (can't remember whether there is a specific
field or whether you can add the options directly after the executable
name).



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

* RE: Best practices for launching Emacs on Windows 7/8
  2013-02-20 13:36 ` Best practices for launching Emacs on Windows 7/8 Jason Rumney
@ 2013-02-21 15:23   ` Ludwig, Mark
  2013-02-21 15:37     ` W. Greenhouse
  2013-02-21 15:56   ` Ludwig, Mark
  1 sibling, 1 reply; 8+ messages in thread
From: Ludwig, Mark @ 2013-02-21 15:23 UTC (permalink / raw)
  To: Jason Rumney, gnu.emacs.help@googlegroups.com; +Cc: help-gnu-emacs@gnu.org

> From: Jason Rumney, Wednesday, February 20, 2013 7:37 AM
> 
> On Tuesday, 19 February 2013 03:59:43 UTC+8, Ludwig, Mark  wrote:
> 
> > For example, on Windows Vista, I used to be able to make a file
> > association with .TXT files that invoked emacsclient with the
> > --alternate-editor=runemacs option so that if Emacs wasn't
> > running, it would be launched.
> >
> > In Windows 7 and 8, the GUI simply does not allow any options.
> 
> Setting ALTERNATE_EDITOR as an environment variable is an alternative to
> using the command line option.  At least in Windows 7 environment variables
> are still accessible from the Advanced properties of "My Computer".

Thanks, everyone!

When I looked back at what I had on Vista, I found that I was using Emacs 23.1 and working around a bug in emacsclientw that, if Emacs wasn't running as a server, insisted on popping up an error dialog box that had to be manually dismissed.  (My workaround was a very complicated command line using NirCmd to launch emacsclient but keep it hidden.  Because it was emacsclient, I also needed the --no-wait option.)  Now that I'm on Emacs 24.2, I can use emacsclientw directly (which does not need --no-wait); combined with setting the ALTERNATE_EDITOR environmental variable, it all works perfectly by simply associating emacsclientw using the regular file association GUI.  It's very nice.

In reviewing the documentation in http://www.gnu.org/software/emacs/manual/html_node/emacs/emacsclient-Options.html, it incorrectly claims:

   '-a command'
   '--alternate-editor=command'
   Specify a command to run if emacsclient fails to contact Emacs. This is useful when running emacsclient in a script. 
   As a special exception, if command is the empty string, then emacsclient starts Emacs in daemon mode (as emacs --daemon) and then tries connecting again. 

Instead with an empty string, emacsclient/emacsclientw 24.2 complain:

   --alternate-editor argument or ALTERNATE_EDITOR variable cannot be
   an empty string

Is this a documentation problem or is the code incorrect?  That is, which way should I report the bug?

Side-question: I have (server-start) in my init (which is fairly complicated), so I use runemacs and never use emacs --daemon, but I wonder if there's any effective difference.  Is there anything really special about emacs --daemon that I might be missing by using (server-start) myself?

Cheers,
Mark

P.S. I am not subscribed to gnu.emacs.help, so cannot post there.  Can someone else forward this or is there a gateway from help-gnu-emacs?




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

* Re: Best practices for launching Emacs on Windows 7/8
  2013-02-21 15:23   ` Ludwig, Mark
@ 2013-02-21 15:37     ` W. Greenhouse
  0 siblings, 0 replies; 8+ messages in thread
From: W. Greenhouse @ 2013-02-21 15:37 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

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

Hi Mark,

"Ludwig, Mark" <ludwig.mark-kv7WeFo6aLtBDgjK7y7TUQ@public.gmane.org> writes:

> In reviewing the documentation in
> http://www.gnu.org/software/emacs/manual/html_node/emacs/emacsclient-Options.html,
> it incorrectly claims:
>
>    '-a command'
>    '--alternate-editor=command'
>    Specify a command to run if emacsclient fails to contact Emacs. This is useful when running emacsclient in a script. 
>    As a special exception, if command is the empty string, then
> emacsclient starts Emacs in daemon mode (as emacs --daemon) and then
> tries connecting again.
>
> Instead with an empty string, emacsclient/emacsclientw 24.2 complain:
>
>    --alternate-editor argument or ALTERNATE_EDITOR variable cannot be
>    an empty string
>
> Is this a documentation problem or is the code incorrect?  That is,
> which way should I report the bug?

Sounds like a documentation bug.  The Info node/online manual entry for
Emacsclient is correct with respect to Emacs on UNIX-like systems, where
launching emacsclient with ALTERNATE_EDITOR set to the empty string does
launch an emacs daemon and then immediately attach a client to it.
emacsclientw is subtly different from emacsclient, and this is one of
the ways.

> Side-question: I have (server-start) in my init (which is fairly
> complicated), so I use runemacs and never use emacs --daemon, but I
> wonder if there's any effective difference.  Is there anything really
> special about emacs --daemon that I might be missing by using
> (server-start) myself?

The initialization and behavior of a normal, interactive Emacs with
(server-start) vs. an Emacs invoked with emacs --daemon is subtly
different.  This is because the "normal" Emacs has a GUI window or a
terminal as its "initial frame," whereas the "initial frame" of an emacs
--daemon instance is not displayed to the user at all.  This matters for
things like what happens if you kill the sole GUI window/emacs frame
displayed on the system (for a "normal" Emacs, this will kill Emacs, but
for emacs --daemon it keeps running backgrounded), and for some
initialization issues like font selection and detection of whether Emacs
is running under a window system or not (operations on the "initial
frame" of an Emacs daemon that are supposed to detect the windowing
environment or set fonts won't do anything, because they're operating on
that backgrounded not-a-frame-at-all daemon frame; you should use
variables such as default-frame-alist or after-make-frame-functions
instead).

As far as the server/emacsclient functionality they're the same, though.

> Cheers,
> Mark
>
> P.S. I am not subscribed to gnu.emacs.help, so cannot post there.  Can
> someone else forward this or is there a gateway from help-gnu-emacs?

It's a gateway to help-gnu-emacs.

--
Regards,
WGG

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* RE: Best practices for launching Emacs on Windows 7/8
  2013-02-20 13:36 ` Best practices for launching Emacs on Windows 7/8 Jason Rumney
  2013-02-21 15:23   ` Ludwig, Mark
@ 2013-02-21 15:56   ` Ludwig, Mark
  1 sibling, 0 replies; 8+ messages in thread
From: Ludwig, Mark @ 2013-02-21 15:56 UTC (permalink / raw)
  To: Jason Rumney, gnu.emacs.help@googlegroups.com; +Cc: help-gnu-emacs@gnu.org

[Resending with nicer line breaks for text readers]

> From: Jason Rumney, Wednesday, February 20, 2013 7:37 AM
> 
> On Tuesday, 19 February 2013 03:59:43 UTC+8, Ludwig, Mark  wrote:
> 
> > For example, on Windows Vista, I used to be able to make a file
> > association with .TXT files that invoked emacsclient with the
> > --alternate-editor=runemacs option so that if Emacs wasn't
> > running, it would be launched.
> >
> > In Windows 7 and 8, the GUI simply does not allow any options.
> 
> Setting ALTERNATE_EDITOR as an environment variable is an alternative to
> using the command line option.  At least in Windows 7 environment variables
> are still accessible from the Advanced properties of "My Computer".

Thanks, everyone!

When I looked back at what I had on Vista, I found that I was
using Emacs 23.1 and working around a bug in emacsclientw that,
if Emacs wasn't running as a server, insisted on popping up an
error dialog box that had to be manually dismissed.  (My
workaround was a very complicated command line using NirCmd to
launch emacsclient but keep it hidden.  Because it was
emacsclient, I also needed the --no-wait option.)  Now that I'm
on Emacs 24.2, I can use emacsclientw directly (which does not
need --no-wait); combined with setting the ALTERNATE_EDITOR
environmental variable, it all works perfectly by simply
associating emacsclientw using the regular file association GUI.
It's very nice.

In reviewing the documentation in
http://www.gnu.org/software/emacs/manual/html_node/emacs/emacsclient-Options.html,
it incorrectly claims:

   '-a command'
   '--alternate-editor=command'
   Specify a command to run if emacsclient fails to contact Emacs. This is useful when running emacsclient in a script. 
   As a special exception, if command is the empty string, then emacsclient starts Emacs in daemon mode (as emacs --daemon) and then tries connecting again. 

Instead with an empty string, emacsclient/emacsclientw 24.2 complain:

   --alternate-editor argument or ALTERNATE_EDITOR variable cannot be
   an empty string

Is this a documentation problem or is the code incorrect?  That
is, which way should I report the bug?

Side-question: I have (server-start) in my init (which is fairly
complicated), so I use runemacs and never use emacs --daemon, but
I wonder if there's any effective difference.  Is there anything
really special about emacs --daemon that I might be missing by
using (server-start) myself?

Cheers,
Mark

P.S. I am not subscribed to gnu.emacs.help, so cannot post there.
     Can someone else forward this or is there a gateway from
     help-gnu-emacs?



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

end of thread, other threads:[~2013-02-21 15:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.20310.1361217600.855.help-gnu-emacs@gnu.org>
2013-02-20 13:36 ` Best practices for launching Emacs on Windows 7/8 Jason Rumney
2013-02-21 15:23   ` Ludwig, Mark
2013-02-21 15:37     ` W. Greenhouse
2013-02-21 15:56   ` Ludwig, Mark
2013-02-20 16:30 Buchs, Kevin
  -- strict thread matches above, loose matches on Subject: below --
2013-02-19 17:36 Buchs, Kevin
2013-02-18 19:59 Ludwig, Mark
2013-02-19 18:44 ` "Jérôme M. Berger"

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.