From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sebastian Tennant Newsgroups: gmane.emacs.help Subject: Re: Evaluation of hooks Date: 25 Dec 2005 22:26:12 +0000 Message-ID: <87zmmoreyj.fsf@smolny.plus.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1135549602 21623 80.91.229.2 (25 Dec 2005 22:26:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 25 Dec 2005 22:26:42 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Dec 25 23:26:41 2005 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EqeK8-00025C-QF for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Dec 2005 23:26:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EqeLJ-0004Xn-E8 for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Dec 2005 17:27:53 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EqeL2-0004Xh-LI for help-gnu-emacs@gnu.org; Sun, 25 Dec 2005 17:27:36 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EqeL2-0004XV-3v for help-gnu-emacs@gnu.org; Sun, 25 Dec 2005 17:27:36 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EqeL1-0004XS-VH for help-gnu-emacs@gnu.org; Sun, 25 Dec 2005 17:27:36 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EqeKk-0003M6-9B for help-gnu-emacs@gnu.org; Sun, 25 Dec 2005 17:27:18 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1EqeJl-0001yr-51 for help-gnu-emacs@gnu.org; Sun, 25 Dec 2005 23:26:17 +0100 Original-Received: from 82.155.147.48 ([82.155.147.48]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 25 Dec 2005 23:26:17 +0100 Original-Received: from sebyte by 82.155.147.48 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 25 Dec 2005 23:26:17 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 43 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 82.155.147.48 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:32228 Archived-At: Tom Breton wrote: > Sebastian Tennant 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