Christopher C.Stacy
cstac****@dtpq*****
Fri Apr 28 05:56:03 JST 2006
I want the "Hide" and "Hide Others" functionality. As it so happens, I will bind this to the usual Mac command keys, but I am using the Command key as Meta (so I want Emacs to intercept those modifiers); just having all such chords be passed to the OS is not acceptable. I see several possible solutions, one of which may not require any changes to Emacs, but I need help with the implementation. 1. Change Emacs so that the user can specify a character map of keys which will be passed to the OS. In the event loop, rather than just looki****@er***** and a global flag like mac-pass-command-to-system, it would look in a keymap to see if the event should be posted to the toolbox dispatcher. Users would be able to specify that COMMAND-h is handled by the OS, while COMMAND-f (ie. M-f) is handled by Emacs. 2. Change Emacs to implement and expose an interface to the "Hide" functionality. 3. Just use Applescript to ask for the "Hide" function to be performed. This would be called via do-applescript from an ordinary interactive function, presumable bound to M-h. This seems like the it may be the best way to go. Unfortunately, I don't know Applescript. Here is a snippet of Applescript code that works when called from Emacs and does something similar to what I want: (defun hide-others-except-emacsen () (interactive) (do-applescript "tell application \"Finder\" set visible of (every process whose visible is true and name is not \"Emacs\") to false end tell")) There seems to be some "visible" property associated with each process, but I don't evenunderstand upon which object that property resides. It might be a Finder data structure or it might be on the target process. I am just parroting some Applescript without understanding it. So I tried things like: "tell current application to set visible to false" and also menu-based approaches like: "click menu item \"Hide Emacs\" of menu \"Emacs\" of menu bar 1") but those incantations do not work. Note that identifying the process by name ("Emacs") is not acceptable, because I am usually running more than one instance of Emacs (from the same Application bundle, even) simultaneously. I usually have one Emacs going for email, one for document editing, another one for doing certain development that is allowed to crash, etc. Anybody here know enough Applescript to pull this off?