Post by physiculusHello,
i created several imap folders inside my Gmail account. i use them to
save my mails with splitting.
As usual if i view Gmail folder "All Messages" i see all my mails. So
far so good.
Is it possible to see the "folder" name from my Gmail account in
gnus-summary-line during inside "All Messages" folder?
Or is it nearly impossible, because "folder" names are tags in real.
Regards
Poul
Hi,
Only one year after your original post (that tells you how often I frequent this group -- sadly). Here is what I do:
;; --------------------
;; Display GMail labels in Summary
;; --------------------
(setq gmail-label-length 1)
(defun gmail-parse-labels (lbls)
(if (not (= (length lbls) 0))
(let ((lbl (car lbls)))
(setq lbl (replace-regexp-in-string "[\"\(\)]" "" lbl))
(if (not (= (length lbl) 0))
(if (not (string= (substring lbl 0 1) "\\"))
(concat
(substring lbl 0 gmail-label-length)
(gmail-parse-labels (cdr lbls))
)
(gmail-parse-labels (cdr lbls)) ;; Else, just go for the next label
)
(gmail-parse-labels (cdr lbls)) ;; Else, just go for the next label (to be on the safe side)
)
)
)
)
(defun nnimap-fetch-gmail-labels (number)
;;(message "Requesting Gmail labels for message #%s..." number)
(with-current-buffer (nnimap-buffer)
(let ((result (nnimap-command "UID FETCH %d (%s)" number 'X-GM-LABELS))
lbls lbl)
;; This gives me a response looking like
;; (t (OK Success) (11 FETCH (X-GM-LABELS ("\\Important" "\\Starred") UID 12641)))
;; (message "Result: %s" result)
(setq lbls (nthcdr 2 result))
(setq lbls (nthcdr 2 (car lbls)))
(setq lbls (nthcdr 1 (car lbls)))
(gmail-parse-labels lbls)
)))
(defun gnus-user-format-function-g (headers)
(concat
(if (boundp 'group)
(if (string= group "INBOX")
(nnimap-fetch-gmail-labels number)
(concat "-")))
"")
)
Summary: I use a "user-format-function" to get the data into the line for each e-mail (Relevant part of gnus-summary-line-format is "%2,2ug"). I use very few labels so one letter is sufficient for me.
Cave: This was, I think, my first ever foray into elisp and I haven't touched this in maybe eight years. There is a metric ton of refactorings that could be made.
/Mikael