X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/ac1a0ce1c6ba60a3faddc64463cb7a697b9d8fd2..4ac426a1b90912ea947d46a57b6fcbbbf7586da1:/lisp/emacs-lisp/elint.el diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el index 82e958533e..317e5a6fd3 100644 --- a/lisp/emacs-lisp/elint.el +++ b/lisp/emacs-lisp/elint.el @@ -1,6 +1,6 @@ ;;; elint.el --- Lint Emacs Lisp -;; Copyright (C) 1997, 2001-2012 Free Software Foundation, Inc. +;; Copyright (C) 1997, 2001-2015 Free Software Foundation, Inc. ;; Author: Peter Liljenberg ;; Created: May 1997 @@ -46,6 +46,8 @@ ;;; Code: +(require 'help-fns) + (defgroup elint nil "Linting for Emacs Lisp." :prefix "elint-" @@ -372,7 +374,7 @@ Returns the forms." (let ((elint-current-pos (point))) ;; non-list check could be here too. errors may be out of seq. ;; quoted check cannot be elsewhere, since quotes skipped. - (if (looking-back "'") + (if (looking-back "'" (1- (point))) ;; Eg cust-print.el uses ' as a comment syntax. (elint-warning "Skipping quoted form `'%.20s...'" (read (current-buffer))) @@ -466,6 +468,9 @@ Return nil if there are no more forms, t otherwise." (add-to-list 'elint-features name) ;; cl loads cl-macs in an opaque manner. ;; Since cl-macs requires cl, we can just process cl-macs. + ;; FIXME: AFAIK, `cl' now behaves properly and does not need any + ;; special treatment any more. Can someone who understands this + ;; code confirm? --Stef (and (eq name 'cl) (not elint-doing-cl) ;; We need cl if elint-form is to be able to expand cl macros. (require 'cl) @@ -710,14 +715,8 @@ Returns `unknown' if we couldn't find arguments." (defun elint-find-args-in-code (code) "Extract the arguments from CODE. CODE can be a lambda expression, a macro, or byte-compiled code." - (cond - ((byte-code-function-p code) - (aref code 0)) - ((and (listp code) (eq (car code) 'lambda)) - (car (cdr code))) - ((and (listp code) (eq (car code) 'macro)) - (elint-find-args-in-code (cdr code))) - (t 'unknown))) + (let ((args (help-function-arglist code))) + (if (listp args) args 'unknown))) ;;; ;;; Functions to check some special forms @@ -1146,8 +1145,8 @@ Marks the function with their arguments, and returns a list of variables." (defun elint-find-builtins () "Return a list of all built-in functions." (let (subrs) - (mapatoms (lambda (s) (and (fboundp s) (subrp (symbol-function s)) - (setq subrs (cons s subrs))))) + (mapatoms (lambda (s) (and (subrp (symbol-function s)) + (push s subrs)))) subrs)) (defun elint-find-builtin-args (&optional list)