unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* smiley regexp problem
@ 2005-03-17 11:55 Rajsekar
  2005-03-20 21:23 ` Rajsekar
  0 siblings, 1 reply; 9+ messages in thread
From: Rajsekar @ 2005-03-17 11:55 UTC (permalink / raw)



I want to setup the smileys similar to gaim.
So I put 

        "\\(:)\\)\\W" for smile.
and
        "\\(:))\\)\\W" for laugh.

The problem is that :)) also contains a :).  At the same time, i do not
want to replace \W with something like [^)] because i lose the advantage of
\W (which works based on the current syntax).  I want something like \\W
minus the character `('.  Can someone tell me how to achieve this?


-- 
    Rajsekar Manokaran
    IIT Madras

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: smiley regexp problem
  2005-03-17 11:55 smiley regexp problem Rajsekar
@ 2005-03-20 21:23 ` Rajsekar
  2005-03-20 21:48   ` David Kastrup
  0 siblings, 1 reply; 9+ messages in thread
From: Rajsekar @ 2005-03-20 21:23 UTC (permalink / raw)


Rajsekar <rajsekar@cse.iitm.ernet.in> writes:

> I want to setup the smileys similar to gaim.
> So I put 
>
>         "\\(:)\\)\\W" for smile.
> and
>         "\\(:))\\)\\W" for laugh.
>
> The problem is that :)) also contains a :).  At the same time, i do not
> want to replace \W with something like [^)] because i lose the advantage of
> \W (which works based on the current syntax).  I want something like \\W
> minus the character `('.  Can someone tell me how to achieve this?

I see from theory that the needed language is still a regexp, yet i am not
able to express it in the language of regexp.  Is it a shortcoming in the language?

-- 
    Rajsekar Manokaran
    IIT Madras

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: smiley regexp problem
  2005-03-20 21:23 ` Rajsekar
@ 2005-03-20 21:48   ` David Kastrup
  2005-03-21  8:06     ` Rajsekar
  0 siblings, 1 reply; 9+ messages in thread
From: David Kastrup @ 2005-03-20 21:48 UTC (permalink / raw)
  Cc: emacs-devel

Rajsekar <rajsekar@cse.iitm.ernet.in> writes:

> Rajsekar <rajsekar@cse.iitm.ernet.in> writes:
>
>> I want to setup the smileys similar to gaim.
>> So I put 
>>
>>         "\\(:)\\)\\W" for smile.
>> and
>>         "\\(:))\\)\\W" for laugh.
>>
>> The problem is that :)) also contains a :).  At the same time, i do not
>> want to replace \W with something like [^)] because i lose the advantage of
>> \W (which works based on the current syntax).  I want something like \\W
>> minus the character `('.  Can someone tell me how to achieve this?
>
> I see from theory that the needed language is still a regexp, yet i
> am not able to express it in the language of regexp.  Is it a
> shortcoming in the language?

Why don't you match "laugh" first, and only look for a smile if no
laugh is can be found?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: smiley regexp problem
  2005-03-20 21:48   ` David Kastrup
@ 2005-03-21  8:06     ` Rajsekar
  0 siblings, 0 replies; 9+ messages in thread
From: Rajsekar @ 2005-03-21  8:06 UTC (permalink / raw)
  Cc: emacs-devel

David Kastrup <dak@gnu.org> writes:

> Rajsekar <rajsekar@cse.iitm.ernet.in> writes:
>
>> Rajsekar <rajsekar@cse.iitm.ernet.in> writes:
>>
>>> I want to setup the smileys similar to gaim.
>>> So I put 
>>>
>>>         "\\(:)\\)\\W" for smile.
>>> and
>>>         "\\(:))\\)\\W" for laugh.
>>>
>>> The problem is that :)) also contains a :).  At the same time, i do not
>>> want to replace \W with something like [^)] because i lose the advantage of
>>> \W (which works based on the current syntax).  I want something like \\W
>>> minus the character `('.  Can someone tell me how to achieve this?
>>
>> I see from theory that the needed language is still a regexp, yet i
>> am not able to express it in the language of regexp.  Is it a
>> shortcoming in the language?
>
> Why don't you match "laugh" first, and only look for a smile if no
> laugh is can be found?

The code to add the smiley (gnus/smiley.el) does not allow me to do that.
If I have `:))', both, smile and laugh pictures get inserted.

-- 
    Rajsekar Manokaran
    IIT Madras

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: smiley regexp problem
@ 2005-03-21 10:47 LENNART BORGMAN
  2005-03-21 12:12 ` Rajsekar
  0 siblings, 1 reply; 9+ messages in thread
From: LENNART BORGMAN @ 2005-03-21 10:47 UTC (permalink / raw)
  Cc: emacs-devel

> >>> I want to setup the smileys similar to gaim.
> >>> So I put 
> >>>
> >>>         "\\(:)\\)\\W" for smile.
> >>> and
> >>>         "\\(:))\\)\\W" for laugh.
> >>>
> >>> The problem is that :)) also contains a :).  At the same time, 
...
> > Why don't you match "laugh" first, and only look for a smile if no
> > laugh is can be found?
> 
> The code to add the smiley (gnus/smiley.el) does not allow me to 
> do that.
> If I have `:))', both, smile and laugh pictures get inserted.

Maybe you could add a complemented character set to the first one after the smile (with whatever slashes there are needed to get this to work): [^)] 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: smiley regexp problem
  2005-03-21 10:47 LENNART BORGMAN
@ 2005-03-21 12:12 ` Rajsekar
  2005-03-21 13:22   ` Lennart Borgman
  2005-03-21 13:49   ` Stefan Monnier
  0 siblings, 2 replies; 9+ messages in thread
