Re: bind print-level and print-length?

2007-11-02 Thread Robert Widhopf-Fenk
On Tuesday, September 11, 2007 at 08:55:22, Tom Tromey wrote:
> > "Leo" == Leo  <[EMAIL PROTECTED]> writes:
> 
> Leo> Which version are you using? I haven't seen this bug in '2.36
> Leo> devo'.
> 
> 2.35.  But you probably wouldn't see the bug unless one of those
> variables gets set, and you happen to have an entry that overflows
> the print length.  I don't know how print-length gets set -- this is
> probably a bug in some other package -- but the point is that BBDB
> should be robust against it.

I will change that, it should not do any harm ..

Robert

=== modified file 'lisp/bbdb-com.el'
--- lisp/bbdb-com.el2007-06-26 21:52:34 +
+++ lisp/bbdb-com.el2007-11-02 22:21:43 +
@@ -3168,7 +3168,7 @@
   (if (cdr (cdr condition)) ": ")
   (mapconcat '(lambda (x)
 (if (stringp x) x
-  (prin1-to-string x)))
+  (bbdb-prin1-to-string x)))
  (cdr (cdr condition)) ", ")
  (bbdb-finger-process-sentinel nil nil ; hackaroonie
 

=== modified file 'lisp/bbdb.el'
--- lisp/bbdb.el2007-06-26 21:53:10 +
+++ lisp/bbdb.el2007-11-02 22:21:43 +
@@ -142,6 +142,16 @@
 (defun bbdb-replace-in-string (string regexp newtext &optional literal)
   (bbdb-replace-regexp-in-string regexp newtext string nil literal
 
+(defun bbdb-prin1-to-string (object &optional noescape)
+  (let ((print-length nil)
+(print-level nil))
+(prin1-to-string object noescape)))
+
+(defun bbdb-prin1 (object &optional stream)
+  (let ((print-length nil)
+(print-level nil))
+(prin1 object stream)))
+
 ;; this should really be in bbdb-com
 ;;;###autoload
 (defun bbdb-submit-bug-report ()
@@ -2621,7 +2631,7 @@
   point)))
   (bbdb-record-set-cache record nil)
   (if unmigrated (bbdb-record-set-cache unmigrated nil))
-  (insert-before-markers (prin1-to-string (or unmigrated record)) "\n")
+  (insert-before-markers (bbdb-prin1-to-string (or unmigrated record)) 
"\n")
   (set-marker (bbdb-cache-marker cache) point)
   (bbdb-record-set-cache record cache)
 ;;(if (bbdb-record-name record)
@@ -2667,7 +2677,7 @@
 (bbdb-record-set-cache record nil)
 (if unmigrated (bbdb-record-set-cache unmigrated nil))
 
-(insert (prin1-to-string (or unmigrated record)) "\n")
+(insert (bbdb-prin1-to-string (or unmigrated record)) "\n")
 (delete-region (point)
(if (cdr tail)
(bbdb-record-marker (car (cdr tail)))
@@ -2784,7 +2794,7 @@
   ;; record in the database!
   (insert-before-markers ";;; user-fields: \n")
   (forward-char -1))
-(prin1 (mapcar (lambda (x) (intern (car x)))
+(bbdb-prin1 (mapcar (lambda (x) (intern (car x)))
bbdb-propnames)
(current-buffer))
 bbdb-propnames))
@@ -3657,7 +3667,7 @@
(setq record (car records)
  cache (bbdb-record-cache record))
(bbdb-record-set-cache record nil)
-   (prin1 (car records))
+   (bbdb-prin1 (car records))
(bbdb-record-set-cache record cache)
(insert ?\n)
(setq records (cdr records



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: bind print-level and print-length?

2007-09-11 Thread Tom Tromey
> "Leo" == Leo  <[EMAIL PROTECTED]> writes:

Leo> Which version are you using? I haven't seen this bug in '2.36 devo'.

2.35.  But you probably wouldn't see the bug unless one of those
variables gets set, and you happen to have an entry that overflows the
print length.  I don't know how print-length gets set -- this is
probably a bug in some other package -- but the point is that BBDB
should be robust against it.

Tom

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: bind print-level and print-length?

2007-09-10 Thread Leo
On 2007-09-10 00:32 +0100, Tom Tromey wrote:
> Every once in a while I get a corrupt .bbdb.  One record will have
> something like \.\.\. in it.  I am not entirely sure how this happens
> but my theory is that something binds print-length and this affects
> writing the bbdb record.
>
> Perhaps BBDB should bind print-length and print-level to nil around
> calls to prin1?
>
> Tom

Which version are you using? I haven't seen this bug in '2.36 devo'.

> -
> This SF.net email is sponsored by: Microsoft Defy all
> challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/

This funny to see in free software world.

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .:  [ GPG Key: 9283AA3F ]  :.

=> "(require 'cl) considered harmful" considered harmful
=>   http://dto.freeshell.org/blog/blog-2007-09-07-2323.html


-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


bind print-level and print-length?

2007-09-09 Thread Tom Tromey
Every once in a while I get a corrupt .bbdb.  One record will have
something like \.\.\. in it.  I am not entirely sure how this happens
but my theory is that something binds print-length and this affects
writing the bbdb record.

Perhaps BBDB should bind print-length and print-level to nil around
calls to prin1?

Tom

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/