scheme.el 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. (add-to-list 'auto-mode-alist `("\\.tmpl" . scheme-mode))
  2. (defun projectile-run-guile (&optional pure)
  3. "Invoke ‘run-guile’ in the project’s root.
  4. Interactively a non-nil prefix argument cleans `geiser-guile-load-path'.
  5. Non-interactively, this uses the optional second argument PURE."
  6. (interactive)
  7. (let* ((geiser-guile-load-path (if (or pure current-prefix-arg) nil
  8. geiser-guile-load-path))
  9. (geiser-guile-load-path
  10. (append (list (directory-file-name
  11. (expand-file-name
  12. (projectile-project-root))))
  13. geiser-guile-load-path)))
  14. (run-guile)))
  15. (defun run-guile-with-directory (directory)
  16. "Invoke `run-guile' and add DIRECTORY to %`load-path'."
  17. (interactive "DAdd to %%load-path: ")
  18. (let ((geiser-guile-load-path (append (list directory)
  19. geiser-guile-load-path)))
  20. (run-guile)))
  21. (defun emacs-add-to-load-path (directory)
  22. "Add DIRECTORY to `load-path'."
  23. (interactive "DAdd to `load-path': ")
  24. (add-to-list 'load-path (expand-file-name directory)))
  25. (with-eval-after-load 'geiser
  26. (setq geiser-active-implementations '(guile))
  27. (setq geiser-default-implementation 'guile))
  28. (with-eval-after-load 'geiser-guile
  29. ;; (add-to-list 'geiser-guile-load-path (expand-file-name "/home/oleg/src/git.savannah.gnu.org/git/guix"))
  30. (setq geiser-guile-binary '("guile" "--no-auto-compile"))
  31. ;; Origin <https://gnunet.org/bot/log/guile/2018-02-24>
  32. ;; (setq geiser-guile-load-path (f-entries "~/src"))
  33. )
  34. (defconst wi-scheme--prettify-symbols-alist
  35. '(("lambda" . ?λ)
  36. ("lambda*" . (?λ (Br . Bl) ?*))))
  37. (when (functionp #'add-hooks)
  38. (add-hooks
  39. '(((scheme-mode-hook geiser-repl-mode-hook)
  40. . (lambda ()
  41. (set (make-local-variable 'prettify-symbols-alist)
  42. wi-scheme--prettify-symbols-alist))))))
  43. (setq geiser-debug-show-debug-p nil)
  44. ;; (setq geiser-debug-jump-to-debug-p nil)
  45. ;; (setq geiser-debug-always-display-sexp-after-p nil)
  46. (autoload 'scheme-smart-complete "scheme-complete" nil t)
  47. ;; (eval-after-load 'scheme
  48. ;; '(define-key scheme-mode-map "\e\t" 'scheme-smart-complete))
  49. (setq scheme-default-implementation 'guile)
  50. (setq *scheme-use-r7rs* nil)
  51. ;;;
  52. ;;; Hide
  53. ;;;
  54. (defcustom wi-scheme-mode-toggle-hs-minor-mode nil
  55. "If non-nil enable `hs-minor-mode' in `scheme-mode'."
  56. :type 'boolean)
  57. (defun wi-scheme-mode-toggle-hs-minor-mode ()
  58. (interactive)
  59. (if wi-scheme-mode-toggle-hs-minor-mode
  60. (progn (remove-hook 'scheme-mode-hook 'hs-minor-mode)
  61. (setq wi-scheme-mode-toggle-hs-minor-mode nil))
  62. (progn (add-hook 'scheme-mode-hook 'hs-minor-mode)
  63. (add-hook 'scheme-mode-hook #'hs-hide-all)
  64. (setq wi-scheme-mode-toggle-hs-minor-mode t))))
  65. ;;;
  66. ;;; Snippets
  67. ;;;
  68. (define-auto-insert
  69. (rx "guile" (one-or-more (or alphanumeric "-")) line-end)
  70. ["guile/script" scheme-mode yas-expand-current-buffer])