From: Rajsekar @ 2005-03-21 12:12 UTC (permalink / raw)
  Cc: emacs-devel

LENNART BORGMAN <lennart.borgman.073@student.lu.se> writes:

>
> Maybe you could add a complemented character set to the first one after the smile (with whatever slashes there are needed to get this to work): [^)] 


The point is about \\W.  \\W matches any character that is not a
word-constituent.  I want `:-)' to become a smile if it is followed by any
of `\\W' but not ')'.  If I put it as "\\(:-?)\\)[^)]", then even strings
like "smile_within:-)strings" also get smileys.  So I am looking for a way
to specify "characters in \\W but no ')' in the language of regexps".


-- 
    Rajsekar Manokaran
    IIT Madras

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: smiley regexp problem
  2005-03-21 12:12 ` Rajsekar
@ 2005-03-21 13:22   ` Lennart Borgman
  2005-03-21 13:49   ` Stefan Monnier
  1 sibling, 0 replies; 9+ messages in thread
From: Lennart Borgman @ 2005-03-21 13:22 UTC (permalink / raw)
  Cc: emacs-devel

----- Original Message ----- 
From: "Rajsekar" <rajsekar@cse.iitm.ernet.in>

> The point is about \\W.  \\W matches any character that is not a
> word-constituent.  I want `:-)' to become a smile if it is followed by any
> of `\\W' but not ')'.  If I put it as "\\(:-?)\\)[^)]", then even strings
> like "smile_within:-)strings" also get smileys.  So I am looking for a way
> to specify "characters in \\W but no ')' in the language of regexps".

Oh, I see. I can't find any way to do it. You can perhaps build a larger
[^...] but that is not exactly what you want. BTW the reg exps in perl is a
bit stronger and I believe things like what you want can be done there.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: smiley regexp problem
  2005-03-21 12:12 ` Rajsekar
  2005-03-21 13:22   ` Lennart Borgman
@ 2005-03-21 13:49   ` Stefan Monnier
  2005-03-21 19:53     ` Rajsekar
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2005-03-21 13:49 UTC (permalink / raw)
  Cc: LENNART BORGMAN, emacs-devel

> The point is about \\W.  \\W matches any character that is not a
> word-constituent.  I want `:-)' to become a smile if it is followed by any
> of `\\W' but not ')'.  If I put it as "\\(:-?)\\)[^)]", then even strings
> like "smile_within:-)strings" also get smileys.  So I am looking for a way
> to specify "characters in \\W but no ')' in the language of regexps".

":-)[^[:word:])]"


        Stefan

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: smiley regexp problem
  2005-03-21 13:49   ` Stefan Monnier
@ 2005-03-21 19:53     ` Rajsekar
  0 siblings, 0 replies; 9+ messages in thread
From: Rajsekar @ 2005-03-21 19:53 UTC (permalink / raw)
  Cc: LENNART BORGMAN, emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> The point is about \\W.  \\W matches any character that is not a
>> word-constituent.  I want `:-)' to become a smile if it is followed by any
>> of `\\W' but not ')'.  If I put it as "\\(:-?)\\)[^)]", then even strings
>> like "smile_within:-)strings" also get smileys.  So I am looking for a way
>> to specify "characters in \\W but no ')' in the language of regexps".
>
> ":-)[^[:word:])]"
>
>
Oh great!
It worked perfect.
Thanks.

-- 
    Rajsekar Manokaran
    IIT Madras

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-03-21 19:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-17 11:55 smiley regexp problem Rajsekar
2005-03-20 21:23 ` Rajsekar
2005-03-20 21:48   ` David Kastrup
2005-03-21  8:06     ` Rajsekar
  -- strict thread matches above, loose matches on Subject: below --
2005-03-21 10:47 LENNART BORGMAN
2005-03-21 12:12 ` Rajsekar
2005-03-21 13:22   ` Lennart Borgman
2005-03-21 13:49   ` Stefan Monnier
2005-03-21 19:53     ` Rajsekar

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).