[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Elisp -- Check if a buffer has a valid `Local Variables' block
From: |
Leo |
Subject: |
Re: Elisp -- Check if a buffer has a valid `Local Variables' block |
Date: |
Mon, 03 Sep 2007 15:55:03 +0100 |
User-agent: |
Gnus/5.110007 Emacs/23.0.50 (20070901) Fedora 7 (gnu/linux) |
On 2007-09-03 15:27 +0100, Kevin Rodgers wrote:
> Leo wrote:
>> Dear all,
>>
>> Emacs has some rules regarding the Local Variables block. I wonder if
>
>> there is a function to validate that block or go to that block etc. if
>> not could you help me create one?
>>
>> #v+
>> (defun sdl:goto-local-variables ()
>> (interactive)
>> (let (pt pos)
>> (save-excursion
>> (goto-char (point-max))
>> (save-restriction
>> (narrow-to-page)
>> (if (> (- (point-max) (point-min)) 3000)
>> (setq pt (- (point-max) 3000))
>> (setq pt (point-min))))
>> (goto-char pt)
>> (when (re-search-forward ".*Local Variables:\n\\(.*\n\\)*.*End:" nil t)
>> (beginning-of-line 2)
>> (setq pos (point))))
>> (if pos
>> (goto-char pos))))
>
> (condition-case nil
> (progn (hack-local-variables t) t)
> (error nil))
This looks neat. Thanks.
--
Leo <sdl.web AT gmail.com> (GPG Key: 9283AA3F)
Gnus is one component of the Emacs operating system.