[O] Emacs server and org-protocol

2014-09-17 Thread Gonzalo Camarillo
Hi,

I am using org-protocol to have my firefox browser talk to my emacs (to
capture stuff).

I am using Windows 7. So, I cannot use the --daemon flag to simply start
a sever (it is not supported under Windows). Instead, I have added a
(server-start) line to my .emacs file (init.el).

When I run emacs for the first time, everything works correctly (i.e.,
the server starts and I can connect to it from firefox). However, when I
open a second instance of emacs, it processes again the .emacs file and,
thus, I get the following error:

 Warning (server): Unable to start the Emacs server.
 There is an existing Emacs server, named server.
 To start the server in this Emacs process, stop the existing
 server or call `M-x server-force-delete' to forcibly disconnect it.

Does anybody know a workaround so that the server is only started
once?... maybe in connection to opening a particular .org file?

Thanks,

Gonzalo




Re: [O] Emacs server and org-protocol

2014-09-17 Thread Paul Rudin
Gonzalo Camarillo gcama...@gmail.com writes:


 Does anybody know a workaround so that the server is only started
 once?... 

Does the function server-running-p work on windows? If so then you can
replace (server-start) with (unless (server-running-p) (server-start)).





Re: [O] Emacs server and org-protocol

2014-09-17 Thread Fabrice Popineau
What is the purpose of opening a second instance of emacs ?
I precisely tend to avoid it.

If the emacs server is running, why not using emacsclient(w) instead of a
new instance ?

Fabrice

2014-09-17 9:26 GMT+02:00 Gonzalo Camarillo gcama...@gmail.com:

 Hi,

 I am using org-protocol to have my firefox browser talk to my emacs (to
 capture stuff).

 I am using Windows 7. So, I cannot use the --daemon flag to simply start
 a sever (it is not supported under Windows). Instead, I have added a
 (server-start) line to my .emacs file (init.el).

 When I run emacs for the first time, everything works correctly (i.e.,
 the server starts and I can connect to it from firefox). However, when I
 open a second instance of emacs, it processes again the .emacs file and,
 thus, I get the following error:

  Warning (server): Unable to start the Emacs server.
  There is an existing Emacs server, named server.
  To start the server in this Emacs process, stop the existing
  server or call `M-x server-force-delete' to forcibly disconnect it.

 Does anybody know a workaround so that the server is only started
 once?... maybe in connection to opening a particular .org file?

 Thanks,

 Gonzalo





-- 
Fabrice Popineau
-
SUPELEC
Département Informatique
3, rue Joliot Curie
91192 Gif/Yvette Cedex
Tel direct : +33 (0) 169851950
Standard : +33 (0) 169851212
--


Re: [O] Emacs server and org-protocol

2014-09-17 Thread Paul Rudin
Fabrice Popineau fabrice.popin...@supelec.fr writes:

 What is the purpose of opening a second instance of emacs ? 
 I precisely tend to avoid it.

There are situations where it can be useful - e.g. using emacs as
a news or mail client where the whole process can block for a few
seconds.




Re: [O] Emacs server and org-protocol

2014-09-17 Thread Thorsten Jolitz
Fabrice Popineau fabrice.popin...@supelec.fr writes:

 What is the purpose of opening a second instance of emacs ? 
 I precisely tend to avoid it.

 If the emacs server is running, why not using emacsclient(w) instead
 of a new instance ?

I had that setup for quite some time - starting one Emacs server on the
console, and then several emacsclients as parts of tmux and stumpwm
window configurations. 

But it crashed too often - and it was just too painful to recover all
the emacsclients in all the window-configurations. 

So nowadays I have one (non-server) Emacs instance for doing the real
work, and another server instance which I use for the convenience of
getting emacsclients everywhere for some quick adhoc stuff, without
caring much when it crashes.

-- 
cheers,
Thorsten




Re: [O] Emacs server and org-protocol

2014-09-17 Thread Gonzalo Camarillo
Hi Paul,

