X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/da0d153e1520b5af5d008412187bbcb1d686de48..2d2431cc6b6cce8dcdf4369e8c1efce9d90bb1a5:/packages/shen-mode/shen-mode.el diff --git a/packages/shen-mode/shen-mode.el b/packages/shen-mode/shen-mode.el index 45d426233..81c28298c 100644 --- a/packages/shen-mode/shen-mode.el +++ b/packages/shen-mode/shen-mode.el @@ -1,6 +1,6 @@ ;;; shen-mode.el --- A major mode for editing shen source code -;; Copyright (C) 2011 Free Software Foundation, Inc. +;; Copyright (C) 2011, 2013 Free Software Foundation, Inc. ;; Author: Eric Schulte ;; Version: 0.1 @@ -24,12 +24,13 @@ ;;; Commentary: -;; A minor mode for editing shen source code. Shen is a modern lisp +;; A major mode for editing Shen source code. Shen is a modern Lisp ;; dialect with support for functional and declarative programming, ;; pattern matching and a very powerful type system. See the -;; following for more information on Shen. http://www.shenlanguage.org +;; following for more information on Shen. http://www.shenlanguage.org ;;; Code: +(eval-when-compile (require 'cl)) (require 'lisp-mode) (require 'imenu) @@ -44,6 +45,7 @@ map) "Currently just inherits from `lisp-mode-shared-map'.") +(eval-and-compile (defconst shen-functions '((* "number --> number --> number" "Number multiplication.") (+ "number --> number --> number" "Number addition.") @@ -220,7 +222,7 @@ (warn "string --> string" "Prints the string as a warning and returns \"done\". See strong-warning") (write-to-file "string --> A --> string" "Writes the second input into a file named in the first input. If the file does not exist, it is created, else it is overwritten. If the second input is a string then it is written to the file without the enclosing quotes. The first input is returned.") (y-or-n\? "string --> boolean" "Prints the string as a question and returns true for y and false for n.")) - "Shen functions taken largely from the Qi documentation by Dr. Mark Tarver.") + "Shen functions taken largely from the Qi documentation by Dr. Mark Tarver.")) ;;; Fontification @@ -362,7 +364,7 @@ ;; shallow indent because we're in the body edge))) -(defun shen-package-indent (state indent-point normal-indent) +(defun shen-package-indent (_state _indent-point _normal-indent) (- (current-column) 8)) (put 'let 'shen-indent-function 'shen-let-indent) @@ -397,31 +399,31 @@ (unless (fboundp 'prog-mode) (defalias 'prog-mode 'fundamental-mode)) +;;;###autoload (define-derived-mode shen-mode prog-mode "shen" "Major mode for editing Shen code." :syntax-table shen-mode-syntax-table - ;; set a variety of local variables - ((lambda (local-vars) - (dolist (pair local-vars) - (set (make-local-variable (car pair)) (cdr pair)))) - `((adaptive-fill-mode . nil) - (fill-paragraph-function . lisp-fill-paragraph) - (indent-line-function . lisp-indent-line) - (lisp-indent-function . shen-indent-function) - (parse-sexp-ignore-comments . t) - (comment-start . "\\* ") - (comment-end . " *\\") - (comment-add . 0) - (comment-column . 32) - (parse-sexp-ignore-comments . t) - (comment-use-global-state . nil) - (comment-multi-line . t) - (eldoc-documentation-function . shen-mode-eldoc) - (imenu-case-fold-search . t) - (imenu-generic-expression . ,shen-imenu-generic-expression) - (mode-name . "Shen") - (font-lock-defaults . (shen-font-lock-keywords))))) + ;; Set a variety of local variables. + (dolist (pair `((adaptive-fill-mode . nil) + (fill-paragraph-function . lisp-fill-paragraph) + (indent-line-function . lisp-indent-line) + (lisp-indent-function . shen-indent-function) + (parse-sexp-ignore-comments . t) + (comment-start . "\\* ") + (comment-end . " *\\") + (comment-add . 0) + (comment-column . 32) + (parse-sexp-ignore-comments . t) + (comment-use-global-state . nil) + (comment-multi-line . t) + (eldoc-documentation-function . shen-mode-eldoc) + (imenu-case-fold-search . t) + (imenu-generic-expression . ,shen-imenu-generic-expression) + (mode-name . "Shen") + (font-lock-defaults . (shen-font-lock-keywords)))) + (set (make-local-variable (car pair)) (cdr pair)))) +;;;###autoload (add-to-list 'auto-mode-alist '("\\.shen\\'" . shen-mode)) (provide 'shen-mode)