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

2017-07-12 Thread Roland Winkler
On Tue Jul 11 2017 Vincent Belaïche wrote:
> 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).

I believe the purpose of cl-progv is to provide a let binding where
the var list is determined at run time.  This is achieved by
`eval'ing the let form.  Yet to deal with lexical bindings, `eval'
needs to know the lexical environment (as a 2nd arg for eval) that
cl-progv does not provide.

Barak's patch has done exactly that and I also used the same
approach in bbdb-tex.el.

--
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-print.el lexical binding breaks bbdb-print-record

2017-07-11 Thread Vincent Belaïche
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 <vincent@hotmail.fr>
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 <vincent@hotmail.fr>
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 ( 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___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/

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

2017-06-30 Thread Vincent Belaïche
Hello Bob,

I did not have any problem with the Bbdb Print Tex Path. Certainly because on 
my machine it was already customized with the usual customization interface 
(M-x cutomize-variable...) to an existing path.

Problably, if not, bbdb-print.el should be robust to that and test if the 
directory exists to provide a suitable error message.

  V.


De : Bob Newell <bobnew...@bobnewell.net>
Envoyé : vendredi 30 juin 2017 06:51:40
À : BBDB info list
Objet : Re: bbdb-print.el lexical binding breaks bbdb-print-record

I also ran into this a while ago. I did a kludge fix in my initialization:

(setq bbdb-print-require t)

but of course this makes even blank records print, so it is not
exactly recommended for anything other than a quick and sloppy
workaround.

By the way I also had to do this as I was having a problem with the
tex-path being undefined:

(setq bbdb-print-tex-path '("/home/bnewell/.emacs.d/elpa/"))

and, in addition, the melpa package didn't seem to have the .tex files
so I had to fetch the git distribution and copy them over.

--
Bob Newell
Honolulu, Hawai`i

Sent via Linux Mint 17.

--
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/
--
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-print.el lexical binding breaks bbdb-print-record

2017-06-29 Thread Bob Newell
I also ran into this a while ago. I did a kludge fix in my initialization:

(setq bbdb-print-require t)

but of course this makes even blank records print, so it is not
exactly recommended for anything other than a quick and sloppy
workaround.

By the way I also had to do this as I was having a problem with the
tex-path being undefined:

(setq bbdb-print-tex-path '("/home/bnewell/.emacs.d/elpa/"))

and, in addition, the melpa package didn't seem to have the .tex files
so I had to fetch the git distribution and copy them over.

-- 
Bob Newell
Honolulu, Hawai`i

Sent via Linux Mint 17.

--
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-print.el lexical binding breaks bbdb-print-record

2017-06-29 Thread Vincent Belaïche

I can't find this suggest-v3.x branch which you refer to here:

https://github.com/barak/BBDB/branches/all

  V.


De : Barak A. Pearlmutter <ba...@pearlmutter.net>
Envoyé : jeudi 29 juin 2017 15:16
À : Roland Winkler
Cc : Vincent Belaïche; BBDB info list
Objet : Re: bbdb-print.el lexical binding breaks bbdb-print-record
    
I've also made a fix for this, see github.com/barak/bbdb3 commit
7469e6e which is the tip of branch suggest-v3.x

It uses a slightly different mechanism to accomplish similar ends.

--
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-print.el lexical binding breaks bbdb-print-record

2017-06-29 Thread Vincent Belaïche
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 
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 ( 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.


bug-1.diff
Description: bug-1.diff
--
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/