Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by eloy on Friday October 30, 2015 @10:33AM
(#10478012)
They should read the book "Popular Unix text editors and how to exit them"
[ Parent
| on HN ]
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by scarmig on Friday October 30, 2015 @10:55AM
(#10478164)
quit
?
exit
?
end
?
done
?
bye
?
quit!
?
^X
?
^C
?
^C
?
help
?
?
?
^Z
$ killall ed
$ vi
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by xnxn on Friday October 30, 2015 @04:50PM
(#10480471)
eat flaming death
?
http://www.gnu.org/fun/jokes/ed-msg.txt
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by api on Friday October 30, 2015 @12:26PM
(#10478768)
You mean that isn't how to exit 'ed'?
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by mcguire on Friday October 30, 2015 @12:53PM
(#10478945)
Technically, the official method of exiting ed, if you're running as root, is:
$ed a_file
... (normal usage)
r /etc/motd
w /boot/vmlinuz-3.19.0-16-generic (replace with specific kernel)
!reboot
The alternative of "w /dev/sda1" is also acceptable.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by mcguire on Friday October 30, 2015 @01:01PM
(#10479007)
Note to those objecting to '$': I have PS1 set to '$' on every account. It just saves confusion.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by iso8859-1 on Friday October 30, 2015 @02:02PM
(#10479411)
Don't you think it is prettier with the space?
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by mcguire on Friday October 30, 2015 @02:24PM
(#10479564)
Nah, just adds clutter.
[Fixed in the great-grandparent.]
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by ChrisArgyle on Friday October 30, 2015 @03:55PM
(#10480148)
^D^D should do it
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by Roodgorf on Friday October 30, 2015 @11:17AM
(#10478327)
I was much too easily convinced that this could be a real book.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by Keyframe on Friday October 30, 2015 @03:55PM
(#10480150)
Accompanied by coffe table book 'Greatest screenshots of ruby in Sublime with dark themes'
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by Natanael_L on Friday October 30, 2015 @03:22PM
(#10479941)
We can make it one! Who'll launch the kickstarter?
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by Roodgorf on Friday October 30, 2015 @04:08PM
(#10480237)
Top contributor decides which editor we write it in.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by dllthomas on Saturday October 31, 2015 @03:13AM
(#10482070)
Can it be proprietary?
... can it cost more than my contribution?
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by fisherjeff on Friday October 30, 2015 @10:47AM
(#10478105)
Thank you both for inciting a fascinating combination of uncontrollable laughter and existential dread
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by DonHopkins on Friday October 30, 2015 @03:42PM
(#10480076)
Not to be confused with the book "Popular Unix text editors and how to nest them".
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by techdragon on Friday October 30, 2015 @04:37PM
(#10480395)
Which is a book inside a smaller book which is inside a smaller book ...
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by gknoy on Friday October 30, 2015 @07:19PM
(#10481133)
... published as a Jupyter notebook of a LaTeX document of a markdown file containing Perl POD comments. ;)
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by eru on Friday October 30, 2015 @10:56AM
(#10478171)
Ctrl-z works universally, doesn't it?
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by emergie on Friday October 30, 2015 @11:03AM
(#10478228)
it doesn't, ctrl-z only suspends process and switches to backgroud - the thing is still alive
try ctrl-z and then type bg command - you will see a list, you can resume with fg [number]
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by jokr004 on Friday October 30, 2015 @04:02PM
(#10480200)
Ctrl-z by itself doesn't actually switch the process to run in the background, it stops the process. Running 'bg' is what starts the process back up running in the background, 'fg', like you said, resumes the process in the foreground and 'jobs' is the command you can run to see a list of processes that are running.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by waterhouse on Saturday October 31, 2015 @05:44AM
(#10482248)
Since the question was "Ctrl-z works universally", I feel obliged to point out that ctrl-z sends SIGTSTP, which can be blocked--not to be confused with SIGSTOP, which cannot be blocked. I don't know of any program that does intercept SIGTSTP (except a test program I wrote that tries to print the name of any signal it receives), and I suspect that "polite" interception would be to release a few resources and then accept being paused--but, in theory, a program could ignore it.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by FreeFull on Saturday October 31, 2015 @09:18AM
(#10482554)
Many curses programs (for example vim) intercept ^Z to set the terminal back into a more normal mode and then pause.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by Touche on Saturday October 31, 2015 @12:47PM
(#10483197)
This is probably a stupid question, didn't know about bg and fg before. But after playing around with it, it feels pretty amazing, why even use screen/tmux when you have these?
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by wutbrodo on Saturday October 31, 2015 @02:37PM
(#10483605)
Screen has aaugh easier interface for multitasking, including things like stderr not bleeding out from whatever background tasks you're running. Not to mention that switching back and forth between screens is what it's designed for and thus a lot easier than switching between job numbers. Also the ability to detach your screen and its running processes from being coupled to a specific login session, which is probably the main reason I started using screen instead of multiple terminals in the first place.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by dllthomas on Saturday October 31, 2015 @03:15AM
(#10482075)
With bg, it is likely to suspend itself again by attempting to read from the terminal (which a text editor is likely to do basically all the time).
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by Anderkent on Friday October 30, 2015 @11:33AM
(#10478422)
Well, it might still run but it lets you out of the editor, which is the goal here. You can just kill -9 it afterwards.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by mcguire on Friday October 30, 2015 @12:57PM
(#10478975)
If you have good reflexes, you can type "^Z" right after "kill -9", before the syscall to send the signal is executed.
Legend has it that, if you do, you bring on the Singularity immediately.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by dllthomas on Saturday October 31, 2015 @03:17AM
(#10482079)
There is no reason for -9 here - all the major unix editors happily exit on SIGTERM.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by ciupicri on Friday October 30, 2015 @11:03AM
(#10478223)
Not really. Some programs disable it including vim (at least on some setups).
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by api_or_ipa on Friday October 30, 2015 @04:45PM
(#10480429)
Every vim I've ever played on has respected `ctrl-z`. In fact, I use `ctrl-z` to jump out of my vim (to restart a server, ls the local dir, etc).
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by ciupicri on Friday October 30, 2015 @07:19PM
(#10481130)
My vimrc has
source $VIMRUNTIME/mswin.vim
behave mswin
which maps Ctrl-z to undo.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by skinnyfoetusboy on Saturday October 31, 2015 @06:42AM
(#10482323)
You monster.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by tomcam on Saturday October 31, 2015 @02:28PM
(#10483578)
Well I'll be damned. Never thought of trying it. Thank you.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by jlhim on Friday October 30, 2015 @11:04AM
(#10478235)
this has got to be trolling. right? right?! i'm so confused.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by schwap on Friday October 30, 2015 @11:41AM
(#10478472)
Back when I first started my CompSci degree, a friend of mine always "quit" emacs with ctrl-z. Or, at least he did until he managed to fill his entire home directory quota with emacs backup files that were never cleaned up...
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by __david__ on Friday October 30, 2015 @02:26PM
(#10479577)
Ha, I still do that!
$ jobs
[4] Stopped emacsclient -a '' -nw [redacted] (wd: [redacted])
[5] Stopped emacsclient -a '' -nw [redacted] (wd: [redacted])
[6] Stopped emacsclient -a '' -nw [redacted] (wd: [redacted])
[7] Stopped emacsclient -a '' -nw [redacted] (wd: [redacted])
[8] Stopped emacsclient -a '' -nw [redacted] (wd: [redacted])
[9] Stopped emacsclient -a '' -nw [redacted] (wd: [redacted])
[10] Stopped emacsclient -a '' -nw [redacted] (wd: [redacted])
[11] Stopped emacsclient -a '' -nw [redacted] (wd: [redacted])
[12]- Stopped emacsclient -a '' -nw [redacted] (wd: [redacted])
[13]+ Stopped emacsclient -a '' -nw [redacted]
But since they're all emacsclients it doesn't really matter.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by jnpatel on Friday October 30, 2015 @05:01PM
(#10480520)
Don't you frequently deal with:
/private/tmp/foo.txt locked by jnpatel@mac... (pid 14836): (s, q, p, ?)?
because of the lock files?
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by __david__ on Friday October 30, 2015 @05:25PM
(#10480630)
Nope, because emacsclient ends up opening them all in the same process (that's the beauty/entire point): Fork off an emacs in the background:
emacs --daemon
Then run emacsclient to connect to it (open a new buffer in the daemon and switch to it): emacsclient -nw some_file
When you "quit" (with C-x C-c), it really just quits that client, but the main emacs is left running.This has a number of benefits: 1) no locks like you mention, 2) access to all open buffers (even unsaved) from every emacsclient that's currently running (since they're really all just opening buffers in a single instance), 3) blazing startup speed (emacs is already running, you're just connecting to it and splatting a new buffer to the terminal).
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by krylon on Friday October 30, 2015 @08:26PM
(#10481320)
I still remember how happy I was when I found out about that. On all servers I use (at home and at work), starting an emacs daemon is usually among the first things I do after rebooting.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by rcthompson on Friday October 30, 2015 @05:34PM
(#10480675)
Do you know about the "--no-wait" option for emacsclient?
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by __david__ on Friday October 30, 2015 @06:20PM
(#10480883)
Yes. But it doesn't play well with "-nw".
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by rcthompson on Friday October 30, 2015 @08:03PM
(#10481266)
Ah yes, good point. In that case, the solution is `C-x #` to finish an emacsclient session without causing the server to quit.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by __david__ on Friday October 30, 2015 @08:20PM
(#10481305)
Luckily C-x C-c also does that now.
Re:Show HN: Twitch Installs Arch Linux – A cooperative text-...
by api_or_ipa on Friday October 30, 2015 @04:45PM
(#10480442)
`fg` is your friend