Re: Change name "Söme Näme" to "Söme Näme"?

2007-11-28 Thread Reiner Steib
On Mon, Nov 26 2007, Robert Widhopf-Fenk wrote:

> On Monday, November 26, 2007 at 22:33:40, Reiner Steib wrote:
>> Wouldn't it be better to encode the strings in UTF-8 and compare
>> thereafter?  (encode-coding-string name 'utf-8)?
>
> Thanks this was exactly the hint I was looking for ;-)

Disclaimer: 100% untested.

>> > +(defun bbdb-name-normalize (n)
>> > +  "Normalizes a name, i.e. downcase and unibyte converion."
>> > +  (when n 
>> > +(setq n (downcase n))
>> > +(if (functionp 'string-make-unibyte)
>> > +  (funcall 'string-make-unibyte n)
>> > +  n)))
>> 
>> Using `name' instead of `name' would be more readable, IMHO.
>
> You mean in the doc string?

Sorry, I meant...  "Using `name' instead of `n'".

Bye, Reiner.
-- 
   ,,,
  (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: Change name "Söme Näme" to "Söme Näme"?

2007-11-28 Thread Reiner Steib
On Fri, Nov 23 2007, Tassilo Horn wrote:

> From: =?ISO-8859-15?Q?J=FCrgen_Ebert?= <[EMAIL PROTECTED]>
> From: =?ISO-8859-1?Q?J=FCrgen_Ebert?= <[EMAIL PROTECTED]>

`unify-8859-on-decoding-mode' might solve this problem.

Bye, Reiner.
-- 
   ,,,
  (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: Change name "Söme Näme" to "Söme Näme"?

2007-11-28 Thread Reiner Steib
On Sun, Nov 25 2007, Robert Widhopf-Fenk wrote:

> attached is a patch which fixes it for me in GNU Emacs 22,
> but it is not perfect as it possibly fails for names which
> cannot be converted to unibyte ...

Wouldn't it be better to encode the strings in UTF-8 and compare
thereafter?  (encode-coding-string name 'utf-8)?

> +(defun bbdb-name-normalize (n)
> +  "Normalizes a name, i.e. downcase and unibyte converion."
> +  (when n 
> +(setq n (downcase n))
> +(if (functionp 'string-make-unibyte)
> + (funcall 'string-make-unibyte n)
> +  n)))

Using `name' instead of `name' would be more readable, IMHO.

Bye, Reiner.
-- 
   ,,,
  (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

-
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
___
bbdb-info@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bbdb-info
BBDB Home Page: http://bbdb.sourceforge.net/


Re: Change name "Söme Näme" to "Söme Näme"?

2007-11-27 Thread Tassilo Horn
Robert Widhopf-Fenk <[EMAIL PROTECTED]> writes:

Hi Robert,

>> > +(defun bbdb-name-normalize (n)
>> > +  "Normalizes a name, i.e. downcase and unibyte converion."
>> > +  (when n 
>> > +(setq n (downcase n))
>> > +(if (functionp 'string-make-unibyte)
>> > +  (funcall 'string-make-unibyte n)
>> > +  n)))
>> 
>> Using `name' instead of `name' would be more readable, IMHO.
>
> You mean in the doc string?

I think he means renaming the argument `n' to `name' and the doc string
would be "Normalize the given NAME." then.

Bye,
Tassilo
-- 
You know how they say if you die in your dream then you will die in real
life? In  actuality, if you dream  of death then Chuck  Norris will find
you and kill you.

-
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: Change name "Söme Näme" to "Söme Näme"?

2007-11-26 Thread Robert Widhopf-Fenk
On Monday, November 26, 2007 at 22:36:47, Reiner Steib wrote:
> On Fri, Nov 23 2007, Tassilo Horn wrote:
> 
> > From: Jürgen Ebert <[EMAIL PROTECTED]>
> > From: Jürgen Ebert <[EMAIL PROTECTED]>
> 
> `unify-8859-on-decoding-mode' might solve this problem.

Within the same buffer, but IMHO not in the way how BBDB needs
it, but the doc string of `unify-8859-on-decoding-mode' says:

  The `utf-8' coding system treats the characters of
  European scripts in a unified manner.

So your first tip was just right and works. 

This is now in CVS.

Cheers Robert

-
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: Change name "Söme Näme" to "Söme Näme"?

2007-11-26 Thread Robert Widhopf-Fenk
On Monday, November 26, 2007 at 22:33:40, Reiner Steib wrote:
> On Sun, Nov 25 2007, Robert Widhopf-Fenk wrote:
> 
> > attached is a patch which fixes it for me in GNU Emacs 22,
> > but it is not perfect as it possibly fails for names which
> > cannot be converted to unibyte ...
> 
> Wouldn't it be better to encode the strings in UTF-8 and compare
> thereafter?  (encode-coding-string name 'utf-8)?

Thanks this was exactly the hint I was looking for ;-)

> > +(defun bbdb-name-normalize (n)
> > +  "Normalizes a name, i.e. downcase and unibyte converion."
> > +  (when n 
> > +(setq n (downcase n))
> > +(if (functionp 'string-make-unibyte)
> > +   (funcall 'string-make-unibyte n)
> > +  n)))
> 
> Using `name' instead of `name' would be more readable, IMHO.

You mean in the doc string?

Cheers Robert

-
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: Change name "Söme Näme" to "Söme Näme"?

2007-11-26 Thread Tassilo Horn
Robert Widhopf-Fenk <[EMAIL PROTECTED]> writes:

Hi Robert,

> attached is a patch which fixes it for me in GNU Emacs 22, but it is
> not perfect as it possibly fails for names which cannot be converted
> to unibyte ...
>
> Anyway, please test it.

It seems to work for me, too.

> +(defun bbdb-name-normalize (n)
> +  "Normalizes a name, i.e. downcase and unibyte converion."
^^

Here's a "s" missing.

Thanks for the fix,
Tassilo

-
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: Change name "Söme Näme" to "Söme Näme"?

2007-11-25 Thread Robert Widhopf-Fenk
Hi Tassilo,

attached is a patch which fixes it for me in GNU Emacs 22,
but it is not perfect as it possibly fails for names which
cannot be converted to unibyte ...

Anyway, please test it.

Bye Robert

=== modified file 'lisp/bbdb.el'
--- lisp/bbdb.el2007-11-08 20:36:49 +
+++ lisp/bbdb.el2007-11-25 22:52:47 +
@@ -3223,6 +3223,18 @@
   (setq old-nets (cdr old-nets)))
 redundant-addr))
 
+(defun bbdb-name-normalize (n)
+  "Normalizes a name, i.e. downcase and unibyte converion."
+  (when n 
+(setq n (downcase n))
+(if (functionp 'string-make-unibyte)
+   (funcall 'string-make-unibyte n)
+  n)))
+
+(defun bbdb-name= (a b)
+  "Return t if two names are equal after normalizing them."
+  (string= (bbdb-name-normalize a) (bbdb-name-normalize b)))
+
 
 (defun bbdb-annotate-message-sender (from &optional loudly create-p
   prompt-to-create-p)
@@ -3264,14 +3276,12 @@
   ;; corresponding to a person who has a real-name which is the same
   ;; as the network-address of someone in the db already.  This is not
   ;; a good solution.
-  (let (down-name old-net)
-(if (and record name
- (not (equal (setq down-name (downcase name))
- (and old-name (downcase old-name)
+  (let (old-net)
+(if (and record name (not (bbdb-name= name old-name)))
 (progn
   (setq old-net (bbdb-record-net record))
   (while old-net
-(if (equal down-name (downcase (car old-net)))
+(if (bbdb-name= name (car old-net))
 (progn
   (setq bogon-mode t
 old-net nil)
@@ -3312,8 +3322,7 @@
 (bbdb-debug (if (bbdb-record-deleted-p record)
 (error "nasty nasty deleted record nasty.")))
 (if (and name
- (not (equal (and name (downcase name))
- (and old-name (downcase old-name
+ (not (bbdb-name= name old-name))
  (or (null bbdb-use-alternate-names)
  (not (bbdb-check-alternate-name name record)))
  (let ((fullname (bbdb-divide-name name))

-
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: Change name "Söme Näme" to "Söme Näme"?

2007-11-23 Thread Tassilo Horn
Robert Widhopf-Fenk <[EMAIL PROTECTED]> writes:

Hi Robert,

> Please mail the From header of two of these messages.  It is much
> easier to debug this by example?

From: =?ISO-8859-15?Q?J=FCrgen_Ebert?= <[EMAIL PROTECTED]>
From: =?ISO-8859-1?Q?J=FCrgen_Ebert?= <[EMAIL PROTECTED]>

The strange thing is that when I opened the message with the first From
I wasn't asked a question.  When I opened the message with the second
>From I was asked to change the name and replied with yes.  So I would
expect that it would ask me again if I open the former message, but it
doesn't.

> You are using a mime enabled Emacs, aren't you?

Yes, M-x emacs-version says:

GNU Emacs 23.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.12.1) of
2007-11-23 on baldur

Bye,
Tassilo

-
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: Change name "Söme Näme" to "Söme Näme"?

2007-11-22 Thread Robert Widhopf-Fenk
On Wednesday, November 21, 2007 at 14:40:29, Tassilo Horn wrote:
> Hi all,
> 
> I read several newsgroups from my university where people whose name
> contains umlauts and that are in my bbdb post with different
> newsreaders.  When I read such a posting bbdb asks me if I want to
> change the name like the example I have in my subject.
> 
> The problem is that one newsreader they use encodes the umlauts with
> latin-1 and the other encodes them with latin-15.  (At least that's
> what describe-char on the characters that are not `eql' in both
> strings says.)
> 
> Is there a way to stop bbdb asking those questions?  Maybe by
> converting the strings to some other encoding system like utf-8
> before the comparison?

Please mail the From header of two of these messages.  It is
much easier to debug this by example?

In Gnus please select the raw article buffer by "C-u g" and
extract the From headers there.  You may spoof the email
addresses or names if you want.

You are using a mime enabled Emacs, aren't you?

Robert

-
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/