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.

I used to use tomboy wiki and they allowed you to bind opening a new note to a keyboard combination.

I use emacs on Lion and I want replicate this behaviour. I want to visit a new/existing file in my projects folder named yyyymmdd.md by pressing shift-z-command anywhere.

It might be possible to use automator to run a shell script that gets the iso date and then appends the directory path and .md at the end. Then it calls emacs with those arguments. As a service I can assign it to a keyboard combination. But I have no idea how to complete the steps exactly.

share|improve this question
    
I updated the question. –  Fire Oct 16 '11 at 2:10

2 Answers 2

up vote 0 down vote accepted
#!/bin/bash

date=$(date '+%Y%m%d')
f="$HOME/Desktop/$date.md"
[[ ! -f "$f" ]] && echo $'## $date\n' > "$f"
# emacs "$f"
open "$f" -a Aquamacs

And Assign a shortcut to running a script in OS X - Super User

share|improve this answer
    
I believe emacs just visits the file. If it doesn't exist it is created. –  Fire Oct 14 '11 at 20:17
    
If you want to open an emacs app you can just use record using applescript, then run it with osascript -e . –  Fire Oct 15 '11 at 1:44
    
@Fire Only a few apps (like Finder and BBEdit) support recording AppleScripts. open -a SomeApp is pretty much equivalent to osascript -e $'tell app "SomeApp"\nreopen\nactivate\nend tell'. osascript is a lot slower though. –  Lri Oct 15 '11 at 3:03
    
I'm just wondering if I can use open -a Emacs with a filename? –  Fire Oct 15 '11 at 7:25
    
If you mean the graphical Emacs.app, then yeah. –  Lri Oct 15 '11 at 7:35

I don't know of any freeware that does this, but here are some shareware apps :

http://nulana.com/shortcuts

http://www.alfredapp.com/ - You need the paid powerpack

http://www.obdev.at/products/launchbar/index.html - Not exactly what you want, but with an action/script you can make it work.

share|improve this answer
    
The system it is designed is for Mac OS X.4.11? I'm on 10.7.2. –  Fire Oct 14 '11 at 6:27
    
The forums is spammed and dead. –  Fire Oct 14 '11 at 6:28
    
I'm going to assume the code is abandoned. –  Fire Oct 14 '11 at 6:29
    
My bad... Please check the updated post. –  Kassym Dorsel Oct 14 '11 at 13:38

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.