changeset 104989:bbe883d49650

(elint-init-env): Skip non-list forms. (elint-log): Handle unknown file positions.
author Glenn Morris <rgm@gnu.org>
date Sat, 12 Sep 2009 22:32:52 +0000
parents 3edc5799260a
children f0794252d960
files lisp/ChangeLog lisp/emacs-lisp/elint.el
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Sep 12 19:05:49 2009 +0000
+++ b/lisp/ChangeLog	Sat Sep 12 22:32:52 2009 +0000
@@ -18,6 +18,8 @@
 	1000.
 	(elint-add-required-env): Don't beep on error.
 	(elint-forms): In case of error, return ENV unchanged.
+	(elint-init-env): Skip non-list forms.
+	(elint-log): Handle unknown file positions.
 
 2009-09-12  Daiki Ueno  <ueno@unixuser.org>
 
--- a/lisp/emacs-lisp/elint.el	Sat Sep 12 19:05:49 2009 +0000
+++ b/lisp/emacs-lisp/elint.el	Sat Sep 12 22:32:52 2009 +0000
@@ -298,6 +298,9 @@
       (setq form (elint-top-form-form (car forms))
 	    forms (cdr forms))
       (cond
+       ;; Eg nnmaildir seems to use [] as a form of comment syntax.
+       ((not (listp form))
+	(elint-error "Skipping non-list form `%s'" form))
        ;; Add defined variable
        ((memq (car form) '(defvar defconst defcustom))
 	(setq env (elint-env-add-var env (cadr form))))
@@ -686,10 +689,12 @@
 			       (if f
 				   (file-name-nondirectory f)
 				 (buffer-name)))
-			     (save-excursion
-			       (goto-char elint-current-pos)
-			       (1+ (count-lines (point-min)
-						(line-beginning-position))))
+			     (if (boundp 'elint-current-pos)
+				 (save-excursion
+				   (goto-char elint-current-pos)
+				   (1+ (count-lines (point-min)
+						    (line-beginning-position))))
+			       0)	; unknown position
 			     type
 			     (apply 'format string args))))