Gnus development mailing list
 help / color / mirror / Atom feed
* IMAP Folder hierarchy -> Topics
@ 2012-11-23 10:16 Vegard Vesterheim
  2012-11-23 10:47 ` Steinar Bang
  0 siblings, 1 reply; 7+ messages in thread
From: Vegard Vesterheim @ 2012-11-23 10:16 UTC (permalink / raw)
  To: ding

I find it convenient to arrange my IMAP folders in a hierarchy on my
IMAP server. I use procmail to presort incoming mail to IMAP folders.
This allows me maintain some structure in my mail without depending on
a specific IMAP client.

In GNUS this folder-structure is by default flattened. Is there a
convenient way to let GNUS reflect this structure in the Group buffer?

Currently I use Topics for this, but I have to administer this
manually. This is cumbersome, I tend to use different Gnusae on
different computers and therefore I need to reestablish my Topics
structure on each of them. I would like to have a simple way to tell
GNUS to generate the Topic hierarchy from the IMAP Folder hierarchy
automatically. Has anyone done something like this?

 - Vegard V -



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

* Re: IMAP Folder hierarchy -> Topics
  2012-11-23 10:16 IMAP Folder hierarchy -> Topics Vegard Vesterheim
@ 2012-11-23 10:47 ` Steinar Bang
  2012-11-23 11:09   ` Vegard Vesterheim
  0 siblings, 1 reply; 7+ messages in thread
From: Steinar Bang @ 2012-11-23 10:47 UTC (permalink / raw)
  To: ding

>>>>> Vegard Vesterheim <vegard.vesterheim@uninett.no>:

> I find it convenient to arrange my IMAP folders in a hierarchy on my
> IMAP server. I use procmail to presort incoming mail to IMAP folders.
> This allows me maintain some structure in my mail without depending on
> a specific IMAP client.

> In GNUS this folder-structure is by default flattened.

Not sure what you mean by flattened...?  If the hierarchy is reflected
in the folder name, it will be reflected in the nnimap group name.

But if you mean that a group cannot be a child of another group, then
that's correct.




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

* Re: IMAP Folder hierarchy -> Topics
  2012-11-23 10:47 ` Steinar Bang
@ 2012-11-23 11:09   ` Vegard Vesterheim
  2012-12-24 17:45     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Vegard Vesterheim @ 2012-11-23 11:09 UTC (permalink / raw)
  To: ding

On Fri, 23 Nov 2012 11:47:32 +0100 Steinar Bang <sb@dod.no> wrote:

>>>>>> Vegard Vesterheim <vegard.vesterheim@uninett.no>:
>
>> I find it convenient to arrange my IMAP folders in a hierarchy on my
>> IMAP server. I use procmail to presort incoming mail to IMAP folders.
>> This allows me maintain some structure in my mail without depending on
>> a specific IMAP client.
>
>> In GNUS this folder-structure is by default flattened.
>
> Not sure what you mean by flattened...?  If the hierarchy is reflected
> in the folder name, it will be reflected in the nnimap group name.

Yes, but GNUS has no idea about the hierarchy. I am unable to manipulate
the parent folders as a unit. Contrast this to the way topics can be
expanded/collapsed.

> But if you mean that a group cannot be a child of another group, then
> that's correct.

Right, so I guess the only feasible way to handle this is using
topics. That is why I asked if someone had written some elisp to
automatically generate the Topic structure from the IMAP Folder
structure. 

 - Vegard V -



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

* Re: IMAP Folder hierarchy -> Topics
  2012-11-23 11:09   ` Vegard Vesterheim
@ 2012-12-24 17:45     ` Lars Ingebrigtsen
  2012-12-24 17:48       ` Ted Zlatanov
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2012-12-24 17:45 UTC (permalink / raw)
  To: Vegard Vesterheim; +Cc: ding

Vegard Vesterheim <vegard.vesterheim@uninett.no> writes:

> Right, so I guess the only feasible way to handle this is using
> topics. That is why I asked if someone had written some elisp to
> automatically generate the Topic structure from the IMAP Folder
> structure. 

I haven't heard of anybody doing so...

-- 
(domestic pets only, the antidote for overdose, milk.)
  http://lars.ingebrigtsen.no  *  Lars Magne Ingebrigtsen



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

* Re: IMAP Folder hierarchy -> Topics
  2012-12-24 17:45     ` Lars Ingebrigtsen
@ 2012-12-24 17:48       ` Ted Zlatanov
  2014-09-15 10:55         ` Vegard Vesterheim
  0 siblings, 1 reply; 7+ messages in thread
From: Ted Zlatanov @ 2012-12-24 17:48 UTC (permalink / raw)
  To: ding

On Mon, 24 Dec 2012 18:45:42 +0100 Lars Ingebrigtsen <larsi@gnus.org> wrote: 

LI> Vegard Vesterheim <vegard.vesterheim@uninett.no> writes:
>> Right, so I guess the only feasible way to handle this is using
>> topics. That is why I asked if someone had written some elisp to
>> automatically generate the Topic structure from the IMAP Folder
>> structure. 

LI> I haven't heard of anybody doing so...

If you were interested in pursuing this further, gnus-sync.el has code
to create topics and move groups to them programmatically.

Ted




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

* Re: IMAP Folder hierarchy -> Topics
  2012-12-24 17:48       ` Ted Zlatanov
