unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Is it possible to use emacsclient as the Gnome system editor?
@ 2006-11-21 13:22 Steinar Bang
  2006-11-21 13:59 ` Lennart Borgman
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Steinar Bang @ 2006-11-21 13:22 UTC (permalink / raw)


Platform: Intel Pentium M, Ubuntu Dapper,
	  Gnome desktop (2.14.3-0ubuntu1)
	  emacs21 21.4a-3ubuntu2

I'm trying to use emacsclient, instead of gedit, as the default Gnome
text editor.

Googling found me this howto:
	http://ubuntuforums.org/showthread.php?t=299086

But this requires that there is a .desktop entry for the replacement
editor.  On my system there is an emacs21.desktop.  But using that
would fire up a new emacs for each file opened, and that's not what I
want. 

So what I wonder is: is it possible to create an emacsclient.desktop
entry?  Or is desktop entry for emacsclient a meaningless concept?

Basically: Is it possible to use emacsclient as the Gnome system
editor? 

Thanx!


- Steinar

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

* Re: Is it possible to use emacsclient as the Gnome system editor?
       [not found] <mailman.934.1164115395.2155.help-gnu-emacs@gnu.org>
@ 2006-11-21 13:42 ` Charles philip Chan
  2006-11-22  7:40   ` Steinar Bang
  2006-11-21 18:07 ` Olive
  1 sibling, 1 reply; 11+ messages in thread
From: Charles philip Chan @ 2006-11-21 13:42 UTC (permalink / raw)


On 21 Nov 2006, sb@dod.no wrote:

> So what I wonder is: is it possible to create an emacsclient.desktop
> entry?  Or is desktop entry for emacsclient a meaningless concept?

Yes.

(1) Copy emacs.desktop to emacsclient.desktop

(2) Open the emacsclient.desktop file in an edit

(3) Change the command from emacs to emacsclient

Charles

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

* Re: Is it possible to use emacsclient as the Gnome system editor?
  2006-11-21 13:22 Is it possible to use emacsclient as the Gnome system editor? Steinar Bang
@ 2006-11-21 13:59 ` Lennart Borgman
  2006-11-21 14:07 ` Leo
       [not found] ` <mailman.938.1164117578.2155.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 11+ messages in thread
From: Lennart Borgman @ 2006-11-21 13:59 UTC (permalink / raw)


Steinar Bang wrote:
> Platform: Intel Pentium M, Ubuntu Dapper,
> 	  Gnome desktop (2.14.3-0ubuntu1)
> 	  emacs21 21.4a-3ubuntu2
> 
> I'm trying to use emacsclient, instead of gedit, as the default Gnome
> text editor.
> 
> Googling found me this howto:
> 	http://ubuntuforums.org/showthread.php?t=299086
> 
> But this requires that there is a .desktop entry for the replacement
> editor.  On my system there is an emacs21.desktop.  But using that
> would fire up a new emacs for each file opened, and that's not what I
> want. 
> 
> So what I wonder is: is it possible to create an emacsclient.desktop
> entry?  Or is desktop entry for emacsclient a meaningless concept?
> 
> Basically: Is it possible to use emacsclient as the Gnome system
> editor? 


Basically: yes. However with the current emacsclient you have to start 
emacs first. There has currently been a discussion on the emacs devel 
list where I have tried to argue that in Emacs 22 emacsclient should be 
able to automatically start emacs when needed. I think most people there 
would agree it is a good (but for many not very important) thing. 
However it does not seem that it will make it into Emacs 22.

I have this working on MS Windows at the moment, but I am not sure the 
code is working on GNU/Linux. Testers are welcome.

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

* Re: Is it possible to use emacsclient as the Gnome system editor?
  2006-11-21 13:22 Is it possible to use emacsclient as the Gnome system editor? Steinar Bang
  2006-11-21 13:59 ` Lennart Borgman
@ 2006-11-21 14:07 ` Leo
       [not found] ` <mailman.938.1164117578.2155.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 11+ messages in thread
From: Leo @ 2006-11-21 14:07 UTC (permalink / raw)


On Tue, 21/11/06, Steinar Bang wrote:

> So what I wonder is: is it possible to create an emacsclient.desktop
> entry?  Or is desktop entry for emacsclient a meaningless concept?
>
> Basically: Is it possible to use emacsclient as the Gnome system
> editor? 

Create the .desktop file and then edit
/usr/share/applications/defaults.list

-- 
Leo

The next release of Fedora will unify core and extras.
http://fedoraproject.org/wiki/FedoraSummit

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

* Re: Is it possible to use emacsclient as the Gnome system editor?
       [not found] ` <mailman.938.1164117578.2155.help-gnu-emacs@gnu.org>
@ 2006-11-21 14:25   ` David Kastrup
  2006-11-21 15:34     ` Lennart Borgman
  0 siblings, 1 reply; 11+ messages in thread
From: David Kastrup @ 2006-11-21 14:25 UTC (permalink / raw)


Lennart Borgman <lennart.borgman.073@student.lu.se> writes:

> Basically: yes. However with the current emacsclient you have to start
> emacs first.

Not true.  You can use `-a emacs' in the emacsclient invocation.