yes, adding (require 'server) makes the function available. That is exactly
what I was looking for. Thanks for the quick response!

Cheers,

Gonzalo


On Wed, Sep 17, 2014 at 9:36 AM, Paul Rudin p...@rudin.co.uk wrote:

 Gonzalo Camarillo gcama...@gmail.com writes:


  Does anybody know a workaround so that the server is only started
  once?...

 Does the function server-running-p work on windows? If so then you can
 replace (server-start) with (unless (server-running-p) (server-start)).






Re: [O] Emacs server and org-protocol

2014-09-17 Thread Fabrice Popineau
2014-09-17 9:56 GMT+02:00 Paul Rudin p...@rudin.co.uk:

 Fabrice Popineau fabrice.popin...@supelec.fr writes:

  What is the purpose of opening a second instance of emacs ?
  I precisely tend to avoid it.

 There are situations where it can be useful - e.g. using emacs as
 a news or mail client where the whole process can block for a few
 seconds.


Yes seconds or even much more.
This is the reason I don't use Emacs to read my mail/news anymore :-/

-- 
Fabrice


Re: [O] Emacs server and org-protocol

2014-09-17 Thread Alexis

Fabrice Popineau writes:

 Yes seconds or even much more.
 This is the reason I don't use Emacs to read my mail/news anymore :-/

If i may ask, which email front-end were you using? (Gnus, perhaps?) i
used to use notmuch.el, and currently use mu4e, and basically don't have
this issue 


Alexis.



Re: [O] Emacs server and org-protocol

2014-09-17 Thread Alexis

Eric S Fraga writes:

 The issue is not the email front-end per se but the email servers (IMAP,
 POP, whatever).  A couple of years ago, I ended up having to use an
 email server that would take many seconds, often minutes, to access,
 even just to query to find out if there was any new email.

Well, i run getmail+procmail to fetch and sort my mail, so if a server
is running slowly, that doesn't affect Emacs. Emacs is only affected by
e.g. mu indexing newly-arrived emails, which is fast enough that i don't
notice it.


Alexis.



Re: [O] Emacs server and org-protocol

2014-09-17 Thread Eric S Fraga
On Wednesday, 17 Sep 2014 at 18:54, Alexis wrote:

[...]

 If i may ask, which email front-end were you using? (Gnus, perhaps?) i
 used to use notmuch.el, and currently use mu4e, and basically don't have
 this issue 

The issue is not the email front-end per se but the email servers (IMAP,
POP, whatever).  A couple of years ago, I ended up having to use an
email server that would take many seconds, often minutes, to access,
even just to query to find out if there was any new email.

The easiest solution, for me, was to get into the habit of starting two
emacs instances.  The first for all my work (org, writing, coding, etc.)
and a second just for email.  The first starts the emacs server so
emacsclient always goes to the non-email instance.  I've been doing this
for two years now and it has become second nature for me.

Obviously, the real fix is to have proper multi-threading in Emacs and,
as in nuclear fusion, this will be with us *soon* ;-)

-- 
: Eric S Fraga, GnuPG: 0xFFFCF67D
: in Emacs 24.4.50.1 + Ma Gnus v0.12 + evil-git-0469bee
: BBDB version 3.1.2 (2014-05-06 11:45:08 -0500)


signature.asc
Description: PGP signature


Re: [O] Emacs server and org-protocol

2014-09-17 Thread Fabrice Popineau
2014-09-17 11:06 GMT+02:00 Eric S Fraga e.fr...@ucl.ac.uk:

 On Wednesday, 17 Sep 2014 at 18:54, Alexis wrote:

 [...]

  If i may ask, which email front-end were you using? (Gnus, perhaps?) i
  used to use notmuch.el, and currently use mu4e, and basically don't have
  this issue 

 The issue is not the email front-end per se but the email servers (IMAP,
 POP, whatever).  A couple of years ago, I ended up having to use an
 email server that would take many seconds, often minutes, to access,
 even just to query to find out if there was any new email.

 The easiest solution, for me, was to get into the habit of starting two
 emacs instances.  The first for all my work (org, writing, coding, etc.)
 and a second just for email.  The first starts the emacs server so
 emacsclient always goes to the non-email instance.  I've been doing this
 for two years now and it has become second nature for me.

 Obviously, the real fix is to have proper multi-threading in Emacs and,
 as in nuclear fusion, this will be with us *soon* ;-)


