help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why do I need to eval this?


From: HS
Subject: Re: Why do I need to eval this?
Date: 15 Jan 2007 18:44:41 -0800
User-agent: G2/1.0

Interessante a sua idéia, mas acho que não consegui fazer funcionar.
Agora me diz se você sabe fazer isto:
Eu queria que todas palavras terminando em `ao` fossem substituidas por
`ão` assim eu poderia escrever chao, nao, coracao e elas seriam
arrumadas na hora.
Normalmente eu resolvo isto com as abbrevs, mas neste caso é uma
regex, então nao sei.
Você tem alguma idéia ?
Sds
Hugo


Arnaldo Mandel escreveu:

> Here is a short utility command that is useful to those writing
> Portuguese on US keyboards:
>
> (defun crases (daqui)
>   "Offers all grave-accented chars to be corrected to the corresponding tilda.
> Argument DAQUI starts search from point."
>   (interactive "P")
>   (let ((start (if daqui (point) (point-min))))
>     (save-excursion
>       (query-replace-regexp-eval "[àòÀÒ]"
>                                  '(cdr (assoc (match-string-no-properties 0)
>                                               '(("à" . "ã") ("ò" . "õ")
>                                                 ("À" . "Ã") ("Ò" . "Õ"))))
>                                  nil start (point-max)))))
>
> If I either byte-compile it or load it uncompiled from a file, it
> doesn't work: it finds the characters that have to be replaced,
> but replaces with nil.  On the other hand, if I eval this expression
> (C-x C-e), it works perfectly.  The behavior is the same in emacs 21
> and 22.
>
> Any idea on what is going on?
>
> am
> 
> -- 
> Arnaldo Mandel                        
> am@ime.usp.br



reply via email to

[Prev in Thread] Current Thread [Next in Thread]