all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Shigeru Fukaya" <shigeru.fukaya@gmail.com>
To: bug-gnu-emacs@gnu.org
Subject: bug#1063: improvement of elint.el
Date: Wed, 1 Oct 2008 23:41:05 +0900	[thread overview]
Message-ID: <64bd60570810010741q24baafc8w721891bfb8ae397d@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 438 bytes --]

Hello,

I changed elint.el to work better in the latest Emacs.

Revised features are,

 * Regard more variables as defined.

   - Variables defined in C source without help string.
     (by preset in elint-standard-variables)

   - Variables having entries in DOC file.

   - Variables defined in some file, but unbound.

 * Get builtin function arguments properly.
   (adapt to current (fn ARG1 ARG2...) document form)

Regards,
Shigeru

[-- Attachment #2: elint.diff --]
[-- Type: text/plain, Size: 3625 bytes --]

*** elint.el	Tue May  6 22:54:43 2008
--- elint-new.el	Wed Oct  1 23:23:27 2008
***************
*** 68,74 ****
       overwrite-mode
       point-before-scroll right-fringe-width right-margin-width
       scroll-bar-width scroll-down-aggressively scroll-up-aggressively selective-display
!      selective-display-ellipses tab-width truncate-lines vc-mode vertical-scroll-bar)
    "Standard buffer local vars.")
  
  (defconst elint-unknown-builtin-args
--- 68,78 ----
       overwrite-mode
       point-before-scroll right-fringe-width right-margin-width
       scroll-bar-width scroll-down-aggressively scroll-up-aggressively selective-display
!      selective-display-ellipses tab-width truncate-lines vc-mode vertical-scroll-bar
!      ;; bound, defined in some C source, and no help.
!      activate-menubar-hook buffer-name-history coding-system-history
!      extended-command-history kbd-macro-termination-hook
!      minibuffer-default read-expression-history yes-or-no-p-history)
    "Standard buffer local vars.")
  
  (defconst elint-unknown-builtin-args
***************
*** 461,467 ****
    (not (or (eq var nil)
  	   (eq var t)
  	   (elint-env-find-var env var)
! 	   (memq var elint-standard-variables))))
  
  ;;;
  ;;; Function argument checking
--- 465,476 ----
    (not (or (eq var nil)
  	   (eq var t)
  	   (elint-env-find-var env var)
! 	   (memq var elint-standard-variables)
! 	   ;; symbol in DOC may be bound at runtime.
! 	   (numberp (get var 'variable-documentation))
! 	   (numberp (cdr-safe (get var 'variable-documentation)))
! 	   ;; symbol in some loaded file may be bound at runtime.
! 	   (symbol-file var))))
  
  ;;;
  ;;; Function argument checking
***************
*** 770,778 ****
  			(eq (cdr x) 'unknown)
  			(put (car x) 'elint-args (cdr x)))))
  	(elint-find-builtin-args))
!   (mapcar (function (lambda (x)
  		      (put (car x) 'elint-args (cdr x))))
! 	  elint-unknown-builtin-args))
  
  
  (defun elint-find-builtins ()
--- 779,787 ----
  			(eq (cdr x) 'unknown)
  			(put (car x) 'elint-args (cdr x)))))
  	(elint-find-builtin-args))
!   (mapc (function (lambda (x)		;;; mapcar
  		      (put (car x) 'elint-args (cdr x))))
! 	elint-unknown-builtin-args))
  
  
  (defun elint-find-builtins ()
***************
*** 783,788 ****
--- 792,798 ----
      subrs
      ))
  
+ 
  (defun elint-find-builtin-args (&optional list)
    "Returns a list of the built-in functions and their arguments.
  
***************
*** 792,808 ****
  Each functions is represented by a cons cell:
  \(function-symbol . args)
  If no documentation could be found args will be `unknown'."
  
-     (mapcar (function (lambda (f)
- 			(let ((doc (documentation f t)))
- 			  (if (and doc (string-match "\n\n\\((.*)\\)" doc))
- 			      (read (match-string 1 doc))
- 			    (cons f 'unknown))
- 			  )))
- 	    (if list list
- 	      (elint-find-builtins))))
  
  (provide 'elint)
- 
- ;; arch-tag: b2f061e2-af84-4ddc-8e39-f5e969ac228f
- ;;; elint.el ends here
--- 802,822 ----
  Each functions is represented by a cons cell:
  \(function-symbol . args)
  If no documentation could be found args will be `unknown'."
+   (mapcar (lambda (f)
+ 	    (let ((doc (documentation f t))
+ 		  exp)
+ 	      (if (and doc (string-match "\n\n\\((.*)\\)" doc))
+ 		  (progn
+ 		    (setq exp (match-string 1 doc))
+ 		    ;; replace (fn ARG...) to (name arg...)
+ 		    (read
+ 		     (if (string-match "\\`(\\(fn\\) " exp)
+ 			 (replace-match (symbol-name f) nil t
+ 					(downcase exp) 1)
+ 		       exp)))
+ 		(cons f 'unknown))))
+ 	  (if list list
+ 	    (elint-find-builtins))))
  
  
  (provide 'elint)

[-- Attachment #3: ChangeLog.elint --]
[-- Type: text/plain, Size: 351 bytes --]

	* elint-new.el (elint-standard-variables): Add symbols that are
	bound, defined in some C source, and have no help.
	(elint-unbound-variable): Check if symbol has document in DOC, or
	defined or loaded in some file.
	(elint-initialize): mapcar to mapc.
	(elint-find-builtin-args): Adapt to the current function document
	style `(fn ARGS...)'.

             reply	other threads:[~2008-10-01 14:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ufocn4j2qv.fsf@fencepost.gnu.org>
2008-10-01 14:41 ` Shigeru Fukaya [this message]
2009-11-14 20:10   ` bug#1063: marked as done (improvement of elint.el) Emacs bug Tracking System

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64bd60570810010741q24baafc8w721891bfb8ae397d@mail.gmail.com \
    --to=shigeru.fukaya@gmail.com \
    --cc=1063@emacsbugs.donarmstrong.com \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.