Emacs AutoHotkey Mode (ahk-mode)
xahk-mode is a emacs major mode for editing AutoHotkey (AHK) scripts.
or MELPA. 〔➤ Emacs: How to Install Packages Using ELPA, MELPA, Marmalade〕
- Quality Syntax coloring
- Graphical menu
- Correct Comment/Uncomment code
- Code indentation
- Word completion
- Keyword Reference lookup (via autohotkey.com website)
Comment Uncomment Code
Type 【Alt+;】 (“comment-dwim”) to comment or uncomment current line or text selection in a smart way.
Press 【Tab ↹】 (or 【◆ Meta+Tab ↹】) to complete the word to the left of cursor to one of AHK's keyword. All the language's words are supported.
Tip: If you are looking for a built-in word that has a name “key” in it, but you don't remember how it starts, you can type【Esc Tab ↹】 on a blank line, then it will list all AHK's buildin words. Then, you can switch cursor to the completion pane and do standard search.
To lookup documentation of the word under cursor, type 【Ctrl+c Ctrl+r】 (“xahk-lookup-ahk-ref”). It'll switch you to the web browser of the function's documentation page at www.autohotkey.com.
“xahk-mode” follows emacs's convention of keyboard shortcuts. Many of them are not very convenient. If you prefer easier keys, or other conveniences, put the following code in your emacs init file “.emacs”.
(defun my-xahk-mode-customizations () "Some customization for xahk-mode." (local-set-key (kbd "<f9>") 'xahk-lookup-ahk-ref) ) (add-hook 'xahk-mode-hook 'my-xahk-mode-customizations)
Select the above code, then type 【Alt+x eval-buffer】. Then, close any ahk files and re-open them. Or, you can just restart emacs.
I also recommend:
- Emacs: Auto Highlight Parenthesis: show-paren-mode
- Emacs: Insert Parenthesis by Pair: electric-pair-mode
Bugs and Wishlist
There is another AHK mode, but that mode has some problems. See: Emacs Ahk Mode Problems.
If you like it, please support by Buy Xah Emacs Tutorial or make a donation. Thanks!
back to Xah Emacs Packages