[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Marking certain folders as read automatically



Hi list,

there does not seem to be a way to easily select folders to be always mark as
fully read. For this reason I hacked up this little script that will do so (with
groups too). Specifically, all the folders or the group with a name that matches
an element in `wl-folder-auto-read' will be marked automatically as read after
checking:

-------------------8<-----------------------------

(setq wl-auto-read-folders nil)

(defun wl-folder-auto-read-execute (entity-name entity)
  (when (member entity-name wl-auto-read-folders)
    (wl-folder-mark-as-read-all-entity entity)
    t))

(defun wl-folder-auto-read-check (entity)
  (cond ((consp entity)
         (unless (wl-folder-auto-read-execute (car entity) entity)
           (mapc (lambda (entity-1)
                   (wl-folder-auto-read-check entity-1))
                 (nth 2 entity))))
        ((stringp entity)
         (wl-folder-auto-read-execute entity entity))
        (t (error "Invalid entity"))))

(defadvice wl-folder-check-entity (after wl-folder-auto-read
                                         (entity &optional auto))
  (when wl-auto-read-folders
    (wl-folder-auto-read-check entity)))

(ad-activate 'wl-folder-check-entity)

------------------->8-----------------------------

Admittedly this is quite an ugly way. The problem is that the
`wl-folder-check-entity-hook' does not have any information on the entity being
checked. But you know, it works! I'm open to nicer ways to do this.

--
Francesco * Often in error, never in doubt