[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Geiser-users] Shortcut for Inserting the Lambda C haracter (λ)
From: |
Ali Asad Lotia |
Subject: |
Re: [Geiser-users] Shortcut for Inserting the Lambda C haracter (λ) |
Date: |
Sat, 18 Jun 2011 17:58:48 -0400 |
If you set up pretty-mode it will substitute the lambda character for
the string "lambda" in any mode that is set up to use pretty-mode.
http://www.emacswiki.org/emacs/pretty-mode.el
There are other characters that also get substituted when running pretty mode.
--
Ali
On Fri, Jun 17, 2011 at 11:44, Jose A. Ortega Ruiz <address@hidden> wrote:
> On Fri, Jun 17 2011, Sina K. Heshmati wrote:
>
>> L.S.,
>>
>> Is there a shortcut similar to 'Cmd+\' in DrRacket for inserting the
>> lambda character (λ) in the source code.
>
> No, but you can define your own:
>
> (define-key scheme-mode-map [(hyper ?\\)] (lambda () (interactive) (insert
> "λ ")))
>
> Another possibility is to tell emacs to display the word "lambda" using
> a λ (while still saving the buffer using "lambda"):
>
> --8<---------------cut here---------------start------------->8---
>
> (defun pretty-lambdas ()
> (font-lock-add-keywords
> nil `(("(\\(lambda\\>\\)"
> (0 (progn (compose-region (match-beginning 1) (match-end 1)
> ,(make-char 'greek-iso8859-7 107))
> nil))))))
>
> (add-hook 'scheme-mode-hook 'pretty-lambdas)
>
> --8<---------------cut here---------------end--------------->8---
>
> and you can also define the shortcut to insert lambda:
>
> (define-key scheme-mode-map [(hyper ?\\)] (lambda () (interactive) (insert
> "lambda ")))
>
> The nice thing about the latter approach is that you'll be sure that
> everything is ASCII, which is the only encoding with which i've tested
> Geiser :)
>
> HTH,
> jao
> --
> I have never met a man so ignorant that I couldn't learn something
> from him. -Galileo Galilei, physicist and astronomer (1564-1642)
>
>