annotate lisp/emacs-lisp/elint.el @ 78537:4164b3c91734

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