RE: bbdb-print.el lexical binding breaks bbdb-print-record

Vincent Belaïche <[email protected]>
Newsgroups gmane.emacs.bbdb.user
Message-ID <AM5PR10MB0676F86B50B2CDB5DA4E593C84AE0@AM5PR10MB0676.EURPRD10.PROD.OUTLOOK.COM>
Hello,


Just to mention that the code based on cl-progv which I have supplied does not work. I don't have any time to investigate why, so if you want to take my patch, please take the 1st one (that based on lambda).


  Vincent.


________________________________
De : Vincent Belaïche <[email protected]>
Envoyé : jeudi 29 juin 2017 15:05
À : Roland Winkler; BBDB info list
Objet : RE: bbdb-print.el lexical binding breaks bbdb-print-record


Ooops... there was some mistake in the code based on cl-progv which I supplied. Just to be 100% clear about this alternative solution, it would be as in the attached patch bug-1.diff.


   V.

________________________________
De : Vincent Belaïche <[email protected]>
Envoyé : jeudi 29 juin 2017 13:24:53
À : Roland Winkler; BBDB info list
Objet : bbdb-print.el lexical binding breaks bbdb-print-record

Hello Roland,

With lexical binding bbdb-print-record makes a void variable error on address variable.

Attached is a fix. I use a lambda expression to make the binding dynmical so that bbdb-print-require can be evalled in the correct context. An alternative fix would have been to use :

(cl-progv '(first-letter name organization mail phone address xfields) (list first-letter name organization mail phone address xfields)).

Well, to avoid any duplication in this case, it would be better to use some macro like this:

(defmacro bbdb-do-cl-progv (&rest l)
   `(cl-progv (quote ,l) (list ,@l)))

and then in bdbd-print-record:

(bbdb-do-cl-progv first-letter name organization mail phone address xfields)(list first-letter name organization mail phone address xfields)

Anyway, I prefer the lambda trick, I don't like cl-progv and eval. Probably lambdas are more portable to old Emacs versions.

  Vincent.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
[email protected]
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.