From: Leo <sdl.web@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Elisp -- Check if a buffer has a valid `Local Variables' block
Date: Mon, 03 Sep 2007 15:55:03 +0100 [thread overview]
Message-ID: <m2ir6ryf20.fsf@cam.ac.uk> (raw)
In-Reply-To: fbh5lb$bf1$1@sea.gmane.org
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.
prev parent reply other threads:[~2007-09-03 14:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-26 15:56 Elisp -- Check if a buffer has a valid `Local Variables' block Leo
2007-09-03 14:27 ` Kevin Rodgers
2007-09-03 14:55 ` Leo [this message]
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=m2ir6ryf20.fsf@cam.ac.uk \
--to=sdl.web@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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).