[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to call a function on every directory change (in dired)?
From: |
Marc Mientki |
Subject: |
How to call a function on every directory change (in dired)? |
Date: |
Wed, 08 Dec 2010 15:30:09 -0000 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 |
Hello!
I have some problem which I can't solve myself.
My goal is to run one specified function *each time* I enter
a directory in dired-mode. After some investigation I found
seemingly the right hook: dired-after-readin-hook. I defined the
test function foo:
(defun foo ()
(message "--> huhu"))
and add it to the above hook:
(add-hook 'dired-after-readin-hook 'foo)
Now when I enter first time a directory everything works fine -
I see in minibuffer '--> huhu'. The problem is when I leave the
directory (I do RET on '..', or press '^' - NOT kill buffer) and
enter this directory once again foo will be not called. I think
the reason is that in case of reenter of a directory - which
has already an existing buffer - dired only switch to this buffer
so the dired-after-readin-hook is not affected. But I can't find
no bufer hook that can solve my problem. Some analysis of lisp
code in dired.el (dired-find-file) and files.el (find-file)
brought no success.
Any ideas?
regards
Marc
- How to call a function on every directory change (in dired)?,
Marc Mientki <=