Changes committed gnus/lisp (ChangeLog gnus-registry.el)

"Ted Zlatanov" <[email protected]>
Newsgroups gmane.emacs.gnus.commits
Message-ID <[email protected]>
Modified: ChangeLog gnus-registry.el

(gnus-registry-mark-article)
(gnus-registry-article-marks): Add functionality to mark articles
through the Gnus registry.


Index: ChangeLog
diff -u gnus/lisp/ChangeLog:7.1715 gnus/lisp/ChangeLog:7.1716
--- ChangeLog:7.1715	Tue Dec 18 23:42:10 2007
+++ ChangeLog	Wed Dec 19 02:13:30 2007
@@ -1,5 +1,9 @@
 2007-12-19  Teodor Zlatanov  <[email protected]>
 
+	* gnus-registry.el (gnus-registry-mark-article)
+	(gnus-registry-article-marks): Add functionality to mark articles
+	through the Gnus registry.
+
 	* encrypt.el: Clarify documentation for the new pgg method.
 	(encrypt-file-alist): Add PGG option.
 	(encrypt-insert-file-contents, encrypt-write-file-contents): Use PGG
@@ -8,8 +12,6 @@
 	(encrypt-message-method-and-cipher): Add new convenience external functions.
 	(encrypt-pgg-encode-buffer, encrypt-pgg-decode-buffer)
 	(encrypt-pgg-process-buffer): Add PGG functionality glue.
-
-2007-12-19  Teodor Zlatanov  <[email protected]>
 
 	* netrc.el: Autoload encrypt when encrypt-file-alist is set.
 	(netrc-parse): Use encrypt-file-alist to determine if
Index: gnus-registry.el
diff -u gnus/lisp/gnus-registry.el:7.41 gnus/lisp/gnus-registry.el:7.42
--- gnus-registry.el:7.41	Sun Dec  9 01:04:21 2007
+++ gnus-registry.el	Wed Dec 19 02:13:30 2007
@@ -586,6 +586,54 @@
 		     (string-match word x))
 		   list)))))
 
+(defun gnus-registry-mark-article (article &optional mark remove)
+  "Mark ARTICLE with MARK in the Gnus registry or remove MARK.
+MARK can be any symbol.  If ARTICLE is nil, then the
+`gnus-current-article' will be marked.  If MARK is nil,
+`gnus-registry-flag-default' will be used."
+  (interactive "nArticle number: ")
+  (let ((article (or article gnus-current-article))
+	(mark (or mark 'gnus-registry-flag-default))
+	article-id)
+    (unless article
+      (error "No article on current line"))
+    (setq article-id 
+	  (gnus-registry-fetch-message-id-fast gnus-current-article))
+    (unless article-id
+      (error "No article ID could be retrieved"))
+    (let* (
+	   ;; all the marks for this article
+	   (marks (gnus-registry-fetch-extra-flags article-id))
+	   ;; the marks without the mark of interest
+	   (cleaned-marks (delq mark marks))
+	   ;; the new marks we want to use
+	   (new-marks (if remove
+			  cleaned-marks
+			(cons mark cleaned-marks))))
+    (apply 'gnus-registry-store-extra-flags ; set the extra flags
+     article-id				    ; for the message ID
+     new-marks)
+    (gnus-registry-fetch-extra-flags article-id))))
+
+(defun gnus-registry-article-marks (article)
+  "Get the Gnus registry marks for ARTICLE.
+If ARTICLE is nil, then the `gnus-current-article' will be
+used."
+  (interactive "nArticle number: ")
+  (let ((article (or article gnus-current-article))
+	article-id)
+    (unless article
+      (error "No article on current line"))
+    (setq article-id 
+	  (gnus-registry-fetch-message-id-fast gnus-current-article))
+    (unless article-id
+      (error "No article ID could be retrieved"))
+    (gnus-message 1 
+		  "Message ID %s, Registry flags: %s" 
+		  article-id 
+		  (concat (gnus-registry-fetch-extra-flags article-id)))))
+    
+
 ;;; if this extends to more than 'flags, it should be improved to be more generic.
 (defun gnus-registry-fetch-extra-flags (id)
   "Get the flags of a message, based on the message ID.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.