Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* last 5 subjects in BBDB and my.gnus.org down
@ 2003-09-19 15:43 Hubert Canon
  0 siblings, 0 replies; only message in thread
From: Hubert Canon @ 2003-09-19 15:43 UTC (permalink / raw)


Hi,

I don't know if I read this in this group or elsewhere, but I got
a piece of code that adds to the BBDB the last five subjects read for
each record.

It doesn't work for me : it collects the subjects but leave them all
in the DB, not only the 5 last but all of them.

I tried to reach my.gnus.org but the site seems to be down.
The link is : http://my.gnus.org/Lisp/1031352025


Does some one have a solution ?


(setq bbdb-auto-notes-alist (cons '("Subject"
                                     ((".*" subjects 0)))
                             bbdb-auto-notes-alist))
                             
; With these code you can see the last 5 subjects in the BBDB-Buffer.
(put 'subjects 'field-separator "\n")
(add-hook 'bbdb-change-hook 'ulmer:bbdb-trim-subjects)
(defun ulmer:bbdb-trim-subjects (record)
  "Remove all but the first 5 lines from the subjects
    in the notes field of a BBDB record. Meant to be
    added to bbdb-change-hook."
  (let* ((sep (get 'subjects 'field-separator))
         (foo (reverse
               (split-string
                (or (bbdb-record-getprop record 'subjects) "")
                sep)))
         (num-to-keep 5)
         (new-subj ""))
    (while (and (> num-to-keep 0) (> (length foo) 0))
      (if (> (length (car foo)) 0)
          (setq new-subj (concat (car foo)
                                 (if (> (length new-subj) 0)
                                     (concat sep new-subj)
                                   ""))
                num-to-keep (- num-to-keep 1)))
      (setq foo (cdr foo)))
    (bbdb-record-putprop record 'subjects new-subj)))



-- 
Hubert Canon


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-09-19 15:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-19 15:43 last 5 subjects in BBDB and my.gnus.org down Hubert Canon

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