Make chicken more ergonomic and remove dired previews
This commit is contained in:
parent
a75f9188f6
commit
ebbe94030f
2 changed files with 104 additions and 35 deletions
|
|
@ -42,16 +42,85 @@
|
|||
(setq inferior-lisp-program "sbcl"))
|
||||
|
||||
;; Scheme (with Chickens)
|
||||
(use-package geiser)
|
||||
(use-package geiser
|
||||
:config
|
||||
;; Auto-start the geiser repl
|
||||
(setq geiser-mode-start-repl-p t)
|
||||
|
||||
;; Put geiser in the bottom
|
||||
(add-to-list 'display-buffer-alist
|
||||
'("\\*Geiser .* REPL"
|
||||
(display-buffer-in-side-window)
|
||||
(side . bottom)
|
||||
(slot . 1)
|
||||
(window-height . 0.2)))
|
||||
(add-to-list 'display-buffer-alist
|
||||
`("\\*Geiser Documentation"
|
||||
(display-buffer-in-side-window)
|
||||
(side . ,(if (equal system-type 'android) 'bottom 'right))
|
||||
(slot . ,(if (equal system-type 'android) 0 3))
|
||||
(window-height . 0.2)))
|
||||
(add-to-list 'display-buffer-alist
|
||||
`("\\*Geiser Debug"
|
||||
(display-buffer-in-side-window)
|
||||
(side . ,(if (equal system-type 'android) 'bottom 'right))
|
||||
(slot . ,(if (equal system-type 'android) 0 4))
|
||||
(window-height . 0.2))))
|
||||
|
||||
(defcustom chicken-doc-repository ""
|
||||
"Custom location for the chicken-doc repository."
|
||||
:type 'string
|
||||
:group 'scheme
|
||||
:group 'geiser)
|
||||
|
||||
(use-package geiser-chicken
|
||||
:after (geiser)
|
||||
:config (add-to-list 'display-buffer-alist
|
||||
'("\\*Geiser"
|
||||
(display-buffer-in-side-window)
|
||||
(side . bottom)
|
||||
(slot . 1)
|
||||
(window-height . 0.2))))
|
||||
:config
|
||||
(setenv "CHICKEN_DOC_REPOSITORY" chicken-doc-repository)
|
||||
|
||||
;; Annoying BS to prevent inline C code from fucking with the syntax table
|
||||
;; This is really hacky and doesn't truly work properly especially with auto-indent
|
||||
(defun scheme-propertize-chicken-comment (start)
|
||||
"Find the matching <# for a #> at START and mark the whole region as a comment."
|
||||
(save-excursion
|
||||
(goto-char start)
|
||||
(let ((pos (point)))
|
||||
(if (re-search-forward "<#" nil t)
|
||||
(progn
|
||||
(put-text-property pos (point) 'syntax-table (string-to-syntax "< c"))
|
||||
(put-text-property pos (1+ pos) 'syntax-table (string-to-syntax "<"))
|
||||
(put-text-property (1- (point)) (point) 'syntax-table (string-to-syntax ">")))
|
||||
;; no matching <# found – maybe just mark the #> as invalid
|
||||
(put-text-property pos (1+ pos) 'syntax-table (string-to-syntax "'"))))))
|
||||
|
||||
(defun chicken-scheme-syntax-propertize (start end)
|
||||
"Extend scheme-syntax-propertize to also handle #> ... <#."
|
||||
(goto-char start)
|
||||
(funcall
|
||||
(syntax-propertize-rules
|
||||
("#>" (0 (ignore (scheme-propertize-chicken-comment (match-beginning 0)))))
|
||||
("<#" (0 (ignore (scheme-propertize-chicken-comment (match-beginning 0)))))
|
||||
)
|
||||
start end))
|
||||
|
||||
;; Replace the default scheme-syntax-propertize when chicken is being used
|
||||
(add-hook 'scheme-mode-hook
|
||||
(lambda ()
|
||||
(when (memq 'chicken geiser-active-implementations)
|
||||
(setq-local syntax-propertize-function #'chicken-scheme-syntax-propertize)
|
||||
(syntax-propertize (point-max)))))
|
||||
|
||||
;; Modifications for chicken
|
||||
;; Indent module contents at column 0
|
||||
(defun scheme-module-indent (state indent-point normal-indent) 0)
|
||||
(put 'module 'scheme-indent-function 'scheme-module-indent)
|
||||
|
||||
(put 'and-let* 'scheme-indent-function 1)
|
||||
(put 'parameterize 'scheme-indent-function 1)
|
||||
(put 'handle-exceptions 'scheme-indent-function 1)
|
||||
(put 'when 'scheme-indent-function 1)
|
||||
(put 'unless 'scheme-indent-function 1)
|
||||
(put 'match 'scheme-indent-function 1))
|
||||
|
||||
(use-package geiser-racket
|
||||
:after (geiser))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue