"Jose A. Ortega Ruiz" <[email protected]> said: > On Fri, Jun 17 2011, Sina K. Heshmati wrote: > >> 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 :)
For now, I went with the second approach. This way, I get to see λs in standard Scheme too. Thank you very much, Jao. Kind regards, Sina
