Re: [AUCTeX] AUCTeX support in lettre

2015-12-02 Thread Mosè Giordano
Hi Vincent,

2015-12-01 0:30 GMT+01:00 Vincent Belaïche :
> This would be easilly analysed with some expression like
>
> (with-temp-buffer
> (insert "" formatter-string "")
> (xml-parse-region (point-min) (point-max)))

I'm interested in this: `xml-parse-region' requires Emacs to be
compiled with libxml2 in order to work.  Do you think it's common?  I
use Emacs provided by Debian and it works, but I don't know which is
the situation for other distros or the standard binaries for other
operating systems.

Bye,
Mosè

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] AUCTeX support in lettre

2015-11-30 Thread Vincent Belaïche

FYI, I will not do this work soon...

Now, concerning Eric's question about auto-completion, I do not intend to
reinvent the wheel. I will reuse whatever autocompletion mechanism is
provided by BBDB of with which BBDB has some already existing
connection. Well, my intention is plainly to use something like

(bbdb-completing-read-record "Recipient: ")

The technical problems which I forsee are the following:

- address presentation depends on recipient's country, so the question is
  how to configure that.

- Presence of country name in address depends on whether the sender and
  recipient are in the same country, and its presentation depends on the
  sender's country, for instance if you send a letter to Spain from
  France you would write Espagne, if you send it from Mexico you would
  write España, and if you send it from England you would write Spain.

- A same name can have several postal addresses, when there are several
  of them:
  - how to rank them / identify them
  - how to browse through them

My current thinking is that there will be some defcustom alist with some
mapping between county name regexp (e.g. "\\`U\.?S\.?A\.?\\'") and some
country symbol (e.g. 'usa), and then some other alist with some mapping
between country symbol and
1) some address formatter.
2) some alist for translating recipient's country symbol to country name 
depending
   on sender's country symbol

The address formatter maybe a function or a string.

If formatter is a function then it would take as argument:

1) the recipient name
2) the recipient address streetline list, and
3) optionnally the translated recipient's country name (omission meaning
  do not insert.

For instance a standard formatter function could be:

