Open masinter opened 11 months ago
On chromeOS you can escape the system behavior of Ctrl-W
, and make it behave as expected in Medley, by pressing Search-Ctrl-W
. Search
is the search key (Windows key on ordinary keyboards) which Google calls the "Everything Button".
The problem is the unconscious habit of using control-W to do 'delete backward word', which works in many applications. It's nice that you can get the same effect using some other keyboard input, but that doesn't solve the problem of having the session blown away.
What I would really like is protection against inadvertent closing of a Medlley-in-browser session with unsaved changes; I know some web applications seem to do that, but not consistently.
Would it help to have maiko handle an error from the display subsystem (X or SDL) and do the savevm before exiting?
This doesn't solve the problem (which might be just me) of reflexively typing Control-W. It usually happens when I'm trying to demonstrate something.
The problem of losing work on X-server closing is a different problem. But then, an interrupt-instigated SAVEVM might produce a system that was unusable if in the middle of an UNINTERRUPTABLE critical section. Unless it just did a 'causeinterrupt'.... I wonder if the VM saved by an explicit SAVEVM should be more like a SYSOUT.
It wouldn't be an interrupt-instigated SAVEVM as far as Lisp was concerned - maiko wouldn't make it visible to Lisp. Also, for example, it's OK to do (UNINTERRUPTABLY (SAVEVM))
- you get a working VM image from that. It just returns T from the SAVEVM
on restart where it returned NIL
when first executed, which is a whole lot like a SYSOUT
.
What about having Maiko handle an error from the display subsystem and ask the user whether to exit?
@pamoroso - see my comment 4 back, and then the discussion. What I've found is that it's not happy with the savevm created image when the X connection is lost - it's not an "interruptable" problem, but there's something about the state of the machine that isn't saved/restored when initiated from the lower level. I'll look into it a bit more.
@masinter - see my previous note to Paulo. I've looked more into the situation and your comment about causeinterrupt
.
I think I can get X11 to not exit (undocumented handler that you can set up), and set a flag when the window gets closed, but I don't understand what I need to set up in order to use cause_interruptcall()
to be able to call, for example, LOGOUT
. There are examples of using it in maiko/src/xc.c
to call DORECLAIM, or INTERRUPTFRAME, but if I get the atom-index for LOGOUT and try to run that, it seems to take a fault in \INTERRUPTED
thus
APPLYing an atom: IL:BACKGROUND-YIELD.
../src/xc.c:261 Saving PC = 072 (0x10362fdd2).
../src/xc.c:349 RETURN = 0x4c, CL:T
Calling a 0-arg FN: IL:\INTERRUPTED().
../src/xc.c:324 def cell = 0x802fb754.
0 ldex 0x000000010001d012 NativeAligned4FromLAddr + 66
1 ldex 0x000000010001d5a8 native_newframe + 344
2 ldex 0x000000010002222c dispatch + 19116
3 ldex 0x000000010004b375 start_lisp + 437
4 ldex 0x000000010004b12f main + 2671
5 libdyld.dylib 0x00007fff203eef3d start + 1
6 ??? 0x0000000000000006 0x0 + 6
Misaligned pointer in NativeAligned4FromLAddr 0xfffffff
Process 17083 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x12300000c)
frame #0: 0x000000010001d5bc ldex`native_newframe(slot=0) at fvar.c:446:24
443 pindex = (NAMETABLE *)(((DLword *)newpfn2) + FNHEADSIZE);
444 /* now pindex points 1st word of Nametable. */
445 #ifdef BIGATOMS
-> 446 nametablesize = (newpfn2->ntsize >> 1); /* ntsize is # of words in NT
447 nametablesize is # of items in NT */
448 #else
449 nametablesize = newpfn2->ntsize;
Target 0: (ldex) stopped.
I have a suspicion it might be because LOGOUT
is not a no-argument function, but...
@nbriggs You could add a no-argument function that wraps (LOGOUT FAST)
. ;-)
At least, to see if that is the issue.
@MattHeffron I tried giving it SAVEVM
instead of LOGOUT
, which is no-argument, and it failed the same way (and in the same place). So there's something I just don't understand about how things need to be set up...
maybe start at the other end of the pipeline:
INTERRUPTCHAR ("^W" (printout PROMPTWINDOW "Saving VM" (AND (SAVEVM) (HELP)) T]
will make control-W an interrupt that does a SaveVM.
control-W is any character. The (HELP) is to show you can call something on restore that you didn't get on SAVE.
This might be useful for other situations, like debugging a crasher.
The warning in the running online should note howto turn off control-W.
On a Mac, you can disable or change the
Command+W
shortcut in Safari (or any other application) by following these steps¹:1. From the Apple menu in the top left corner of the screen, select System Preferences.
Command+Control+W
.Now
Command+W
will not close your Safari tabs. Please note that this change will only affect Safari, andCommand+W
will still close tabs and windows in other applications.Remember, these changes can affect how other websites and applications behave, so use them with caution. If you're unsure, consider seeking help from a tech-savvy friend or professional.
Source: Conversation with Bing, 12/4/2023 (1) keyboard - Disable Command-W in the terminal - Ask Different. https://apple.stackexchange.com/questions/44412/disable-command-w-in-the-terminal. (2) How to disable shortcuts like Ctrl-A, Ctr… - Apple Community. https://discussions.apple.com/thread/252971303. (3) How to unbind Command-Control-Space key from Mac OS X 10.9?. https://stackoverflow.com/questions/20245652/how-to-unbind-command-control-space-key-from-mac-os-x-10-9. (4) How to Change the Cmd+Q Shortcut Key in OS X (to Stop ... - How-To Geek. https://www.howtogeek.com/39520/how-to-change-the-cmdq-shortcut-key-in-os-x-to-stop-accidentally-closing-apps/. (5) How to disable command + q for Terminal on OSX - Super User. https://superuser.com/questions/222440/how-to-disable-command-q-for-terminal-on-osx.