* Deleting mail in virtual group
@ 2014-10-04 9:19 Alexander Baier
2014-10-04 12:48 ` Eric Abrahamsen
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Baier @ 2014-10-04 9:19 UTC (permalink / raw)
To: ding
Hello,
This is my setup:
I sync my E-Mail to disk with mbsync and access it from gnus via the
nnmaildir backend. Each IMAP-folder corresponds to a group
(e.g. nnmaildir+mailbox:Inbox). To be able to read a complete conversion
(that is including my answers) I have a virtual group that combines
Inbox and Sent groups.
This is what I want:
From the summary buffer of the virtual group I want to delete the
current article. Deleting is done by moving said article to a designated
group (e.g. nnmaildir+mailbox:Trash).
Problem:
Moving an article from a virtual group does not work:
"gnus-summary-move-article: The current group does not support article
moving".
Solution?:
I want to write my own command that finds the original group of the
article in question and executes the move in that group. Is there a
function that gets me the original group of an article in a virtual
group?
Regards,
--
Alexander Baier
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Deleting mail in virtual group
2014-10-04 9:19 Deleting mail in virtual group Alexander Baier
@ 2014-10-04 12:48 ` Eric Abrahamsen
2014-10-04 14:10 ` Alexander Baier
0 siblings, 1 reply; 6+ messages in thread
From: Eric Abrahamsen @ 2014-10-04 12:48 UTC (permalink / raw)
To: ding
Alexander Baier <alexander.baier@mailbox.org> writes:
> Hello,
>
> This is my setup:
>
> I sync my E-Mail to disk with mbsync and access it from gnus via the
> nnmaildir backend. Each IMAP-folder corresponds to a group
> (e.g. nnmaildir+mailbox:Inbox). To be able to read a complete conversion
> (that is including my answers) I have a virtual group that combines
> Inbox and Sent groups.
>
>
> This is what I want:
>
> From the summary buffer of the virtual group I want to delete the
> current article. Deleting is done by moving said article to a designated
> group (e.g. nnmaildir+mailbox:Trash).
>
>
> Problem:
>
> Moving an article from a virtual group does not work:
> "gnus-summary-move-article: The current group does not support article
> moving".
>
>
> Solution?:
>
> I want to write my own command that finds the original group of the
> article in question and executes the move in that group. Is there a
> function that gets me the original group of an article in a virtual
> group?
>
> Regards,
I'm pretty sure that nnvirtual-find-group-art will do what you want.
Feed it the article number of the article under point, along with
gnus-newsgroup-name in the virtual Summary buffer. See how it works!
Eric
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Deleting mail in virtual group
2014-10-04 12:48 ` Eric Abrahamsen
@ 2014-10-04 14:10 ` Alexander Baier
2014-10-05 8:36 ` Eric Abrahamsen
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Baier @ 2014-10-04 14:10 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: ding
On 2014-10-04 14:48 Eric Abrahamsen wrote:
>> I want to write my own command that finds the original group of the
>> article in question and executes the move in that group. Is there a
>> function that gets me the original group of an article in a virtual
>> group?
>
> I'm pretty sure that nnvirtual-find-group-art will do what you want.
> Feed it the article number of the article under point, along with
> gnus-newsgroup-name in the virtual Summary buffer. See how it works!
Thank you for your quick reply! These to functions do what I want and I
get the correct original group and article. But now I am stuck and do
not know how to get to the original group. This is what I tried:
#+BEGIN_SRC emacs-lisp
(defun my-nnvirtual-delete-article ()
(interactive)
(let ((original (nnvirtual-find-group-art
gnus-newsgroup-name
(gnus-summary-article-number))))
(with-current-buffer gnus-group-buffer
(gnus-group-goto-group (car original))
(gnus-summary-goto-article (cdr original)))))
#+END_SRC
The group and article number returned by nnvirtual-find-group-art are
correct, I checked. But the with-current-buffer part does not seem to
work, as gnus always displays the article from the nnvirtual group with
the original number.
How do I switch to the original group?
TIA,
--
Alexander Baier
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Deleting mail in virtual group
2014-10-04 14:10 ` Alexander Baier
@ 2014-10-05 8:36 ` Eric Abrahamsen
2014-10-05 18:28 ` Alexander Baier
0 siblings, 1 reply; 6+ messages in thread
From: Eric Abrahamsen @ 2014-10-05 8:36 UTC (permalink / raw)
To: ding
Alexander Baier <alexander.baier@mailbox.org> writes:
> On 2014-10-04 14:48 Eric Abrahamsen wrote:
>>> I want to write my own command that finds the original group of the
>>> article in question and executes the move in that group. Is there a
>>> function that gets me the original group of an article in a virtual
>>> group?
>>
>> I'm pretty sure that nnvirtual-find-group-art will do what you want.
>> Feed it the article number of the article under point, along with
>> gnus-newsgroup-name in the virtual Summary buffer. See how it works!
>
> Thank you for your quick reply! These to functions do what I want and I
> get the correct original group and article. But now I am stuck and do
> not know how to get to the original group. This is what I tried:
>
> #+BEGIN_SRC emacs-lisp
> (defun my-nnvirtual-delete-article ()
> (interactive)
> (let ((original (nnvirtual-find-group-art
> gnus-newsgroup-name
> (gnus-summary-article-number))))
> (with-current-buffer gnus-group-buffer
> (gnus-group-goto-group (car original))
> (gnus-summary-goto-article (cdr original)))))
> #+END_SRC
All `gnus-group-goto-group' does is move to the group's line in the
*Group* buffer. Try `gnus-group-read-group' instead. That -- or
something involving that -- ought to do what you want.
> The group and article number returned by nnvirtual-find-group-art are
> correct, I checked. But the with-current-buffer part does not seem to
> work, as gnus always displays the article from the nnvirtual group with
> the original number.
>
> How do I switch to the original group?
>
> TIA,
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Deleting mail in virtual group
2014-10-05 8:36 ` Eric Abrahamsen
@ 2014-10-05 18:28 ` Alexander Baier
2014-10-06 2:44 ` Eric Abrahamsen
0 siblings, 1 reply; 6+ messages in thread
From: Alexander Baier @ 2014-10-05 18:28 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: ding
On 2014-10-05 10:36 Eric Abrahamsen wrote:
> Alexander Baier <alexander.baier@mailbox.org> writes:
>
>> On 2014-10-04 14:48 Eric Abrahamsen wrote:
>>>> I want to write my own command that finds the original group of the
>>>> article in question and executes the move in that group. Is there a
>>>> function that gets me the original group of an article in a virtual
>>>> group?
>>>
>>> I'm pretty sure that nnvirtual-find-group-art will do what you want.
>>> Feed it the article number of the article under point, along with
>>> gnus-newsgroup-name in the virtual Summary buffer. See how it works!
>>
>> Thank you for your quick reply! These to functions do what I want and I
>> get the correct original group and article. But now I am stuck and do
>> not know how to get to the original group. This is what I tried:
>>
>> #+BEGIN_SRC emacs-lisp
>> (defun my-nnvirtual-delete-article ()
>> (interactive)
>> (let ((original (nnvirtual-find-group-art
>> gnus-newsgroup-name
>> (gnus-summary-article-number))))
>> (with-current-buffer gnus-group-buffer
>> (gnus-group-goto-group (car original))
>> (gnus-summary-goto-article (cdr original)))))
>> #+END_SRC
>
> All `gnus-group-goto-group' does is move to the group's line in the
> *Group* buffer. Try `gnus-group-read-group' instead. That -- or
> something involving that -- ought to do what you want.
Yes, gnus-group-read-group works! The following code takes the current
article and moves it from its original group to a specified trash
group:
#+BEGIN_SRC emacs-lisp
(defun my-nnvirtual-delete-article ()
(interactive)
(let* ((original (nnvirtual-find-group-art
gnus-newsgroup-name
(gnus-summary-article-number)))
(group (car original))
(article (cdr original))
(trash (cl-assoc group my-gnus-trash-locations
:test (lambda (item rx)
(string-match-p rx item)))))
(unless trash
(error "No trash folder configured for group %s" group))
(with-current-buffer gnus-group-buffer
(gnus-group-read-group nil nil group (list article))
(gnus-summary-move-article 1 (cdr trash)))))
(defvar my-gnus-trash-locations
'(("nnmaildir\\+mailbox:.*" . "nnmaildir+mailbox:Trash"))
"Locations of trash folders.")
#+END_SRC
The problem with this code is that I end up in the original group after
the moving/deleting is finished and not in the virtual group. This
surprises me, as I always thought of `with-current-buffer' as a macro
that save my window configuration. Apparently this is not the case, why
is that?
Regards,
--
Alexander Baier
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Deleting mail in virtual group
2014-10-05 18:28 ` Alexander Baier
@ 2014-10-06 2:44 ` Eric Abrahamsen
0 siblings, 0 replies; 6+ messages in thread
From: Eric Abrahamsen @ 2014-10-06 2:44 UTC (permalink / raw)
To: ding
Alexander Baier <alexander.baier@mailbox.org> writes:
> On 2014-10-05 10:36 Eric Abrahamsen wrote:
>> Alexander Baier <alexander.baier@mailbox.org> writes:
>>
>>> On 2014-10-04 14:48 Eric Abrahamsen wrote:
>>>>> I want to write my own command that finds the original group of the
>>>>> article in question and executes the move in that group. Is there a
>>>>> function that gets me the original group of an article in a virtual
>>>>> group?
>>>>
>>>> I'm pretty sure that nnvirtual-find-group-art will do what you want.
>>>> Feed it the article number of the article under point, along with
>>>> gnus-newsgroup-name in the virtual Summary buffer. See how it works!
>>>
>>> Thank you for your quick reply! These to functions do what I want and I
>>> get the correct original group and article. But now I am stuck and do
>>> not know how to get to the original group. This is what I tried:
>>>
>>> #+BEGIN_SRC emacs-lisp
>>> (defun my-nnvirtual-delete-article ()
>>> (interactive)
>>> (let ((original (nnvirtual-find-group-art
>>> gnus-newsgroup-name
>>> (gnus-summary-article-number))))
>>> (with-current-buffer gnus-group-buffer
>>> (gnus-group-goto-group (car original))
>>> (gnus-summary-goto-article (cdr original)))))
>>> #+END_SRC
>>
>> All `gnus-group-goto-group' does is move to the group's line in the
>> *Group* buffer. Try `gnus-group-read-group' instead. That -- or
>> something involving that -- ought to do what you want.
>
> Yes, gnus-group-read-group works! The following code takes the current
> article and moves it from its original group to a specified trash
> group:
>
> #+BEGIN_SRC emacs-lisp
> (defun my-nnvirtual-delete-article ()
> (interactive)
> (let* ((original (nnvirtual-find-group-art
> gnus-newsgroup-name
> (gnus-summary-article-number)))
> (group (car original))
> (article (cdr original))
> (trash (cl-assoc group my-gnus-trash-locations
> :test (lambda (item rx)
> (string-match-p rx item)))))
> (unless trash
> (error "No trash folder configured for group %s" group))
> (with-current-buffer gnus-group-buffer
> (gnus-group-read-group nil nil group (list article))
> (gnus-summary-move-article 1 (cdr trash)))))
>
> (defvar my-gnus-trash-locations
> '(("nnmaildir\\+mailbox:.*" . "nnmaildir+mailbox:Trash"))
> "Locations of trash folders.")
> #+END_SRC
>
> The problem with this code is that I end up in the original group after
> the moving/deleting is finished and not in the virtual group. This
> surprises me, as I always thought of `with-current-buffer' as a macro
> that save my window configuration. Apparently this is not the case, why
> is that?
That I can't tell you! My only guess is that virtual group *Summary*
buffer is actually getting destroyed in the process of shifting groups
and moving messages, and there's nowhere to return to. You could test by
manually replicating what `with-current-buffer' does: save the current
buffer in your let form, then try to `switch-to-buffer' back to it when
the article's been moved, and see if it still exists.
Eric
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-10-06 2:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-04 9:19 Deleting mail in virtual group Alexander Baier
2014-10-04 12:48 ` Eric Abrahamsen
2014-10-04 14:10 ` Alexander Baier
2014-10-05 8:36 ` Eric Abrahamsen
2014-10-05 18:28 ` Alexander Baier
2014-10-06 2:44 ` Eric Abrahamsen
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).