@ 2014-09-15 10:55         ` Vegard Vesterheim
  2015-01-27  4:53           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Vegard Vesterheim @ 2014-09-15 10:55 UTC (permalink / raw)
  To: ding

On Mon, 24 Dec 2012 12:48:13 -0500 Ted Zlatanov <tzz@lifelogs.com> wrote:

> On Mon, 24 Dec 2012 18:45:42 +0100 Lars Ingebrigtsen <larsi@gnus.org> wrote: 
>
> LI> Vegard Vesterheim <vegard.vesterheim@uninett.no> writes:
>>> Right, so I guess the only feasible way to handle this is using
>>> topics. That is why I asked if someone had written some elisp to
>>> automatically generate the Topic structure from the IMAP Folder
>>> structure. 
>
> LI> I haven't heard of anybody doing so...
>
> If you were interested in pursuing this further, gnus-sync.el has code
> to create topics and move groups to them programmatically.

This is an old thread. With my limited elisp skills, I took a stab at
solving this problem.

Here is a function which seems to work, using dovecot as IMAP
server. Each IMAP server gets its own main topic, and the IMAP folder
hierarchy is used to create a corresponding topic structure. Setting the
variable gnus-browse-subscribe-newsgroup-method to
gnus-subscribe-create-topic, I can simply subscribe the folders in the
server buffer (pressing 'u') and have GNUS create the appropriate topic
structure automatically. Hopefully someone with better elisp knowledge
can verify and clean up this code, and add it to GNUS.

(defun gnus-subscribe-create-topic (group)
  "Subscribe new NEWSGROUP and create a topics structure reflecting the IMAP folder structure."
  (interactive)
  (let ((nextpos 0) ;; next position when parsing IMAP folder structure
        (server)
        (topic-name)
        (parent-topic "Gnus")
        (topicl))
    (string-match "\\(.*\\):" group)
    (setq server (match-string 1 group))
    (setq nextpos (match-end 0))
    (ignore-errors
      (progn 
        (gnus-topic-kill-group)))
    (unless (gnus-topic-find-topology server)
      (gnus-topic-create-topic server parent-topic nil))
    (setq parent-topic server)
    (setq topic-name server)
    ;; Loop throuch IMAP folder structure, creating subtopics as necessary
    (while (string-match "\\([^\\.]+\\)\\." group nextpos)
      (setq nextpos (match-end 1))
      (setq topic-name (concat parent-topic "." (match-string 1 group)))
      (ignore-errors
        (gnus-topic-create-topic topic-name parent-topic nil))
      (setq parent-topic topic-name)
      )
    (gnus-subscribe-newsgroup group)
    (setq topicl (assoc (gnus-group-topic group) gnus-topic-alist))
    (if topicl                          ; Delete group from existing topic
        (gnus-delete-first group topicl))
    ;; Add the group to the topic.
    (nconc (assoc topic-name gnus-topic-alist) (list group))
    (message "Subscribed group %s to topic %s" group topic-name)
))




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

* Re: IMAP Folder hierarchy -> Topics
  2014-09-15 10:55         ` Vegard Vesterheim
@ 2015-01-27  4:53           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2015-01-27  4:53 UTC (permalink / raw)
  To: ding

Vegard Vesterheim <vegard.vesterheim@uninett.no> writes:

> Here is a function which seems to work, using dovecot as IMAP
> server. Each IMAP server gets its own main topic, and the IMAP folder
> hierarchy is used to create a corresponding topic structure. Setting the
> variable gnus-browse-subscribe-newsgroup-method to
> gnus-subscribe-create-topic, I can simply subscribe the folders in the
> server buffer (pressing 'u') and have GNUS create the appropriate topic
> structure automatically. Hopefully someone with better elisp knowledge
> can verify and clean up this code, and add it to GNUS.

Sounds like a good idea.  I don't have mail box hierarchies on any IMAP
servers, so I can't test this.  Perhaps somebody else who does feels
inspired to take the idea and install it in Gnus?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



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

end of thread, other threads:[~2015-01-27  4:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-23 10:16 IMAP Folder hierarchy -> Topics Vegard Vesterheim
2012-11-23 10:47 ` Steinar Bang
2012-11-23 11:09   ` Vegard Vesterheim
2012-12-24 17:45     ` Lars Ingebrigtsen
2012-12-24 17:48       ` Ted Zlatanov
2014-09-15 10:55         ` Vegard Vesterheim
2015-01-27  4:53           ` Lars Ingebrigtsen

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