From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Joakim Hove Newsgroups: gmane.emacs.help Subject: Re: eval: (search-forward) Date: Mon, 11 Oct 2004 09:59:36 +0200 Organization: University of Bergen Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1097481639 23012 80.91.229.6 (11 Oct 2004 08:00:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 11 Oct 2004 08:00:39 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 11 10:00:32 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CGv6e-0007JH-00 for ; Mon, 11 Oct 2004 10:00:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CGvDZ-0005rD-Ma for geh-help-gnu-emacs@m.gmane.org; Mon, 11 Oct 2004 04:07:41 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!uninett.no!nntp.uib.no!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 36 Original-NNTP-Posting-Host: termo1.fi.uib.no Original-X-Trace: toralf.uib.no 1097481564 66606 129.177.39.206 (11 Oct 2004 07:59:24 GMT) Original-X-Complaints-To: abuse@uib.no Original-NNTP-Posting-Date: 11 Oct 2004 07:59:24 GMT User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.2 (gnu/linux) Cancel-Lock: sha1:cbcUDWtWsNInA5Co1MGzrUmkBuM= Original-Xref: shelby.stanford.edu gnu.emacs.help:125820 Original-To: help-gnu-emacs@gnu.org 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: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:21186 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:21186 Albert Reiner writes: >> Local Variables: >> eval: (add-hook 'find-file-hook (lambda () (goto-char (point-min)) >> (search-forward "%%WORK%%")) t t) >> End: I thought the hook was called find-file-hooks. The following works for me: ^ 1. Define the local variable work-string (or whatever) *as a string*, in the relevant file. 2. The following function in .emacs or somewhere: (defun goto-work () (if (boundp 'work-string) (progn (goto-char (point-min)) (unless (search-forward work-string (point-max) 't) (message (format "Could not find \"%s\" in buffer" work-string)))))) 3. (add-hook 'find-file-hooks 'goto-work) Your existing soultion might work by just changin find-file-hook -> find-file-hooks though. HTH - Joakim -- Joakim Hove hove AT ift uib no +47 (55 5)8 27 90 http://www.ift.uib.no/~hove/