From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Torsten Bronger Newsgroups: gmane.emacs.help Subject: Re: Display "dash" as "minus" in programming language mode? Date: Thu, 09 Jul 2009 09:56:27 +0200 Organization: Phoenix Foundation Message-ID: <873a9670ic.fsf@physik.rwth-aachen.de> References: <874otm28kw.fsf@physik.rwth-aachen.de> <87hbxmluqk.fsf@galatea.local> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1247130526 10319 80.91.229.12 (9 Jul 2009 09:08:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 9 Jul 2009 09:08:46 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 09 11:08:31 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MOpcE-0004JS-EL for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Jul 2009 11:08:30 +0200 Original-Received: from localhost ([127.0.0.1]:34513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOpcD-000648-Qi for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Jul 2009 05:08:29 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 46 Original-X-Trace: news.dfncis.de DsHDEumZnvPpO4KJgSNwCQ681f0PRMZBeNl4O1rjgGCqaRGWERxTHGOBbe X-Orig-Path: wilson.homeunix.com!not-for-mail Cancel-Lock: sha1:H+eKHRVoWsN2m6tA5/Dhv6Sb3Os= sha1:iQgP+El5j0IH2ACfj5Y/sC1+gB0= X-PGP-Fingerprint: C5C8 D6E2 79D2 EFE9 8C0F 6D77 D5E3 CEFC 9F51 6B77 X-PGP-Affinity: will accept encrypted message for GPG X-Home-Page: http://www.wikipedia.org/wiki/User:Bronger X-Face: +wpw"|jN2Fde|7_lKBa0\7!_6suIE_m! x)'S9ytBu8tkt'k779jbzQ4o|p+@H_DCrIdnKG]E*w X-Binford: 6100 (more power) X-Accept-Language: de, en Jabber-ID: torsten.bronger@jabber.rwth-aachen.de User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.94 (gnu/linux) Original-Xref: news.stanford.edu gnu.emacs.help:170684 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:65886 Archived-At: Hallöchen! Pascal J. Bourguignon writes: > Torsten Bronger writes: > >> I have an arguably odd question: Is it possible to tell Emacs to >> display every "dash" character as an "en-dash" character? >> >> The reason is that I use the DejaVu fonts which have a >> particularly short dash. In source code, this is unfortunate. >> Is is possible to use e.g. font-lock-mode to substitute "en-dash" >> or "minus" for every "dash"? > > Yes, it's trivial: > > (font-lock-add-keywords nil > '(("-" (0 (progn (compose-region (match-beginning 0) (match-end 0) "–" > 'decompose-region) > nil))))) Thanks to both of you. 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))) )))) (add-hook 'python-mode-hook (lambda () (aset (or buffer-display-table (setq buffer-display-table (make-display-table))) ?* [?✻]))) Although the heuristics are not perfict, it works quite nicely. Tschö, Torsten. -- Torsten Bronger, aquisgrana, europa vetus Jabber ID: torsten.bronger@jabber.rwth-aachen.de or http://bronger-jmp.appspot.com