all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* resending... desktop files not working for recent ubuntu?
@ 2016-05-30 15:04 Rustom Mody
  2016-05-31  5:21 ` Alexis
       [not found] ` <mailman.545.1464672115.1216.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Rustom Mody @ 2016-05-30 15:04 UTC (permalink / raw)
  To: help-gnu-emacs

Apologies for second copy 1st doesnt seem to have appeared

---------------------------------------------
I have this emacs.desktop file put in ~/.local/share/applications

---------------
[Desktop Entry]
Name=EmacsClient
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;

Exec=emacsclient -n -a emacs %F
Icon=python
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Emacs

---------------
Currently this laptop is on ubuntu 16.4 (xenial) -- vanilla unity desktop
It used to work ok in earlier ubuntus
Now on 16.4 it shows 2 emacs icons when editing a file via emacsclient
Clicking the second icon shows no effect
After about 10 seconds it disappears

Dont know when it stopped working because frankly I am not much of a
nautilus -> click -> emacsclient type of user

Current generation -- my students -- however default to this kind of usage
And so they default to one or both of
- gedit by default
- dozens of emacses open for each file they clicked


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

* Re: resending... desktop files not working for recent ubuntu?
  2016-05-30 15:04 resending... desktop files not working for recent ubuntu? Rustom Mody
@ 2016-05-31  5:21 ` Alexis
  2016-06-01 15:49   ` Rustom Mody
       [not found] ` <mailman.545.1464672115.1216.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Alexis @ 2016-05-31  5:21 UTC (permalink / raw)
  To: Rustom Mody; +Cc: help-gnu-emacs


Rustom Mody <rustompmody@gmail.com> writes:

> Apologies for second copy 1st doesnt seem to have appeared
>
> --------------------------------------------- I have this 
> emacs.desktop file put in ~/.local/share/applications
>
> --------------- [Desktop Entry] Name=EmacsClient 
> GenericName=Text Editor Comment=Edit text 
> MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
>
> Exec=emacsclient -n -a emacs %F Icon=python Type=Application 
> Terminal=false Categories=Development;TextEditor; 
> StartupWMClass=Emacs
>
> --------------- Currently this laptop is on ubuntu 16.4 (xenial) 
> -- vanilla unity desktop It used to work ok in earlier ubuntus 
> Now on 16.4 it shows 2 emacs icons when editing a file via 
> emacsclient Clicking the second icon shows no effect After about 
> 10 seconds it disappears
>
> Dont know when it stopped working because frankly I am not much 
> of a nautilus -> click -> emacsclient type of user
>
> Current generation -- my students -- however default to this 
> kind of usage And so they default to one or both of - gedit by 
> default - dozens of emacses open for each file they clicked

Shouldn't you specify '' (i.e. the empty string) as the -a 
argument in the Exec option? From the man page for emacsclient(1):

    -a, --alternate-editor=EDITOR 

    if the Emacs server is not running, run the specified editor 
    instead.  This can also be specified via the 
    `ALTERNATE_EDITOR' environment variable.  If the value of 
    EDITOR is the empty string, run `emacs --daemon' to start 
    Emacs in daemon mode, and try to connect to it.


Alexis.




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

* Re: resending... desktop files not working for recent ubuntu?
  2016-05-31  5:21 ` Alexis
@ 2016-06-01 15:49   ` Rustom Mody
  0 siblings, 0 replies; 4+ messages in thread
From: Rustom Mody @ 2016-06-01 15:49 UTC (permalink / raw)
  To: Alexis; +Cc: help-gnu-emacs

On Tue, May 31, 2016 at 10:51 AM, Alexis <flexibeast@gmail.com> wrote:

>
> Rustom Mody <rustompmody@gmail.com> writes:
>
> Apologies for second copy 1st doesnt seem to have appeared
>>
>> --------------------------------------------- I have this emacs.desktop
>> file put in ~/.local/share/applications
>>
>> --------------- [Desktop Entry] Name=EmacsClient GenericName=Text Editor
>> Comment=Edit text
>> MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
>>
>> Exec=emacsclient -n -a emacs %F Icon=python Type=Application
>> Terminal=false Categories=Development;TextEditor; StartupWMClass=Emacs
>>
>> --------------- Currently this laptop is on ubuntu 16.4 (xenial) --
>> vanilla unity desktop It used to work ok in earlier ubuntus Now on 16.4 it
>> shows 2 emacs icons when editing a file via emacsclient Clicking the second
>> icon shows no effect After about 10 seconds it disappears
>>
>> Dont know when it stopped working because frankly I am not much of a
>> nautilus -> click -> emacsclient type of user
>>
>> Current generation -- my students -- however default to this kind of
>> usage And so they default to one or both of - gedit by default - dozens of
>> emacses open for each file they clicked
>>
>
> Shouldn't you specify '' (i.e. the empty string) as the -a argument in the
> Exec option? From the man page for emacsclient(1):
>
>    -a, --alternate-editor=EDITOR
>    if the Emacs server is not running, run the specified editor
> instead.  This can also be specified via the    `ALTERNATE_EDITOR'
> environment variable.  If the value of    EDITOR is the empty string, run
> `emacs --daemon' to start    Emacs in daemon mode, and try to connect to it.
>
>
Tried changing it...  Same behavior

It would be nice if people with other ubuntu versions and other linux
desktops could try it and inform.

If it works then its a bug specific to this ubuntu
If not its a more general emacs bug


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

* Re: resending... desktop files not working for recent ubuntu?
       [not found] ` <mailman.545.1464672115.1216.help-gnu-emacs@gnu.org>
