Gnus development mailing list
 help / color / mirror / Atom feed
From: Matt Ford <matt@dancingfrog.co.uk>
To: ding@gnus.org
Subject: Re: Marking ! in virtual groups
Date: Mon, 17 Feb 2014 03:18:23 +0000	[thread overview]
Message-ID: <87k3cu2zr4.fsf@rss01.mhs.man.ac.uk> (raw)
In-Reply-To: <87zjlt27eb.fsf@rss01.mhs.man.ac.uk>

Goodness, I'm making a mess of this.  Okay, a simple test case.

Setting edebug over gnus-request-set-mark shows behaviour like so:

In a *nnimap* summary buffer marking an article with ! and then doing M-g
results in the action part of the function

(defun gnus-request-set-mark (group action)
  "Set marks on articles in the back end."
  (let ((gnus-command-method (gnus-find-method-for-group group)))
    (if (not (gnus-check-backend-function
	      'request-set-mark (car gnus-command-method)))
	action
      (funcall (gnus-get-function gnus-command-method 'request-set-mark)
	       (gnus-group-real-name group) action
	       (nth 1 gnus-command-method))
      (gnus-run-hook-with-args gnus-after-set-mark-hook group action))))

being

(((6507) add (tick)))

However in a *nnvirtual* summary buffer marking and article with ! and then doing M-g
results in the action being

((((1 . 6508)) add (read)))

so the passed action parameter is wrong.

I had a look at the M-g code and I reckon it's the function

(defun gnus-update-marks ()
  "Enter the various lists of marked articles into the newsgroup info list."
...

In particular its the section of this function that builds up the
delta-marks data structure used for changing the info.  It looks like this

...
	(when (and (gnus-check-backend-function
		    'request-set-mark gnus-newsgroup-name)
		   (not (gnus-article-unpropagatable-p (cdr type))))
	  (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
		 ;; Don't do anything about marks for articles we
		 ;; didn't actually get any headers for.
... SNIP ...
	    (when add
	      (push (list add 'add (list (cdr type))) delta-marks))
	    (when del
	      ;; Don't delete marks from outside the active range.
	      ;; This shouldn't happen, but is a sanity check.
	      (setq del (gnus-sorted-range-intersection
			 (gnus-active gnus-newsgroup-name) del))
	      (push (list del 'del (list (cdr type))) delta-marks))))

Other functions that set marks seem to have a more sophisticated form
of checking that looks to iterate over the actual backends.  For example,

(defun gnus-request-set-mark (group action)
  "Set marks on articles in the back end."
  (let ((gnus-command-method (gnus-find-method-for-group group)))
    (if (not (gnus-check-backend-function
	      'request-set-mark (car gnus-command-method)))
	action
      (funcall (gnus-get-function gnus-command-method 'request-set-mark)
	       (gnus-group-real-name group) action
	       (nth 1 gnus-command-method))
      (gnus-run-hook-with-args gnus-after-set-mark-hook group action))))

I think this more advanced check could be used in gnus-update-marks
function for generating delta-marks over the "real" back-ends.
      
This is all at the very limit of my elisp and gnus so perhaps I've got
this horribly wrong. I'm very unsure of myself here.

Any help appreciated.
-- 
Matt




  parent reply	other threads:[~2014-02-17  3:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 12:41 Matt Ford
2014-02-16 15:58 ` Matt Ford
2014-02-16 19:35   ` Matt Ford
2014-02-16 22:20     ` nnir and distant notmuch Erik Colson
2014-02-17  3:18 ` Matt Ford [this message]
2014-03-05 17:26   ` Marking ! in virtual groups Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k3cu2zr4.fsf@rss01.mhs.man.ac.uk \
    --to=matt@dancingfrog.co.uk \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).