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: Miles Bader
Subject: Re: Display "dash" as "minus" in programming language mode?
Date: Thu, 09 Jul 2009 18:00:33 +0900

Torsten Bronger <bronger@physik.rwth-aachen.de> writes:
> (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)))
>                 ?* [?✻])))

Hmm, why add font-lock stuff, when using display-table for dash too
would be easier and far more efficient (and you're already setting up
the display table anyway, so even simpler...)?

[I mean, like:

(add-hook 'python-mode-hook
          (lambda ()
            (unless buffer-display-table
              (setq buffer-display-table (make-display-table)))
            (aset buffer-display-table ?* [?✻])
            (aset buffer-display-table ?- [?−])))

]

-Miles

-- 
Politics, n. A strife of interests masquerading as a contest of
principles. The conduct of public affairs for private advantage.


reply via email to

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