I disagree on this. The problem is less servers than the sheer slowness of
elisp.
And Gnus offers so many fancy opportunities to process your mail that it is
easy to
overuse it.

Emacs won't become any more efficient without switching its own elisp
implementation to something with a true compiler (or jit).

Threading would gain some responsiveness, but that may not be so obvious
nor so easy to implement.
http://www.emacswiki.org/emacs/ConcurrentEmacs
http://www.emacswiki.org/emacs/NoThreading

Fabrice


Re: [O] Emacs server and org-protocol

2014-09-17 Thread Eric S Fraga
On Wednesday, 17 Sep 2014 at 11:41, Fabrice Popineau wrote:

[...]

 I disagree on this. The problem is less servers than the sheer slowness of
 elisp.

Sure, elisp is not fast but I it seems to be perfectly fast enough for
me for gnus, even on my little OpenPandora.  In my case, the limiting
factor is the email server and not elisp.  YMMV, of course!

-- 
: Eric S Fraga, GnuPG: 0xFFFCF67D
: in Emacs 24.4.50.1 + Ma Gnus v0.12 + evil-git-0469bee
: BBDB version 3.1.2 (2014-05-06 11:45:08 -0500)


signature.asc
Description: PGP signature


Re: [O] Emacs server and org-protocol

2014-09-17 Thread Stefan Huchler
I dont really get what the problem is here, email servers checkup is
fast enough, and rss u can use that:

nnrss-use-local to ‘t’ and use ‘nnrss-generate-download-script





Re: [O] Emacs server and org-protocol

2014-09-17 Thread Rainer M Krug
Stefan Huchler stefan.huch...@mail.de writes:

 I dont really get what the problem is here, email servers checkup is

Not necessarily - depends which mail server (e.g. gmail or local), if
you have one or many folders / tags, your network connection, ...

Often used solution:

mail server (e.g. gmail) - offlineimap - local imap server - gnus -
the user

So offlineimap runs in the background and the local email server check
is fast enough.

I have two instances running, because of longer calculation in my second
(non-email) emacs instance...

Cheers,

Rainer


 fast enough, and rss u can use that:

 nnrss-use-local to ‘t’ and use ‘nnrss-generate-download-script





-- 
Rainer M. Krug
email: Raineratkrugsdotde
PGP: 0x0F52F982


pgpSiQ7VoGtAL.pgp
Description: PGP signature


Re: [O] Emacs server and org-protocol

2014-09-17 Thread Brett Viren
Alexis flexibe...@gmail.com writes:

 If i may ask, which email front-end were you using? (Gnus, perhaps?) i
 used to use notmuch.el, and currently use mu4e, and basically don't have
 this issue 

My GNUS + IMAP subprocess + Maildir used to lead to long wait times when
updating for new mail (g in Groups).  Things have now vastly improved
since moving my Maildirs to a SSD.

-Brett.


pgpdCvvL5sXuj.pgp
Description: PGP signature


Re: [O] Emacs server and org-protocol

2014-09-17 Thread Stefan Huchler
Rainer M Krug rai...@krugs.de writes:

 Stefan Huchler stefan.huch...@mail.de writes:

 I dont really get what the problem is here, email servers checkup is

 Not necessarily - depends which mail server (e.g. gmail or local), if
 you have one or many folders / tags, your network connection, ...

I just did setup the nnrss-download thing and yes mail still takes a bit
longer. I dont even see the big problem in waithing here 2 seks or so,
dont have to check my mails every 10 mins.

What I have more a problem with is that it often hangs have to cancel it
at least every seond time.

And btw is there a way to update my rss things in emacs every 10 mins
automaticly? because if it automaticly downloads every 10 mins the xml
files it would make sense taht in gnus u see the new entries automaticly
after that.

and yes a local email (offline-email-server) would be the solution for
mail, but I am to lazy to setup and backup all that data :)




Re: [O] Emacs server and org-protocol

2014-09-17 Thread Alexis

Stefan Huchler writes:

 What I have more a problem with is that it often hangs have to cancel
 it at least every seond time.

Sounds like something that might need to be reported as a bug?


Alexis.