[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: eval: (search-forward)
From: |
Albert Reiner |
Subject: |
Re: eval: (search-forward) |
Date: |
12 Oct 2004 15:57:39 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
[Joakim Hove <hove@ift.uib.no>, Mon, 11 Oct 2004 09:59:36 +0200]:
> 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)
I have modified goto-work to be (interactive) and would have expected
that I could then use M-x goto-work to go to the current position of
work-string at any time. But surprisingly, after the hook is run the
boundp test always fails, as if the buffer-local value went away after
initialization. Any simple fix?
TIA,
Albert.