Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I open Aquamacs and jump to a specific line number from the command line (I've already installed the Aquamacs command line tools).

In regular emacs I can do emacs +5 test.txt to open and jump to line 5, but it doesn't work when I replace emacs with aquamacs.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Looks like the answer is no:

unlike the “emacs” command, “aquamacs” currently does not process other arguments than filenames.

But M-g-g (GoTo line) still works once you have the file open.

share|improve this answer

This small AppleScript / bash function opens a file and jumps to a specific line.

First, add this function to your ~/.bash_profile:

function aquamacs-line {
  aquamacs "$2"
  osascript -e "
  tell application \"AquaMacs\"
    activate
    tell application \"System Events\"
      keystroke \"l\" using command down
      keystroke \"$1\"
      key code 36
    end tell
  end tell" > /dev/null 2>&1
}

Reload the shell by opening a new terminal or calling source ~/.bash_profile. Then call it, for example with:

aquamacs-line 5 /some/file

There is of room for improvement, but it works so far. Others feel free to add/fix stuff.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.