From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani
Concerning factorization, couldn't one use [\n\r] in all cases rather than a switch based on some input argument ?
I was also wondering whether it is not possible to have a single regexp
for the whole Local Variable section. The following `doit' function is = a
trial to do so. `M-x doit' will seach forward the whole Local Variables=
section and display "ok" if found, "nak" otherwise.
(defun doit ()
=C2=A0 (interactive)
=C2=A0 (let* ((eol "\\(\r\n?\\|\n\\)")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(eol-again "\\1")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(space-maybe "[ \t]*")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; suffix may be the empty string
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(suffix=C2=A0 "\\([^ \r\n]+\\(?:[^\r= \n]*[^ \r\n]\\)?\\|\\)")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(prefix "\\([ \t]*[^ \r\n]+\\(?:[^\r= \n]*[^ \r\n]\\)?\\)")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(prefix-again "\\2")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(suffix-again "\\3")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(symbol: "\\(?:\\(?:[^][()'\&quo= t; \t\r\n]\\|\\\\[][()'\" \t]\\)+[ \t]*:\\)")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(sexp (concat "\\(?:" (substrin= g prefix 2))))
=C2=A0 =C2=A0 (message (if (and (re-search-forward
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (concat eol<= br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 prefix space-maybe "Local Variables:" space-may= be suffix space-maybe eol-again
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 "\\(?:" prefix space-maybe symbol:=C2=A0 sexp s= pace-maybe suffix-again space-maybe eol-again "\\)*"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 prefix space-maybe "End:" space-maybe suffix sp= ace-maybe "\\(" eol-again "\\)?"
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 )
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 nil t)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; when the = tailing eol is not there we must be at EOB.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or (match-s= tring 3) (eobp)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "ok" "n= ak"))))