unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Joakim Hove <hove@ift.uib.no>
Subject: Re: eval: (search-forward)
Date: Mon, 11 Oct 2004 09:59:36 +0200	[thread overview]
Message-ID: <bjju0t13ct3.fsf@termo1.fi.uib.no> (raw)
In-Reply-To: vw8k6tyfx3r.fsf@berry.phys.ntnu.no


Albert Reiner <areiner@tph.tuwien.ac.at> 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/

  reply	other threads:[~2004-10-11  7:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-09 12:48 eval: (search-forward) Albert Reiner
2004-10-10 12:33 ` Oliver Scholz
2004-10-10 14:48   ` Albert Reiner
2004-10-11  7:59     ` Joakim Hove [this message]
2004-10-11 10:16       ` Albert Reiner
2004-10-12 13:57       ` Albert Reiner
2004-10-18  7:02         ` Joakim Hove
2004-10-24 16:11           ` eval: (search-forward) (Solved) Albert Reiner
2004-10-11  9:40     ` eval: (search-forward) Oliver Scholz
2004-10-11 10:09       ` Albert Reiner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bjju0t13ct3.fsf@termo1.fi.uib.no \
    --to=hove@ift.uib.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).