Re: [BBDB] ChangeLog 2016-10-02: Use lexical binding

2016-10-22 Thread Stefan Monnier
>> The first solution binds the  variables lexically rather than
>> dynamically.  That means that if those  appear lexically inside
>> the  things will work correctly, but if  calls a function
>> which then refers to  this reference will fail.
> Thank you for the clarification.  The code in bbdb-anniv binds the
> variables lexcially via let which also contains the call of eval.
> So this is fine.

Not sure I understand.  You seem to describe something like

(let ((x1 v1)) ... (eval exp) ...)

in which case the evaluation of `exp' will not have access to `x1'.
What I suggested was

(eval exp `((x1 . ,v1)))

in which case the value of `exp' can contain references to `x1'.
But it's still different from a dynamic-binding of `x1', because

(let ((exp '(+ x1 4)))
  (eval exp `((x1 . 5

will correctly return 9, but

(defun my-f (y) (+ x1 y))
(let ((exp '(my-f 4)))
  (eval exp `((x1 . 5

will signal en error because `x1' is not visible to `my-f' (it's only
visible lexically within `exp').

In many cases, this is perfectly acceptable, in which case it's the
solution I recommend.


Stefan


--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: [BBDB] ChangeLog 2016-10-02: Use lexical binding

2016-10-04 Thread Stefan Monnier
> This variable contains forms that are evaluated using `eval',
> assuming that the variables appearing in this form are bound
> dynamically.  - I believe that old coding schemes like this one,

There are two ways to do that with lexical-binding:
- use (eval  `(( . ,) ( . ,) ...)
  which will not give the exact same behavior but works well in many
  cases (i.e. depends on the code put in diary-date-forms).
- use

(defvar ) (defvar ) ...
(let (( )
  ( )
  ...)
  (eval  t))

  which will preserve backward compatibility.


-- Stefan


--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: [PATCH] Better support for organisation-only records

2011-09-26 Thread Stefan Monnier
 Direct editing maybe similar to wdired-mode could be, indeed, a
 great thing. -- Yet as I said: I'll postpone such dreams till BBDB 3
 has been released.

No!  I want it now!
[...starts rolling on the floor screaming...]
Now! now! now! now! now!!


Stefan Damn adults!


--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: [PATCH] Better support for organisation-only records

2011-09-25 Thread Stefan Monnier
 A much fancier solution would be to reimplement bbdb-create from
 scratch by using something like a form to fill, similar to what
 customize is using.
 I should add: Such a rather substantial change would have rather low
 priority on my current BBDB agenda. Currently, I consider a proper
 BBDB release more important.

Being able to (more or less) directly edit the *BBDB* buffer would
be great.


Stefan


--
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: function to add new records from email message

2011-08-07 Thread Stefan Monnier
 (local-set-key : '(lambda () (interactive)
[...]
  bbdb/gnus-update-records-p'(lambda ()

Hmm... running for The Useless Use of Quote Award?


Stefan


--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos  much more. Register early  save!
http://p.sf.net/sfu/rim-blackberry-1
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: TAB should move from field to field

2011-04-25 Thread Stefan Monnier
 If I could add a rider request to this, it would be great to have a
 single key command to copy the field contents to the kill ring (the way
 'M' does now for the primary mail address). I often need to copy
 people's details to other places, and every time I do I wish I had this…

I'd personally even prefer if fields work as sexp, so I can just use
M-C-SPC to mark a few fields and then M-w to copy them.
I.e. hooking into forward-sexp-function would suit my fingers.


Stefan


--
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been 
demonstrated beyond question. Learn why your peers are replacing JEE 
containers with lightweight application servers - and what you can gain 
from the move. http://p.sf.net/sfu/vmware-sfemails
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Re: Non-nil default value in hook variables

2011-04-14 Thread Stefan Monnier
 I suggest change all these defcustom instances something like:
 
 (defcustom bbdb-create-hook nil
 :group 'bbdb
 :type 'hook)
 (add-hook 'bbdb-create-hook 'bbdb-creation-date)

 Agreed and thanks, that looks much cleaner!

But then don't define them as defcustom but just defvars since Custom
gets confused by the add-hook.


Stefan


--
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: bbdb-mode-map should inherit from special-mode-map

2011-04-13 Thread Stefan Monnier
 +  (when (boundp 'revert-buffer-function)
 +(setq revert-buffer-function 'bbdb-revert-buffer))
 
 I recommend to use (set (make-local-variable foo) bar) when setting
 a buffer-local variable, even if you know that the variable is
 automatically buffer-local.  One of the benefits is that you don't need
 to check `boundp' in that case.

 I check for `boundp' because bbdb might be supposed to work on emacsen
 which may lack `revert-buffer-function'.

I thought so, but if you use `setq' you also need such a check to make
sure the variable has been defined and its make-variable-buffer-local
call happened, otherwise even if the variable is automatically
buffer-local the `setq' will modify the variable globally.
That's a good reason to use (set (make-local-variable foo) bar).

As for whether you need `boundp' to set a variable, I think that's not
the case: if your Emacs doesn't obey this variable, setting it
shouldn't do any harm (it'll just be ignored).


Stefan


--
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: bbdb-complete-name return value

2011-03-05 Thread Stefan Monnier
 I thought that would be easier too, but it's counter-intuitive.

It's only counter intuitive if you think of it (and name it) something
like score.  So yes, we need another name to make it less
counter-intuitive.  E.g. `completion-penalty'.  And I think it would be
good to make it clear that this is for cycling, so the name could be
`completion-cycle-penalty'.


Stefan


!   (let ((s1 (get-text-property 0 :completion-score c1))
! (s2 (get-text-property 0 :completion-score c2)))
! (cond ((and s1 s2) ( s1 s2))
!   (s1 t)
!   (s2 nil)

BTW, I'd rather use something like

!   (let ((s1 (get-text-property 0 :completion-score c1))
! (s2 (get-text-property 0 :completion-score c2)))
! (cond ((and s1 s2) (cond (( s1 s2) t)
!  (( s1 s2) nil)
!  (t ( (length c1) (length c2)
!   (s1 t)
!   (s2 nil)

PS: Please Cc the patch to emacs-devel because I don't read this
bbdb-list as regularly.


--
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: bbdb-complete-name return value

2011-02-28 Thread Stefan Monnier
 The only thing I need to clarify is sorting.  Right now shorter string
 wins.  In the new method, higher score should win.

I think it's easier if lower scores win, so it's consistent with the
current use of `length'.  It's really not a big issue: just negate the
values you put on the property and you're done.


Stefan


--
Free Software Download: Index, Search  Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: bbdb-complete-name return value

2011-02-27 Thread Stefan Monnier
TZ Maybe accept the score as a property to the candidate strings and use
TZ that property, if it exists, instead of the string length?
TZ That would side-step the current completion mechanism nicely, requiring
TZ little extra code except in the final sort of candidates.  If the
TZ strings aren't mangled by the completion mechanism, of course--but I
TZ don't think they are after a quick scan.

That would work.  It's a quicksimple solution (i.e. generally a good
sign), but it has one drawback: the properties will be often added
without being used, since the list of completions is used not only to
build the *Completions* buffer or to cycle through completions but also
to do TAB completion (often just handled by try-completion, but with
substring completion it instead needs to get the all-completions list
and then weed it out).

So it has a performance downside (which means, it's not the last word in
this respect), but I'd probably accept a patch to add such a feature to
minibuffer.el since the performance impact is only incurred by
completion tables that really use the feature and it's unlikely to be
a serious maintenance problem in the future.


Stefan


--
Free Software Download: Index, Search  Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: bbdb-complete-name return value

2011-02-13 Thread Stefan Monnier
 IMO the cycling should only be based on scores.  That would, I think,
 accomplish all your items and produce less DWIM but that's not it.

Currently, the cycling code is fairly naive and it uses a fixed ordering
based on string length (shorter first).  Patches to make it more
customizable (by the completion table, not just by the end-user) would
be very welcome (e.g. for file completion, it could first cycle through
VCS-managed files).

 Do you have any thoughts / plans on implementing something like that
 for the generic completion code?

Directly, no.  But adding hooks so that the completion table can come
with its own sorting function, yes.


Stefan


--
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: bbdb-complete-name return value

2011-02-10 Thread Stefan Monnier
 Currently bbdb-complete-mail (the new name of bbdb-complete-name)
 really has no well-defined return values whatsoever. Would it help
 if it returned non-nil whenever it had done something?

Yes, that's generally the expected behavior of completion functions.

 Would this be the right thing??

Since BBDB3 only works on Emacs≥23, its completion could use
completion-at-point-functions and/or completion-in-region.


Stefan


--
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

Re: bbdb-complete-name return value

2011-02-10 Thread Stefan Monnier
 In any event, a simple t after (run-hooks 'bbdb-complete-mail-hook)
 does the trick, but it probably needs to be changed in some other
 places.

Note also that I've already installed a hack in message.el (at least in
Emacs's trunk) that checks that the buffer really was not modified
before trusting a nil return value from bbdb, to work around
the problem.


Stefan


--
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: bbdb-popup-target-window-size (Re: BBDB 3.x documentation)

2011-02-04 Thread Stefan Monnier
 Well, my recent discovery was that the variable name change
 bbdb-popup-target-lines - bbdb-popup-window-size in BBDB 3.x. They seem
 to do the same thing (i.e. setting the target number of lines for the
 bbdb-popup window). The default value was 5 but is now 0.5.

 You are right. I guess the change of the default happened when I
 added the code to use not only absolute line numbers but fractions
 of the window hight.  In general, my personal preference is to use
 the latter. I'll be happy to go back to the old default if that's
 what people prefer.

You can accept both, depending on whether the setting is an integer or
a float.


Stefan


--
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: BBDB ELPA-style packaging

2011-01-20 Thread Stefan Monnier
 I'd be OK with providing BBDB3 in a beta form through
 elpa.gnu.org. As long as the version string states it clearly,
 which it will. You are likely to get plenty of feedback.
 Feedback is always appreciated!

Talking about feedback: is there some warning/discussion about the
change of format somewhere?  I'm very happy with your BBDB3 overall, but
the change of format is rather inconvenient (I share my bbdb file among
several machines and would prefer to not have to upgrade them all at the
same time).

 A rewrite is the worst case, where you can't find the original
 contributor or they are not willing to assign the copyright to the FSF.
 Some pieces of BBDB in their original form are rather old.
 So I exepct that tracking down the original contributor can be
 more difficult.

AFAICT the main problem will be that Jamie is known for refusing to sign
any copyright assignment for the FSF, and he's the original author, so
any code of his that survived will need a rewrite.

 My main question is the legal meaning of rewrite. (Almost all code
 has been rewritten in one or the other way.)

If the similarity is due to the API (e.g. compatibility with user's
custom settings will force you to share variable names), I think that
such similarity is OK, but otherwise, the code should look sufficiently
different that the original author can't say look they took my code.

 By the way, I already passed on the copyright to FSF for my
 general contributions to GNU Emacs.  Is this enough here?
 I'll be happy to do this once more.

For your own code, AFAIK your general assignment can be sufficient under
the condition that you send an email to ass...@gnu.org telling them that
you consider this code to be covered by your assignment (this is because
bbdb is not part of Emacs).

 That's wonderful.  
 Yes and no  :-)

Hopefully your BBDB revival (and inclusion in the FSF's ELPA) will bring
new blood.  E.g. I've bumped into a few issues in the past but, for lack of
a place where to report them, I never bothered to send a patch.


Stefan


--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: whenever I expand a bbdb name at To:, trailing whitespace gets added when using the latest emacs

2011-01-20 Thread Stefan Monnier
 Whenever I expand a bbdb name at To:, trailing whitespace gets added
 when using the latest emacs.

It's probably the result of a change I made in message.el's completion
code.  I've seen a few other reports about it, but I can't reproduce it.
Could you give me more details: which version of BBDB are you running,
and which specific keys do you hit (and where) in order to cause
the expansion?


Stefan


--
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


(error Attempt to split minibuffer window)

2011-01-14 Thread Stefan Monnier
When I invoke M-x bbdb from my minibuffer-only frame, BBDB burps with
the above error.  The Elisp backtrace is:

  split-window(#window 8 on  *Minibuf-0* 0)
  bbdb-pop-up-buffer(t nil)
  bbdb-display-records-internal((...) multi-line nil t nil)
  bbdb-display-records((...) multi-line nil t)
  bbdb( multi-line)
  call-interactively(bbdb t nil)
  execute-extended-command(nil)
  call-interactively(execute-extended-command nil nil)

This is with the CVS code from nongnu.org.


Stefan


PS: BTW, I suggest the patch below to let users initialize BBDB in their
.emacs with a single `load' (i.e. without messing with load-path
themselves):

--- Makefile.~1.2.~ 2010-12-15 01:24:53.0 -0500
+++ Makefile2011-01-14 21:06:59.0 -0500
@@ -88,6 +88,7 @@
 bbdb-autoloads.el: $(DEPSRCS)
@-$(RM) $@;
@echo (provide 'bbdb-autoloads)  $@;
+   @echo (add-to-list 'load-path (or (file-name-directory load-file-name) 
(car load-path)))\n\n  $@;
@echo   $@;
@$(emacs) -batch -l autoload \
--eval '(setq generated-autoload-file '`pwd`'/$@)' \


--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Minor bug fixes

2003-09-29 Thread Stefan Monnier

The patch below (against the head of the sf.net CVS trunk) fixes
a namespace-pollution bug (`digit' should have been `bbdb-digit'
at least, although the patch fixes it in a different way) and a bug
in the migration query which appears if your `display-buffer' chooses
to display the query in a separate (typically dedicated) frame.
The patch also fixes the docstring to follow the convention that
the first line should be a complete sentence.


Stefan


cvs server: Diffing lisp
Index: lisp/bbdb-migrate.el
===
RCS file: /cvsroot/bbdb/bbdb/lisp/bbdb-migrate.el,v
retrieving revision 1.19
diff -u -r1.19 bbdb-migrate.el
--- lisp/bbdb-migrate.el19 Aug 2002 22:49:12 -  1.19
+++ lisp/bbdb-migrate.el26 Sep 2003 20:36:58 -
@@ -101,9 +101,9 @@
 
 ;;;###autoload
 (defun bbdb-migration-query (ondisk)
-  Ask if the database is to be migrated.  ONDISK is the version
-number of the database as currently stored on disk.  Returns the
-version for the saved database.
+  Ask if the database is to be migrated.
+ONDISK is the version number of the database as currently stored on disk.
+Returns the version for the saved database.
   (save-excursion
 (let ((wc (current-window-configuration))
   (buf (get-buffer-create *BBDB Migration Info*))
@@ -135,7 +135,11 @@
 (y-or-n-p (concat Upgrade BBDB to version 
   (format %d bbdb-file-format)
   ? )))
-  (delete-window win)
+  (condition-case nil
+ (delete-window win)
+   ;; The window might be the only one on its frame.  Hopefully, it's
+   ;; a dedicated window and the kill-buffer below will DTRT.
+   (error nil))
   (kill-buffer buf)
   (set-window-configuration wc)
   (if update bbdb-file-format ondisk
Index: lisp/bbdb-snarf.el
===
RCS file: /cvsroot/bbdb/bbdb/lisp/bbdb-snarf.el,v
retrieving revision 1.38
diff -u -r1.38 bbdb-snarf.el
--- lisp/bbdb-snarf.el  7 Mar 2003 22:12:41 -   1.38
+++ lisp/bbdb-snarf.el  26 Sep 2003 20:36:58 -
@@ -37,7 +37,6 @@
 (require 'rfc822)
 (require 'mail-extr)
 
-(defconst digit [0-9])
 (defvar bbdb-snarf-phone-regexp
   (concat
\\(([2-9][0-9][0-9])[-. ]?\\|[2-9][0-9][0-9][-. ]\\)?
@@ -46,11 +45,12 @@
)
   regexp to match phones.)
 (defvar bbdb-snarf-zip-regexp
-  (concat
-   \\
-   digit digit digit digit digit
-   \\(- digit digit digit digit \\)?
-   \\$)
+  (let ((digit [0-9]))
+(concat
+ \\
+ digit digit digit digit digit
+ \\(- digit digit digit digit \\)?
+ \\$))
   regexp matching zip.)
 
 (defcustom bbdb-snarf-web-prop 'www


---
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
___
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/