help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Evaluation of hooks


From: Sebastian Tennant
Subject: Re: Evaluation of hooks
Date: 25 Dec 2005 22:26:12 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Tom Breton <tehom@REMOVEpanNOSPAMix.com> wrote:

> Sebastian Tennant <sebyte@smolny.plus.com> wrote:
> 
> > 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
> 
> I doubt that has anything to do with hooks.

It's odd though, don't you think?  I'm wondering if I should fie a bug report.

> > 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))))
> 
> Nope, that doesn't work either ... sometimes.

I've got it working (despite the aforementioned error at startup). The problem
was that (view-mode-enable) is only defined as a function *after* view-mode is
loaded.  The fix was to replace this with (view-mode 1).

sdt






reply via email to

[Prev in Thread] Current Thread [Next in Thread]