>>> "AadfGtGEUn(E" == Announcements and discussions for GNUS, the GNU Emacs >>> Usenet newsreader (in English) <Uwe> writes:
> Hi
> I am looking for a package that would allow me add annotations to messages
> (and might serve those annotations locally in my home directory)
> Like
> * []{ }O +160533 [ Uwe Braue] Uwe Brauer [bio mod2 ] Mon, 19 May 2025
> 09:07:44 +0200 0.3M 6
> * is the annoation containting.
> Urgent: you need to send also mod1.
I found a solution:
(defvar my-gnus-annotations (make-hash-table :test 'equal)
"Hash table of GNUS annotations keyed by article number.")
(defvar my-gnus-annotations-file (expand-file-name
"~/.emacs.d/gnus-annotations.el")
"File to save GNUS annotations.")
(defun my-gnus-save-annotations ()
"Save GNUS annotations to a file."
(with-temp-file my-gnus-annotations-file
(prin1 my-gnus-annotations (current-buffer))))
(defun my-gnus-load-annotations ()
"Load GNUS annotations from a file."
(when (file-exists-p my-gnus-annotations-file)
(with-temp-buffer
(insert-file-contents my-gnus-annotations-file)
(setq my-gnus-annotations (read (current-buffer))))))
(defun my-gnus-add-annotation (annotation)
"Add an annotation to the current message and save it."
(interactive "sAnnotation: ")
(let ((article (gnus-summary-article-number)))
(progn
(puthash article annotation my-gnus-annotations)
(my-gnus-save-annotations)
(gnus-registry-set-article-Ann-mark article)
(gnus-summary-update-line))))
(defun my-gnus-show-annotation ()
"Show annotation for the current article."
(interactive)
(let ((annotation (gethash (gnus-summary-article-number)
my-gnus-annotations)))
(if annotation
(message "Annotation: %s" annotation)
(message "No annotation"))))
(defun my-gnus-edit-annotation ()
"Edit the annotation for the current article, if one exists."
(interactive)
(let* ((article (gnus-summary-article-number))
(current (gethash article my-gnus-annotations))
(new (read-string "Edit annotation (empty to remove): " current)))
(if (string-empty-p new)
(remhash article my-gnus-annotations)
(puthash article new my-gnus-annotations))
(my-gnus-save-annotations)
(gnus-summary-update-line)
(message "Annotation %s." (if (string-empty-p new) "removed" "updated"))))
;; Load annotations on startup
(my-gnus-load-annotations)
;; Optional: Save annotations automatically on Emacs exit
(add-hook 'kill-emacs-hook #'my-gnus-save-annotations)
I also tried out modifying the gnus-summary-line, but gave it up after some
attempts
And that is why I also need
(setq gnus-registry-marks nil)
(setq gnus-registry-marks
'((Imp
:char ?i
:image "summary_important")
(WAIT
:char ?w
:image "summary_wait")
(DONE
:char ?d
:image "summary_personal")
(Ann
:char ?a
:image "summary_personal")
(TODO
:char ?t
:image "summary_todo")
(Later
:char ?l
:image "summary_later")))
(gnus-registry-initialize)
(defalias 'gnus-user-format-function-M 'gnus-registry-article-marks-to-names)
Maybe somebody finds this useful
Uwe Brauer
smime.p7s
Description: S/MIME cryptographic signature
