annotate lisp/emacs-lisp/elint.el @ 64226:278c7e4c078a

(custom-declare-variable): Doc fix.
author Richard M. Stallman <rms@gnu.org>
date Mon, 11 Jul 2005 05:41:45 +0000
parents 18a818a2ee7c
children 5b1a238fcbb4 f9a65d7ebd29
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38436
b174db545cfd Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 20014
diff changeset
1 ;;; elint.el --- Lint Emacs Lisp
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: Peter Liljenberg <petli@lysator.liu.se>
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6 ;; Created: May 1997
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7 ;; Keywords: lisp
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; any later version.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63511
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 63511
diff changeset
24 ;; Boston, MA 02110-1301, USA.
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;;; Commentary:
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;; This is a linter for Emacs Lisp. Currently, it mainly catches
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;; mispellings and undefined variables, although it can also catch
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; function calls with the wrong number of arguments.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
59506
3da5314608ab Fixed typo in Commentary section.
Reiner Steib <Reiner.Steib@gmx.de>
parents: 58938
diff changeset
32 ;; Before using, call `elint-initialize' to set up some argument
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;; data. This takes a while. Then call elint-current-buffer or
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;; elint-defun to lint a buffer or a defun.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; The linter will try to "include" any require'd libraries to find
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; the variables defined in those. There is a fair amount of voodoo
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; involved in this, but it seems to work in normal situations.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;;; History:
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 ;;; To do:
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 ;; * A list of all standard Emacs variables would be nice to have...
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; * Adding type checking. (Stop that sniggering!)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 ;;; Code:
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 (defvar elint-log-buffer "*Elint*"
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 "*The buffer to insert lint messages in.")
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 ;;;
58938
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
53 ;;; Data
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
54 ;;;
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
55
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
56 (defconst elint-standard-variables
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
57 '(abbrev-mode auto-fill-function buffer-auto-save-file-name
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
58 buffer-backed-up buffer-display-count buffer-display-table buffer-display-time buffer-file-coding-system buffer-file-format
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
59 buffer-file-name buffer-file-number buffer-file-truename
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
60 buffer-file-type buffer-invisibility-spec buffer-offer-save
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
61 buffer-read-only buffer-saved-size buffer-undo-list
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
62 cache-long-line-scans case-fold-search ctl-arrow cursor-type comment-column
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
63 default-directory defun-prompt-regexp desktop-save-buffer enable-multibyte-characters fill-column fringes-outside-margins goal-column
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
64 header-line-format indicate-buffer-boundaries indicate-empty-lines
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
65 left-fringe-width
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
66 left-margin left-margin-width line-spacing local-abbrev-table local-write-file-hooks major-mode
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
67 mark-active mark-ring mode-line-buffer-identification
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
68 mode-line-format mode-line-modified mode-line-process mode-name
63511
964ef053b1bc (elint-init-env): Fix spelling in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 59506
diff changeset
69 overwrite-mode
58938
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
70 point-before-scroll right-fringe-width right-margin-width
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
71 scroll-bar-width scroll-down-aggressively scroll-up-aggressively selective-display
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
72 selective-display-ellipses tab-width truncate-lines vc-mode vertical-scroll-bar)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
73 "Standard buffer local vars.")
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
74
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
75 (defconst elint-unknown-builtin-args
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
76 '((while test &rest forms)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
77 (insert-before-markers-and-inherit &rest text)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
78 (catch tag &rest body)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
79 (and &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
80 (funcall func &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
81 (insert &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
82 (vconcat &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
83 (run-hook-with-args hook &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
84 (message-or-box string &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
85 (save-window-excursion &rest body)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
86 (append &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
87 (logior &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
88 (progn &rest body)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
89 (insert-and-inherit &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
90 (message-box string &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
91 (prog2 x y &rest body)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
92 (prog1 first &rest body)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
93 (insert-before-markers &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
94 (call-process-region start end program &optional delete
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
95 destination display &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
96 (concat &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
97 (vector &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
98 (run-hook-with-args-until-success hook &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
99 (track-mouse &rest body)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
100 (unwind-protect bodyform &rest unwindforms)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
101 (save-restriction &rest body)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
102 (quote arg)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
103 (make-byte-code &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
104 (or &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
105 (cond &rest clauses)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
106 (start-process name buffer program &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
107 (run-hook-with-args-until-failure hook &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
108 (if cond then &rest else)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
109 (apply function &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
110 (format string &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
111 (encode-time second minute hour day month year zone &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
112 (min &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
113 (logand &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
114 (logxor &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
115 (max &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
116 (list &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
117 (message string &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
118 (defvar symbol init doc)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
119 (call-process program &optional infile destination display &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
120 (with-output-to-temp-buffer bufname &rest body)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
121 (nconc &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
122 (save-excursion &rest body)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
123 (run-hooks &rest hooks)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
124 (/ x y &rest zs)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
125 (- x &rest y)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
126 (+ &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
127 (* &rest args)
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
128 (interactive &optional args))
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
129 "Those built-ins for which we can't find arguments.")
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
130
f3ac898990de (elint-standard-variables, elint-unknown-builtin-args): Move definitions up.
Richard M. Stallman <rms@gnu.org>
parents: 58740
diff changeset
131 ;;;
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 ;;; ADT: top-form
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
133 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
134
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
135 (defsubst elint-make-top-form (form pos)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
136 "Create a top form.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
137 FORM is the form, and POS is the point where it starts in the buffer."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
138 (cons form pos))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
139
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140 (defsubst elint-top-form-form (top-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
141 "Extract the form from a TOP-FORM."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
142 (car top-form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
144 (defsubst elint-top-form-pos (top-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
145 "Extract the position from a TOP-FORM."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
146 (cdr top-form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
147
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
148 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
149 ;;; ADT: env
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
150 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
151
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
152 (defsubst elint-make-env ()
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
153 "Create an empty environment."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154 (list (list nil) nil nil))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 (defsubst elint-env-add-env (env newenv)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157 "Augment ENV with NEWENV.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
158 None of them is modified, and the new env is returned."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
159 (list (append (car env) (car newenv))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 (append (car (cdr env)) (car (cdr newenv)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
161 (append (car (cdr (cdr env))) (car (cdr (cdr newenv))))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
162
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163 (defsubst elint-env-add-var (env var)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164 "Augment ENV with the variable VAR.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 The new environment is returned, the old is unmodified."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 (cons (cons (list var) (car env)) (cdr env)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 (defsubst elint-env-add-global-var (env var)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 "Augment ENV with the variable VAR.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 ENV is modified so VAR is seen everywhere.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
171 ENV is returned."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 (nconc (car env) (list (list var)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
174
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 (defsubst elint-env-find-var (env var)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
176 "Non-nil if ENV contains the variable VAR.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
177 Actually, a list with VAR as a single element is returned."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 (assq var (car env)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 (defsubst elint-env-add-func (env func args)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 "Augment ENV with the function FUNC, which has the arguments ARGS.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
182 The new environment is returned, the old is unmodified."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
183 (list (car env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
184 (cons (list func args) (car (cdr env)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
185 (car (cdr (cdr env)))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
186
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
187 (defsubst elint-env-find-func (env func)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
188 "Non-nil if ENV contains the function FUNC.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
189 Actually, a list of (FUNC ARGS) is returned."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
190 (assq func (car (cdr env))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
192 (defsubst elint-env-add-macro (env macro def)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
193 "Augment ENV with the macro named MACRO.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 DEF is the macro definition (a lambda expression or similar).
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 The new environment is returned, the old is unmodified."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 (list (car env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 (car (cdr env))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 (cons (cons macro def) (car (cdr (cdr env))))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 (defsubst elint-env-macro-env (env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201 "Return the macro environment of ENV.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 This environment can be passed to `macroexpand'."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 (car (cdr (cdr env))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 (defsubst elint-env-macrop (env macro)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 "Non-nil if ENV contains MACRO."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
207 (assq macro (elint-env-macro-env env)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
208
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
209 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
210 ;;; User interface
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
211 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
212
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
213 (defun elint-current-buffer ()
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
214 "Lint the current buffer."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
215 (interactive)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216 (elint-clear-log (format "Linting %s" (if (buffer-file-name)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
217 (buffer-file-name)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
218 (buffer-name))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
219 (elint-display-log)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
220 (mapcar 'elint-top-form (elint-update-env))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
221
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
222 ;; Tell the user we're finished. This is terribly klugy: we set
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223 ;; elint-top-form-logged so elint-log-message doesn't print the
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 ;; ** top form ** header...
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 (let ((elint-top-form-logged t))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226 (elint-log-message "\nLinting complete.\n")))
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
227
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
228 (defun elint-defun ()
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 "Lint the function at point."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 (interactive)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 (save-excursion
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232 (if (not (beginning-of-defun))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 (error "Lint what?"))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 (let ((pos (point))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 (def (read (current-buffer))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 (elint-display-log)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 (elint-update-env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 (elint-top-form (elint-make-top-form def pos)))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 ;;; Top form functions
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 (defvar elint-buffer-env nil
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 "The environment of a elisp buffer.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248 Will be local in linted buffers.")
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 (defvar elint-buffer-forms nil
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 "The top forms in a buffer.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 Will be local in linted buffers.")
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
253
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
254 (defvar elint-last-env-time nil
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
255 "The last time the buffers env was updated.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
256 Is measured in buffer-modified-ticks and is local in linted buffers.")
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
257
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258 (defun elint-update-env ()
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
259 "Update the elint environment in the current buffer.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
260 Don't do anything if the buffer hasn't been changed since this
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261 function was called the last time.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
262 Returns the forms."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
263 (if (and (local-variable-p 'elint-buffer-env (current-buffer))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
264 (local-variable-p 'elint-buffer-forms (current-buffer))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
265 (local-variable-p 'elint-last-env-time (current-buffer))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
266 (= (buffer-modified-tick) elint-last-env-time))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
267 ;; Env is up to date
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268 elint-buffer-forms
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
269 ;; Remake env
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
270 (set (make-local-variable 'elint-buffer-forms) (elint-get-top-forms))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
271 (set (make-local-variable 'elint-buffer-env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 (elint-init-env elint-buffer-forms))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
273 (set (make-local-variable 'elint-last-env-time) (buffer-modified-tick))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
274 elint-buffer-forms))
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
275
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
276 (defun elint-get-top-forms ()
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277 "Collect all the top forms in the current buffer."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 (save-excursion
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 (let ((tops nil))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
280 (goto-char (point-min))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
281 (while (elint-find-next-top-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 (let ((pos (point)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
283 (condition-case nil
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
284 (setq tops (cons
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285 (elint-make-top-form (read (current-buffer)) pos)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
286 tops))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287 (end-of-file
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 (goto-char pos)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (end-of-line)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
290 (error "Missing ')' in top form: %s" (buffer-substring pos (point)))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
291 ))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
292 (nreverse tops))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
293
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
294 (defun elint-find-next-top-form ()
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
295 "Find the next top form from point.
42206
0f4506820432 Doc fix.
Pavel Janík <Pavel@Janik.cz>
parents: 38436
diff changeset
296 Return nil if there are no more forms, t otherwise."
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
297 (parse-partial-sexp (point) (point-max) nil t)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
298 (not (eobp)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
300 (defun elint-init-env (forms)
63511
964ef053b1bc (elint-init-env): Fix spelling in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents: 59506
diff changeset
301 "Initialize the environment from FORMS."
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
302 (let ((env (elint-make-env))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
303 form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
304 (while forms
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
305 (setq form (elint-top-form-form (car forms))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
306 forms (cdr forms))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
307 (cond
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
308 ;; Add defined variable
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
309 ((memq (car form) '(defvar defconst defcustom))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
310 (setq env (elint-env-add-var env (car (cdr form)))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
311 ;; Add function
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
312 ((memq (car form) '(defun defsubst))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
313 (setq env (elint-env-add-func env (car (cdr form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
314 (car (cdr (cdr form))))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
315 ;; Add macro, both as a macro and as a function
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
316 ((eq (car form) 'defmacro)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
317 (setq env (elint-env-add-macro env (car (cdr form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
318 (cons 'lambda
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
319 (cdr (cdr form))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
320 env (elint-env-add-func env (car (cdr form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
321 (car (cdr (cdr form))))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 ;; Import variable definitions
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324 ((eq (car form) 'require)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 (let ((name (eval (car (cdr form))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326 (file (eval (car (cdr (cdr form))))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327 (setq env (elint-add-required-env env name file))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 ))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 env))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 (defun elint-add-required-env (env name file)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
332 "Augment ENV with the variables definied by feature NAME in FILE."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
333 (condition-case nil
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 (let* ((libname (if (stringp file)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335 file
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336 (symbol-name name)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 ;; First try to find .el files, then the raw name
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 (lib1 (locate-library (concat libname ".el") t))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 (lib (if lib1 lib1 (locate-library libname t))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 ;; Clear the messages :-/
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 (message nil)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343 (if lib
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 (save-excursion
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 (set-buffer (find-file-noselect lib))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 (elint-update-env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
347 (setq env (elint-env-add-env env elint-buffer-env)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
348 (error "dummy error...")))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 (error
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 (ding)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
351 (message "Can't get variables from require'd library %s" name)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 env)
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
353
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
354 (defun regexp-assoc (regexp alist)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 "Search for a key matching REGEXP in ALIST."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 (let ((res nil))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 (while (and alist (not res))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
358 (if (and (stringp (car (car alist)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 (string-match regexp (car (car alist))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
360 (setq res (car alist))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 (setq alist (cdr alist))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
362 res))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
363
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364 (defvar elint-top-form nil
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365 "The currently linted top form, or nil.")
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 (defvar elint-top-form-logged nil
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 "T if the currently linted top form has been mentioned in the log buffer.")
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 (defun elint-top-form (form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 "Lint a top FORM."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 (let ((elint-top-form form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 (elint-top-form-logged nil))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374 (elint-form (elint-top-form-form form) elint-buffer-env)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
376 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
377 ;;; General form linting functions
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
378 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
379
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
380 (defconst elint-special-forms
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
381 '((let . elint-check-let-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 (let* . elint-check-let-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 (setq . elint-check-setq-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
384 (quote . elint-check-quote-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
385 (cond . elint-check-cond-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
386 (lambda . elint-check-defun-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
387 (function . elint-check-function-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 (setq-default . elint-check-setq-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 (defun . elint-check-defun-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 (defsubst . elint-check-defun-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391 (defmacro . elint-check-defun-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 (defvar . elint-check-defvar-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
393 (defconst . elint-check-defvar-form)
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
394 (defcustom . elint-check-defcustom-form)
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
395 (macro . elint-check-macro-form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
396 (condition-case . elint-check-condition-case-form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
397 "Functions to call when some special form should be linted.")
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
398
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
399 (defun elint-form (form env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
400 "Lint FORM in the environment ENV.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
401 The environment created by the form is returned."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 (cond
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 ((consp form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 (let ((func (cdr (assq (car form) elint-special-forms))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 (if func
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 ;; Special form
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 (funcall func form env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 (let* ((func (car form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 (args (elint-get-args func env))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 (argsok t))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
412 (cond
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
413 ((eq args 'undefined)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
414 (setq argsok nil)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
415 (elint-error "Call to undefined function: %s" form))
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
416
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
417 ((eq args 'unknown) nil)
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
418
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
419 (t (setq argsok (elint-match-args form args))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
420
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
421 ;; Is this a macro?
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
422 (if (elint-env-macrop env func)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
423 ;; Macro defined in buffer, expand it
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
424 (if argsok
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
425 (elint-form (macroexpand form (elint-env-macro-env env)) env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
426 env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
427
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
428 (let ((fcode (if (symbolp func)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
429 (if (fboundp func)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
430 (indirect-function func)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
431 nil)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
432 func)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
433 (if (and (listp fcode) (eq (car fcode) 'macro))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
434 ;; Macro defined outside buffer
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
435 (if argsok
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
436 (elint-form (macroexpand form) env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
437 env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
438 ;; Function, lint its parameters
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
439 (elint-forms (cdr form) env))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
440 ))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441 ))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442 ((symbolp form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443 ;; :foo variables are quoted
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
444 (if (and (/= (aref (symbol-name form) 0) ?:)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
445 (elint-unbound-variable form env))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
446 (elint-warning "Reference to unbound symbol: %s" form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
447 env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
448
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
449 (t env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
450 ))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452 (defun elint-forms (forms env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453 "Lint the FORMS, accumulating an environment, starting with ENV."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 ;; grumblegrumbletailrecursiongrumblegrumble
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
455 (while forms
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
456 (setq env (elint-form (car forms) env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 forms (cdr forms)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 (defun elint-unbound-variable (var env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 "T if VAR is unbound in ENV."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 (not (or (eq var nil)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 (eq var t)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 (elint-env-find-var env var)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 (memq var elint-standard-variables))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 ;;; Function argument checking
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
469 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 (defun elint-match-args (arglist argpattern)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
472 "Match ARGLIST against ARGPATTERN."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
473
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
474 (let ((state 'all)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
475 (al (cdr arglist))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
476 (ap argpattern)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
477 (ok t))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 (while
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
479 (cond
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
480 ((and (null al) (null ap)) nil)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
481 ((eq (car ap) '&optional)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
482 (setq state 'optional)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
483 (setq ap (cdr ap))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
484 t)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
485 ((eq (car ap) '&rest)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
486 nil)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
487 ((or (and (eq state 'all) (or (null al) (null ap)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
488 (and (eq state 'optional) (and al (null ap))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
489 (elint-error "Wrong number of args: %s, %s" arglist argpattern)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
490 (setq ok nil)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
491 nil)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
492 ((and (eq state 'optional) (null al))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
493 nil)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
494 (t (setq al (cdr al)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
495 ap (cdr ap))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496 t)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 ok))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 (defun elint-get-args (func env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
500 "Find the args of FUNC in ENV.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
501 Returns `unknown' if we couldn't find arguments."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 (let ((f (elint-env-find-func env func)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503 (if f
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504 (car (cdr f))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 (if (symbolp func)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 (if (fboundp func)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 (let ((fcode (indirect-function func)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 (if (subrp fcode)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 (let ((args (get func 'elint-args)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 (if args args 'unknown))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 (elint-find-args-in-code fcode)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 'undefined)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 (elint-find-args-in-code func)))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 (defun elint-find-args-in-code (code)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 "Extract the arguments from CODE.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 CODE can be a lambda expression, a macro, or byte-compiled code."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 (cond
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 ((byte-code-function-p code)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 (aref code 0))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 ((and (listp code) (eq (car code) 'lambda))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 (car (cdr code)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 ((and (listp code) (eq (car code) 'macro))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 (elint-find-args-in-code (cdr code)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 (t 'unknown)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
526
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
527 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
528 ;;; Functions to check some special forms
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
529 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
530
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
531 (defun elint-check-cond-form (form env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
532 "Lint a cond FORM in ENV."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
533 (setq form (cdr form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
534 (while form
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
535 (if (consp (car form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
536 (elint-forms (car form) env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
537 (elint-error "cond clause should be a list: %s" (car form)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 (setq form (cdr form)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 (defun elint-check-defun-form (form env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 "Lint a defun/defmacro/lambda FORM in ENV."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 (setq form (if (eq (car form) 'lambda) (cdr form) (cdr (cdr form))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 (mapcar (function (lambda (p)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 (or (memq p '(&optional &rest))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
546 (setq env (elint-env-add-var env p)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
547 ))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
548 (car form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 (elint-forms (cdr form) env))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
550
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 (defun elint-check-let-form (form env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 "Lint the let/let* FORM in ENV."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 (let ((varlist (car (cdr form))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 (if (not varlist)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 (progn
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 (elint-error "Missing varlist in let: %s" form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
559 ;; Check for (let (a (car b)) ...) type of error
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
560 (if (and (= (length varlist) 2)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
561 (symbolp (car varlist))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
562 (listp (car (cdr varlist)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 (fboundp (car (car (cdr varlist)))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 (elint-warning "Suspect varlist: %s" form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 ;; Add variables to environment, and check the init values
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 (let ((newenv env))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568 (mapcar (function (lambda (s)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 (cond
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 ((symbolp s)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 (setq newenv (elint-env-add-var newenv s)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 ((and (consp s) (<= (length s) 2))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 (elint-form (car (cdr s))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 (if (eq (car form) 'let)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 env
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 newenv))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 (setq newenv
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
578 (elint-env-add-var newenv (car s))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 (t (elint-error
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
580 "Malformed `let' declaration: %s" s))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581 )))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 varlist)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
583
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 ;; Lint the body forms
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 (elint-forms (cdr (cdr form)) newenv)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 ))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
588 (defun elint-check-setq-form (form env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 "Lint the setq FORM in ENV."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590 (or (= (mod (length form) 2) 1)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591 (elint-error "Missing value in setq: %s" form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
592
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593 (let ((newenv env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594 sym val)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 (setq form (cdr form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596 (while form
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 (setq sym (car form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
598 val (car (cdr form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
599 form (cdr (cdr form)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
600 (if (symbolp sym)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
601 (if (elint-unbound-variable sym newenv)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
602 (elint-warning "Setting previously unbound symbol: %s" sym))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
603 (elint-error "Setting non-symbol in setq: %s" sym))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
604 (elint-form val newenv)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
605 (if (symbolp sym)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
606 (setq newenv (elint-env-add-var newenv sym))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
607 newenv))
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
608
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
609 (defun elint-check-defvar-form (form env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
610 "Lint the defvar/defconst FORM in ENV."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
611 (if (or (= (length form) 2)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
612 (= (length form) 3)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
613 (and (= (length form) 4) (stringp (nth 3 form))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
614 (elint-env-add-global-var (elint-form (nth 2 form) env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
615 (car (cdr form)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
616 (elint-error "Malformed variable declaration: %s" form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
617 env))
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
618
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
619 (defun elint-check-defcustom-form (form env)
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
620 "Lint the defcustom FORM in ENV."
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
621 (if (and (> (length form) 3)
52880
9417a94488d3 (elint-check-defcustom-form): Don't use `evenp' so we don't implicitly
John Paul Wallington <jpw@pobox.com>
parents: 52401
diff changeset
622 ;; even no. of keyword/value args ?
9417a94488d3 (elint-check-defcustom-form): Don't use `evenp' so we don't implicitly
John Paul Wallington <jpw@pobox.com>
parents: 52401
diff changeset
623 (zerop (logand (length form) 1)))
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
624 (elint-env-add-global-var (elint-form (nth 2 form) env)
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
625 (car (cdr form)))
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
626 (elint-error "Malformed variable declaration: %s" form)
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
627 env))
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
628
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
629 (defun elint-check-function-form (form env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630 "Lint the function FORM in ENV."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631 (let ((func (car (cdr-safe form))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
632 (cond
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633 ((symbolp func)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634 (or (elint-env-find-func env func)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 (fboundp func)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 (elint-warning "Reference to undefined function: %s" form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637 env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638 ((and (consp func) (memq (car func) '(lambda macro)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 (elint-form func env))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640 ((stringp func) env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641 (t (elint-error "Not a function object: %s" form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 )))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 (defun elint-check-quote-form (form env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 "Lint the quote FORM in ENV."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649 (defun elint-check-macro-form (form env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650 "Check the macro FORM in ENV."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 (elint-check-function-form (list (car form) (cdr form)) env))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 (defun elint-check-condition-case-form (form env)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 "Check the condition-case FORM in ENV."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655 (let ((resenv env))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656 (if (< (length form) 3)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657 (elint-error "Malformed condition-case: %s" form)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658 (or (symbolp (car (cdr form)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659 (elint-warning "First parameter should be a symbol: %s" form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
660 (setq resenv (elint-form (nth 2 form) env))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
661
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662 (let ((newenv (elint-env-add-var env (car (cdr form))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 (errforms (nthcdr 3 form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664 errlist)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665 (while errforms
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666 (setq errlist (car (car errforms)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667 (mapcar (function (lambda (s)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668 (or (get s 'error-conditions)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669 (get s 'error-message)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670 (elint-warning
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671 "Not an error symbol in error handler: %s" s))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 (cond
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 ((symbolp errlist) (list errlist))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 ((listp errlist) errlist)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 (t (elint-error "Bad error list in error handler: %s"
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676 errlist)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
677 nil))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
678 )
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679 (elint-forms (cdr (car errforms)) newenv)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680 (setq errforms (cdr errforms))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681 )))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682 resenv))
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
683
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 ;;; Message functions
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688 ;; elint-error and elint-warning are identical, but they might change
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
689 ;; to reflect different seriousness of linting errors
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691 (defun elint-error (string &rest args)
47923
07d91c802db4 (elint-error, elint-warning): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 42268
diff changeset
692 "Report a linting error.
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693 STRING and ARGS are thrown on `format' to get the message."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
694 (let ((errstr (apply 'format string args)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
695 (elint-log-message errstr)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
696 ))
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
697
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 (defun elint-warning (string &rest args)
47923
07d91c802db4 (elint-error, elint-warning): Fix typo.
Juanma Barranquero <lekktu@gmail.com>
parents: 42268
diff changeset
699 "Report a linting warning.
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 STRING and ARGS are thrown on `format' to get the message."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 (let ((errstr (apply 'format string args)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702 (elint-log-message errstr)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703 ))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 (defun elint-log-message (errstr)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706 "Insert ERRSTR last in the lint log buffer."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 (save-excursion
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708 (set-buffer (elint-get-log-buffer))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709 (goto-char (point-max))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710 (or (bolp) (newline))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
711
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
712 ;; Do we have to say where we are?
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
713 (if elint-top-form-logged
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
714 nil
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
715 (insert
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716 (let* ((form (elint-top-form-form elint-top-form))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717 (top (car form)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 (cond
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
719 ((memq top '(defun defsubst))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
720 (format "\n** function %s **\n" (car (cdr form))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721 ((eq top 'defmacro)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
722 (format "\n** macro %s **\n" (car (cdr form))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
723 ((memq top '(defvar defconst))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
724 (format "\n** variable %s **\n" (car (cdr form))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
725 (t "\n** top level expression **\n"))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
726 (setq elint-top-form-logged t))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
727
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
728 (insert errstr)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
729 (newline)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
730
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
731 (defun elint-clear-log (&optional header)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
732 "Clear the lint log buffer.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
733 Insert HEADER followed by a blank line if non-nil."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
734 (save-excursion
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
735 (set-buffer (elint-get-log-buffer))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
736 (erase-buffer)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
737 (if header
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
738 (progn
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
739 (insert header)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
740 (newline))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
741 )))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
742
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
743 (defun elint-display-log ()
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
744 "Display the lint log buffer."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
745 (let ((pop-up-windows t))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
746 (display-buffer (elint-get-log-buffer))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
747 (sit-for 0)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
748
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
749 (defun elint-get-log-buffer ()
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
750 "Return a log buffer for elint."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
751 (let ((buf (get-buffer elint-log-buffer)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
752 (if buf
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
753 buf
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
754 (let ((oldbuf (current-buffer)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
755 (prog1
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
756 (set-buffer (get-buffer-create elint-log-buffer))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
757 (setq truncate-lines t)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
758 (set-buffer oldbuf)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
759 )))
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
760
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
761 ;;;
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
762 ;;; Initializing code
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
763 ;;;
20014
2ecea967337d (elint-check-defcustom-form): New function.
Karl Heuer <kwzh@gnu.org>
parents: 19210
diff changeset
764
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
765 ;;;###autoload
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
766 (defun elint-initialize ()
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
767 "Initialize elint."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
768 (interactive)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
769 (mapcar (function (lambda (x)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
770 (or (not (symbolp (car x)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
771 (eq (cdr x) 'unknown)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
772 (put (car x) 'elint-args (cdr x)))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
773 (elint-find-builtin-args))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
774 (mapcar (function (lambda (x)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
775 (put (car x) 'elint-args (cdr x))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
776 elint-unknown-builtin-args))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
777
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
778
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
779 (defun elint-find-builtins ()
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
780 "Returns a list of all built-in functions."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
781 (let ((subrs nil))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
782 (mapatoms (lambda (s) (if (and (fboundp s) (subrp (symbol-function s)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
783 (setq subrs (cons s subrs)))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
784 subrs
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
785 ))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
786
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
787 (defun elint-find-builtin-args (&optional list)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
788 "Returns a list of the built-in functions and their arguments.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
789
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
790 If LIST is nil, call `elint-find-builtins' to get a list of all built-in
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
791 functions, otherwise use LIST.
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
792
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
793 Each functions is represented by a cons cell:
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
794 \(function-symbol . args)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
795 If no documentation could be found args will be `unknown'."
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
796
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
797 (mapcar (function (lambda (f)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
798 (let ((doc (documentation f t)))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
799 (if (and doc (string-match "\n\n\\((.*)\\)" doc))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
800 (read (match-string 1 doc))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
801 (cons f 'unknown))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
802 )))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
803 (if list list
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
804 (elint-find-builtins))))
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
805
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
806 (provide 'elint)
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
807
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 47923
diff changeset
808 ;;; arch-tag: b2f061e2-af84-4ddc-8e39-f5e969ac228f
19210
ad26cf3804c3 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
809 ;;; elint.el ends here