info-gnus-english
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

interface to KILL file (was: Re: Standard way to use Gnus?)


From: Emanuel Berg
Subject: interface to KILL file (was: Re: Standard way to use Gnus?)
Date: Fri, 20 Mar 2015 22:12:58 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Emanuel Berg <embe8573@student.uu.se> writes:

> Other than that, I miss a fast way to insert to the
> KILL file from an article buffer.
> Like "gnus-article-kill-author" that would forever
> expunge that e-mail from your system. Just extract
> header data, make a line, and append it to a file.

I got something to this extent but it assumes the type
of KILL file I described and not (apparently) what was
originally refered to.

Here is the code in context - not that there is any
(context), but anyway:

    http://user.it.uu.se/~embe8573/conf/emacs-init/gnus/lamer.el

By the way, "lamer" isn't exactly a good word for it.
Rather, plonks should be spammers, flamers/haters, and
such folks. And when this is used, no one should be
told it happened. It doesn't make the *plonk*
sound, even.

In terms of the code, the most interesting thing was
the iso-8859-1 thing which deal with the strange

    =?iso-8859-1?q? ... ?=

enclosure - this is describe here:

    https://www.gnu.org/software/emacs/manual/html_mono/emacs-mime.html

at the entry fro `mail-encode-encoded-word-string'.

The code:

(defun lamer ()
  (interactive)
  (save-window-excursion
    (if (string= major-mode "gnus-summary-mode") ; so possible to invoke in
                 (gnus-summary-select-article) ) ; summary as well as article 
mode
    (let*((killfile (format "%s%s" gnus-directory gnus-kill-file-name))
          (header "From")
          (header-value
           (mail-decode-encoded-word-string      ; handle special iso-8859-1 
chars
            (gnus-article-header-value header))) ; in header, e.g. 'ü'
          (entry
           (format
            "(gnus-kill \"%s\" \"%s\" \'(gnus-summary-mark-as-read nil \"X\") 
t)\n"
            header header-value)) )
      (if (not (file-exists-p killfile))
          (with-temp-file killfile (insert "(gnus-expunge \"X\")\n")) )
      (with-current-buffer (find-file-noselect killfile t) ; NOWARN
        (revert-buffer t t) ; IGNORE-AUTO NOCONFIRM
        (goto-char (point-min))
        (insert entry)
        (save-buffer) ))))

-- 
underground experts united


reply via email to

[Prev in Thread] Current Thread [Next in Thread]