Please change the Subject header to a concise bug description.
In this report, remember to cover the basics, that is, what you expected to
happen and what in fact did happen.  Please remove these
instructions from your message.

Hi,
I use the latest emacs from CVS under windows.
I use bbdb and I found out, that the bbdb append feature does not
work with my emacs.
I tried the same feature on my debian box with the latest debian
emacs packages. It works on debian.

Here is the recipe for the test (in a bbdb buffer):
I type:
b search-string1 <RET>
+ b search-string2 <RET>

But the second search always clears the first one and I get only the
results of the second search.

On linux (emacs21.2.2) I get the correct result:
records with search-string1 and search-string2 are shown.


I started to debug the bbdb query.
Here is, what I found out:
* In the function bbdb-display-records-1, there is a call to
  with-output-to-temp-buffer.
* Before the call to this function, the variable bbdb-records
  contains the already visible bbdb-entries.
* After the call to with-output-to-temp-buffer, the variable
  bbdb-records is nil
  + On linux this variable has still the same value as before
  + I fixed the problem with the new variable xbbdb-records
* My question is now, is this a bug of with-output-to-temp-buffer?

I sent the things I found out to the emacs developers, here is the
response from RMS:

RMS> You need to report this to the bbdb maintainers.  We don't
RMS> know the code of bbdb.  It could be that this is an Emacs bug,
RMS> but we cannot afford to study the code of bbdb to investigate it.
RMS> 
RMS> If the bbdb maintainers find that the bug seems to be in Emacs,
RMS> they need to provide us with a precise test case that doesn't
RMS> involve using bbdb.  Then we can take it the rest of the way.


My changed function looks like this:

(defun bbdb-display-records-1 (records &optional append layout)
  (setq append (or append (bbdb-append-records-p)))
  (if (or (null records)
          (consp (car records)))
      nil

    ;; add layout and a marker to the local list of records
    (setq layout (or layout bbdb-display-layout))
    (setq records (mapcar (lambda (x)
                            (list x layout (make-marker)))
                          records)))

  (let ((b (current-buffer))
        (temp-buffer-setup-hook nil)
        (temp-buffer-show-hook nil)
        (xbbdb-records (copy-alist bbdb-records))
        (first (car (car records))))
    ;;(message "xbbdb-records: %S" xbbdb-records)
    ;;(message "bbdb-records: %S" bbdb-records)

    ;;05.03.2003, XSteve, with-output-to-temp-buffer seems to
    ;; destroy the binding of bbdb-records on windows emacs, cvs version...
    ;; so use xbbdb-records - this works
    (with-output-to-temp-buffer bbdb-buffer-name
      (set-buffer bbdb-buffer-name)
      ;;(message "xbbdb-records: %S" xbbdb-records)
      ;;(message "bbdb-records: %S" bbdb-records)
      
      ;; If append is unset, clear the buffer.
      (unless append
        (bbdb-undisplay-records))

      ;; If we're appending these records to the ones already displayed,
      ;; then first remove any duplicates, and then sort them.
      (if append
          (let ((rest records))
            (while rest
              (if (assq (car (car rest)) xbbdb-records)
                  (setq records (delq (car rest) records)))
              (setq rest (cdr rest)))
            (setq records (append xbbdb-records records))
            (setq records
                  (sort records
                        (lambda (x y) (bbdb-record-lessp (car x) (car y)))))))
      (make-local-variable 'mode-line-buffer-identification)
      (make-local-variable 'mode-line-modified)
      (set (make-local-variable 'bbdb-showing-changed-ones) nil)
      (let ((done nil)
            (rest records)
            (changed (bbdb-changed-records)))
        (while (and rest (not done))
          (setq done (memq (car (car rest)) changed)
                rest (cdr rest)))
        (setq bbdb-showing-changed-ones done))
      (bbdb-frob-mode-line (length records))
      (and (not bbdb-gag-messages)
           (not bbdb-silent-running)
           (message "Formatting..."))
      (bbdb-mode)
      ;; this in in the *BBDB* buffer, remember, not the .bbdb buffer.
      (set (make-local-variable 'bbdb-records) nil)
      (setq bbdb-records records)
      (let ((buffer-read-only nil)
            prs)
        (bbdb-debug (setq prs (bbdb-records)))
        (setq truncate-lines t)
        (while records
          (bbdb-debug (if (not (memq (car (car records)) prs))
                          (error "record doubleplus unpresent!")))
          (set-marker (nth 2 (car records)) (point))
          (bbdb-format-record (nth 0 (car records))
                              (nth 1 (car records)))
          (setq records (cdr records))))
      (and (not bbdb-gag-messages)
           (not bbdb-silent-running)
           (message "Formatting...done."))
      )
    (set-buffer bbdb-buffer-name)
    (if (and append first)
        (let ((cons (assq first bbdb-records))
              (window (get-buffer-window (current-buffer))))
          (if window (set-window-start window (nth 2 cons)))))
    (bbdbq)
    ;; this doesn't really belong here, but it's convenient ... and when
    ;; using electric display it would not be called otherwise.
    (save-excursion (run-hooks 'bbdb-list-hook))
    (if bbdb-gui (bbdb-fontify-buffer))
    (set-buffer-modified-p nil)
    (setq buffer-read-only t)
    (set-buffer b)))





Emacs  : GNU Emacs 21.3.50.1 (i386-msvc-nt5.0.2195)
 of 2003-02-19 on HEIDI
Package: BBDB 2.35

current state:
==============
(setq
 emacs-version "21.3.50.1"
 bbdb-version-date "$Date: 2002/12/25 15:06:00 $"
 bbdb-file-format 6
 bbdb-no-duplicates-p nil
 bbdb-address-editing-function 'bbdb-address-edit-default
 bbdb-address-formatting-alist '((bbdb-address-is-continental . 
bbdb-format-address-continental)
                                 (nil . bbdb-format-address-default))
 bbdb-addresses-label-list '("Home" "Office" "Mobile")
 bbdb-after-change-hook '(bbdb/gnus-score-invalidate-alist)
 bbdb-after-read-db-hook nil
 bbdb-always-add-addresses nil
 bbdb-auto-revert-p nil
 bbdb-canonicalize-net-hook nil
 bbdb-canonicalize-redundant-nets-p t
 bbdb-case-fold-search t
 bbdb-change-hook 'bbdb-timestamp-hook
 bbdb-check-zip-codes-p t
 bbdb-complete-name-allow-cycling t
 bbdb-complete-name-hooks '(ding)
 bbdb-completion-display-record t
 bbdb-completion-type 'primary-or-name
 bbdb-continental-zip-regexp "^\\s *[A-Z][A-Z]?\\s *-\\s *[0-9][0-9][0-9]"
 bbdb-create-hook 'bbdb-creation-date-hook
 bbdb-default-area-code nil
 bbdb-default-country nil
 bbdb-default-domain nil
 bbdb-default-label-list '("Home" "Office" "Mobile" "Other")
 bbdb-define-all-aliases-field 'mail-alias
 bbdb-define-all-aliases-mode 'all
 bbdb-dial-local-prefix nil
 bbdb-dial-local-prefix-alist '(((if (integerp bbdb-default-area-code)
                                  (format "(%03d)" bbdb-default-area-code)
                                  (or bbdb-default-area-code ""))
                                 "")
                                )
 bbdb-dial-long-distance-prefix nil
 bbdb-display-layout 'multi-line
 bbdb-display-layout-alist '((one-line (order phones mail-alias net notes) (name-end . 
24)
                              (toggle . t))
                             (multi-line (omit creation-date timestamp) (toggle . t))
                             (pop-up-multi-line) (full-multi-line))
 bbdb-dwim-net-address-allow-redundancy t
 bbdb-electric-p nil
 bbdb-expand-mail-aliases t
 bbdb-extract-address-component-handler 'message
 bbdb-extract-address-component-ignore-regexp 
"\\(\\(undisclosed\\|unlisted\\)[^,]*recipients\\)\\|no To-header on input"
 bbdb-extract-address-components-func 'bbdb-rfc822-addresses
 bbdb-file "~/.bbdb"
 bbdb-file-remote nil
 bbdb-file-remote-save-always t
 bbdb-finger-buffer-name "*finger*"
 bbdb-finger-host-field 'finger-host
 bbdb-get-addresses-headers '((authors "From" "Resent-From" "Reply-To")
                              (recipients "Resent-To" "Resent-CC" "To" "CC" "BCC"))
 bbdb-get-only-first-address-p t
 bbdb-gui t
 bbdb-hashtable-size 200003
 bbdb-info-file nil
 bbdb-initialize-hook nil
 bbdb-legal-zip-codes '("^$" "^[        \n]*[0-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]?[       
 \n]*$"
                        "^[     \n]*\\([0-9][0-9][0-9][0-9][0-9]\\)[    \n]*-?[        
 \n]*\\([0-9][0-9][0-9][0-9]?\\)[        \n]*$" "^[      \n]*\\([A-Za-z0-9]+\\)[       
  \n]+\\([A-Za-z0-9]+\\)[         \n]*$" "^[      \n]*\\([A-Z]+\\)[       \n]*-?[      
   \n]*\\([0-9]+ ?[A-Z]*\\)[       \n]*$" "^[      \n]*\\([A-Z]+\\)[       \n]*-?[     
    \n]*\\([0-9]+\\)[       \n]+\\([0-9]+\\)[       \n]*$")
 bbdb-list-hook nil
 bbdb-load-hook nil
 bbdb-message-caching-enabled t
 bbdb-message-marker-field 'mark-char
 bbdb-mode-hook nil
 bbdb-modem-device "/dev/modem"
 bbdb-modem-dial nil
 bbdb-new-nets-always-primary nil
 bbdb-north-american-phone-numbers-p nil
 bbdb-notes-default-separator ", "
 bbdb-notes-sort-order '((notes . 0) (www . 1) (ftp . 2) (gopher . 3) (telnet . 4)
                         (mail-alias . 5) (mail-folder . 6) (lpr . 7) (creation-date . 
1000)
                         (timestamp . 1001))
 bbdb-notice-auto-save-file nil
 bbdb-notice-hook nil
 bbdb-offer-save t
 bbdb-phones-label-list '("Home" "Office")
 bbdb-pop-up-display-layout 'pop-up-multi-line
 bbdb-pop-up-target-lines 5
 bbdb-print-alist '((omit-area-code . "^(000) ") (phone-on-first-line . "^[     ]*$") 
