All pastes #175873 Raw Edit

Untitled

public text v1 · immutable
·published 2006-09-19 05:55 UTC
rendered paste body
(defun pfm-run-command-on-article (command &optional replace)

  (interactive "sCommand: \nP")
  (let ((n (gnus-summary-article-number))
        (g gnus-newsgroup-name))
     (with-temp-buffer
       (gnus-request-article n g (current-buffer))
       (shell-command-on-region
        (point-min) (point-max)
        command)
       (if replace
            (gnus-request-replace-article n g (current-buffer)))
        )))


(define-key gnus-summary-mode-map
         (read-kbd-macro "C-c R s")
         '(lambda () (interactive) (pfm-run-command-on-article "sa-learn --spam" ))
)

(define-key gnus-summary-mode-map
        (read-kbd-macro "C-c R h")
        '(lambda () (interactive) (pfm-run-command-on-article "sa-learn --ham"))