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: Evaluation of hooks Date: 24 Dec 2005 19:22:37 +0000 Message-ID: <87wthul2pu.fsf@smolny.plus.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1135455610 13969 80.91.229.2 (24 Dec 2005 20:20:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 24 Dec 2005 20:20:10 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 24 21:20:08 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 1EqFs6-0005n1-6v for geh-help-gnu-emacs@m.gmane.org; Sat, 24 Dec 2005 21:20:06 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EqFtD-0003rD-Ey for geh-help-gnu-emacs@m.gmane.org; Sat, 24 Dec 2005 15:21:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EqFss-0003pi-0V for help-gnu-emacs@gnu.org; Sat, 24 Dec 2005 15:20:54 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EqFsp-0003p7-GN for help-gnu-emacs@gnu.org; Sat, 24 Dec 2005 15:20:53 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EqFsp-0003p3-D6 for help-gnu-emacs@gnu.org; Sat, 24 Dec 2005 15:20:51 -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 1EqFsL-0007Ca-Q6 for help-gnu-emacs@gnu.org; Sat, 24 Dec 2005 15:20:22 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1EqFra-0005gM-Bn for help-gnu-emacs@gnu.org; Sat, 24 Dec 2005 21:19:34 +0100 Original-Received: from bl6-147-48.dsl.telepac.pt ([82.155.147.48]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 24 Dec 2005 21:19:34 +0100 Original-Received: from sebyte by bl6-147-48.dsl.telepac.pt with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 24 Dec 2005 21:19:34 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: help-gnu-emacs@gnu.org Original-Lines: 41 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: bl6-147-48.dsl.telepac.pt 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:32209 Archived-At: 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