4 ms·
I think you should be able to replace the "disown" with "nohup", thus making the startup script POSIX compliant. A general question would be what version of Em
by daptaq 5y ago
I think you should be able to replace the "disown" with "nohup", thus making the startup script POSIX compliant.
A general question would be what version of Emacs you are targeting. As even Debian stable distributes 27.1, you could make use of newer features such as fido-mode (instead of ido and ido-everywhere). Then the package configuration doesn't need the package-initalize either (On that topic adding NonGNU ELPA would also be nice). Also, what it the point of just displaying the current time for two seconds?
- daptaq 5y agoPerhaps of interest, I wrote something similar a few years ago for my university in German: https://wwwcip.cs.fau.de/~oj14ozun/src+etc/init.el https://wwwcip.cs.fau.de/~oj14ozun/src+etc/init.el (here a HTML version https://wwwcip.cs.fau.de/~oj14ozun/src+etc/init.el.html https://wwwcip.cs.fau.de/~oj14ozun/src+etc/init.el.html). My intention was to demonstrate different configuration patterns. It even tries to configure Gnus to work OOTB for our university mail accounts. I should probably update it for Emacs 27.1 and change a few things where my tastes have changed.
- susam 5y agoUsing "nohup" was my first choice too. Unfortunately, it does not prevent the Emacs process from dying when we kill the shell from which we launched Emacs. If the shell is killed, Emacs dies too. I have confirmed this behaviour on macOS 10.15.7 + Zsh 5.7.1 as well as Debian 10.0 + Xfce 4.12 + Bash 5.0.3. As a result, I was forced to use "disown" to ensure that the Emacs process continues to run even when the shell dies. By the way, fido-mode is something I am going to add to this configuration in future, so thank you for the suggestion. I do use fido-mode myself in my personal Emacs configuration. However while publishing this project today, I could not make up my mind today whether I should still keep ido-mode around while suggesting fido-mode to beginners. In my personal config, I have both ido-mode and fido-mode enabled in my configuration. For file searches, ido-mode seems to be superior. For example, ido-mode can search deeply nested subdirectories recursively for a match, something I have not been able to do with fido-mode yet.
- susam 5y agoAn update to the previous comment. It is true that typing `nohup emacs &` directly into the shell does not help, i.e., Emacs dies when the shell dies. Example: $ cat /etc/debian_version 10.0 $ $SHELL --version | head -n 1 GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu) $ nohup emacs & $ ps -ef | grep emacs | grep -v grep susam 22210 22046 2 13:59 pts/0 00:00:00 emacs $ ps -ef | grep 22046 | grep -v grep susam 22046 22042 0 13:45 pts/0 00:00:00 bash susam 22210 22046 0 13:59 pts/0 00:00:00 emacs susam 22224 22046 0 14:00 pts/0 00:00:00 ps -ef The parent of the emacs process is still bash, so when bash dies, Emacs dies too. However, invoking `nohup emacs &` from another shell script does work. The PPID of Emacs gets assigned to 1 and Emacs continues to keep running even after killing the shell. Example: $ bash -c 'nohup emacs &' $ ps -ef | grep emacs | grep -v grep susam 22229 1 2 14:02 pts/0 00:00:00 emacs $ dash -c 'nohup emacs &' $ ps -ef | grep emacs | grep -v grep susam 22229 1 0 14:02 pts/0 00:00:00 emacs susam 22238 1 2 14:03 pts/0 00:00:00 emacs $ ps -ef | head -n 2 UID PID PPID C STIME TTY TIME CMD root 1 0 0 Dec29 ? 00:00:01 /sbin/init In the second experiment, the parent of the emacs process is the init process, to it continues to run successfully even after the shell or terminal exits. To summarize, yes, we can use nohup in the startup script and make it POSIX compliant.