all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Evaluation of hooks
@ 2005-12-24 19:22 Sebastian Tennant
  0 siblings, 0 replies; 6+ messages in thread
From: Sebastian Tennant @ 2005-12-24 19:22 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <mailman.20359.1135455656.20277.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2005-12-26 22:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-24 19:22 Evaluation of hooks Sebastian Tennant
     [not found] <mailman.20359.1135455656.20277.help-gnu-emacs@gnu.org>
2005-12-25  2:36 ` Tom Breton
2005-12-25 22:26   ` Sebastian Tennant
2005-12-26 22:07     ` Sebastian Tennant
2005-12-26 22:32       ` Cameron Desautels
2005-12-26 22:41         ` Sebastian Tennant

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.