(lambda (name streetlines  country)
  (insert "\\textsc{" name "}\n")
  (dolist (streetline streetlines)
 (insert streetline "\n"))
  (if country (insert country)
    (delet-region  (- (point) 3) (point

This function would be evalled in the letter buffer at point of
insertion of the address, and would do the string insertion by itself.

If formatter is a string it would contain markup for each of the address
field, plus some markup of what is conditional on field presence.  The
markup would be substituted with each field assigned the content of the
recipient address record, where country would be forced to nil in case
not to be inserted. For instance the string could use some XML-like
syntax as follows:

\textsc{}\\
\\
\\

This would be easilly analysed with some expression like

(with-temp-buffer
    (insert "" formatter-string "")
    (xml-parse-region (point-min) (point-max)))

VBR,
    Vincent




> To: bbdb-i...@lists.sourceforge.net
> From: e...@ericabrahamsen.net
> Subject: Re: [AUCTeX] AUCTeX support in lettre
> Date: Sun, 15 Nov 2015 16:37:14 +0800
>
> Vincent Belaïche <vincent@hotmail.fr> writes:
>
>> Hello Mosè,
>>
>> BBDB is some sort of phone book (well, it means insidious Big-Bother
>> Data Base). My intention is to have functions to read the to-address with
>> auto-completion by getting the data from BBDB by means of name or
>> organisation.
>
> Are you intending to provide support for some/all of the existing
> auto-completion packages (ac, helm, company, etc), or home-roll
> something of your own?
>
> Just curious, as I'm still fooling around with BBDB and completion. I
> use helm, and recently replaced auto-complete with company-mode, which I
> generally like better. But helm-bbdb is unmaintained (I asked, and was
> told I could have it!) and while company-mode completes fine on the To
> header in message-mode, it seems to have somehow broken cycling on the
> From header.
>
> Anyhow... this is a bit off-topic, so I won't follow up to the auctex
> list.
>
> E
>
>> It is not that simple because the way you present the address in a
>> postal sending may need some formatting dependent on the country, so
>> probably a defcustom is needed to make this more open. There may also be
>> some dependance on the LaTeX extension (koma-script, letter or lettre),
>> I have not investigated kom-script yet, but letter and lettre are quite
>> similar.
>>
>> The same recipient name may also be associated with several snail mail
>> address, so there also needs to be some selection mechanism for this
>> case.
>>
>> Concerning the place where to put the Elisp code, well I don't know
>> where the best place is, probably some new tex-bbdb.el would be a good
>> alternative.
>>
>> VBR,
>> Vincent Belaïche
>>
>> PS: CC to BBDB list.
>> 
>>> From: m...@gnu.org
>>> Date: Fri, 13 Nov 2015 1

Re: [AUCTeX] AUCTeX support in lettre

2015-11-16 Thread Roland Winkler
On Sat Nov 14 2015 Vincent Belaïche wrote:
> BBDB is some sort of phone book (well, it means insidious Big-Bother 
> Data Base). My intention is to have functions to read the to-address with
> auto-completion by getting the data from BBDB by means of name or
> organisation.
> 
> It is not that simple because the way you present the address in a
> postal sending may need some formatting dependent on the country,
> so probably a defcustom is needed to make this more open.

In BBDB 3 the formatting of addresses is quite customizable via the
user variable bbdb-address-format-list.

You might know that BBDB also comes with an interface for printing
complete BBDB records via TeX (not LaTeX), see the file bbdb-print.el.
For addresses, this uses bbdb-print-address-format-list, which
defaults to bbdb-address-format-list.  Printing complete BBDB
records is probably not what you want.  However, you might want to
use a scheme similar to what bbdb-print does in order to feed BBDB
addresses into your (La)TeX files.

Roland

PS: The main code in bbdb-print.el is very old.  It's on my to-do
list to update this code to have a better interface with LaTeX.
However, I have not yet found the time to do that.  Yet printing of
addresses will most likely continue to use bbdb-address-format-list.


___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] AUCTeX support in lettre

2015-11-14 Thread Mosè Giordano
Hi Vincent,

2015-11-14 16:57 GMT+01:00 Vincent Belaïche :
>
> Hello Mosè,
>
> BBDB is some sort of phone book (well, it means insidious Big-Bother
> Data Base). My intention is to have functions to read the to-address with
> auto-completion by getting the data from BBDB by means of name or
> organisation.

Thank you, looks good!

> It is not that simple because the way you present the address in a
> postal sending may need some formatting dependent on the country, so
> probably a defcustom is needed to make this more open.

Yes, makes sense, somewhat like language-specific babel features (see
(info "(auctex)European")
https://gnu.org/software/auctex/manual/auctex.html#Style-Files-for-Different-Languages).

> There may also be
> some dependance on the LaTeX extension (koma-script, letter or lettre),
> I have not investigated kom-script yet, but letter and lettre are quite
> similar.
>
> The same recipient name may also be associated with several snail mail
> address, so there also needs to be some selection mechanism for this
> case.
>
> Concerning the place where to put the Elisp code, well I don't know
> where the best place is, probably some new tex-bbdb.el would be a good
> alternative.

Yes, I was thinking to a fake style file ("fake" in the sense that
doesn't correspond to real LaTeX style file), that is loaded by
letter.el, lettre.el, etc.  This may be a bit hackish, but avoid
filling tex.el or latex.el with non-generic functions.

Cheers,
Mosè

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] AUCTeX support in lettre

2015-11-14 Thread Vincent Belaïche

Hello Mosè,

BBDB is some sort of phone book (well, it means insidious Big-Bother 
Data Base). My intention is to have functions to read the to-address with
auto-completion by getting the data from BBDB by means of name or
organisation.

It is not that simple because the way you present the address in a
postal sending may need some formatting dependent on the country, so
probably a defcustom is needed to make this more open. There may also be
some dependance on the LaTeX extension (koma-script, letter or lettre),
I have not investigated kom-script yet, but letter and lettre are quite
similar.

The same recipient name may also be associated with several snail mail
address, so there also needs to be some selection mechanism for this
case.

Concerning the place where to put the Elisp code, well I don't know
where the best place is, probably some new tex-bbdb.el would be a good
alternative.

VBR,
Vincent Belaïche

PS: CC to BBDB list.

> From: m...@gnu.org
> Date: Fri, 13 Nov 2015 12:23:13 +0100
> Subject: Re: [AUCTeX] AUCTeX support in lettre
> To: vincent@hotmail.fr
> CC: auctex@gnu.org
>
> Hi Vincent,
>
> 2015-11-12 23:23 GMT+01:00 Vincent Belaïche <vincent@hotmail.fr>:
>> Dear AUCTeX experts,
>>
>> For your information I intend to add AUCTeX support to package lettre of 
>> which I am the maintainer.
>>
>> Here is a preliminary verison, comments/brickbats welcome...
>>
>> http://svn.gna.org/viewcvs/lettre_observatoire/trunk/source/latex/lettre/lettre.el?revision=177=markup
>
> Just a comment: please use `TeX-read-string' instead of `read-string' ;-)
>
>> My intention is to add BBDB support, I have seen that this is also in the 
>> TODO list of AUCTeX for class letter. I think that it would be a good idea 
>> if some code could be commonalized for all letter supporting classes (the 
>> three main ones, AFAIK, are letter, lettre, and koma-script).
>
> I don't know what BBDB actually does, could you please briefly explain
> which features provides and how do you plan to integrate with your
> package?
>
>> Any idea how to do that ? Any suggestion where to start ?
>
> Do you mean how to commonalize the functions used in those style
> files? If so, indeed we don't have a real place where to put
> functions that should be used only in style files, they simply go in
> tex.el or latex.el, where appropriate. tex-style.el has been used so
> far only for variables (as stated also in the header).
>
> Bye,
> Mosè
  
___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


Re: [AUCTeX] AUCTeX support in lettre

2015-11-13 Thread Mosè Giordano
Hi Vincent,

2015-11-12 23:23 GMT+01:00 Vincent Belaïche <vincent@hotmail.fr>:
> Dear AUCTeX experts,
>
> For your information I intend to add AUCTeX support to package lettre of 
> which I am the maintainer.
>
> Here is a preliminary verison, comments/brickbats welcome...
>
> http://svn.gna.org/viewcvs/lettre_observatoire/trunk/source/latex/lettre/lettre.el?revision=177=markup

Just a comment: please use `TeX-read-string' instead of `read-string' ;-)

> My intention is to add BBDB support, I have seen that this is also in the 
> TODO list of AUCTeX for class letter. I think that it would be a good idea if 
> some code could be commonalized for all letter supporting classes (the three 
> main ones, AFAIK, are letter, lettre, and koma-script).

I don't know what BBDB actually does, could you please briefly explain
which features provides and how do you plan to integrate with your
package?

> Any idea how to do that ? Any suggestion where to start ?

Do you mean how to commonalize the functions used in those style
files?  If so, indeed we don't have a real place where to put
functions that should be used only in style files, they simply go in
tex.el or latex.el, where appropriate.  tex-style.el has been used so
far only for variables (as stated also in the header).

Bye,
Mosè

___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex


[AUCTeX] AUCTeX support in lettre

2015-11-12 Thread Vincent Belaïche
Dear AUCTeX experts,

For your information I intend to add AUCTeX support to package lettre of which 
I am the maintainer.

Here is a preliminary verison, comments/brickbats welcome...

http://svn.gna.org/viewcvs/lettre_observatoire/trunk/source/latex/lettre/lettre.el?revision=177=markup

My intention is to add BBDB support, I have seen that this is also in the TODO 
list of AUCTeX for class letter. I think that it would be a good idea if some 
code could be commonalized for all letter supporting classes (the three main 
ones, AFAIK, are letter, lettre, and koma-script). Any idea how to do that ? 
Any suggestion where to start ?

   Vincent.


  
___
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex