all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Torsten Bronger <bronger@physik.rwth-aachen.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Display "dash" as "minus" in programming language mode?
Date: Fri, 10 Jul 2009 16:15:11 +0200	[thread overview]
Message-ID: <87prc8tyj4.fsf@physik.rwth-aachen.de> (raw)
In-Reply-To: 873a9670ic.fsf@physik.rwth-aachen.de

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


  parent reply	other threads:[~2009-07-10 14:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-08 21:01 Display "dash" as "minus" in programming language mode? Torsten Bronger
2009-07-08 21:39 ` Pascal J. Bourguignon
2009-07-09  7:56   ` Torsten Bronger
2009-07-09  9:00     ` Miles Bader
2009-07-09  9:15       ` Torsten Bronger
2009-07-09 11:04         ` Miles Bader
2009-07-10 14:15     ` Torsten Bronger [this message]
2009-07-09  1:23 ` Kevin Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87prc8tyj4.fsf@physik.rwth-aachen.de \
    --to=bronger@physik.rwth-aachen.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.