How to enable the mousetrap.js to accept Caps letter - capslock

I am using mousetrap.js library to accept the possible characters. But It is not accepting capital letters when caps is on while it is working fine with Alt+any letter.
Any help will be appreciated.
Thanks

I was using this library until we decided to remove it as a dependency. I'm programming around it now. I'm not sure it actually handles caps lock, though. This [caps lock state] seems to be a really poorly supported attribute in JS. Most of the methods i've looked at for detecting caps lock don't actually work on a Mac. event.key seems to work with caps lock in FireFox, but is undefined in Chrome and Safari.

Related

Emacs tty evil / viper ESC key stand-alone

There are several vim clone packages for Emacs (Evil, Viper..). These packages have a special built in functionality where they remap the Escape key for tty users. I'm not sure how this is done (With a timeout?).
I'd like this functionality as well however I don't want to use the entire Evil / Viper package, I only want the Escape key functionality. This is because I use God Mode, basically Vim's normal / Insert mode with emacs keybindings instead. It doesn't however have a solution for the TTY Escape key like Evil / Viper do. My Elisp isn't really good enough to implement this myself.
So if there is a stand alone package for the escape key issue I'd love to hear about it.
This doesn't /really/ answer my question but I've found something nice that solves my problem.
Xcape is a tool that you can use change the behavior of a key. For example if you run this command:
xcape -e 'Control_L=Control_L|G'
When pressing Left Control and releasing right away, it will act as Control-G. If you hold down Control it will simply act as Control normally does.
Now if I remap C-g to active God-mode I get the expected behavior in the terminal as well. And you can change the keys to however you want.
As I said this doesn't really answer my question but it does solve the problem. So I'll just leave this answer for other people to find.

Two separate keyboards, two separate spacebars