> There has currently been a discussion on the emacs devel list where
> I have tried to argue that in Emacs 22 emacsclient should be able to
> automatically start emacs when needed. I think most people there
> would agree it is a good (but for many not very important)
> thing. However it does not seem that it will make it into Emacs 22.

For the GNOME association, the above should do the trick perfectly
well.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

* Re: Is it possible to use emacsclient as the Gnome system editor?
  2006-11-21 14:25   ` David Kastrup
@ 2006-11-21 15:34     ` Lennart Borgman
  2006-11-22  7:53       ` Steinar Bang
       [not found]       ` <mailman.977.1164182027.2155.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 11+ messages in thread
From: Lennart Borgman @ 2006-11-21 15:34 UTC (permalink / raw)
  Cc: help-gnu-emacs

David Kastrup wrote:
> Lennart Borgman <lennart.borgman.073@student.lu.se> writes:
> 
>> Basically: yes. However with the current emacsclient you have to start
>> emacs first.
> 
> Not true.  You can use `-a emacs' in the emacsclient invocation.
> 
>> There has currently been a discussion on the emacs devel list where
>> I have tried to argue that in Emacs 22 emacsclient should be able to
>> automatically start emacs when needed. I think most people there
>> would agree it is a good (but for many not very important)
>> thing. However it does not seem that it will make it into Emacs 22.
> 
> For the GNOME association, the above should do the trick perfectly
> well.
> 

Yes, you are right. However you have also to start emacs server in your 
init files.

The more problematic case is when you want to use emacs as an edit 
server for another program and wait. In that case you have to have emacs 
started first.

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

* Re: Is it possible to use emacsclient as the Gnome system editor?
       [not found] <mailman.934.1164115395.2155.help-gnu-emacs@gnu.org>
  2006-11-21 13:42 ` Charles philip Chan
@ 2006-11-21 18:07 ` Olive
  2006-11-21 19:11   ` Juanma Barranquero
  1 sibling, 1 reply; 11+ messages in thread
From: Olive @ 2006-11-21 18:07 UTC (permalink / raw)


Steinar Bang wrote:
> Platform: Intel Pentium M, Ubuntu Dapper,
> 	  Gnome desktop (2.14.3-0ubuntu1)
> 	  emacs21 21.4a-3ubuntu2
> 
> I'm trying to use emacsclient, instead of gedit, as the default Gnome
> text editor.
> 
> Googling found me this howto:
> 	http://ubuntuforums.org/showthread.php?t=299086
> 
> But this requires that there is a .desktop entry for the replacement
> editor.  On my system there is an emacs21.desktop.  But using that
> would fire up a new emacs for each file opened, and that's not what I
> want. 
> 
> So what I wonder is: is it possible to create an emacsclient.desktop
> entry?  Or is desktop entry for emacsclient a meaningless concept?
> 
> Basically: Is it possible to use emacsclient as the Gnome system
> editor? 
> 
> Thanx!
> 
> 
> - Steinar
> 
> 
> 

To complete what others have said, I start emacs with a (very) small 
script; if a server is running it use it otherwise it launch a new emacs 
process:

#! /bin/sh
emacsclient -n "$@" &> /dev/null || exec emacs "$@"

Olive

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

* Re: Is it possible to use emacsclient as the Gnome system editor?
  2006-11-21 18:07 ` Olive
@ 2006-11-21 19:11   ` Juanma Barranquero
  0 siblings, 0 replies; 11+ messages in thread
From: Juanma Barranquero @ 2006-11-21 19:11 UTC (permalink / raw)
  Cc: help-gnu-emacs

On 11/21/06, Olive <olive@noemail.org> wrote:

> #! /bin/sh
> emacsclient -n "$@" &> /dev/null || exec emacs "$@"

You can do simply:

 #! /bin/sh
 emacsclient -a emacs -n "$@"

                    /L/e/k/t/u

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

* Re: Is it possible to use emacsclient as the Gnome system editor?
  2006-11-21 13:42 ` Charles philip Chan
@ 2006-11-22  7:40   ` Steinar Bang
  0 siblings, 0 replies; 11+ messages in thread
From: Steinar Bang @ 2006-11-22  7:40 UTC (permalink / raw)


>>>>> "Charles philip Chan" <cpchan@sympatico.ca>:

> On 21 Nov 2006, sb@dod.no wrote:
>> So what I wonder is: is it possible to create an emacsclient.desktop
>> entry?  Or is desktop entry for emacsclient a meaningless concept?

> Yes.

> (1) Copy emacs.desktop to emacsclient.desktop

> (2) Open the emacsclient.desktop file in an edit

> (3) Change the command from emacs to emacsclient