(ps-fonts)
                    (font-size . 6) (quad-hsize . "3.15in") (quad-vsize . "4.5in"))
 bbdb-print-brief-alist '((columns . 1) (separator . 1) (n-phones . 2) (n-addresses . 
1)
                          (include-files "bbdb-print-brief" "bbdb-cols"))
 bbdb-print-epilog "\\endaddresses\n\\bye\n"
 bbdb-print-file-name "c:/temp/bbdb.tex"
 bbdb-print-full-alist '((columns . 3) (separator . 2) (include-files "bbdb-print" 
"bbdb-cols"))
 bbdb-print-net 'primary
 bbdb-print-omit-fields '(omit tex-name aka mail-alias)
 bbdb-print-prolog "%%%% ====== Phone/Address list in -*-TeX-*- Format =====\n%%%%     
   produced by bbdb-print, version 3.0\n\n\\input texnansi\n\n"
 bbdb-print-require t
 bbdb-quiet-about-name-mismatches nil
 bbdb-readonly-p nil
 bbdb-refile-notes-default-merge-function 'bbdb-refile-notes-default-merge-function
 bbdb-refile-notes-generate-alist '((creation-date . bbdb-refile-notes-string-least)
                                    (timestamp . bbdb-refile-notes-string-most))
 bbdb-save-db-timeout nil
 bbdb-send-mail-style 'compose-mail
 bbdb-silent-running nil
 bbdb-snarf-web-prop 'www
 bbdb-sound-files ["/usr/demo/SOUND/sounds/touchtone.0.au" 
"/usr/demo/SOUND/sounds/touchtone.1.au" "/usr/demo/SOUND/sounds/touchtone.2.au" 
"/usr/demo/SOUND/sounds/touchtone.3.au" "/usr/demo/SOUND/sounds/touchtone.4.au" 
"/usr/demo/SOUND/sounds/touchtone.5.au" "/usr/demo/SOUND/sounds/touchtone.6.au" 
"/usr/demo/SOUND/sounds/touchtone.7.au" "/usr/demo/SOUND/sounds/touchtone.8.au" 
"/usr/demo/SOUND/sounds/touchtone.9.au" "/usr/demo/SOUND/sounds/touchtone.pound.au" 
"/usr/demo/SOUND/sounds/touchtone.star.au"]
 bbdb-sound-player nil
 bbdb-sound-volume 50
 bbdb-time-display-format "%d %b %Y"
 bbdb-update-records-mode 'annotating
 bbdb-use-alternate-names t
 bbdb-use-pop-up t
 bbdb-user-mail-names nil
 bbdb-write-file-hooks '(bbdb-write-file-hook-fn)
 bbdb/gnus-lines-and-from-length 18
 bbdb/gnus-score-default nil
 bbdb/gnus-score-field 'gnus-score
 bbdb/gnus-split-crosspost-default nil
 bbdb/gnus-split-default-group "mail.misc"
 bbdb/gnus-split-myaddr-regexp "^reichoer$\\|[EMAIL 
