guix-scheme.el 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ;;; guix-scheme.el --- Scheme major mode -*- lexical-binding: t -*-
  2. ;; Copyright © 2017 Alex Kost <alezost@gmail.com>
  3. ;; This file is part of Emacs-Guix.
  4. ;; Emacs-Guix is free software; you can redistribute it and/or modify
  5. ;; it under the terms of the GNU General Public License as published by
  6. ;; the Free Software Foundation, either version 3 of the License, or
  7. ;; (at your option) any later version.
  8. ;;
  9. ;; Emacs-Guix is distributed in the hope that it will be useful,
  10. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. ;; GNU General Public License for more details.
  13. ;;
  14. ;; You should have received a copy of the GNU General Public License
  15. ;; along with Emacs-Guix. If not, see <http://www.gnu.org/licenses/>.
  16. ;;; Commentary:
  17. ;; This file provides `guix-scheme-mode'.
  18. ;;; Code:
  19. (require 'scheme)
  20. (require 'guix-utils)
  21. (defvar guix-scheme-display-message t
  22. "If non-nil, display a message after enabling `guix-scheme-mode'.
  23. This message allows you to see that the current buffer is
  24. indented (while the original buffer file may not be indented).")
  25. ;;;###autoload
  26. (define-derived-mode guix-scheme-mode scheme-mode "Scheme"
  27. "Major mode for editing Scheme code.
  28. This mode is the same as `scheme-mode', except it also reindents
  29. the current buffer after it is enabled."
  30. (guix-pretty-print-buffer)
  31. ;; There may be long lines (like lists of strings), so display them on
  32. ;; multiple lines.
  33. (setq truncate-lines nil)
  34. (when guix-scheme-display-message
  35. (message "This buffer has been indented by `guix-scheme-mode'.")))
  36. (provide 'guix-scheme)
  37. ;;; guix-scheme.el ends here