The new syntax-table capabalities which were recently committed broke
autoload.el. Specifically, it was choking with "Unbalanced parentheses"
on files which contained unquoted pipe ('|') characters.
I've managed to figure out what was happening, and have a fix for it
which I'll be submitting. I wanted to discuss the issue a bit though,
and get someone's opinion on the right thing to do.
The problem is that lisp-mode-syntax-table was being incorrectly
initialized because the length of the list returned by
parse-partial-sexp changed (from 8 to 10) with the new functionality.
lisp-mode-syntax-table is copied from emacs-lisp-mode-syntax-table. It
then (among other things) gets | defined as a quote character. Then if
"new" parse-partial-sexp functionality is available, | is redefined as
punctuation and as part of the #|...|# comment sequence.
Here's the fix (and I realize that these diffs may be a bit mangled by
the text wrapping of my mail client. sorry about that, and I'll make
sure the final one sent to xemacs-patches isn't):
Index: lisp-mode.el
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/lisp/lisp-mode.el,v
retrieving revision 1.10.2.7
diff -u -r1.10.2.7 lisp-mode.el
--- lisp-mode.el 2000/11/23 06:27:36 1.10.2.7
+++ lisp-mode.el 2001/02/17 09:34:25
@@ -177,7 +177,7 @@
;;
;; If emacs was compiled with NEW_SYNTAX, then do
;; CL's #| |# block comments.
- (if (= 8 (length (parse-partial-sexp (point) (point))))
+ (if (< 7 (length (parse-partial-sexp (point) (point))))
(progn
(modify-syntax-entry ?# "' 58"
lisp-mode-syntax-table)
(modify-syntax-entry ?| ". 67"
lisp-mode-syntax-table))
---- end of patch ----
I have three problems with this as the only fix, though:
1) This seeems like an odd way to detect syntax-table functionality,
and XEmacs now supports the required functionality unequivocally,
so there's no need to detect it at all.
2) | should still be a quote character under lisp-mode, in addition
to being part of a two-char comment sequence.
3) autoload.el should be using the emacs-lisp syntax table, instead of
the standard lisp one (it is, after all, dealing with emacs lisp).
Therefore, I propose the following patch instead:
Index: lisp-mode.el
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/lisp/lisp-mode.el,v
retrieving revision 1.10.2.7
diff -u -r1.10.2.7 lisp-mode.el
--- lisp-mode.el 2000/11/23 06:27:36 1.10.2.7
+++ lisp-mode.el 2001/02/17 09:45:14
@@ -170,19 +170,11 @@
(if (not lisp-mode-syntax-table)
(progn (setq lisp-mode-syntax-table
(copy-syntax-table emacs-lisp-mode-syntax-table))
- (modify-syntax-entry ?\| "\" " lisp-mode-syntax-table)
(modify-syntax-entry ?\[ "_ " lisp-mode-syntax-table)
;; XEmacs changes
(modify-syntax-entry ?\] "_ " lisp-mode-syntax-table)
- ;;
- ;; If emacs was compiled with NEW_SYNTAX, then do
- ;; CL's #| |# block comments.
- (if (= 8 (length (parse-partial-sexp (point) (point))))
- (progn
- (modify-syntax-entry ?# "' 58"
lisp-mode-syntax-table)
- (modify-syntax-entry ?| ". 67"
lisp-mode-syntax-table))
- ;; else, old style
- (modify-syntax-entry ?\| "\" " lisp-mode-syntax-table))))
+ (modify-syntax-entry ?# "' 58" lisp-mode-syntax-table)
+ (modify-syntax-entry ?| "\" 67" lisp-mode-syntax-table)))
(define-abbrev-table 'lisp-mode-abbrev-table ())
Index: autoload.el
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/lisp/autoload.el,v
retrieving revision 1.2.2.7
diff -u -r1.2.2.7 autoload.el
--- autoload.el 2000/09/20 02:39:08 1.2.2.7
+++ autoload.el 2001/02/17 09:45:14
@@ -167,7 +167,7 @@
(let ((find-file-hooks nil)
(enable-local-variables nil))
(set-buffer (or visited (find-file-noselect file)))
- (set-syntax-table lisp-mode-syntax-table))
+ (set-syntax-table emacs-lisp-mode-syntax-table))
(save-excursion
(save-restriction
(widen)
This fixes both autoload.el and lisp-mode-syntax-table properly. Any
objections?