PROTECTED]([-a-z0-9]+\\.\\)*riic.at$"
 bbdb/gnus-split-nomatch-function nil
 bbdb/gnus-split-private-field 'gnus-private
 bbdb/gnus-split-public-field 'gnus-public
 bbdb/gnus-summary-in-bbdb-format-letter "b"
 bbdb/gnus-summary-known-poster-mark "+"
 bbdb/gnus-summary-mark-known-posters t
 bbdb/gnus-summary-prefer-bbdb-data t
 bbdb/gnus-summary-prefer-real-names t
 bbdb/gnus-summary-show-bbdb-names t
 bbdb/gnus-summary-user-format-letter "B"
 bbdb/gnus-update-records-mode 'annotating
 bbdb/mail-auto-create-p t
 bbdb/news-auto-create-p nil
 bbdb/vm-set-auto-folder-alist-field 'vm-folder
 features '(apropos smtpmail holidays diary-lib rx em-smart em-rebind em-xtra em-unix 
term em-term
            em-script em-prompt em-ls em-pred em-hist em-glob em-dirs em-cmpl esh-opt 
em-basic
            em-banner em-alias esh-var esh-io esh-ext esh-proc esh-arg esh-cmd 
esh-mode eshell
            psvn cl-specs flow-fill w3m-form w3m ccl w3m-hist w3m-e21 w3m-fsf 
w3m-image w3m-proc
            w3m-util edebug sort gnus-cite smiley gnus-bcklg gnus-async gnus-dup 
gnus-ml
            gnus-topic url-http url-gw url-handlers nnrss mm-url pop3 nnml nnfolder 
bbdb-gnus
            bbdb-snarf mail-extr spam spam-stat gnus-uu gnus-delay gnus-draft 
gnus-agent gnus-srvr
            gnus-score score-mode nnvirtual gnus-cache nndraft nnmh gnus-pers 
gnus-dired gnus-msg
            gnus-art mm-uu nnir nnimap imap gnus-sum gnus-group gnus-undo gnus-demon 
nnmail
            mail-source nntp nnoo gnus-start gnus-spec gnus-int gnus-range gnus-win 
log-edit
            tramp-vc vc-rcs vc add-log pcvs pcvs-parse pcvs-info pcvs-defs pcvs-util 
ewoc mwheel
            thingatpt ede-dired wisent-python wisent-bovine wisent eieio-opt dabbrev 
find-file
            semantic-c filladapt tempo w3-cus xml-parse doxymacs vhdl-mode mmm-mode 
mmm-univ
            mmm-class mmm-region mmm-utils semantic-bovine semanticdb-file 
semantic-edit eldoc
            semantic-el find-func loadhist todoo reftex-vcr reftex-dcr reftex-auc 
