emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master d5cb737: * externals-list: Convert shen-mode to :external


From: Stefan Monnier
Subject: [elpa] master d5cb737: * externals-list: Convert shen-mode to :external
Date: Sun, 29 Nov 2020 00:14:33 -0500 (EST)

branch: master
commit d5cb7374b67843ac49ec4dbf82644f7254f1ff3a
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * externals-list: Convert shen-mode to :external
---
 externals-list                  |   3 +-
 packages/shen-mode/README       |   6 -
 packages/shen-mode/inf-shen.el  | 590 ----------------------------------------
 packages/shen-mode/shen-mode.el | 432 -----------------------------
 4 files changed, 2 insertions(+), 1029 deletions(-)

diff --git a/externals-list b/externals-list
index 29d618f..0a07aff 100644
--- a/externals-list
+++ b/externals-list
@@ -154,7 +154,7 @@
  ("python"             :core "lisp/progmodes/python.el")
  ;;FIXME:("org"                :external ??) ;; Need to introduce snapshots!!
  ("rbit"               :external nil)
- ("rcirc-color" :external nil)
+ ("rcirc-color"                :external nil)
  ("realgud"             :external "https://github.com/realgud/realgud";)
  ("realgud-ipdb"        :external "https://github.com/realgud/realgud-ipdb";)
  ("realgud-jdb"         :external "https://github.com/realgud/jdb";)
@@ -171,6 +171,7 @@
  ("rudel"              :external nil) ;; Was 
bzr::bzr://rudel.bzr.sourceforge.net/bzrroot/rudel/trunk
  ("scanner"            :external "https://gitlab.com/rstocker/scanner.git";)
  ("shell-command+"     :external 
"https://git.sr.ht/~zge/bang/tree/shell-command+";)
+ ("shen-mode"          :external nil)
  ("slime-volleyball"   :external nil)
  ("sm-c-mode"          :external nil)
  ("smalltalk-mode"     :external "git://git.sv.gnu.org/smalltalk")