Basically I've used 2 keyboards for a very long time for the sake of personal convenience, but now there's something that's really bugging me. I'd like to remap the spacebar on my second keyboard to w/e so that I can play a particular game with two separate space bars.
Problems I've encountered so far is that keyboard remapping software tend to remap the keys for both keyboards. Or the remaping doesn't work in-game although it seems to work fine in notepad or such. Mostly likely since the remapping occurs on a higher level then where the game is fetching it's inputs.
Here's what did on HIDmacros;
For the trigger kbd6 32 ()
HIDMacros.SendKeys "p"
Not much but I'm not too savvy in this field haha
Does anyone know how I may achieve this?
-Edit: Oh and the ability to "hold" the key is a must, or else they'd be no point in doing this :/. I'm thinking hardware modifications at this point haha
I was able to use AutoHotKey AHKHID script and SharpKeys to accomplish something similar.
Using SharpKeys I remapped the key (in your case it's spacebar) to some fictitious key.
Then using AutoHotKey with AHKHID script, I was able to listen to strokes on that key, and determine from which device it was sent -
Then I would simulate the wanted key stroke.
I believe this could work in your situation (also, I simulate the up and down strokes, so "holding" works).
I've posted the full solution on the AutoHotKey's forum:
http://www.autohotkey.com/board/topic/38015-ahkhid-an-ahk-implementation-of-the-hid-functions/page-29#entry631055
Good luck

Voice coding in Emacs on Mac OS X

I would like to be able to write code by voice recognition and him currently using Aquamacs 2.4 and Dragon Dictate 2 on Mac OS X 10.6.8. Does anybody know if this is possible and if so how? I've seen shorttalk, emacs listen, and voice code but they only work on windows machines with Dragon Naturally Speaking.
Any leads would be much appreciated.
Also I am writing in R via ESS.
Have a look at this presentation by Tavis Rudd : http://www.youtube.com/watch?v=8SkdfdXWYaI
He runs Dragon Naturally Speaking inside a Windows VM, because the Windows version can be scripted with Python. Then the VM communicates with Emacs on his local machine.
He says in the presentation he will open source his code, but it doesn't seem to be there yet on his Github.
So yes, it's possible, but at this point there is no out of the box solution. If you really want this, prepare to invests weeks or months to get to a properly working setup.
I recently released the coding-by-voice solution I created to solve my own RSI issues. It can be found here: http://www.voicecode.io
I use it mostly for coding in Sublime Text and Xcode, but it works great with emacs or vim as well. The great thing about this solution is that all commands can be chained into "command phrases" so you don't have to pause between every individual command like you do with other voice command solutions.
It has builtin support for all standard variable-name formats (snake case, camel case, etc), has builtin commands for every permutation of keyboard shortcuts (ie command-shift-5, command-option-shift-T, and so on), has cursor movement commands, app switching commands, window switching commands, commands for symbol combos like "=>", "||", ">=", etc, and tons more. Plus it is very easy to add your own custom commands as well.

What are the compelling reasons to upgrade to emacs 23.1?

I saw the the news that emacs 23.1 was released.
For a programmer, What are the big reasons to upgrade? I'm currently on 22.2.
None of the features listed really seem like must-haves for me. The most immediately interesting bit is that nXML is now integrated. I already have it though.
But I have to admit I don't know what is really behind "smarter minibuffer completion" or "per buffer text scaling".
Anyone have any tips or examples of what these things are?
For me, the biggest reason is the support for anti-aliased fonts. And the --daemon support is nice.
Emacs-fu has a nice write-up of some of the features.
M-x butterfly
No one said anything about multi-tty support? I have one long (LONG!) emacs session opened somewhere, and I ssh'ed into that machine remotely and use that particular emacs session (with all the temporary buffers, everything setup the way I liked, groups of buffers opened, etc.). The benefit of course, is that I don't need to worry about saving temporary buffers (you do use those as scratch pad, don't you?), etc. when switching machines (from school to home, for example).
Also, with multi-tty support, you can open emacs with emacsclient -nw to substitute your occasional needs for vi for quick terminal edits. emacsclient -nw will open even faster than vi, and you will have access to your opened emacs session as a bonus. (Before emacs 23, emacsclient cannot run from the terminal).
"Improved Unicode support (the internal character representation is now based on UTF-8)."
is a critical reason for me, but it no doubt depends on your work flow.
Some of the terms you are asking about were discussed in Set Emacs defaut font face per-buffer/mode and are also in the emacs wiki, e.g. http://www.emacswiki.org/emacs/SetFonts (under Changing Font Size - Buffer Text Resizing ).
While I was using the pre-releases, the most noticeable feature has been the improved font support. and some small things about smarter window splitting.
for me its font support and gnupg integration.
also its nice to read pdf's from within emacs.

How can I intercept and correct keypresses at a low level?

I keep typing "t eh" instead of " the" which is, of course, annoying in the amount of time it takes me to correct myself.
The obvious answer is "Learn to type, noob!" or at least to type more slowly and/or more correctly. This error is frighteningly consistent so it appears I've trained my muscle memory for that pattern already.
But I'm wondering if it's possible to write a small, windows portable script or application that, when it detects the incorrect sequence, backspaces and corrects it automatically at a layer where it would apply to any keyboard input.
Does C# have access to that layer of the OS that intercepts keypresses systemwide?
Will I run into UAC issues with Vista?
Am I re-inventing the wheel (ie, are there open source tools I can modify or use out of the box)?
In DOS this sort of thing was quite easy and one could make TSRs (Terminate and Stay Resident) programs that would, for instance, give you a calculator onscreen with a special keypress. Not to mention the many, many practical joke programs based on this concept (dial "M" for monster!)...
I would, of course, never suggest such a utility could be used that way for co-workers...
-Adam
On windows you could use AutoHotKey. That allows you to create little scripts or macros to automate and correct things like mistypes.
One use was posted on lifehacker which took the common mistyped words and corrected them. It is at http://lifehacker.com/192506/download-of-the-day-universal-autocorrect
UPDATE Per Comment: This is Free software and windows only as far as I know.
The above script is just an example of what it can do. There are a slew of scripts available at AutoHotkeys Site
I suggest AutoHotKey. If you've never used it before, have a quick read of the tutorial: http://www.autohotkey.com/docs/Tutorial.htm
The feature you are looking for is called "hotstrings." http://www.autohotkey.com/docs/Hotstrings.htm
In your case, your script would look something like:
::teh::the
That's it! Add other things you want corrected on additional lines. AutoHotkey scripts can be compiled so you don't have to install AutoHotKey on all of your machines.
It's a very cool program. It's primary use (for making custom hotkeys) rocks! These scripts are system wide so you'll also probably want to make a hotkey to be able to turn them off too!
EDIT: In a comment, it was mentioned that he actually types "t eh" (with a space in it) and I wondered if something additional would be needed for it to work. I just tested it and it works fine. Just install autohotkey, and create a file with the .AHK extension. In that file put in the following line
::t eh::the
and save the file. Then double-click on the AHK file to load AutoHotKey with your script (you'll see a green square in your system tray to let you know it is running). It should work fine!
Yes, you can use pinvoke commands from C# to intercept the low-level os commands. I recommend you take a look at http://www.pinvoke.net. The coding isn't easy but it does work.
I suggest learning to type more slowly. I also suffer from "teh" and "ahve" in part due to autocorrect giving me the leniency. If you forced yourself to retrain then you would not be at a disadvantage when using someone else's machine.
Not to mention the unfortunate event when you need to write "t eh" and are being prevented by an overzealous 'corrector'.