changeset 20014:2ecea967337d

(elint-check-defcustom-form): New function. (elint-special-forms): Use it.
author Karl Heuer <kwzh@gnu.org>
date Thu, 02 Oct 1997 02:47:57 +0000
parents cc417f06a333
children d5c245242a88
files lisp/emacs-lisp/elint.el
diffstat 1 files changed, 23 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/elint.el	Wed Oct 01 17:28:02 1997 +0000
+++ b/lisp/emacs-lisp/elint.el	Thu Oct 02 02:47:57 1997 +0000
@@ -145,7 +145,7 @@
   ;; ** top form ** header...
   (let ((elint-top-form-logged t))
     (elint-log-message "\nLinting complete.\n")))
-	
+
 (defun elint-defun ()
   "Lint the function at point."
   (interactive)
@@ -193,7 +193,7 @@
 	 (elint-init-env elint-buffer-forms))
     (set (make-local-variable 'elint-last-env-time) (buffer-modified-tick))
     elint-buffer-forms))
-       
+
 (defun elint-get-top-forms ()
   "Collect all the top forms in the current buffer."
   (save-excursion
@@ -271,7 +271,7 @@
      (ding)
      (message "Can't get variables from require'd library %s" name)))
   env)
-					
+
 (defun regexp-assoc (regexp alist)
   "Search for a key matching REGEXP in ALIST."
   (let ((res nil))
@@ -312,11 +312,11 @@
     (defmacro . elint-check-defun-form)
     (defvar . elint-check-defvar-form)
     (defconst . elint-check-defvar-form)
-    (defcustom . elint-check-defvar-form)
+    (defcustom . elint-check-defcustom-form)
     (macro . elint-check-macro-form)
     (condition-case . elint-check-condition-case-form))
   "Functions to call when some special form should be linted.")
-								
+
 (defun elint-form (form env)
   "Lint FORM in the environment ENV.
 The environment created by the form is returned."
@@ -334,9 +334,9 @@
 	   ((eq args 'undefined)
 	    (setq argsok nil)
 	    (elint-error "Call to undefined function: %s" form))
-       
+
 	   ((eq args 'unknown) nil)
-	 
+
 	   (t (setq argsok (elint-match-args form args))))
 
 	  ;; Is this a macro?
@@ -526,7 +526,7 @@
       (if (symbolp sym)
 	  (setq newenv (elint-env-add-var newenv sym))))
     newenv))
-			
+
 (defun elint-check-defvar-form (form env)
   "Lint the defvar/defconst FORM in ENV."
   (if (or (= (length form) 2)
@@ -536,7 +536,16 @@
 			     (car (cdr form)))
     (elint-error "Malformed variable declaration: %s" form)
     env))
-   
+
+(defun elint-check-defcustom-form (form env)
+  "Lint the defcustom FORM in ENV."
+  (if (and (> (length form) 3)
+	   (evenp (length form)))	; even no. of keyword/value args
+      (elint-env-add-global-var (elint-form (nth 2 form) env)
+				(car (cdr form)))
+    (elint-error "Malformed variable declaration: %s" form)
+    env))
+
 (defun elint-check-function-form (form env)
   "Lint the function FORM in ENV."
   (let ((func (car (cdr-safe form))))
@@ -591,7 +600,7 @@
 	  (setq errforms (cdr errforms))
 	  )))
     resenv))
-	
+
 ;;;
 ;;; Message functions
 ;;;
@@ -605,7 +614,7 @@
   (let ((errstr (apply 'format string args)))
     (elint-log-message errstr)
     ))
-    
+
 (defun elint-warning (string &rest args)
   "Report an linting warning.
 STRING and ARGS are thrown on `format' to get the message."
@@ -668,11 +677,11 @@
 	  (setq truncate-lines t)
 	  (set-buffer oldbuf)))
       )))
-      
+
 ;;;
 ;;; Initializing code
 ;;;
-   
+
 ;;;###autoload
 (defun elint-initialize ()
   "Initialize elint."
@@ -733,7 +742,7 @@
      point-before-scroll require-final-newline selective-display
      selective-display-ellipses tab-width truncate-lines vc-mode)
   "Standard buffer local vars.")
-  
+
 (defconst elint-unknown-builtin-args
   '((while test &rest forms)
     (insert-before-markers-and-inherit &rest text)