emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog emacs-lisp/elint.el


From: Glenn Morris
Subject: [Emacs-diffs] emacs/lisp ChangeLog emacs-lisp/elint.el
Date: Fri, 24 Jul 2009 03:52:46 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       09/07/24 03:52:46

Modified files:
        lisp           : ChangeLog 
        lisp/emacs-lisp: elint.el 

Log message:
        (elint-current-buffer, elint-defun):
        Add autoload cookies.  If necessary, initialize.
        (elint-log): Handle non-file buffers.
        (elint-initialize): Add optional argument to reinitialize.
        (elint-find-builtin-variables): Save excursion.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15854&r2=1.15855
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/emacs-lisp/elint.el?cvsroot=emacs&r1=1.25&r2=1.26

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15854
retrieving revision 1.15855
diff -u -b -r1.15854 -r1.15855
--- ChangeLog   23 Jul 2009 07:09:28 -0000      1.15854
+++ ChangeLog   24 Jul 2009 03:52:42 -0000      1.15855
@@ -1,3 +1,11 @@
+2009-07-24  Glenn Morris  <address@hidden>
+
+       * emacs-lisp/elint.el (elint-current-buffer, elint-defun):
+       Add autoload cookies.  If necessary, initialize.
+       (elint-log): Handle non-file buffers.
+       (elint-initialize): Add optional argument to reinitialize.
+       (elint-find-builtin-variables): Save excursion.
+
 2009-07-23  Dan Nicolaescu  <address@hidden>
 
        * emacs-lisp/lisp-mode.el (emacs-lisp-mode-map): Add menu entries

Index: emacs-lisp/elint.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/elint.el,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -b -r1.25 -r1.26
--- emacs-lisp/elint.el 23 Jul 2009 02:54:39 -0000      1.25
+++ emacs-lisp/elint.el 24 Jul 2009 03:52:46 -0000      1.26
@@ -28,9 +28,9 @@
 ;; misspellings and undefined variables, although it can also catch
 ;; function calls with the wrong number of arguments.
 
-;; Before using, call `elint-initialize' to set up some argument
-;; data.  This takes a while.  Then call elint-current-buffer or
-;; elint-defun to lint a buffer or a defun.
+;; To use, call elint-current-buffer or elint-defun to lint a buffer
+;; or defun.  The first call runs `elint-initialize' to set up some
+;; argument data, which may take a while.
 
 ;; The linter will try to "include" any require'd libraries to find
 ;; the variables defined in those.  There is a fair amount of voodoo
@@ -151,9 +151,13 @@
 ;;; User interface
 ;;;
 
+;;;###autoload
 (defun elint-current-buffer ()
-  "Lint the current buffer."
+  "Lint the current buffer.
+If necessary, this first calls `elint-initalize'."
   (interactive)
+  (or elint-builtin-variables
+      (elint-initialize))
   (elint-clear-log (format "Linting %s" (or (buffer-file-name)
                                            (buffer-name))))
   (elint-display-log)
@@ -164,9 +168,13 @@
   (let ((elint-top-form-logged t))
     (elint-log-message "\nLinting finished.\n")))
 
+;;;###autoload
 (defun elint-defun ()
-  "Lint the function at point."
+  "Lint the function at point.
+If necessary, this first calls `elint-initalize'."
   (interactive)
+  (or elint-builtin-variables
+      (elint-initialize))
   (save-excursion
     (or (beginning-of-defun) (error "Lint what?"))
     (let ((pos (point))
@@ -610,7 +618,10 @@
 
 (defun elint-log (type string args)
   (elint-log-message (format "%s:%d:%s: %s"
-                            (file-name-nondirectory (buffer-file-name))
+                            (let ((f (buffer-file-name)))
+                              (if f
+                                  (file-name-nondirectory f)
+                                (buffer-name)))
                             (save-excursion
                               (goto-char elint-current-pos)
                               (1+ (count-lines (point-min)
@@ -680,9 +691,14 @@
 ;;;
 
 ;;;###autoload
-(defun elint-initialize ()
-  "Initialize elint."
-  (interactive)
+(defun elint-initialize (&optional reinit)
+  "Initialize elint.
+If elint is already initialized, this does nothing, unless
+optional prefix argument REINIT is non-nil."
+  (interactive "P")
+  (if (and elint-builtin-variables (not reinit))
+      (message "Elint is already initialized")
+    (message "Initializing elint...")
   (setq elint-builtin-variables (elint-find-builtin-variables)
        elint-autoloaded-variables (elint-find-autoloaded-variables))
   (mapc (lambda (x) (or (not (symbolp (car x)))
@@ -691,7 +707,8 @@
        (elint-find-builtin-args))
   (if elint-unknown-builtin-args
       (mapc (lambda (x) (put (car x) 'elint-args (cdr x)))
-           elint-unknown-builtin-args)))
+             elint-unknown-builtin-args))
+    (message "Initializing elint...done")))
 
 
 (defun elint-find-builtin-variables ()
@@ -699,6 +716,7 @@
   ;; Cribbed from help-fns.el.
   (let ((docbuf " *DOC*")
        vars var)
+    (save-excursion
     (if (get-buffer docbuf)
        (progn
          (set-buffer docbuf)
@@ -711,7 +729,7 @@
                      (buffer-substring (point) (line-end-position))))
           (boundp var)
           (setq vars (cons var vars))))
-    vars))
+      vars)))
 
 (defun elint-find-autoloaded-variables ()
   "Return a list of all autoloaded variables."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]