[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
find-file-hook for a specific file?
From: |
Plugger |
Subject: |
find-file-hook for a specific file? |
Date: |
Wed, 16 Feb 2011 16:32:49 -0800 (PST) |
User-agent: |
G2/1.0 |
How can I get a find-file hook function to run for only a specific file?
Conceptually, I'd like this: (find-file "myfile.txt" 'myfile-hook-function)
I want myfile-hook-function to run only on the first call to find-file, i.e.
when the file is opened and loaded, but not if the file is already loaded.
I do this now:
(add-hook 'find-file-hook 'myfile-hook-function)
(find-file "myfile.txt")
(remove-hook 'find-file-hook 'myfile-hook-function)
This works, but it seems hokey.
- find-file-hook for a specific file?,
Plugger <=