Fri, 3 Dec 2004 (09:57 +0900 UTC) Stephen J. Turnbull wrote:
>>>>> "robert" == robert delius royar
<xemacs(a)frinabulax.org> writes:
robert> ^L
robert> local variables:
robert> mode: text
robert> eval: (hide-buffer-variables)
robert> end:
robert> Here is the defun:
(defun hide-buffer-variables ()
"Narrow to first page and hide variables. Assumes only two pages."
(let ((pos (point)))
(end-of-buffer)
(narrow-to-page -1)
(goto-char pos)
)
)
robert> If I remove (goto-char pos), I do not get the error. I
robert> verified that pos is before the last page.
Well, what's happening is that XEmacs hasn't read the "end:"
directive, and tries to continue parsing. Because you've disturbed
point, it finds a syntax error. It would be possible to change the
local variables hack to read the sexps and save them until the "end:"
directive is read, then execute them, but eval expressions are
deprecated anyway.
I'm comfortable with saying "If it hurts, don't do it." :-)
Alternative ways of achieving the same goal would be to write a mode
hook or similar to do the same thing, or even a whole mode.
Stephen,
Thanks, I added a call to the function in my existing text-mode hook, but received
the same error (after removing the `eval:' line. However, I then tried
removing the LV section at the end and adding
-*- mode: emacs-lisp -*-
^L
To the beginning of the file and rewrote the defun to be
(defun hide-buffer-variables ()
"Narrow to second page and hide variables. Assumes only two pages."
(let ((cpos (point)))
(goto-char (point-min))
(narrow-to-page 1)
(goto-char cpos)
)
)
It works.
--
Dr. Robert Delius Royar Associate Professor of English
Morehead State University Morehead, Kentucky