Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
One of my favorite emacs plugins is expand-region.
It selects block code in a smart way. Their ready recommends binding
the key C-= to expand-region. However, in the Mac OS terminal, C-= is not passed to the application by the OS.
So what two key combination can I use on OS X ? (It has to be quickly pressable , because I use expand region almost every minute)
The reason you are unable to use C-= is because you have an OS X shortcut which is using that key binding. You could either disable that shortcut or move it to another key binding, which would allow you to use C-= in emacs.
I'm running Emacs in a GUI window under OS X (El Capitan) and have C-= bound to expand-region.
If your running in a terminal, it is possible the terminal could also be stealing that key binding, so if you find nothing which matches in preferences -> keyboard -> shortcuts, then look in your keyboard preferences.
In general, they way I find available keys to bind in emacs is to do the following
List current key bindings with C-h b and look to see what is already used and identify an available binding.
Use C-h k to verify the key is not bound and to verify the OS will pass it through. If nothing happens, they key is being stolen by the OS or terminal, in which case, either you choose another key or disable the binding at the OS/Terminal layer.
Once you have identified the key binding to use, use either global-set-key to define it globally, or a local key map and define-key to define it in a specific mode.
I tend to use emacs a lot under OSX and therefore, disable many of the OSX shortcuts so that I can use the keys inside emacs. As I work on both Linux and OS X, I like to try and keep my key bindings for emacs the same across both platforms.
Related
There is a lot of information on Stack Overflow about how to set environment variables (like this question and this one). Unfortunately it seems that Apple has been playing with this process a lot over the last few years and so much of the discussion online seems to have been rendered obsolete by Mountain Lion and Mavericks. There are two methods discussed in more recent posts: editing launchd.conf and modifying ~/.MacOSX/environment.plist. I've tried both and am still not getting my new environment variable everywhere I want.
I've boiled the problem down to this bit of AppleScript:
set pp to system attribute "PYTHONPATH"
display dialog pp buttons {"OK"} default button 1
When I run the code from the AppleScript editor it gives me a non-empty PYTHONPATH, which is what I want (I'm trying to set the PYTHONPATH variable for scripts run from places other than terminal windows). But when I run the same script from Quicksilver (which is really where I'd like it to work), it gives me an empty Python path. Can I set PYTHONPATH in a way that will show up both places?
The answer was to edit launchd.conf and then restart. This answer claims to tell you how to do it without a restart, but it didn't work for me.
The answer is different under Yosemite. See these two pages:
https://apple.stackexchange.com/a/106814/60655
Setting environment variables via launchd.conf no longer works in OS X Yosemite/El Capitan/macOS Sierra?
I guess there's not much else to the question. OS X 10.5.
If possible, use the mvim://-protocol instead. It should be compatible with the txmt://-protocol.
If you are not able to change the links themselves, you could try editing the Info.plist for MacVim.
I do not know whether plugin for this «protocol» already exists, but if you want to write your own, you should take a look at BufReadCmd event (and also BufWriteCmd). If you don't want to start from scratch, some such events are defined in $VIMRUNTIME/plugin/netrwPlugin.vim (for example, for ftp:// protocol) file which should come with your vim installation.
I'm trying to create an AIR application to log application usage and the only easy way to get information from the system with AIR is using command line tools and scraping stdout.
I know about tools like top and ps for OS X, but neither of them seems to tell me which application / window is active, maybe I shouldn't even be looking for processes? For my logging purposes I`d like to get the name and title of the currently active window (and application) as a start.
I`m primarily interested in OS X, but would be great to have Windows and Linux equivalents too for the future.
If no such tools exist yet, it would be great to get some pointers how to make them. I haven't done any OS level programming yet, but I'd think creating a command line tool should be one of the easier things to do (completely ignoring GUI frameworks).
These two questions seem to be asking the same thing, unless I've misunderstood your question. Should be a good start for OS X:
Get the title of the current active Window/Document in Mac OS X
Finding the Current Active Window in Mac OS X using Python
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
On my Mac, there is no window open when I start Terminal app. I just played with a friend's Mac, a window is automatically opened on startup of terminal. He doesn't know how it's done. I just played with preferences and couldn't find anything for that. Does anyone know how to do that?
I'm just grasping at straws here: is it possible that your Terminal program is always running in the background, and you are not actually completely exiting? You can perform this test: Run Terminal in whatever manner you usually do, and then press Command-Q to quit the application completely. Now run Terminal again. Did it open a new window?
The Mac has a slightly different paradigm on open/closed applications, namely that closing the last window doesn't actually quit the application. Combine this with the fact that Mac users rarely ever actually reboot their computers, and it's easy for relatively novice Mac users to have many applications that are simply running in the background that are never closed completely.
Just a shot in the dark. If you are for sure exiting the app completely than I can't think of a solution for the problem either.
Create a Windows Group
Go to Preferences -> Start, and select the windows group to open on start up
From the Terminal App, choose Preferences: select Startup and verify that the "On startup, open new window with settings:" radio button is selected and select Basic from the pull-down menu. That's all I have and it starts up with an open window for me.
If you've tried all the above suggestions, see if anything weird is appearing in your console. Open up /Applications/Utilities/Console.app and watch the "All Messages" log while you open Terminal.
You could try one of the other terminal apps that are out there for Mac. I prefer iTerm, it's free and works very well. It also gives you nice features like tabs, color schemes and fullscreen terminals.
You can also try this out, it is a Ruby gem that lets you automate opening mutliple tabs that run preset scripts or commands: https://github.com/Achillefs/elscripto
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I'd like to have my command key work as a ctrl key in the Mac OS X terminal. That is, I want "command-c" to do the same thing as "ctrl-c". Does anyone know of a way to do this?
Specifically, I would really like this to work in emacs. Emacs uses a LOT of ctrl key bindings and reaching for the control key is beginning to strain my wrists. You may say that the command key is actually harder to reach, but I've swapped the command key and the caps-lock key on my MacBook Pro to make that easier.
Any help is appreciated!
I don't think that you can have the same key act as both command and ctrl, and I don't think that there's a way to override the keys for a specific program, at least not without a third-party program. Personally, I recommend having the command key once again be the one with the apple/command label, and using caps lock as your ctrl key as Emacs commands are more complicated (and require pressing multiple keys with ctrl held down).
By the way, if pressing the command key is difficult, you're probably trying to do so with your pinky and not your thumb.
As a side note, if you are using Emacs in the terminal, you may be interested in using option as meta. If you want to use your command key as meta, you can check out Carbon Emacs. It doesn't run in the terminal, but it might fill your needs.
You could (in Leopard) map the Caps Lock key to act as control for all apps.
System Preferences->Keyboard and Mouse->keyboard Modifier Keys button at bottom
Perhaps you could hack http://doublecommand.sourceforge.net/ for this purpose.
I don't think this is possible because the command key is already mapped to a bunch of system-level shortcuts. For example Cmd-C is copy, Cmd-X is paste. I don't think an application can override those system commands.