Emacs AutoHotkey Mode Problems

By Xah Lee. Date: . Last updated: .

This page documents some problems of the “ahk-mode.el” for emacs by Robert Widhopf-Fenk.

(This is the one bundled with AHK as of 2009, version 1.0.48.3. The elisp package's version number is “Version: $Id: ahk-mode--main--1.0--patch-13$”)

If you are looking for a alternative AHK mode, you might try AutoHotkey Mode (xahk-mode.el) For Emacs (written by me.)

Syntax Coloring Problem

Letter Case Sensitivity

AHK is not case sensitive. “IfWinActive” is the same as “IFWINACTIVE”. However, the syntax coloring in this mode requires all the command/keywords/function etc names to be properly camel-cased for it to have syntax color. Compare:

#SingleInstance force
#singleInstance force

Some Function Names Not Colored

The packages misses some common functions used by the language, even if properly capitalized. Here are some example of words not syntax colored: IsFunc FileExist WinActive WinExist.

You can open file c:/Program Files (x86)/AutoHotkey/Extras/Editors/Syntax/Functions.txt and activate the ahk-mode and see all the function words it misses.

Other keywords are not colored. For example, the “force” and “on” keywords in:

#SingleInstance force
DetectHiddenWindows, on

Bad Syntax Coloring on Comments

Some comments are not correctly colored. Example:

; Home::
; WinGet, processName, processname, A
; if (processName = "safari.exe")
;   Send ^{Tab}
; Return

Bad Syntax Table

if you move cursor by word over “$F4::”, it thinks that “::” and “$” are part of the word.

Because AHK is primarily used to define hotkeys, so any AHK script has a lot such lines. This makes the package quite annoying.

Auto Formatting Breaks Code

When you press Enter, it tries to smartly format your line into mulitple lines with indentations, but this often is not desired, and sometimes break your string into separate lines, making a valid code into invalid code.

For example, suppose you have this line in a valid script:

Else If (WinActive("ahk_class Emacs") Or WinActive("ahk_class Chrome_WidgetWin_0")

When you press Enter at the end of line, it changes your code into this:

Else If (WinActive("ahk_class Emacs") Or WinActive("ahk_class
Chrome_WidgetWin_0")

If you save the file and reload the script, the compiler reports a error.

Reference Lookup Problem

It has a feature that lets you lookup the doc of keywords, but it assumes you have emacs's w3m package installed.

(w3m is a emacs interface to a text-based web browser program called W3m. The purpose is to allow you to browse the web in emacs. The emacs w3m package is not bundled in any major emacs distribution (not in GNU Emacs, Carbon Emacs, Aquamacs Emacs, NeXTStep emacs (aka “Emacs.app”), Lennart's EmacsW32, ErgoEmacs, or most Linux's packaged emacs.), nor is the required text browser w3m installed by default in any OS (possibly except some Linuxes.))

No Support For Keyword Completion

The package does not support language word completion. (this is a not a major problem, since many major language modes also do not support this by default. However, word completion is extremely convenient, because it is often used to find out which command to use or exist.)

Emacs Modernization

  1. Simple Changes Emacs Should Adopt
  2. Why Emacs Keys are Painful
  3. Problems of the Scratch Buffer
  4. M-key Notation vs Alt+key Notation
  5. Menu Problem
  6. Mode Line Problem
  7. cua-mode Problems
  8. kill-buffer Induces Buffer Accumulation
  9. Emacs Form Feed ^L
  10. Inconsistency of Search Features
  11. Single Key to Delete Whole Line
  12. Emacs HTML Mode Sucks
  13. Emacs Does Not Support Viewing Images Files In Windows
  14. Emacs Spell Checker Problems
  15. Adopt HTML as Texinfo Replacement
  16. Support HTML Mail
  17. Problems of “man” Command
  18. Emacs Lisp Mode Syntax Coloring Problem
  19. Emacs Ahk Mode Problems
  20. Problems of Emacs's Manual
  21. Problems of Emacs's Manual; Examples
  22. Emacs: Have You Read Emacs Manual?
  23. Elisp: Ban Syntax Table
  24. Emacs: Make elisp-index-search use Current Symbol
  25. Emacs: Usability Problems of Mode Documentation
  26. Emacs GNU Texinfo Problems; Invalid HTML
  27. A Record of Frustration in IT Industry; Disappearing FSF URLs, 2006
  28. Emacs Manual Node Persistency Issues
  29. Emacs: dired-do-query-replace-regex Replace ALL (fixed)
  30. Problems of Emacs Supporting Obsolete Systems
  31. Elisp: Function to Copy/Delete a Dir Recursively (fixed)
  32. Thoughts on Common Lisp Scheme Lisp Based Emacs
  33. Text Editors Popularity and Market Research
  34. Text Editor's Cursor Movement Behavior (emacs, vi, Notepad++)
  35. GNU Emacs Development Inefficiency
  36. Emacs Dev Inefficiency and Emacs Web 2.0?
  37. Letter-Case Commands Usability Problems
  38. Emacs: Select Line, between Quotes, Extend Selection
  39. Emacs: isearch Current Word
  40. Suggestions on Line Wrap Commands
  41. Emacs: Single Key to Delete Whole Line
  42. Emacs Undo and Emacs Cult Problem

If you have a question, put $5 at patreon and message me.
Or Buy Xah Emacs Tutorial
Or buy a nice keyboard: Best Keyboards for Emacs

Emacs

Emacs Lisp

Misc