/
emacs-rc-scheme.el
73 lines (62 loc) · 2.08 KB
/
emacs-rc-scheme.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
;;; emacs-rc-scheme.el ---
;; Copyright (C) 2003 Alex Ott
;;
;; Author: alexott@gmail.com
;; Keywords:
;; Requirements:
;; Status: not intended to be distributed yet
(autoload 'run-scheme "cmuscheme" "Run an inferior Scheme" t)
(setq scheme-program-name "mzscheme")
(require 'quack)
(setq quack-remap-find-file-bindings-p nil)
(defun insert-balanced-comments (arg)
"Insert a set of balanced comments around the s-expression
containing the point. If this command is invoked repeatedly
(without any other command occurring between invocations), the
comment progressively moves outward over enclosing expressions."
(interactive "*p")
(save-excursion
(when (eq last-command this-command)
(when (search-backward "#|" nil t)
(save-excursion
(delete-char 2)
(while (and (< (point) (point-max)) (not (looking-at " *|#")))
(forward-sexp))
(replace-match ""))))
(while (> arg 0)
(backward-char 1)
(cond ((looking-at ")") (incf arg))
((looking-at "(") (decf arg))))
(insert "#|")
(forward-sexp)
(insert "|#")))
(defun remove-balanced-comments ()
"Remove a set of balanced comments enclosing point."
(interactive "*")
(save-excursion
(when (search-backward "#|" nil t)
(delete-char 2)
(while (and (< (point) (point-max)) (not (looking-at " *|#")))
(forward-sexp))
(replace-match ""))))
(add-hook 'inferior-scheme-mode-hook
'(lambda ()
(split-window)))
(defun r5rs-call ()
"Calls r5rs info for current symbol"
(interactive)
(ignore-errors
(let ((symbol (thing-at-point 'symbol)))
(info "(r5rs)")
(Info-index symbol))))
(defun alexott/scheme-mode-hook ()
"My customization of Scheme Mode"
(turn-on-eldoc-mode)
(local-set-key [return] 'newline-and-indent)
(local-set-key [f1] 'r5rs-call)
)
(add-hook 'scheme-mode-hook 'alexott/scheme-mode-hook)
(add-hook 'scheme-mode-hook 'alexott/common-hook)
(add-hook 'scheme-mode-hook 'alexott/show-prog-keywords)
(add-to-list 'auto-mode-alist '("\\.scm$" . scheme-mode))
;;; emacs-rc-scheme.el ends here