diff --git a/packages/shen-mode/README b/packages/shen-mode/README
deleted file mode 100644
index 22ddde1..0000000
--- a/packages/shen-mode/README
+++ /dev/null
@@ -1,6 +0,0 @@
-Shen-mode provides functionality for working with the shen programming
-language.  This includes both a major mode `shen-mode' and an inferior
-Shen mode (`run-shen') for evaluating shen code in a comint buffer or
-from a buffer of Shen source code.
-
-For information on shen see http://www.shenlanguage.org/.
\ No newline at end of file
diff --git a/packages/shen-mode/inf-shen.el b/packages/shen-mode/inf-shen.el
deleted file mode 100644
index 9ecc627..0000000
--- a/packages/shen-mode/inf-shen.el
+++ /dev/null
@@ -1,590 +0,0 @@
-;;; inferior-shen-mode --- an inferior-shen mode
-
-;; Copyright (C) 2011-2014 Free Software Foundation, Inc.
-
-;; Authors: Michael Ilseman, Eric Schulte <schulte.eric@gmail.com>
-;; Version: 0.1
-;; Keywords: languages, shen, comint
-;; Description: A major mode for editing shen source code
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; This file defines an inferior Shen mode.
-
-;;; Code:
-(require 'comint)
-(require 'shen-mode)
-
-;;;###autoload
-(defvar inferior-shen-filter-regexp "\\`\\s *\\(:\\(\\w\\|\\s_\\)\\)?\\s *\\'"
-  "*What not to save on inferior Shen's input history.
-Input matching this regexp is not saved on the input history in Inferior Shen
-mode.  Default is whitespace followed by 0 or 1 single-letter colon-keyword
-\(as in :a, :c, etc.)")
-
-(defvar inferior-shen-mode-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map comint-mode-map)
-    ;; (set-keymap-parent inferior-shen-mode-map shen-mode-shared-map)
-    (define-key map "\C-x\C-e" 'shen-eval-last-sexp)
-    (define-key map "\C-c\C-l" 'shen-load-file)
-    (define-key map "\C-c\C-k" 'shen-compile-file)
-    (define-key map "\C-c\C-a" 'shen-show-arglist)
-    (define-key map "\C-c\C-d" 'shen-describe-sym)
-    (define-key map "\C-c\C-f" 'shen-show-function-documentation)
-    (define-key map "\C-c\C-v" 'shen-show-variable-documentation)
-    map))
-
-;; These commands augment Shen mode, so you can process Shen code in
-;; the source files.
-(define-key shen-mode-map "\M-\C-x"  'shen-eval-defun)     ; Gnu convention
-(define-key shen-mode-map "\C-x\C-e" 'shen-eval-last-sexp) ; Gnu convention
-(define-key shen-mode-map "\C-c\C-e" 'shen-eval-defun)
-(define-key shen-mode-map "\C-c\C-r" 'shen-eval-region)
-(define-key shen-mode-map "\C-c\C-c" 'shen-compile-defun)
-(define-key shen-mode-map "\C-c\C-z" 'switch-to-shen)
-(define-key shen-mode-map "\C-c\C-l" 'shen-load-file)
-(define-key shen-mode-map "\C-c\C-k" 'shen-compile-file)  ; "kompile" file
-(define-key shen-mode-map "\C-c\C-a" 'shen-show-arglist)
-(define-key shen-mode-map "\C-c\C-d" 'shen-describe-sym)
-(define-key shen-mode-map "\C-c\C-f" 'shen-show-function-documentation)
-(define-key shen-mode-map "\C-c\C-v" 'shen-show-variable-documentation)
-
-
-;; This function exists for backwards compatibility.
-;; Previous versions of this package bound commands to C-c <letter>
-;; bindings, which is not allowed by the gnumacs standard.
-
-;;  "This function binds many inferior-shen commands to C-c <letter> bindings,
-;;where they are more accessible. C-c <letter> bindings are reserved for the
-;;user, so these bindings are non-standard. If you want them, you should
-;;have this function called by the inferior-shen-load-hook:
-;;    (setq inferior-shen-load-hook '(inferior-shen-install-letter-bindings))
-;;You can modify this function to install just the bindings you want."
-(defun inferior-shen-install-letter-bindings ()
-  (define-key shen-mode-map "\C-ce" 'shen-eval-defun-and-go)
-  (define-key shen-mode-map "\C-cr" 'shen-eval-region-and-go)
-  (define-key shen-mode-map "\C-cc" 'shen-compile-defun-and-go)
-  (define-key shen-mode-map "\C-cz" 'switch-to-shen)
-  (define-key shen-mode-map "\C-cl" 'shen-load-file)
-  (define-key shen-mode-map "\C-ck" 'shen-compile-file)
-  (define-key shen-mode-map "\C-ca" 'shen-show-arglist)
-  (define-key shen-mode-map "\C-cd" 'shen-describe-sym)
-  (define-key shen-mode-map "\C-cf" 'shen-show-function-documentation)
-  (define-key shen-mode-map "\C-cv" 'shen-show-variable-documentation)
-
-  (define-key inferior-shen-mode-map "\C-cl" 'shen-load-file)
-  (define-key inferior-shen-mode-map "\C-ck" 'shen-compile-file)
-  (define-key inferior-shen-mode-map "\C-ca" 'shen-show-arglist)
-  (define-key inferior-shen-mode-map "\C-cd" 'shen-describe-sym)
-  (define-key inferior-shen-mode-map "\C-cf" 'shen-show-function-documentation)
-  (define-key inferior-shen-mode-map "\C-cv"
-    'shen-show-variable-documentation))
-
-
-(defvar inferior-shen-program "shen"
-  "*Program name for invoking an inferior Shen with for Inferior Shen mode.")
-
-(defvar inferior-shen-load-command "(load \"%s\")\n"
-  "*Format-string for building a Shen expression to load a file.
-This format string should use `%s' to substitute a file name
-and should result in a Shen expression that will command the inferior Shen
-to load that file.  The default works acceptably on most Shens.
-The string \"(progn (load \\\"%s\\\" :verbose nil :print t) (values))\\n\"
-produces cosmetically superior output for this application,
-but it works only in Common Shen.")
-
-(defvar inferior-shen-prompt "^[^> \n]*>+:? *"
-  "Regexp to recognise prompts in the Inferior Shen mode.
-Defaults to \"^[^> \\n]*>+:? *\", which works pretty good for Lucid, kcl,
-and franz.  This variable is used to initialize `comint-prompt-regexp' in the
-Inferior Shen buffer.
-
-This variable is only used if the variable `comint-use-prompt-regexp'
-is non-nil.
-
-More precise choices:
-Lucid Common Shen: \"^\\\\(>\\\\|\\\\(->\\\\)+\\\\) *\"
-franz: \"^\\\\(->\\\\|<[0-9]*>:\\\\) *\"
-kcl: \"^>+ *\"
-
-This is a fine thing to set in your .emacs file.")
-
-(defvar inferior-shen-buffer nil "*The current inferior-shen process buffer.
-
-MULTIPLE PROCESS SUPPORT
-===========================================================================
-To run multiple Shen processes, you start the first up
-with \\[inferior-shen].  It will be in a buffer named `*inferior-shen*'.
-Rename this buffer with \\[rename-buffer].  You may now start up a new
-process with another \\[inferior-shen].  It will be in a new buffer,
-named `*inferior-shen*'.  You can switch between the different process
-buffers with \\[switch-to-buffer].
-
-Commands that send text from source buffers to Shen processes --
-like `shen-eval-defun' or `shen-show-arglist' -- have to choose a process
-to send to, when you have more than one Shen process around.  This
-is determined by the global variable `inferior-shen-buffer'.  Suppose you
-have three inferior Shens running:
-    Buffer              Process
-    foo                 inferior-shen
-    bar                 inferior-shen<2>
-    *inferior-shen*     inferior-shen<3>
-If you do a \\[shen-eval-defun] command on some Shen source code,
-what process do you send it to?
-
-- If you're in a process buffer (foo, bar, or *inferior-shen*),
-  you send it to that process.
-- If you're in some other buffer (e.g., a source file), you
-  send it to the process attached to buffer `inferior-shen-buffer'.
-This process selection is performed by function `inferior-shen-proc'.
-
-Whenever \\[inferior-shen] fires up a new process, it resets
-`inferior-shen-buffer' to be the new process's buffer.  If you only run
-one process, this does the right thing.  If you run multiple
-processes, you can change `inferior-shen-buffer' to another process
-buffer with \\[set-variable].")
-
-(defvar inferior-shen-mode-hook '()
-  "*Hook for customising Inferior Shen mode.")
-
-(put 'inferior-shen-mode 'mode-class 'special)
-
-(define-derived-mode inferior-shen-mode comint-mode "Inferior Shen"
-  "Major mode for interacting with an inferior Shen process.
-Runs a Shen interpreter as a subprocess of Emacs, with Shen I/O through an
-Emacs buffer.  Variable `inferior-shen-program' controls which Shen interpreter
-is run.  Variables `inferior-shen-prompt', `inferior-shen-filter-regexp' and
-`inferior-shen-load-command' can customize this mode for different Shen
-interpreters.
-
-For information on running multiple processes in multiple buffers, see
-documentation for variable `inferior-shen-buffer'.
-
-\\{inferior-shen-mode-map}
-
-Customisation: Entry to this mode runs the hooks on `comint-mode-hook' and
-`inferior-shen-mode-hook' (in that order).
-
-You can send text to the inferior Shen process from other buffers containing
-Shen source.
-    switch-to-shen switches the current buffer to the Shen process buffer.
-    shen-eval-defun sends the current defun to the Shen process.
-    shen-compile-defun compiles the current defun.
-    shen-eval-region sends the current region to the Shen process.
-    shen-compile-region compiles the current region.
-
-    Prefixing the shen-eval/compile-defun/region commands with
-    a \\[universal-argument] causes a switch to the Shen process buffer after 
sending
-    the text.
-
-Commands:
-Return after the end of the process' output sends the text from the
-    end of process to point.
-Return before the end of the process' output copies the sexp ending at point
-    to the end of the process' output, and sends it.
-Delete converts tabs to spaces as it moves back.
-Tab indents for Shen; with argument, shifts rest
-    of expression rigidly with the current line.
-C-M-q does Tab on each line starting within following expression.
-Paragraphs are separated only by blank lines.  Semicolons start comments.
-If you accidentally suspend your process, use \\[comint-continue-subjob]
-to continue it."
-  (set (make-local-variable 'font-lock-defaults) '(shen-font-lock-keywords))
-  (setq comint-prompt-regexp inferior-shen-prompt)
-  (setq mode-line-process '(":%s"))
-
-  (setq comint-get-old-input (function shen-get-old-input))
-  (setq comint-input-filter (function shen-input-filter)))
-
-(defun shen-get-old-input ()
-  "Return a string containing the sexp ending at point."
-  (save-excursion
-    (let ((end (point)))
-      (backward-sexp)
-      (buffer-substring (point) end))))
-
-(defun shen-input-filter (str)
-  "t if STR does not match `inferior-shen-filter-regexp'."
-  (not (string-match inferior-shen-filter-regexp str)))
-
-;;;###autoload
-(defun inferior-shen (cmd)
-  "Run an inferior Shen process, input and output via buffer `*inferior-shen*'.
-If there is a process already running in `*inferior-shen*', just switch
-to that buffer.
-With argument, allows you to edit the command line (default is value
-of `inferior-shen-program').  Runs the hooks from
-`inferior-shen-mode-hook' (after the `comint-mode-hook' is run).
-\(Type \\[describe-mode] in the process buffer for a list of commands.)"
-  (interactive (list (if current-prefix-arg
-                        (read-string "Run shen: " inferior-shen-program)
-                      inferior-shen-program)))
-  (if (not (comint-check-proc "*inferior-shen*"))
-      (let ((cmdlist (split-string cmd)))
-       (set-buffer (apply (function make-comint)
-                          "inferior-shen" (car cmdlist) nil (cdr cmdlist)))
-       (inferior-shen-mode)))
-  (setq inferior-shen-buffer "*inferior-shen*")
-  (pop-to-buffer "*inferior-shen*"))
-;;;###autoload (add-hook 'same-window-buffer-names "*inferior-shen*")
-
-;;;###autoload
-(defalias 'run-shen 'inferior-shen)
-
-(defcustom shen-pre-eval-hook '()
-  "Hook to run on code before sending it to the inferior-shen-process.
-Functions on this hook will be called with an active region
-containing the shen source code about to be evaluated.")
-
-(defun shen-remember-functions (start end)
-  "Add functions defined between START and END to `shen-functions'."
-  (interactive "r")
-  (let ((clean (lambda (text)
-                 (when text
-                   (set-text-properties 0 (length text) nil text) text))))
-    (save-excursion
-      (goto-char start)
-      (let ((re (concat
-                 "^(define[ \t]+\\(.+\\)[\n\r]" ; function name
-                 "\\([ \t]*\\\\\\*[ \t]*\\([^\000]+?\\)[ \t]*\\*\\\\\\)?" ; doc
-                 "[\n\r]?[ \t]*\\({\\(.+\\)}\\)?"))) ; type
-        (while (re-search-forward re end t)
-          (let ((name (intern (match-string 1)))
-                (doc (funcall clean (match-string 3)))
-                (type (funcall clean (match-string 5))))
-            (add-to-list 'shen-functions (list name type doc))))))))
-
-(add-hook 'shen-pre-eval-hook #'shen-remember-functions)
-
-(defun check-balanced-parens (start end)
-  "Check if parentheses in the region are balanced."
-  (save-restriction (save-excursion
-    (let ((deactivate-mark nil))
-      (condition-case _
-          (progn (narrow-to-region start end) (goto-char (point-min))
-                 (while (/= 0 (- (point) (forward-list)))) t)
-          (scan-error (signal 'scan-error '("Parentheses not balanced."))))))))
-
-(add-hook 'shen-pre-eval-hook
-          (lambda (start end)
-            (condition-case err (check-balanced-parens start end)
-              (error (unless (y-or-n-p (format "%s Eval anyway ?"
-                                               (error-message-string err)))
-                       (signal 'scan-error err))))))
-
-(defun shen-eval-region (start end &optional and-go)
-  "Send the current region to the inferior Shen process.
-Prefix argument means switch to the Shen buffer afterwards."
-  (interactive "r\nP")
-  (let ((before-input (marker-position (process-mark (inferior-shen-proc))))
-        result)
-
-    (run-hook-with-args 'shen-pre-eval-hook start end)
-    (comint-send-region (inferior-shen-proc) start end)
-    (comint-send-string (inferior-shen-proc) "\n")
-    (accept-process-output (inferior-shen-proc))
-    (sit-for 0)
-    (with-current-buffer inferior-shen-buffer
-      (goto-char before-input)
-      (setq result (buffer-substring (point) (point-at-eol)))
-      (message "%s" result)
-      (goto-char (process-mark (inferior-shen-proc))))
-    (if and-go (switch-to-shen t))
-    result))
-
-(defun shen-eval-defun (&optional and-go)
-  "Send the current defun to the inferior Shen process.
-Prefix argument means switch to the Shen buffer afterwards."
-  (interactive "P")
-  (let (result)
-    (save-excursion
-      (end-of-defun)
-      (skip-chars-backward " \t\n\r\f") ;  Makes allegro happy
-      (let ((end (point)))
-        (beginning-of-defun)
-        (setq result (shen-eval-region (point) end))))
-    (if and-go (switch-to-shen t))
-    result))
-
-(defun shen-eval-last-sexp (&optional and-go)
-  "Send the previous sexp to the inferior Shen process.
-Prefix argument means switch to the Shen buffer afterwards."
-  (interactive "P")
-  (shen-eval-region (save-excursion (backward-sexp) (point)) (point) and-go))
-
-;;; Common Shen COMPILE sux.
-(defun shen-compile-region (start end &optional and-go)
-  "Compile the current region in the inferior Shen process.
-Prefix argument means switch to the Shen buffer afterwards."
-  (interactive "r\nP")
-  (comint-send-string
-   (inferior-shen-proc)
-   (format "(funcall (compile nil `(lambda () (progn 'compile %s))))\n"
-          (buffer-substring start end)))
-  (if and-go (switch-to-shen t)))
-
-(defun shen-compile-defun (&optional and-go)
-  "Compile the current defun in the inferior Shen process.
-Prefix argument means switch to the Shen buffer afterwards."
-  (interactive "P")
-  (save-excursion
-    (end-of-defun)
-    (skip-chars-backward " \t\n\r\f") ;  Makes allegro happy
-    (let ((e (point)))
-      (beginning-of-defun)
-      (shen-compile-region (point) e)))
-  (if and-go (switch-to-shen t)))
-
-(defun switch-to-shen (eob-p)
-  "Switch to the inferior Shen process buffer.
-With argument, positions cursor at end of buffer."
-  (interactive "P")
-  (if (get-buffer-process inferior-shen-buffer)
-      (let ((pop-up-frames
-            ;; Be willing to use another frame
-            ;; that already has the window in it.
-            (or pop-up-frames
-                (get-buffer-window inferior-shen-buffer t))))
-       (pop-to-buffer inferior-shen-buffer))
-      (run-shen inferior-shen-program))
-  (when eob-p
-        (push-mark)
-    (goto-char (point-max))))
-
-
-;; Now that shen-compile/eval-defun/region takes an optional prefix arg,
-;; these commands are redundant. But they are kept around for the user
-;; to bind if he wishes, for backwards functionality, and because it's
-;; easier to type C-c e than C-u C-c C-e.
-(defun shen-eval-region-and-go (start end)
-  "Send the current region to the inferior Shen, and switch to its buffer."
-  (interactive "r")
-  (shen-eval-region start end t))
-
-(defun shen-eval-defun-and-go ()
-  "Send the current defun to the inferior Shen, and switch to its buffer."
-  (interactive)
-  (shen-eval-defun t))
-
-(defun shen-compile-region-and-go (start end)
-  "Compile the current region in the inferior Shen, and switch to its buffer."
-  (interactive "r")
-  (shen-compile-region start end t))
-
-(defun shen-compile-defun-and-go ()
-  "Compile the current defun in the inferior Shen, and switch to its buffer."
-  (interactive)
-  (shen-compile-defun t))
-
-;; A version of the form in H. Shevis' soar-mode.el package. Less robust.
-;; (defun shen-compile-sexp (start end)
-;;   "Compile the s-expression bounded by START and END in the inferior shen.
-;; If the sexp isn't a DEFUN form, it is evaluated instead."
-;;   (cond ((looking-at "(defun\\s +")
-;;      (goto-char (match-end 0))
-;;      (let ((name-start (point)))
-;;        (forward-sexp 1)
-;;        (process-send-string "inferior-shen"
-;;                             (format "(compile '%s #'(lambda "
-;;                                     (buffer-substring name-start
-;;                                                       (point)))))
-;;      (let ((body-start (point)))
-;;        (goto-char start) (forward-sexp 1) ; Can't use end-of-defun.
-;;        (process-send-region "inferior-shen"
-;;                             (buffer-substring body-start (point))))
-;;      (process-send-string "inferior-shen" ")\n"))
-;;     (t (shen-eval-region start end)))))
-;;
-;; (defun shen-compile-region (start end)
-;;   "Each s-expression in the current region is compiled (if a DEFUN)
-;; or evaluated (if not) in the inferior shen."
-;;   (interactive "r")
-;;   (save-excursion
-;;     (goto-char start) (end-of-defun) (beginning-of-defun) ; error check
-;;     (if (< (point) start) (error "region begins in middle of defun"))
-;;     (goto-char start)
-;;     (let ((s start))
-;;       (end-of-defun)
-;;       (while (<= (point) end) ; Zip through
-;;     (shen-compile-sexp s (point)) ; compiling up defun-sized chunks.
-;;     (setq s (point))
-;;     (end-of-defun))
-;;       (if (< s end) (shen-compile-sexp s end)))))
-;;
-;; End of HS-style code
-
-
-(defvar shen-prev-l/c-dir/file nil
-  "Record last directory and file used in loading or compiling.
-This holds a cons cell of the form (DIRECTORY . FILE)
-describing the last `shen-load-file' or `shen-compile-file' command.")
-
-(defvar shen-source-modes '(shen-mode)
-  "*Used to determine if a buffer contains Shen source code.
-If it's loaded into a buffer that is in one of these major modes, it's
-considered a Shen source file by `shen-load-file' and `shen-compile-file'.
-Used by these commands to determine defaults.")
-
-(defun shen-load-file (file-name)
-  "Load a Shen file into the inferior Shen process."
-  (interactive (comint-get-source "Load Shen file: " shen-prev-l/c-dir/file
-                                 shen-source-modes nil)) ; NIL because LOAD
-                                       ; doesn't need an exact name
-  (comint-check-source file-name) ; Check to see if buffer needs saved.
-  (setq shen-prev-l/c-dir/file (cons (file-name-directory    file-name)
-                                    (file-name-nondirectory file-name)))
-  (comint-send-string (inferior-shen-proc)
-                     (format inferior-shen-load-command file-name))
-  (switch-to-shen t))
-
-
-(defun shen-compile-file (file-name)
-  "Compile a Shen file in the inferior Shen process."
-  (interactive (comint-get-source "Compile Shen file: " shen-prev-l/c-dir/file
-                                 shen-source-modes nil)) ; NIL = don't need
-                                       ; suffix .shen
-  (comint-check-source file-name) ; Check to see if buffer needs saved.
-  (setq shen-prev-l/c-dir/file (cons (file-name-directory    file-name)
-                                    (file-name-nondirectory file-name)))
-  (comint-send-string (inferior-shen-proc) (concat "(compile-file \""
-                                                  file-name
-                                                  "\"\)\n"))
-  (switch-to-shen t))
-
-
-
-;;; Documentation functions: function doc, var doc, arglist, and
-;;; describe symbol.
-;;; ===========================================================================
-
-;;; Command strings
-;;; ===============
-
-(defvar shen-function-doc-command
-  "(let ((fn '%s))
-     (format t \"Documentation for ~a:~&~a\"
-            fn (documentation fn 'function))
-     (values))\n"
-  "Command to query inferior Shen for a function's documentation.")
-
-(defvar shen-var-doc-command
-  "(let ((v '%s))
-     (format t \"Documentation for ~a:~&~a\"
-            v (documentation v 'variable))
-     (values))\n"
-  "Command to query inferior Shen for a variable's documentation.")
-
-(defvar shen-arglist-command
-  "(let ((fn '%s))
-     (format t \"Arglist for ~a: ~a\" fn (arglist fn))
-     (values))\n"
-  "Command to query inferior Shen for a function's arglist.")
-
-(defvar shen-describe-sym-command
-  "(describe '%s)\n"
-  "Command to query inferior Shen for a variable's documentation.")
-
-
-;;; Ancillary functions
-;;; ===================
-
-(defun shen-symprompt (prompt default)
-  "Read a string from the user."
-  (list (let* ((prompt (if default
-                          (format "%s (default %s): " prompt default)
-                        (concat prompt ": ")))
-              (ans (read-string prompt)))
-         (if (zerop (length ans)) default ans))))
-
-
-;; Adapted from function-called-at-point in help.el.
-(defun shen-fn-called-at-pt ()
-  "Return the name of the function called in the current call.
-The value is nil if it can't find one."
-  (condition-case nil
-      (save-excursion
-       (save-restriction
-         (narrow-to-region (max (point-min) (- (point) 1000)) (point-max))
-         (backward-up-list 1)
-         (forward-char 1)
-         (let ((obj (read (current-buffer))))
-           (and (symbolp obj) obj))))
-    (error nil)))
-
-
-;; Adapted from variable-at-point in help.el.
-(defun shen-var-at-pt ()
-  (condition-case ()
-      (save-excursion
-       (forward-sexp -1)
-       (skip-chars-forward "'")
-       (let ((obj (read (current-buffer))))
-         (and (symbolp obj) obj)))
-    (error nil)))
-
-
-;;; Documentation functions: fn and var doc, arglist, and symbol describe.
-;;; ======================================================================
-(defun shen-show-function-documentation (fn)
-  "Send a command to the inferior Shen to give documentation for function FN.
-See variable `shen-function-doc-command'."
-  (interactive (shen-symprompt "Function doc" (shen-fn-called-at-pt)))
-  (comint-proc-query (inferior-shen-proc)
-                    (format shen-function-doc-command fn)))
-
-(defun shen-show-variable-documentation (var)
-  "Send a command to the inferior Shen to give documentation for function FN.
-See variable `shen-var-doc-command'."
-  (interactive (shen-symprompt "Variable doc" (shen-var-at-pt)))
-  (comint-proc-query (inferior-shen-proc) (format shen-var-doc-command var)))
-
-(defun shen-show-arglist (fn)
-  "Send a query to the inferior Shen for the arglist for function FN.
-See variable `shen-arglist-command'."
-  (interactive (shen-symprompt "Arglist" (shen-fn-called-at-pt)))
-  (comint-proc-query (inferior-shen-proc) (format shen-arglist-command fn)))
-
-(defun shen-describe-sym (sym)
-  "Send a command to the inferior Shen to describe symbol SYM.
-See variable `shen-describe-sym-command'."
-  (interactive (shen-symprompt "Describe" (shen-var-at-pt)))
-  (comint-proc-query (inferior-shen-proc)
-                    (format shen-describe-sym-command sym)))
-
-
-;;  "Returns the current inferior Shen process.
-;; See variable `inferior-shen-buffer'."
-(defun inferior-shen-proc ()
-  (let ((proc (get-buffer-process (if (eq major-mode 'inferior-shen-mode)
-                                     (current-buffer)
-                                   inferior-shen-buffer))))
-    (or proc
-       (error "No Shen subprocess; see variable `inferior-shen-buffer'"))))
-
-
-;;; Do the user's customisation...
-;;;===============================
-(defvar inferior-shen-load-hook nil
-  "This hook is run when the library `inf-shen' is loaded.
-This is a good place to put keybindings.")
-
-(run-hooks 'inferior-shen-load-hook)
-
-(provide 'inf-shen)
-;;; inf-shen.el ends here
diff --git a/packages/shen-mode/shen-mode.el b/packages/shen-mode/shen-mode.el
deleted file mode 100644
index 7817de9..0000000
--- a/packages/shen-mode/shen-mode.el
+++ /dev/null
@@ -1,432 +0,0 @@
-;;; shen-mode.el --- A major mode for editing shen source code
-
-;; Copyright (C) 2011-2020 Free Software Foundation, Inc.
-
-;; Author: Eric Schulte <schulte.eric@gmail.com>
-;; Version: 0.1
-;; Keywords: languages, shen
-;; Description: A major mode for editing shen source code
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; 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
-
-;;; Code:
-
-(require 'lisp-mode)
-(require 'imenu)
-
-(defcustom shen-mode-hook '(turn-on-eldoc-mode)
-  "Normal hook run when entering `shen-mode'."
-  :type 'hook
-  :group 'shen)
-
-(defvar shen-mode-map
-  (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map lisp-mode-shared-map)
-    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.")
-    (- "number --> number --> number" "Number subtraction.")
-    (/ "number --> number --> number" "Number division.")
-    (/. "_" "Abstraction builder, receives a variable and an expression; does 
the job of --> in the lambda calculus.")
-    (< "number --> number --> boolean" "Less than.")
-    (<-vector nil nil)
-    (<= "number --> number --> boolean" "Less than or equal to.")
-    (<e> nil nil)
-    (= "A --> A --> boolean" "Equal to.")
-    (== "A --> B --> boolean" "Equal to.")
-    (> "number --> number --> boolean" "Greater than.")
-    (>= "number --> number --> boolean" "Greater than or equal to.")
-    (@p "_" "Takes two inputs and forms an ordered pair.")
-    (@s "_" "Takes two or more inputs and forms a string.")
-    (@v "_" "Takes two or more inputs and forms a vector.")
-    (abort nil "throw a simple error")
-    (adjoin nil "add arg1 to list arg2 if not already a member")
-    (and "boolean --> boolean --> boolean" "Boolean and.")
-    (append "(list A) --> (list A) --> (list A)" "Appends two lists into one 
list.")
-    (apply "(A --> B) --> (A --> B)" "Applies a function to an input.")
-    (arity nil nil)
-    (assoc nil nil)
-    (assoc-type "symbol --> variable --> symbol" "Associates a Qi type (first 
input) with  Lisp type (second input)..")
-    (average nil "return the average of two numbers")
-    (bind nil nil)
-    (boolean\? "A --> boolean" "Recognisor for booleans.")
-    (bound\? nil "check is a symbol is bound")
-    (byte->string nil "return the string represented by bytes")
-    (call nil nil)
-    (cd "string --> string" "Changes the home directory. (cd \"My Programs\") 
will cause (load \"hello_world.txt\") to load MyPrograms/hello_world.txt.   (cd 
\"\")  is the default.")
-    (character\? "A --> boolean" "Recognisor for characters.")
-    (compile nil nil)
-    (complex\? "A --> boolean" "Recognisor for complex numbers.")
-    (concat "symbol --> symbol --> symbol" "Concatenates two symbols.")
-    (congruent\? "A --> A --> boolean" "Retrns true if objects are identical 
or else if they are strings or characters which are identical differing at most 
in case or numbers of equal value (e.g. 1 and 1.0) or tuples composed of 
congruent elements.")
-    (cons "_" "A special form that takes an object e of type A and a list l of 
type (list A) and produces a list of type (list A) by adding e to the front of  
l.")
-    (cons\? "--> boolean" "Returns true iff the input is a non-empty list.")
-    (core nil nil)
-    (cut nil nil)
-    (debug "A --> string" "The input is ignored and debugging is returned; but 
all terminal output is echoed to the file debug.txt until the undebug function 
is executed.")
-    (declare "_" "Takes a function name f and a type t expressed as a list and 
gives f the type t.")
-    (define "_" "Define a function, takes a name, an optional type and a 
pattern matching body.")
-    (delete-file "string --> string" "The file named in the string is deleted 
and the string returned.")
-    (destroy "_" "Receives the name of a function and removes it and its type 
from the environment.")
-    (difference "(list A) --> (list A) --> (list A)" "Subtracts the elements 
of the second list from the first")
-    (do "_" "A special form: receives n well-typed expressions and evaluates 
each one, returning the normal form of the last one.")
-    (dump "string --> string" "Dumps all user-generated Lisp from the file f 
denoted by the argument into a file f.lsp.")
-    (echo "string --> string" "Echoes all terminal input/output to a file 
named by string (which is either appended to if it exists or created if not) 
until the command (echo \"\") is received which switches echo off.")
-    (element\? "A -> (list A) --> boolean" "Returns true iff the first input 
is an element in the second.")
-    (empty\? "--> boolean" "Returns true iff the input is [].")
-    (error "_" "A special form: takes a string followed by n (n --> 0) 
expressions. Prints error string.")
-    (eval "_" "Evaluates the input.")
-    (explode "A --> (list character)" "Explodes an object to a list of 
characters.")
-    (fail nil nil)
-    (fix "(A --> A) --> (A --> A)" "Applies a function to generate a 
fixpoint.")
-    (float\? "A --> boolean" "Recognisor for floating point numbers.")
-    (floor nil nil)
-    (format nil "takes a stream, a format string and args, formats and prints 
to the stream")
-    (freeze "A --> (lazy A)" "Returns a frozen version of its input.")
-    (fst "(A * B) --> A" "Returns the first element of a tuple.")
-    (fwhen nil nil)
-    (gensym "_" "Generates a fresh symbol or variable from a string..")
-    (get nil "gets property arg2 from object arg1")
-    (get-array "(array A) --> (list number) --> A --> A" "3-place function 
that takes an array of elements of type A, an index to that array as a list of 
natural numbers and an expression E of type A.  If an object is stored at the 
index, then it is returned, otherwise the normal form of E is returned.")
-    (get-prop "_" "3-place function that takes a symbol S, a pointer P (which 
can be a string, symbol or number), and an expression E of any kind and returns 
the value pointed by P from S  (if one exists) or the normal form of E 
otherwise.")
-    (hash nil "hash an object")
-    (hdv nil nil)
-    (head "(list A) --> A" "Returns the first element of a list.")
-    (identical nil nil)
-    (if "boolean --> A --> A" "takes a boolean b and two expressions x and y 
and evaluates x if b evaluates to true and evaluates y if b evaluates to 
false.")
-    (if-with-checking "string --> (list A)" "If type checking is enabled, 
raises the string as an error otherwise returns the empty list..")
-    (if-without-checking "string --> (list A)" "If type checking is disabled, 
raises the string as an error otherwise returns the empty list.")
-    (include "(list symbol) --> (list symbol)" "Includes the datatype theories 
or synonyms for use in type checking.")
-    (include-all-but "(list symbol) --> (list symbol)" "Includes all loaded 
datatype theories and synonyms for use in type checking apart from those 
entered.")
-    (inferences "A --> number" "The input is ignored. Returns the number of 
logical inferences executed since the last call to the top level.")
-    (input "_" "0-place function. Takes a user input i and returns the normal 
form of i.")
-    (input+ "_" "Special form. Takes inputs of the form : <expr>. Where 
d(<expr>) is the type denoted by the choice of expression (e.g. \"number\" 
denotes the type number). Takes a user input i and returns the normal form of i 
given i is of the type d(<expr>).")
-    (integer\? "A --> boolean" "Recognisor for integers.")
-    (interror nil nil)
-    (intersection "(list A) --> (list A) --> (list A)" "Computes the 
intersection of two lists.")
-    (intmake-string nil nil)
-    (intoutput nil nil)
-    (lambda "_" "Lambda operator from lambda calculus.")
-    (length "(list A) --> integer" "Returns the number of elements in a list.")
-    (let nil nil)
-    (limit nil nil)
-    (lineread "_" "Top level reader of read-evaluate-print loop. Reads 
elements into a list.  lineread terminates with carriage return when brackets 
are balanced.  ^ aborts lineread.")
-    (list "A .. A --> (list A)" "A special form. Assembles n (n  --> 0) inputs 
into a list.")
-    (load "string --> symbol" "Takes a file name and loads the file, returning 
loaded as a symbol.")
-    (macroexpand nil nil)
-    (make-string "string A1 - An --> string" "A special form: takes a string 
followed by n (n --> 0) well-typed expressions; assembles and returns a 
string.")
-    (map "(A --> B) --> (list A) --> (list B)" "The first input is applied to 
each member of the second input and the results consed into one list..")
-    (mapcan "(A --> (list B)) --> (list A) --> (list B)" "The first input is 
applied to each member of the second input and the results appended into one 
list.")
-    (maxinferences "number --> number" "Returns the input and as a 
side-effect, sets a global variable to a number that limits the maximum number 
of inferences that can be expended on attempting to typecheck a program.  The 
default is 1,000,000.")
-    (mod nil "arg1 mod arg2")
-    (newsym "symbol --> symbol" "Generates a fresh symbol from a symbol.")
-    (newvar "variable --> variable" "Generates a fresh variable from a 
variable")
-    (nl nil nil)
-    (not "boolean --> boolean" "Boolean not.")
-    (nth "number --> (list A) --> A" "Gets the nth element of a list numbered 
from 1.")
-    (number\? "A --> boolean" "Recognisor for numbers.")
-    (occurences "A --> B --> number" "Returns the number of times the first 
argument occurs in the second.")
-    (occurrences nil "returns the number of occurrences of arg1 in arg2")
-    (occurs-check "symbol --> boolean" "Receives either + or - and 
enables/disables occur checking in Prolog,    datatype definitions and rule 
closures.   The default is +.")
-    (opaque "symbol --> symbol" "Applied to a Lisp macro makes it opaque to 
Qi.")
-    (or "boolean -->  (boolean --> boolean)" "Boolean or.")
-    (output "string A1 - An --> string" "A special form: takes a string 
followed by n (n --> 0) well-typed expressions; prints a message to the screen 
and returns an object of type string (the string \"done\").")
-    (preclude "(list symbol) --> (list symbol)" "Removes the mentioned 
datatype theories and synonyms from use in type checking.")
-    (preclude-all-but "(list symbol) --> (list symbol)" "Removes all the 
datatype theories and synonyms from use in type checking apart from the ones 
given.")
-    (print "A --> A" "Takes an object and prints it, returning it as a 
result.")
-    (profile "(A --> B) --> (A --> B)" "Takes a function represented by a 
function name and inserts profiling code returning the function as an output.")
-    (profile-results "A --> symbol" "The input is ignored.  Returns a list of 
profiled functions and their     timings since  profile-results was last used.")
-    (ps "_" "Receives a symbol  denoting a Qi function and prints the Lisp 
source    code associated with the function.")
-    (put nil "puts value of arg3 as property arg2 in object arg1")
-    (put-array "(array A) --> (list number) --> A --> A" "3-place function 
that takes an array of elements of type A, an index to that array as a list of 
natural numbers and an expression E of type A.  The normal form of E is stored 
at that index and then returned.")
-    (put-prop "_" "3-place function that takes a symbol S, a pointer P (a 
string symbol or number), and an expression E. The pointer P is set to point 
from S to the normal form of E which is then returned.")
-    (quit "_" "0-place function that exits Qi.")
-    (random "number --> number" "Given a positive number n, generates a random 
number between 0 and    n-1.")
-    (rational\? "A --> boolean" "Recognisor for rational numbers.")
-    (read nil nil)
-    (read-char "A --> character" "The input is discarded and the character 
typed by the user is returned.")
-    (read-chars-as-stringlist "(list character) --> (character -->  boolean) 
-->  (list string)" "Returns a list of strings whose components are taken from 
the character list. The second input acts as a tokeniser.  Thus 
(read-chars-as-stringlist [#\\H #\\i #\\Space #\\P #\\a #\\t]  (/. X (= X 
#\\Space))) will produce [\"Hi\" \"Pat\"].")
-    (read-file "string --> (list unit)" "Returns the contents of an ASCII file 
designated by a string.  Returns a list of units,  where unit is an unspecified 
type.")
-    (read-file-as-charlist "string --> (list character)" "Returns the list of 
characters from the contents of an ASCII file designated by a string.")
-    (read-file-as-string nil nil)
-    (real\? "A --> boolean" "Recognisor for real numbers.")
-    (remove "A --> (list A) --> (list A)" "Removes all occurrences of an 
element from a list.")
-    (return nil nil)
-    (reverse "(list A)--> ?(list A)" "Reverses a list.")
-    (round "number--> ?number" "Rounds a number.")
-    (save "_" "0 place function. Saves a Qi image.")
-    (snd "(A * B) --> B" "Returns the second element of a tuple.")
-    (specialise "symbol --> symbol" "Receives the name of a function and turns 
it into a special form. Special forms are not curried during evaluation or 
compilation.")
-    (speed "number --> number" "Receives a value 0 to 3 and sets the 
performance of the generated Lisp code, returning its input.  0 is the lowest 
setting.")
-    (spy "symbol --> boolean" "Receives either + or - and respectively 
enables/disables tracing the    operation of T*.")
-    (sqrt "number --> number" "Returns the square root of a number.")
-    (step "symbol --> boolean" "Receives either + or - and enables/disables 
stepping in the trace.")
-    (stinput nil nil)
-    (string\? "A --> boolean" "Recognisor for strings.")
-    (strong-warning "symbol --> boolean" "Takes + or -; if + then warnings are 
treated as error messages.")
-    (subst nil nil)
-    (sugar "symbol --> (A --> B) --> number --> (A --> B)" "Receives either in 
or out as first argument, a function f and an integer    greater than 0 and 
returns f as a result.  The function f is placed on the    sugaring list at a 
position determined by the number.")
-    (sugar-list "symbol --> (list symbol)" "Receives either in or out as first 
argument, and returns the list of sugar    functions.")
-    (sum nil "sum a list of numbers")
-    (symbol\? "A --> boolean" "Recognisor for symbols.")
-    (systemf nil nil)
-    (tail "(list A) --> (list A)" "Returns all but the first element of a 
non-empty list.")
-    (tc "symbol --> boolean" "Receives either + or - and respectively 
enables/disables static typing.")
-    (tc\? nil "return true if type checking")
-    (thaw "(lazy A) --> A" "Receives a frozen input and evaluates it to get 
the unthawed result..")
-    (time "A --> A" "Prints the run time for the evaluation of its input and 
returns its normal form.")
-    (tlv nil nil)
-    (track "symbol --> symbol" "Tracks the I/O behaviour of a function.")
-    (transparent "symbol --> symbol" "Applied to a Lisp macro makes it 
transparent to Qi.")
-    (tuple\? "A --> boolean" "Recognisor for tuples.")
-    (type "_" "Returns a type for its input (if any) or false if the input has 
no type.")
-    (unassoc-type "symbol --> symbol" "Removes any associations with the Qi 
type in the type association table.")
-    (undebug "A --> string" "The input is ignored, undebugging is returned and 
all terminal output is closed to the file debug.txt.")
-    (unify nil nil)
-    (unify! nil nil)
-    (union "(list A) --> (list A) --> (list A)" "Forms the union of two 
lists.")
-    (unprofile "(A --> B) --> (A --> B)" "Unprofiles a function.")
-    (unspecialise "symbol --> symbol" "Receives the name of a function and 
deletes its special form status.")
-    (unsugar "symbol --> (A --> B) --> (A --> B)" "Receives either out or in 
and the name of a function and removes its status as a sugar function.")
-    (untrack "symbol --> symbol" "Untracks a function.")
-    (value "_" "Applied to a symbol, returns the global value assigned to it.")
-    (variable\? "A --> boolean" "Applied to a variable, returns true.")
-    (vector nil nil)
-    (vector-> nil nil)
-    (vector\? nil nil)
-    (version "string --> string" "Changes the version string displayed on 
startup.")
-    (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."))
-
-
-;;; Fontification
-(defconst shen-font-lock-keywords
-  (eval-when-compile
-    `(;; definitions
-      (,(concat "(\\("
-                (regexp-opt
-                 '("define" "defmacro" "defprolog" "/." "synonyms" "defcc"))
-                "\\)\\>"
-                "[ \t]*(?"
-                "\\(\\sw+\\)?")
-       (1 font-lock-keyword-face)
-       (2 font-lock-function-name-face nil t))
-      ("(\\(lambda\\)\\>[ \t]*(?\\(\\sw+\\)?"
-       (1 font-lock-keyword-face)
-       (2 font-lock-variable-name-face nil t))
-      ;; data types
-      ("(\\(datatype\\)\\>[ \t]*(?\\(\\sw+\\)?"
-       (1 font-lock-keyword-face)
-       (2 font-lock-type-face nil t))
-      ;; variables
-      ("\\<\\([A-Z]\\w*\\)\\>" . font-lock-variable-name-face)
-      ;; control structures
-      (,(concat
-         "("
-         (regexp-opt
-          (append
-           '("let" "=" "eval-without-reader-macros" "freeze" "type") ; generic
-           '("if" "and" "or" "cond")) t) ; boolean
-         "\\>")
-       . 1)
-      ;; errors
-      ("(\\(error\\)\\>" 1 font-lock-warning-face)
-      ;; built-in
-      (,(concat
-         "("
-         (regexp-opt
-          (mapcar
-           (lambda (it) (format "%s" it))
-           (append
-            '(intern function)                          ; symbols
-            '(pos tlstr cn str string?)                 ; strings
-            '(set value)                                ; assignment
-            '(cons hd tl cons?)                         ; lists
-            '(absvector address-> <-address absvector?) ; vector
-            '(pr read-byte open close)                  ; stream
-            '(get-time)                                 ; time
-            '(+ - * / > < >= <= number?)                ; arithmetic
-            '(fst snd tupple?)                          ; tuple
-            '(@s @v @p)
-            '(put get)                  ; property lists
-            '(simple-error trap-error error-to-string) ; error
-            ;; predicates
-            (mapcar
-             (lambda (it) (format "%s?" it))
-             '(boolean character complex congruent cons element empty float
-                       integer number provable rational solved string symbol
-                       tuple variable))
-            ;; misc functions
-            (mapcar #'car shen-functions)))
-          t)
-         "\\>")
-       1 font-lock-builtin-face)
-      ;; external global variables
-      (,(concat
-         (regexp-opt
-          (mapcar
-           (lambda (cnst) (format "*%s*" cnst))
-           '("language" "implementation" "port" "porters"
-             "stinput" "home-directory" "version"
-             "maximum-print-sequence-size" "printer" "macros"))
-          t)
-         "\\>")
-       1 font-lock-builtin-face)))
-  "Default expressions to highlight in Shen mode.")
-
-(defvar shen-mode-syntax-table
-  (let ((table (make-syntax-table)))
-    (dolist (pair '((?@  . "w")
-                    (?_  . "w")
-                    (?-  . "w")
-                    (?+  . "w")
-                    (??  . "w")
-                    (?!  . "w")
-                    (?<  . "w")
-                    (?>  . "w")
-                    (?/  . "w")
-                    ;; comment delimiters
-                    (?\\ . ". 14")
-                    (?*  . ". 23")))
-      (modify-syntax-entry (car pair) (cdr pair) table))
-    table)
-  "Syntax table to use in shen-mode.")
-
-
-;;; Indentation
-;; Copied from qi-mode, which in turn is from scheme-mode and from lisp-mode
-(defun shen-indent-function (indent-point state)
-  (let ((normal-indent (current-column)))
-    (goto-char (1+ (elt state 1)))
-    (parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t)
-    (if (and (elt state 2)
-             (not (looking-at "\\sw\\|\\s_")))
-      ;; car of form doesn't seem to be a symbol
-      (progn
-        (if (not (> (save-excursion (forward-line 1) (point))
-                    calculate-lisp-indent-last-sexp))
-          (progn (goto-char calculate-lisp-indent-last-sexp)
-                 (beginning-of-line)
-                 (parse-partial-sexp (point)
-                                     calculate-lisp-indent-last-sexp 0 t)))
-        ;; Indent under the list or under the first sexp on the same
-        ;; line as calculate-lisp-indent-last-sexp.  Note that first
-        ;; thing on that line has to be complete sexp since we are
-        ;; inside the innermost containing sexp.
-        (backward-prefix-chars)
-        (current-column))
-      (let ((function (buffer-substring (point)
-                                       (progn (forward-sexp 1) (point))))
-           method)
-       (setq method (or (get (intern-soft function) 'shen-indent-function)
-                        (get (intern-soft function) 'shen-indent-hook)))
-       (cond ((or (eq method 'defun)
-                  (and (null method)
-                       (> (length function) 3)
-                       (string-match "\\`def" function)))
-              (lisp-indent-defform state indent-point))
-             ((integerp method)
-              (lisp-indent-specform method state
-                                    indent-point normal-indent))
-             (method
-               (funcall method state indent-point normal-indent)))))))
-
-(defun shen-let-indent (state indent-point normal-indent)
-  (let ((edge (- (current-column) 2)))
-    (goto-char indent-point) (skip-chars-forward " \t")
-    (if (looking-at "[-a-zA-Z0-9+*/?!@$%^&_:~]")
-        ;; deeper indent because we're still defining local variables
-        (lisp-indent-specform 5 state indent-point normal-indent)
-      ;; shallow indent because we're in the body
-      edge)))
-
-(defun shen-package-indent (_state _indent-point _normal-indent)
-  (- (current-column) 8))
-
-(put 'let 'shen-indent-function 'shen-let-indent)
-(put 'lambda 'shen-indent-function 1)
-(put 'package 'shen-indent-function 'shen-package-indent)
-(put 'datatype 'shen-indent-function 1)
-
-
-;;; Function documentation
-(defun shen-current-function ()
-  (ignore-errors
-    (save-excursion
-      (backward-up-list)
-      (forward-char 1)
-      (thing-at-point 'word))))
-
-(defun shen-mode-eldoc ()
-  (let ((func (assoc (intern (or (shen-current-function) "")) shen-functions)))
-    (when func
-      (format "%s%s:%s"
-              (propertize (symbol-name (car func))
-                          'face 'font-lock-function-name-face)
-              (if (cadr func)  (concat "[" (cadr func) "]") "")
-              (if (caddr func) (concat " " (caddr func)) "")))))
-
-(defvar shen-imenu-generic-expression
-  '(("Functions" "^\\s-*(\\(define\\)" 1)))
-
-
-;;; Major mode definition
-;; apparently some versions of Emacs don't have `prog-mode' defined
-(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.
-  (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)
-;;; shen-mode.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]