noutline outline
            font-latex xref filecache rfn-eshadow preview prv-emacs desktop latex 
tex-buf tex
            google xml soap url-cache url-auth url url-proxy url-privacy url-expand 
url-methods
            url-auto url-history url-cookie url-util url-parse url-vars printing 
cus-edit
            cus-start cus-load mh-identity mh-comp mh-e gnus gnus-ems mh-utils mm-view
            mh-customize mh-loaddefs rmail ps-print lpr student-list-mode 
xsteve-pymacs pymacs
            midnight work-log mailalias ecb-layout-defs progr-align grabbox 
remind-mode diminish
            babel bbdb-autoloads bbdb-query bbdb-print bbdb-com bbdb sendmail message 
rfc822 mml
            mml-sec mml-smime smime dig mml1991 mml2015 pgg pgg-parse pgg-def 
mm-decode mm-bodies
            mm-encode mailcap mail-parse rfc2045 rfc2231 rfc2047 gnus-util netrc qp 
ietf-drums
            time-date parse-time mailabbrev nnheader mm-util mail-prsvr mailheader 
canlock
            mail-utils timezone webjump browse-url w3-auto xref-hks mkback jka-compr 
tramp shell
            format-spec mmm-auto mmm-vars mmm-compat tmmofl mouse-embrace window-ring 
saveplace
            live-mode defaultcontent clipper toc hippie-exp align boxes ffap findr 
findstr igrep
            tempbuf keep-buffers scroll-in-place minibuffer-complete-cycle icomplete
            browse-kill-ring generic-dl generic-menu misc newcomment emacs-wiki 
executable
            pcomplete timeclock find-recursive ido bubble-buffer ibuffer ecb 
ecb-autogen autoload
            ecb-tod ecb-upgrade ecb-face ecb-cycle ecb-eshell ecb-navigate ecb-help 
ecb-jde
            ecb-layout compile ecb-create-layout ecb-mode-line ecb-compilation ecb-util
            tree-buffer avoid silentcomp ede-speedbar ede vc-cvs ede-source sb-rmail 
sb-html
            sb-texinfo sb-info info semantic-ia-sb semantic-analyze semantic-cb 
eieio-speedbar
            eieio-custom semantic-sb speedbar ange-ftp sb-image dframe cedet 
semantic-load
            semanticdb-el semanticdb-search semanticdb eieio-base eieio senator 
which-func
            semantic-imenu imenu semantic-ctxt semantic-util-modes semantic-util 
semantic
            semantic-lex semantic-fw semantic-token assoc working inversion escreen 
power-macros
            find-library read-library calendar cal-menu pp esh-util esh-module 
esh-toggle dired-dd
            dired-dd-b3-menu wdired dired-x dired-aux pydoc python-mode comint ring 
vsim-nav cwarn
            cc-mode cc-cmds cc-styles cc-align cc-engine cc-langs cc-vars cc-menus 
cc-defs derived
            latex-doc latex-doc-var help-fns help-mode view button cl cl-19 reftex 
reftex-vars
            tex-font tex-site edmacro screen-lines byte-opt bytecomp byte-compile 
hideshow msb
            mouse-copy cua-base paren stig-paren reporter emacs-functions dired 
diff-mode
            easy-mmode advice advice-preload uniquify autorevert ehelp electric 
recentf wid-edit
            easymenu generic-x skeleton jit-lock font-lock regexp-opt syntax generic 
gnuserv
            tooltip image tool-bar fontset ediff-hook vc-hooks lisp-float-type dos-w32 
disp-table
            ls-lisp lisp-mode page menu-bar timer select scroll-bar mldrag mouse 
facemenu
            font-core frame ucs-tables georgian utf-8-lang misc-lang vietnamese 
tibetan thai lao
            korean japanese hebrew greek romanian slovak czech european ethiopic tamil 
malayalam
            devanagari indian cyrillic chinese case-table help simple faces cus-face
            text-properties overlay md5 base64 format mule env custom widget backquote
            make-network-process)
 )





-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Reply via email to