* lisp/lisp-mnt.el: lm-verify
@ 2007-12-07 20:44 David Kastrup
2007-12-07 21:14 ` Lennart Borgman (gmail)
0 siblings, 1 reply; 6+ messages in thread
From: David Kastrup @ 2007-12-07 20:44 UTC (permalink / raw)
To: emacs-devel
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...
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: lisp/lisp-mnt.el: lm-verify
2007-12-07 20:44 lisp/lisp-mnt.el: lm-verify David Kastrup
@ 2007-12-07 21:14 ` Lennart Borgman (gmail)
2007-12-07 22:03 ` David Kastrup
2007-12-07 22:21 ` Stefan Monnier
0 siblings, 2 replies; 6+ messages in thread
From: Lennart Borgman (gmail) @ 2007-12-07 21:14 UTC (permalink / raw)
To: David Kastrup; +Cc: emacs-devel
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))
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: lisp/lisp-mnt.el: lm-verify
2007-12-07 21:14 ` Lennart Borgman (gmail)
@ 2007-12-07 22:03 ` David Kastrup
2007-12-07 22:20 ` Drew Adams
2007-12-07 22:21 ` Stefan Monnier
1 sibling, 1 reply; 6+ messages in thread
From: David Kastrup @ 2007-12-07 22:03 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: emacs-devel
"Lennart Borgman (gmail)" <lennart.borgman@gmail.com> writes:
> 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? :
Not really:
> (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
Should be mapc, or rather a dolist construct.
> (lambda (f)
> (if (string-match ".*\\.el\\'" f)
Is true for lock files (dead symlinks) as well which makes lm-verify
fail. Also does not actually "recurse" unless the directory is of name
"*.el". The string match is unnecessarily slow because of the initial
.* and is unnecessary anyway since directory-files can take a pattern.
If there is a directory with name *.el, things get really weird.
The resulting message ends with \n and thus is not really pretty for
passing into message. There also is a mixture of "Ok" and "OK"
depending on input flags.
> (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)))
[...]
In short: since this is not autoloaded and not used in this library
itself, I have a hard time picturing who would use it and for what
purpose. Seems like bit rot to me from a time before checkdoc.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: lisp/lisp-mnt.el: lm-verify
2007-12-07 22:03 ` David Kastrup
@ 2007-12-07 22:20 ` Drew Adams
0 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2007-12-07 22:20 UTC (permalink / raw)
To: David Kastrup; +Cc: emacs-devel
> In short: since this is not autoloaded and not used in this library
> itself, I have a hard time picturing who would use it and for what
> purpose. Seems like bit rot to me from a time before checkdoc.
You have apparently looked into the code in detail, but you might also want
to do a google search for "lm-verify", to see who might be using it. There
seem to be hits that mention using both `lm-verify' and `checkdoc'. Such
uses might all be obsolete or unnecessary now, but it might still be worth
it to check.
(I don't use it, and I know nothing about it.)
HTH.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: lisp/lisp-mnt.el: lm-verify
2007-12-07 21:14 ` Lennart Borgman (gmail)
2007-12-07 22:03 ` David Kastrup
@ 2007-12-07 22:21 ` Stefan Monnier
2007-12-07 22:43 ` David Kastrup
1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2007-12-07 22:21 UTC (permalink / raw)
To: Lennart Borgman (gmail); +Cc: emacs-devel
> ((not (lm-history-mark))
> "Can't find a 'History' section marker")
Most files don't have a History section. I think it's fine that way.
That's usually covered by the revision control system.
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: lisp/lisp-mnt.el: lm-verify
2007-12-07 22:21 ` Stefan Monnier
@ 2007-12-07 22:43 ` David Kastrup
0 siblings, 0 replies; 6+ messages in thread
From: David Kastrup @ 2007-12-07 22:43 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Lennart Borgman (gmail), emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> ((not (lm-history-mark))
>> "Can't find a 'History' section marker")
>
> Most files don't have a History section. I think it's fine that way.
> That's usually covered by the revision control system.
Uh. Seems like a can of worms to me. Anyway, I guess I'll wrap up and
apply my "message fix" patch and afterwards offer to patch the weird
lm-verify thingy.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-12-07 22:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-07 20:44 lisp/lisp-mnt.el: lm-verify David Kastrup
2007-12-07 21:14 ` Lennart Borgman (gmail)
2007-12-07 22:03 ` David Kastrup
2007-12-07 22:20 ` Drew Adams
2007-12-07 22:21 ` Stefan Monnier
2007-12-07 22:43 ` David Kastrup
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).