help-gnu-emacs
[Top][All Lists]
Advanced

[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: Kevin Rodgers
Subject: Re: Elisp -- Check if a buffer has a valid `Local Variables' block
Date: Mon, 03 Sep 2007 08:27:53 -0600
User-agent: Thunderbird 1.5.0.13 (Macintosh/20070809)

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))

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

[Prev in Thread] Current Thread [Next in Thread]