geiser-users
[Top][All Lists]
Advanced

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

Re: [Geiser-users] Shortcut for Inserting the Lambda Charac ter (λ)


From: Jose A. Ortega Ruiz
Subject: Re: [Geiser-users] Shortcut for Inserting the Lambda Charac ter (λ)
Date: Fri, 17 Jun 2011 17:44:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (darwin)

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)



reply via email to

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