Ah yes from a long time ago. If you _really_ want some fun in your scheme
code. Add something like the following to your .emacs file as a scheme-mode
hook. Essentially all standard scheme "keywords" / special forms are
reduced to _display_ as single char greek letters. What is sort of cool is
the source code stays unmodified and works just fine. Emacs only displays
the string "lambda" as a λ etc.
This was done as sort of joke years ago so the matching regexs for the
compose-regions are pretty naive. The lambda thing added to quack and
later racket added it as well. I originally found the lambda thing by
accident after I saw someone else using "compose-region" for some similar
purpose. Can't recall. Stephan Monnier?
;; Pretty Lambda and delta character
(defconst schemecmpct-lambda-char (decode-char 'ucs #x03BB)) ;;
(make-char 'greek-iso8859-7 107))
(defconst schemecmpct-delta-char (decode-char 'ucs #x03B4)) ;;
(make-char 'greek-iso8859-7 100))
(defconst schemecmpct-beta-char (decode-char 'ucs #x03B2)) ;;
'greek-iso8859-7 98))
(defconst schemecmpct-rho-char (decode-char 'ucs #x03C1))
(defconst schemecmpct-sigma-char (decode-char 'ucs #x03C2))
(defconst schemecmpct-iota-char (decode-char 'ucs #x03B9))
(defconst schemecmpct-log-and-char (decode-char 'ucs #x2227))
(defconst schemecmpct-log-or-char (decode-char 'ucs #x2228))
(defconst schemecmpct-log-not-char (decode-char 'ucs #x00AC))
(defconst schemecmpct-log-true-char (decode-char 'ucs #x22A4))
(defconst schemecmpct-log-false-char (decode-char 'ucs #x22A5))
(defconst schemecmpct-less-equal-char (decode-char 'ucs #x2264))
(defconst schemecmpct-greater-equal-char (decode-char 'ucs #x2265))
(defconst schemecmpct-key-words
'(("[[(]\\(case-\\|match-\\|opt-\\)?\\(lambda\\)\\>"
2
(progn (compose-region (match-beginning 2)
(match-end 2)
schemecmpct-lambda-char)
nil))
("[[(]\\(define\\)\\(-.+\\)?\\>"
1
(progn (compose-region (match-beginning 1)
(match-end 1)
schemecmpct-delta-char)
nil))
("[[(]\\(let\\)\\(*\\|-\\)?"
1
(progn (compose-region (match-beginning 1)
(match-end 1)
schemecmpct-beta-char)
nil))
("[[(]\\(set!\\)\\>"
1
(progn (compose-region (match-beginning 1)
(match-end 1)
schemecmpct-sigma-char)
nil))
("[[(]\\(begin\\)\\>"
1
(progn (compose-region (match-beginning 1)
(match-end 1)
schemecmpct-rho-char)
nil))
("[[(]\\(if\\)\\>"
1
(progn (compose-region (match-beginning 1)
(match-end 1)
schemecmpct-iota-char)
nil))
("[[(]\\(and\\)\\>"
1
(progn (compose-region (match-beginning 1)
(match-end 1)
schemecmpct-log-and-char)
nil))
("[[(]\\(or\\)\\>"
1
(progn (compose-region (match-beginning 1)
(match-end 1)
schemecmpct-log-or-char)
nil))
("[[(]\\(not\\)\\>"
1
(progn (compose-region (match-beginning 1)
(match-end 1)
schemecmpct-log-not-char)
nil))
("[[(]\\(<=\\)"
1
(progn (compose-region (match-beginning 1)
(match-end 1)
schemecmpct-less-equal-char)
nil))
("[[(]\\(>=\\)"
1
(progn (compose-region (match-beginning 1)
(match-end 1)
schemecmpct-greater-equal-char)
nil))
("\\(#t\\)\\>"
1
(progn (compose-region (match-beginning 1)
(match-end 1)
schemecmpct-log-true-char)
nil))
("\\(#f\\)\\>"
1
(progn (compose-region (match-beginning 1)
(match-end 1)
schemecmpct-log-false-char)
nil))
("[][()]" . 'schemecmpct-paren-face)
("#[\\]\\w+" . 'schemecmpct-character-face) ;; characters
("#x\\w+" . 'schemecmpct-character-face) ;; hex numbers
("\\w+set!" . 'schemecmpct-dangerous-face)
("\\w+!" . 'schemecmpct-dangerous-face)
"library" "import" "export" "provide" "require" "not" "#t" "#f" "aif"
"define-record-type" "struct"))
(defun schemecmpct-install-fontification ()
"Install font lock extendsions to scheme mode."
(font-lock-add-keywords nil schemecmpct-key-words))
On Fri, Jun 17, 2011 at 5:37 AM, Sina K. Heshmati <[email protected]> wrote:
> L.S.,
>
> Is there a shortcut similar to 'Cmd+\' in DrRacket for inserting the lambda
> character (λ) in the source code.
>
> Thanks,
> Sina Khakbaz Heshmati
>
>
>