Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* How to use gnus-summary-universal-argument
@ 2010-03-10  8:54 Cecil Westerhof
  2010-03-10 13:32 ` Ted Zlatanov
  2010-03-19 10:39 ` Leonidas Tsampros
  0 siblings, 2 replies; 5+ messages in thread
From: Cecil Westerhof @ 2010-03-10  8:54 UTC (permalink / raw)
  To: info-gnus-english

I move spam message from different places to a certain folder to be
processed. I like them to be easily marked as read. I can do this with:
    M P A
    M-&
    d
but I am a real programmer and lazy: I do not want to do what I can let
the computer do. ;-]

So I started writing the following function:
    (defun gnus-summary-mark-all-messages-as-read ()
      "If in gnus-summary-mode mark all messages as read"
      (interactive)
      (if (not (equal major-mode 'gnus-summary-mode))
          (message "This function can only be used in gnus-summary-mode")
        (gnus-uu-mark-all)
        (gnus-summary-universal-argument 'gnus-summary-mark-as-read-forward)))

This does not work. The description of gnus-summary-universal-argument
is:
    gnus-summary-universal-argument is an interactive compiled Lisp
    function.

    (gnus-summary-universal-argument ARG)

    Perform any operation on all articles that are process/prefixed.

How do I need to define the argument to let this work?

On a side note: what would be a good key to bind this function to?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to use gnus-summary-universal-argument
  2010-03-10  8:54 How to use gnus-summary-universal-argument Cecil Westerhof
@ 2010-03-10 13:32 ` Ted Zlatanov
  2010-03-10 14:28   ` Cecil Westerhof
  2010-03-19 10:39 ` Leonidas Tsampros
  1 sibling, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2010-03-10 13:32 UTC (permalink / raw)
  To: info-gnus-english

On Wed, 10 Mar 2010 09:54:00 +0100 Cecil Westerhof <Cecil@decebal.nl> wrote: 

CW> I move spam message from different places to a certain folder to be
CW> processed. I like them to be easily marked as read. I can do this with:
CW>     M P A
CW>     M-&
CW>     d
CW> but I am a real programmer and lazy: I do not want to do what I can let
CW> the computer do. ;-]

I assume you're not using spam.el, because it can do this for you?

Ted

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to use gnus-summary-universal-argument
  2010-03-10 13:32 ` Ted Zlatanov
@ 2010-03-10 14:28   ` Cecil Westerhof
  2010-03-19 19:26     ` Ted Zlatanov
  0 siblings, 1 reply; 5+ messages in thread
From: Cecil Westerhof @ 2010-03-10 14:28 UTC (permalink / raw)
  To: info-gnus-english

Ted Zlatanov <tzz@lifelogs.com> writes:

> CW> I move spam message from different places to a certain folder to be
> CW> processed. I like them to be easily marked as read. I can do this with:
> CW>     M P A
> CW>     M-&
> CW>     d
> CW> but I am a real programmer and lazy: I do not want to do what I can let
> CW> the computer do. ;-]
>
> I assume you're not using spam.el, because it can do this for you?

No, I did not know it. I'll look into it. But still I like to know how
to use gnus-summary-universal-argument. Maybe spam.el will do what I
want, but if not (or if I want to use the function for something else)
it would be nice to know how to use it.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to use gnus-summary-universal-argument
  2010-03-10  8:54 How to use gnus-summary-universal-argument Cecil Westerhof
  2010-03-10 13:32 ` Ted Zlatanov
@ 2010-03-19 10:39 ` Leonidas Tsampros
  1 sibling, 0 replies; 5+ messages in thread
From: Leonidas Tsampros @ 2010-03-19 10:39 UTC (permalink / raw)
  To: info-gnus-english

Cecil Westerhof <Cecil@decebal.nl> writes:

> I move spam message from different places to a certain folder to be
> processed. I like them to be easily marked as read. I can do this with:
>     M P A
>     M-&
>     d
> but I am a real programmer and lazy: I do not want to do what I can let
> the computer do. ;-]

Hi Cecil,

Usually, the way I marked spam was simply by using B m
(gnus-summary-move-article) and have them moved to my nnml:mail.junk
directory. B m works either with numerical prefixes or with process
marks. This is how I achieved a little bit of automation:

(defun gnus-move-to-junk (&optional n)
  (interactive "P")
  (gnus-summary-move-article n "nnml:mail.junk" nil 'move))

(add-hook 'gnus-startup-hook
	  '(lambda () 
	     (define-key gnus-summary-mode-map (kbd "j") 'gnus-move-to-junk)))

I remapped the 'j' key as I never used the defualt goto-article
command. 

Hope this helps!

> So I started writing the following function:
>     (defun gnus-summary-mark-all-messages-as-read ()
>       "If in gnus-summary-mode mark all messages as read"
>       (interactive)
>       (if (not (equal major-mode 'gnus-summary-mode))
>           (message "This function can only be used in gnus-summary-mode")
>         (gnus-uu-mark-all)
>         (gnus-summary-universal-argument 'gnus-summary-mark-as-read-forward)))
>
> This does not work. The description of gnus-summary-universal-argument
> is:
>     gnus-summary-universal-argument is an interactive compiled Lisp
>     function.
>
>     (gnus-summary-universal-argument ARG)
>
>     Perform any operation on all articles that are process/prefixed.
>
> How do I need to define the argument to let this work?
>
> On a side note: what would be a good key to bind this function to?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to use gnus-summary-universal-argument
  2010-03-10 14:28   ` Cecil Westerhof
@ 2010-03-19 19:26     ` Ted Zlatanov
  0 siblings, 0 replies; 5+ messages in thread
From: Ted Zlatanov @ 2010-03-19 19:26 UTC (permalink / raw)
  To: info-gnus-english

On Wed, 10 Mar 2010 15:28:22 +0100 Cecil Westerhof <Cecil@decebal.nl> wrote: 

CW> Ted Zlatanov <tzz@lifelogs.com> writes:
CW> I move spam message from different places to a certain folder to be
CW> processed. I like them to be easily marked as read. I can do this with:
CW> M P A
CW> M-&
CW> d
CW> but I am a real programmer and lazy: I do not want to do what I can let
CW> the computer do. ;-]
>> 
>> I assume you're not using spam.el, because it can do this for you?

CW> No, I did not know it. I'll look into it. But still I like to know how
CW> to use gnus-summary-universal-argument. Maybe spam.el will do what I
CW> want, but if not (or if I want to use the function for something else)
CW> it would be nice to know how to use it.

Leonidas gave you a specific answer, but in general you should not use
g-s-u-argument in programs.  It's meant for interactive use.
Specifically, it asks the user for a keystroke and then looks up what
the keystroke means (via `key-binding') in the summary mode keymap.

Now if you want to programmatically do something on all the articles,
that's not hard but it depends on the specific function.  Some take
multiple articles and you can just pass them the return values of
`gnus-summary-work-articles' or let them call it themselves.  Some don't
and you have to loop on all the articles and later remove the process
mark.

If you want to programmatically copy or move articles you could look at
`spam-copy-or-move-routine' in spam.el.  It has some code for that
purpose.  You can also look at `gnus-summary-move-article' which will
work on all the process-marked articles (it does copy, move, and
crosspost).  That's the heart of Gnus' copy and move functionality.

HTH
Ted

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-03-19 19:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-10  8:54 How to use gnus-summary-universal-argument Cecil Westerhof
2010-03-10 13:32 ` Ted Zlatanov
2010-03-10 14:28   ` Cecil Westerhof
2010-03-19 19:26     ` Ted Zlatanov
2010-03-19 10:39 ` Leonidas Tsampros

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).