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

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

Re: Are abbrevs for this?


From: harven
Subject: Re: Are abbrevs for this?
Date: Sat, 13 Jun 2009 10:14:50 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (darwin)

"Paulo J. Matos" <pocmatos@gmail.com> writes:

> On Thu, Jun 11, 2009 at 8:53 AM, TomSW<tom.weissmann@gmail.com> wrote:
>> On Jun 11, 1:53 am, Xah Lee <xah...@gmail.com> wrote:
>>> On Jun 10, 6:53 am, "Paulo J. Matos" <pocma...@gmail.com> wrote:
>>>
>>> > Hi all,
>>>
>>> > I am developing  a new major mode for a new specification language
>>> > which uses a lot of unicode symbols but it also has an ascii notation.
>>> > Like some scheme modes convert the lambda keyword into the greek
>>> > lambda letter, I have a table of keywords that would like them to be
>>> > changed into unicode symbols.
>>
>> If the scheme modes are anything like pretty-haskell, they don't
>> actually convert the text, they use font-lock to disguise "lambda" as
>> the greek letter - the source code itself doesn't change.
>>
>
> That's the approach I need...

Here is the code

;; real lisp hackers use the lambda character
;; courtesy of stefan monnier on c.l.l
(defun sm-lambda-mode-hook ()
  (font-lock-add-keywords
   nil `(("\\<lambda\\>"
   (0 (progn (compose-region (match-beginning 0) (match-end 0)
        ,(make-char 'greek-iso8859-7 107))
      nil))))))
(add-hook 'emacs-lisp-mode-hook 'sm-lambda-mode-hook)
(add-hook 'lisp-interactive-mode-hook 'sm-lamba-mode-hook)
(add-hook 'scheme-mode-hook 'sm-lambda-mode-hook)



reply via email to

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