Thanx to all who has responded in this thread!  This worked great! :-)

What I now have is a $HOME/.local/share/applications/defaults.list
file that looks like this:

[Default Applications]
text/plain=emacsclient.desktop
text/xml=emacsclient.desktop
application/x-perl=emacsclient.desktop
text/x-chdr=emacsclient.desktop
text/x-csrc=emacsclient.desktop
text/x-dtd=emacsclient.desktop
text/x-java=emacsclient.desktop
text/mathml=emacsclient.desktop
text/x-python=emacsclient.desktop
text/x-sql=emacsclient.desktop

I had to map more types than text/plain to get it working.  I would
have added text/html and application/xhtml+xml as well, because the
reason I'm doing this is to make GNU Emacs the system editor from
eclipse's PPW.  But I was afraid that changing those would interfer
with the Gnome desktop's operation.

The emacsclient.desktop file I ended up with, and which works for me,
looks like this (I changed as little as possible):

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=Emacs 21 (X11)
GenericName=Emacs
Comment=GNU Emacs 21 Text Editor
Exec=/usr/bin/emacsclient
TryExec=emacsclient
Terminal=false
Type=Application
Icon=/usr/share/emacs/21.4/etc/gnu-32x32.xpm
Categories=Application;Development;
MimeType=text/plain

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

* Re: Is it possible to use emacsclient as the Gnome system editor?
  2006-11-21 15:34     ` Lennart Borgman
@ 2006-11-22  7:53       ` Steinar Bang
       [not found]       ` <mailman.977.1164182027.2155.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 11+ messages in thread
From: Steinar Bang @ 2006-11-22  7:53 UTC (permalink / raw)


>>>>> Lennart Borgman <lennart.borgman.073@student.lu.se>:

> David Kastrup wrote:
>> Lennart Borgman <lennart.borgman.073@student.lu.se> writes:

>>> Basically: yes. However with the current emacsclient you have to
>>> start emacs first.

>> Not true.  You can use `-a emacs' in the emacsclient invocation.
[snip!]

> Yes, you are right. However you have also to start emacs server in
> your init files.

That may be a problem for me, I think.  Since my use pattern is to
have multiple emacsen up an running (one for Gnus, and misc stuff, one
for development, and occasionally one running as root, and also
possibly emacsen running on development servers).  I've also
CVS-versioned my home directory, so I have the same setup files
everywhere. 

I wonder if there is there some emacs lisp magic for my ~/.emacs, that
could check for a running emacs server, and only start it if one isn't
already running...?

None of the server-* functions seems appropriate for this.  I'm not
sure what the LEAVE-DEAD argument of server-start does?  Is this the
same as what the documentation refers to as the prefix argument?
(well, I'm not sure if I understood what that one did either...:-) )

Thanx!


- Steinar

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

* Re: Is it possible to use emacsclient as the Gnome system editor?
       [not found]       ` <mailman.977.1164182027.2155.help-gnu-emacs@gnu.org>
@ 2006-11-22 10:08         ` David Kastrup
  0 siblings, 0 replies; 11+ messages in thread
From: David Kastrup @ 2006-11-22 10:08 UTC (permalink / raw)


Steinar Bang <sb@dod.no> writes:

>> Yes, you are right. However you have also to start emacs server in
>> your init files.
>
> That may be a problem for me, I think.  Since my use pattern is to
> have multiple emacsen up an running (one for Gnus, and misc stuff,
> one for development, and occasionally one running as root, and also
> possibly emacsen running on development servers).  I've also
> CVS-versioned my home directory, so I have the same setup files
> everywhere.
>
> I wonder if there is there some emacs lisp magic for my ~/.emacs,
> that could check for a running emacs server, and only start it if
> one isn't already running...?

That is the default behavior.

> None of the server-* functions seems appropriate for this.  I'm not
> sure what the LEAVE-DEAD argument of server-start does?  Is this the
> same as what the documentation refers to as the prefix argument?

Yes.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

end of thread, other threads:[~2006-11-22 10:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-21 13:22 Is it possible to use emacsclient as the Gnome system editor? Steinar Bang
2006-11-21 13:59 ` Lennart Borgman
2006-11-21 14:07 ` Leo
     [not found] ` <mailman.938.1164117578.2155.help-gnu-emacs@gnu.org>
2006-11-21 14:25   ` David Kastrup
2006-11-21 15:34     ` Lennart Borgman
2006-11-22  7:53       ` Steinar Bang
     [not found]       ` <mailman.977.1164182027.2155.help-gnu-emacs@gnu.org>
2006-11-22 10:08         ` David Kastrup
     [not found] <mailman.934.1164115395.2155.help-gnu-emacs@gnu.org>
2006-11-21 13:42 ` Charles philip Chan
2006-11-22  7:40   ` Steinar Bang
2006-11-21 18:07 ` Olive
2006-11-21 19:11   ` Juanma Barranquero

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).