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

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

Re: Display "dash" as "minus" in programming language mode?


From: Torsten Bronger
Subject: Re: Display "dash" as "minus" in programming language mode?
Date: Fri, 10 Jul 2009 16:15:11 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.94 (gnu/linux)

Hallöchen!

Torsten Bronger writes:

> [...]
>
> [...]  I now use
>
> (add-hook 'python-mode-hook
>         (lambda ()
>           (font-lock-add-keywords nil
>                                   '(("\\B-\\B"
>                                      (0 (progn (compose-region 
> (match-beginning 0) (match-end 0) "−" 'decompose-region)
>                                                nil)))
>                                     ))))

Sorry to disturb again, but it didn't work because Emacs treats
numbers as words, so the regexp \B-\B means that negative integers
like -1 get a dash instead of a minus.  And negative integers are
frequent in Python.

Is it possible to substitute *all* "-", except those in comments and
string literals?  The documentation of font-lock-mode just says that
add-keywords really works also in comments but I didn't understand
enough of it to prevent it.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                   Jabber ID: torsten.bronger@jabber.rwth-aachen.de
                                  or http://bronger-jmp.appspot.com


reply via email to

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