[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lisp/lisp-mnt.el: lm-verify
From: |
Lennart Borgman (gmail) |
Subject: |
Re: lisp/lisp-mnt.el: lm-verify |
Date: |
Fri, 07 Dec 2007 22:14:48 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 |
David Kastrup wrote:
After wracking my brain over the lm-verify code, I have come to the
conclusion that the code is utter garbage when a directory is passed in:
ret is set to a list (typically (nil nil nil nil)) rather than a string,
a temporary buffer gets filled with output but never gets displayed and
so on.
It does not appear like any code in Emacs uses lm-verify, and there is
no autoload for it either.
Anybody mind if I delete it rather than trying to figure out what might
have been intended? Since there are no apparent callers...
Maybe this will work better? :
(defun lm-verify (&optional file showok verbose non-fsf-ok)
"Check that the current buffer (or FILE if given) is in proper format.
If FILE is a directory, recurse on its files and generate a report in a
temporary buffer. In that case, the optional argument SHOWOK
says display \"OK\" in temp buffer for files that have no problems.
Optional argument VERBOSE specifies verbosity level.
Optional argument NON-FSF-OK if non-nil means a non-FSF
copyright notice is allowed."
(interactive (list nil nil t))
(let* ((ret (and verbose "Ok"))
name)
(if (and file (file-directory-p file))
(setq ret
(with-temp-buffer
(mapcar
(lambda (f)
(if (string-match ".*\\.el\\'" f)
(let ((status (lm-verify f)))
(insert f ":")
(if status
(lm-insert-at-column lm-comment-column status
"\n")
(if showok
(lm-insert-at-column lm-comment-column
"OK\n"))))))
(directory-files file t))
(buffer-string)))
(lm-with-file file
(setq name (lm-get-package-name))
(setq ret
(cond
((null name)
"Can't find package name")
((not (lm-authors))
"`Author:' tag missing")
((not (lm-maintainer))
"`Maintainer:' tag missing")
((not (lm-summary))
"Can't find the one-line summary description")
((not (lm-keywords))
"`Keywords:' tag missing")
((not (lm-keywords-finder-p))
"`Keywords:' has no valid finder keywords (see
`finder-known-keywords')")
((not (lm-commentary-mark))
"Can't find a 'Commentary' section marker")
((not (lm-history-mark))
"Can't find a 'History' section marker")
((not (lm-code-mark))
"Can't find a 'Code' section marker")
((progn
(goto-char (point-max))
(not
(re-search-backward
(concat "^;;;[ \t]+" name "[ \t]+ends here[ \t]*$"
"\\|^;;;[ \t]+ End of file[ \t]+" name)
nil t)))
"Can't find the footer line")
((not (and (lm-copyright-mark) (lm-crack-copyright)))
"Can't find a valid copyright notice")
((not (or non-fsf-ok
(string-match "Free Software Foundation"
(car (lm-crack-copyright)))))
"Copyright holder is not the Free Software Foundation")
(t
ret)))))
(if verbose
(message ret))
ret))