* spam.el and missing functions
@ 2002-10-08 12:21 Katsumi Yamaoka
2002-10-08 14:42 ` Ted Zlatanov
0 siblings, 1 reply; 12+ messages in thread
From: Katsumi Yamaoka @ 2002-10-08 12:21 UTC (permalink / raw)
Hi,
When compiling spam.el, Emacs complaints about missing functions:
Emacs 20.7:
** The following functions are not known to be defined:
bbdb-search, bbdb-records, locate-file, display-message-or-buffer
Emacs 21.2:
** The following functions are not known to be defined:
bbdb-search, bbdb-records, locate-file
Emacs 21.3.50:
spam.el:544:11:Warning: the following functions are not known to be defined:
bbdb-search, bbdb-records
XEmacs 21.4.10:
** The following functions are not known to be defined:
bbdb-search, bbdb-records, display-message-or-buffer
Here, `bbdb-search' is a macro which is defined in bbdb-com.el.
So, spam.el should require the feature `bbdb-com' in the top
level. It is severe since there may be people who don't have
BBDB. The other things are as looking above.
--
Katsumi Yamaoka <yamaoka@jpl.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: spam.el and missing functions
2002-10-08 12:21 spam.el and missing functions Katsumi Yamaoka
@ 2002-10-08 14:42 ` Ted Zlatanov
2002-10-08 23:38 ` Jesper Harder
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Ted Zlatanov @ 2002-10-08 14:42 UTC (permalink / raw)
Cc: ding
On Tue, 08 Oct 2002, yamaoka@jpl.org wrote:
> When compiling spam.el, Emacs complaints about missing functions:
>
> Emacs 20.7:
> ** The following functions are not known to be defined:
> bbdb-search, bbdb-records, locate-file,
> display-message-or-buffer
>
> Emacs 21.2:
> ** The following functions are not known to be defined:
> bbdb-search, bbdb-records, locate-file
>
> Emacs 21.3.50: spam.el:544:11:Warning: the following functions are
> not known to be defined: bbdb-search, bbdb-records
>
> XEmacs 21.4.10:
> ** The following functions are not known to be defined:
> bbdb-search, bbdb-records, display-message-or-buffer
(summary: BBDB problems fixed, I need help with locate-file and
display-message-or-buffer)
locate-file is used by this code:
;; FIXME! I do not know if Gnus has a compatibility function for
;; `executable-find'. Here is a possible mantra for portability,
;; until Lars decides how we really should do it.
(unless (fboundp 'executable-find)
(if (fboundp 'locate-file)
(defun executable-find (command)
(locate-file command exec-path))
(autoload 'executable-find "executable")))
;; End of portability mantra for `executable-find'.
(defvar spam-bogofilter-path (executable-find "bogofilter")
"File path of the Bogofilter executable program.
Force this variable to nil if you want to inhibit the functionality.")
I would appreciate suggestions, I don't know the right way to fix this.
I fixed the BBDB errors with:
;; BBDB autoloads
(autoload 'bbdb-search "bbdb-com")
(autoload 'bbdb-records "bbdb-com")
The display-message-or-buffer function is used by this function:
(defun spam-bogofilter-score ()
"Use `bogofilter -v' on the current article.
This yields the 15 most discriminant words for this article and the
spamicity coefficient of each, and the overall article spamicity."
(interactive)
(when (and spam-use-bogofilter spam-bogofilter-path)
(spam-bogofilter-articles nil "-v" (list (gnus-summary-article-number)))
(save-excursion
(set-buffer spam-output-buffer-name)
(unless (= (point-min) (point-max))
(display-message-or-buffer (current-buffer)
spam-output-buffer-name)))))
Any suggestions? display-message-or-buffer is in the simple.el
package, but I don't know what to use instead of it.
Thanks
Ted
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: spam.el and missing functions
2002-10-08 14:42 ` Ted Zlatanov
@ 2002-10-08 23:38 ` Jesper Harder
2002-10-08 23:57 ` François Pinard
2002-10-09 14:54 ` Ted Zlatanov
2002-10-09 1:02 ` Katsumi Yamaoka
2002-10-17 9:24 ` Katsumi Yamaoka
2 siblings, 2 replies; 12+ messages in thread
From: Jesper Harder @ 2002-10-08 23:38 UTC (permalink / raw)
Ted Zlatanov <tzz@lifelogs.com> writes:
> locate-file is used by this code:
>
> ;; FIXME! I do not know if Gnus has a compatibility function for
> ;; `executable-find'.
I don't think I understand why a compatibility function is needed.
Doesn't both Emacs and XEmacs have 'executable.el'?
> I would appreciate suggestions, I don't know the right way to fix
> this.
How about autoloading it:
(autoload 'executable-find "executable")
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: spam.el and missing functions
2002-10-08 23:38 ` Jesper Harder
@ 2002-10-08 23:57 ` François Pinard
2002-10-09 1:35 ` Jesper Harder
2002-10-09 14:54 ` Ted Zlatanov
1 sibling, 1 reply; 12+ messages in thread
From: François Pinard @ 2002-10-08 23:57 UTC (permalink / raw)
[Jesper Harder]
>> ;; FIXME! I do not know if Gnus has a compatibility function for
>> ;; `executable-find'.
>
> I don't think I understand why a compatibility function is needed.
> Doesn't both Emacs and XEmacs have 'executable.el'?
I do not know about now, but when I wrote it, this surely was because I
stumbled on some [X]Emacs which did not have the function. I'm not enough
of an academician for creating solutions and problems all at once... :-).
Maybe some older version of [X]Emacs? I sometimes have to run across
between many sites in my regular work. By all means, get rid of the
portability mantra if it is known to be obsolete. :-)
--
François Pinard http://www.iro.umontreal.ca/~pinard
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: spam.el and missing functions
2002-10-08 14:42 ` Ted Zlatanov
2002-10-08 23:38 ` Jesper Harder
@ 2002-10-09 1:02 ` Katsumi Yamaoka
2002-10-09 14:53 ` Ted Zlatanov
2002-10-17 9:24 ` Katsumi Yamaoka
2 siblings, 1 reply; 12+ messages in thread
From: Katsumi Yamaoka @ 2002-10-09 1:02 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 976 bytes --]
>>>>> In <m3y9999elt.fsf@heechee.beld.net>
>>>>> Ted Zlatanov <tzz@lifelogs.com> wrote:
>> Emacs 20.7:
>> ** The following functions are not known to be defined:
>> bbdb-search, bbdb-records, locate-file,
>> display-message-or-buffer
[...]
> I fixed the BBDB errors with:
> ;; BBDB autoloads
> (autoload 'bbdb-search "bbdb-com")
Unfortunately, it doesn't fix. The byte-compiler still generates
the byte-code which is equivalent to `(funcall 'bbdb-search args)'
in the function `spam-check-bbdb', and then:
(with-temp-buffer
(insert "From: who\n")
(condition-case code
(spam-check-bbdb)
(error code)))
=> (invalid-function (macro . #[(records &optional name company net...
Since the macro definition of `bbdb-search' should be expanded
before byte-compiling the function `spam-check-bbdb',
bbdb-com.elc should be loaded at the compile time rather than
autoloaded. The following code will help only BBDB users who
have already installed BBDB.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 385 bytes --]
--- spam.el~ 2002-10-08 21:52:36 +0000
+++ spam.el 2002-10-09 01:00:36 +0000
@@ -40,9 +40,14 @@
(require 'message)
;; BBDB autoloads
-(autoload 'bbdb-search "bbdb-com")
(autoload 'bbdb-records "bbdb-com")
+;; Attempt to load BBDB macros
+(eval-when-compile
+ (condition-case nil
+ (require 'bbdb-com)
+ (error)))
+
;;; Main parameters.
(defvar spam-use-blacklist t
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: spam.el and missing functions
2002-10-08 23:57 ` François Pinard
@ 2002-10-09 1:35 ` Jesper Harder
0 siblings, 0 replies; 12+ messages in thread
From: Jesper Harder @ 2002-10-09 1:35 UTC (permalink / raw)
pinard@iro.umontreal.ca (François Pinard) writes:
> [Jesper Harder]
>
>> I don't think I understand why a compatibility function is needed.
>> Doesn't both Emacs and XEmacs have 'executable.el'?
>
> I do not know about now, but when I wrote it, this surely was because
> I stumbled on some [X]Emacs which did not have the function. I'm not
> enough of an academician for creating solutions and problems all at
> once... :-).
I guess it would have to be XEmacs since Emacs doesn't have
`locate-file'.
Anyway, `executable-find' is autoloaded in several other Gnus files:
binhex.el, uudecode.el, mm-decode.el et al. So, it probably doesn't
break anything (that's not already broken) to use the same method in
spam.el.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: spam.el and missing functions
2002-10-09 1:02 ` Katsumi Yamaoka
@ 2002-10-09 14:53 ` Ted Zlatanov
2002-10-09 23:09 ` Alex Schroeder
0 siblings, 1 reply; 12+ messages in thread
From: Ted Zlatanov @ 2002-10-09 14:53 UTC (permalink / raw)
On Wed, 09 Oct 2002, yamaoka@jpl.org wrote:
>> I fixed the BBDB errors with:
>
>> ;; BBDB autoloads
>> (autoload 'bbdb-search "bbdb-com")
>
> Unfortunately, it doesn't fix. The byte-compiler still generates
> the byte-code which is equivalent to `(funcall 'bbdb-search args)'
> in the function `spam-check-bbdb'
> Since the macro definition of `bbdb-search' should be expanded
> before byte-compiling the function `spam-check-bbdb',
> bbdb-com.elc should be loaded at the compile time rather than
> autoloaded. The following code will help only BBDB users who
> have already installed BBDB.
OK, I added your patch (if I understand correctly, it still autoloads
the bbdb-records function, but the bbdb-search macro needs special
treatment), but what do we do if the user does not have BBDB
installed?
As far as I'm concerned, spam-check-bbdb can just be an empty function
without a BBDB installation, or it can raise an error.
Ted
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: spam.el and missing functions
2002-10-08 23:38 ` Jesper Harder
2002-10-08 23:57 ` François Pinard
@ 2002-10-09 14:54 ` Ted Zlatanov
1 sibling, 0 replies; 12+ messages in thread
From: Ted Zlatanov @ 2002-10-09 14:54 UTC (permalink / raw)
On Wed, 09 Oct 2002, harder@myrealbox.com wrote:
> How about autoloading it:
>
> (autoload 'executable-find "executable")
I added that fix, and removed the locate-file reference in spam.el.
Ted
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: spam.el and missing functions
2002-10-09 14:53 ` Ted Zlatanov
@ 2002-10-09 23:09 ` Alex Schroeder
0 siblings, 0 replies; 12+ messages in thread
From: Alex Schroeder @ 2002-10-09 23:09 UTC (permalink / raw)
Ted Zlatanov <tzz@lifelogs.com> writes:
> OK, I added your patch (if I understand correctly, it still autoloads
> the bbdb-records function, but the bbdb-search macro needs special
> treatment), but what do we do if the user does not have BBDB
> installed?
>
> As far as I'm concerned, spam-check-bbdb can just be an empty function
> without a BBDB installation, or it can raise an error.
Then we wrap it in a condition-case, and redefine spam-check-bbdb as
an alias to 'ignore in the error handler.
Alex.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: spam.el and missing functions
2002-10-08 14:42 ` Ted Zlatanov
2002-10-08 23:38 ` Jesper Harder
2002-10-09 1:02 ` Katsumi Yamaoka
@ 2002-10-17 9:24 ` Katsumi Yamaoka
2002-10-18 1:31 ` Ted Zlatanov
2 siblings, 1 reply; 12+ messages in thread
From: Katsumi Yamaoka @ 2002-10-17 9:24 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 258 bytes --]
Hi,
>>>>> In <m3y9999elt.fsf@heechee.beld.net>
>>>>> Ted Zlatanov <tzz@lifelogs.com> wrote:
> (summary: BBDB problems fixed, I need help with locate-file and
> display-message-or-buffer)
Here's a replacement for display-message-or-buffer. How about it?
[-- Attachment #2: Type: application/emacs-lisp, Size: 439 bytes --]
[-- Attachment #3: Type: text/plain, Size: 1 bytes --]
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: Type: text/x-patch, Size: 509 bytes --]
--- spam.el~ 2002-10-14 21:52:48 +0000
+++ spam.el 2002-10-17 09:22:50 +0000
@@ -469,9 +469,7 @@
(spam-bogofilter-articles nil "-v" (list (gnus-summary-article-number)))
(save-excursion
(set-buffer spam-output-buffer-name)
- (unless (= (point-min) (point-max))
- (display-message-or-buffer (current-buffer)
- spam-output-buffer-name)))))
+ (spam-display-buffer-contents))))
(defun spam-bogofilter-register-routine ()
(when (and spam-use-bogofilter spam-bogofilter-path)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: spam.el and missing functions
2002-10-17 9:24 ` Katsumi Yamaoka
@ 2002-10-18 1:31 ` Ted Zlatanov
2002-10-18 1:47 ` Katsumi Yamaoka
0 siblings, 1 reply; 12+ messages in thread
From: Ted Zlatanov @ 2002-10-18 1:31 UTC (permalink / raw)
Cc: ding
On Thu, 17 Oct 2002, yamaoka@jpl.org wrote:
> Here's a replacement for display-message-or-buffer. How about it?
Patch applied, thank you very much.
Ted
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: spam.el and missing functions
2002-10-18 1:31 ` Ted Zlatanov
@ 2002-10-18 1:47 ` Katsumi Yamaoka
0 siblings, 0 replies; 12+ messages in thread
From: Katsumi Yamaoka @ 2002-10-18 1:47 UTC (permalink / raw)
Cc: ding
>>>>> In <m3it004jo0.fsf@heechee.beld.net>
>>>>> Ted Zlatanov <tzz@lifelogs.com> wrote:
>> Here's a replacement for display-message-or-buffer. How about it?
> Patch applied, thank you very much.
Thank you for the adoption. I reconsidered after that it is not
necessary to make the independent function. So, I've changed it
again, with the other trivial fixes.
Regards,
--
Katsumi Yamaoka <yamaoka@jpl.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2002-10-18 1:47 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-08 12:21 spam.el and missing functions Katsumi Yamaoka
2002-10-08 14:42 ` Ted Zlatanov
2002-10-08 23:38 ` Jesper Harder
2002-10-08 23:57 ` François Pinard
2002-10-09 1:35 ` Jesper Harder
2002-10-09 14:54 ` Ted Zlatanov
2002-10-09 1:02 ` Katsumi Yamaoka
2002-10-09 14:53 ` Ted Zlatanov
2002-10-09 23:09 ` Alex Schroeder
2002-10-17 9:24 ` Katsumi Yamaoka
2002-10-18 1:31 ` Ted Zlatanov
2002-10-18 1:47 ` Katsumi Yamaoka
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 NNTP newsgroup(s).