[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Evaluation of hooks
From: |
Sebastian Tennant |
Subject: |
Evaluation of hooks |
Date: |
24 Dec 2005 19:22:37 +0000 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Hi all,
I would like to add a function to my emacs-lisp-mode-hook so that whenever I
visit emacs source files, view-mode minor mode is enabled.
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(when (>= (compare-strings
(buffer-file-name) 1 nil "/usr/share/emacs/" 1 nil) 17)
(view-mode-enable))))
With the above code in my ~/.emacs, I get the following message at startup:
>: Wrong type argument: stringp, nil
but apart from this the startup process is unaffected, and the function is
successfully added to my emacs-lisp-mode-hook, as you can see:
((lambda nil
(when
(>
(compare-strings
(buffer-file-name)
0 nil "/usr/share/emacs/" 0 nil)
18)
(view-mode-enable))))
Needless to say the hook doesn't work, i.e., view-mode is not enabled when I
visit files whose full name begins /usr/share/emacs/.
The condition itself works fine, but just not as a hook. I have tried quoting
the function (buffer-file-name) but this did not improve things.
Any help much appreciated.
TIA
sdt
- Evaluation of hooks,
Sebastian Tennant <=