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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Elisp -- Check if a buffer has a valid `Local Variables' block


From: Leo
Subject: Elisp -- Check if a buffer has a valid `Local Variables' block
Date: Sun, 26 Aug 2007 16:56:49 +0100
User-agent: Gnus/5.110007 Emacs/23.0.0 (20070826) Fedora 7 (gnu/linux)

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

-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

         Gnus is one component of the Emacs operating system.





reply via email to

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