[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with vm-bogofilter: vm-save-restriction & vm-save-buffer-excursi
From: |
Alain . Cochard |
Subject: |
Problem with vm-bogofilter: vm-save-restriction & vm-save-buffer-excursion don't exist |
Date: |
Fri, 17 Jan 2025 14:34:59 +0100 |
Hello.
I did not have this issue with Fedora 40 (emacs 29.4) until december 2024.
I have it now with Fedora 41 (also emacs 29.4).
The problem is that I get
Ignoring error while running vm-retrieved-spooled-mail-hook. (void-function
vm-save-restriction)
when a message is being retrieved from my mailbox, and that I get
Debugger entered--Lisp error: (void-function vm-save-buffer-excursion)
when I try to use the function vm-bogofilter-is-spam.
Fedora 41 comes with
/usr/share/doc/bogofilter/contrib/vm-bogofilter.el
which is part of the bogofilter-1.2.5-16.fc41.x86_64 package.
The beginning of the file is:
;;; vm-bogofilter.el version 1.1.4
[...]
;; Copyright (C) 2003-2006 by Björn Knutsson
If I understand correctly, VM is installed from package
emacs-vm-8.3.0~20240924gitfa1a0ef-1.fc41.noarch in directory in
/usr/share/emacs/site-lisp/vm. In that directory, command
grep vm-save-restriction *.el
gives nothing.
>From an old VM installation, I could see that vm-save-restriction was
defined in file vm-macro.el. I copied the corresponding lines (see below)
in my .emacs and the related error disappeared. Then a line of the kind
X-Bogosity: Unsure, tests=bogofilter, spamicity=0.520000, version=1.2.5
is now inserted in each email's headers, as expected.
Similarly, copying in my .emacs the definition of vm-save-buffer-excursion,
also from vm-macro.el (see below) solved the 2nd problem.
I am holding my breadth in anticipation of the 3rd problem...
Regards.
(defmacro vm-save-restriction (&rest forms)
(let ((vm-sr-clip (make-symbol "vm-sr-clip"))
(vm-sr-min (make-symbol "vm-sr-min"))
(vm-sr-max (make-symbol "vm-sr-max")))
`(let ((,vm-sr-clip (> (buffer-size) (- (point-max) (point-min))))
;; this shouldn't be necessary but the
;; byte-compiler turns these into interned symbols
;; which utterly defeats the purpose of the
;; make-symbol calls above. Soooo, until the compiler
;; is fixed, these must be made into (let ...)
;; temporaries so that nested calls to this macros
;; won't misbehave.
,vm-sr-min ,vm-sr-max)
(and ,vm-sr-clip
(setq ,vm-sr-min (set-marker (make-marker) (point-min)))
(setq ,vm-sr-max (set-marker (make-marker) (point-max))))
(unwind-protect
(progn ,@forms)
(widen)
(and ,vm-sr-clip
(progn
(narrow-to-region ,vm-sr-min ,vm-sr-max)
(set-marker ,vm-sr-min nil)
(set-marker ,vm-sr-max nil)))))))
(defmacro vm-save-buffer-excursion (&rest forms)
`(let ((vm-sbe-buffer (current-buffer)))
(unwind-protect
(progn ,@forms)
(and (not (eq vm-sbe-buffer (current-buffer)))
(buffer-name vm-sbe-buffer)
(set-buffer vm-sbe-buffer)))))
--
EOST (École et Observatoire des Sciences de la Terre)
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes | Phone: +33 (0)3 68 85 50 44
F-67084 Strasbourg Cedex, France | bureau 110, ancien bât.
- Problem with vm-bogofilter: vm-save-restriction & vm-save-buffer-excursion don't exist,
Alain . Cochard <=