@ 2016-06-14  1:54   ` Rusi
  0 siblings, 0 replies; 4+ messages in thread
From: Rusi @ 2016-06-14  1:54 UTC (permalink / raw)
  To: help-gnu-emacs

On Tuesday, May 31, 2016 at 10:51:57 AM UTC+5:30, Alexis wrote:
> Rustom Mody writes:
> 
> > Apologies for second copy 1st doesnt seem to have appeared
> >
> > --------------------------------------------- I have this 
> > emacs.desktop file put in ~/.local/share/applications
> >
> > --------------- [Desktop Entry] Name=EmacsClient 
> > GenericName=Text Editor Comment=Edit text 
> > MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
> >
> > Exec=emacsclient -n -a emacs %F Icon=python Type=Application 
> > Terminal=false Categories=Development;TextEditor; 
> > StartupWMClass=Emacs
> >
> > --------------- Currently this laptop is on ubuntu 16.4 (xenial) 
> > -- vanilla unity desktop It used to work ok in earlier ubuntus 
> > Now on 16.4 it shows 2 emacs icons when editing a file via 
> > emacsclient Clicking the second icon shows no effect After about 
> > 10 seconds it disappears
> >
> > Dont know when it stopped working because frankly I am not much 
> > of a nautilus -> click -> emacsclient type of user
> >
> > Current generation -- my students -- however default to this 
> > kind of usage And so they default to one or both of - gedit by 
> > default - dozens of emacses open for each file they clicked
> 
> Shouldn't you specify '' (i.e. the empty string) as the -a 
> argument in the Exec option? From the man page for emacsclient(1):
> 
>     -a, --alternate-editor=EDITOR 
> 
>     if the Emacs server is not running, run the specified editor 
>     instead.  This can also be specified via the 
>     `ALTERNATE_EDITOR' environment variable.  If the value of 
>     EDITOR is the empty string, run `emacs --daemon' to start 
>     Emacs in daemon mode, and try to connect to it.
> 
> 
> Alexis.

Made some small progress with this following suggestions:
http://stackoverflow.com/questions/1167484/how-to-gracefully-shutdown-emacs-daemon

This needs
1. emacs started with --daemon
2. emacs.desktop as earlier described
3. Having this in the init:

(defun shutdown-emacs-server () (interactive)
  (when (not (eq window-system 'x))
    (message "Initializing x windows system.")
    (x-initialize-window-system)
    (when (not x-display-name) (setq x-display-name (getenv "DISPLAY")))
    (select-frame (make-frame-on-display x-display-name '((window-system . x))))
  )
  (let ((last-nonmenu-event nil)(window-system "x"))(save-buffers-kill-emacs)))


4. And having this systemd service in ~/.local/share/systemd/user/

[Unit]
Description=Emacs: the extensible, self-documenting text editor

[Service]
Type=forking
ExecStart=/usr/bin/emacs --daemon
ExecStop=/usr/bin/emacsclient --eval '(shutdown-emacs-server)'
Restart=no

TimeoutStartSec=12

[Install]
WantedBy=default.target

==============================
Basically the idea is that a dialog should be popped up for saving buffers
when the server is terminated even if no frame was active 

This is currently unreliable - ie sometimes it pops up and sometimes not
thereby losing unsaved work

Is there some more official way of using emacs in client-server mode?


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

end of thread, other threads:[~2016-06-14  1:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-30 15:04 resending... desktop files not working for recent ubuntu? Rustom Mody
2016-05-31  5:21 ` Alexis
2016-06-01 15:49   ` Rustom Mody
     [not found] ` <mailman.545.1464672115.1216.help-gnu-emacs@gnu.org>
2016-06-14  1:54   ` Rusi

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.