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

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

[ELPA-diffs] ELPA branch, master, updated. c313cab0b5092b410ed1631094bd5


From: Stefan Monnier
Subject: [ELPA-diffs] ELPA branch, master, updated. c313cab0b5092b410ed1631094bd5566f23e2fdb
Date: Wed, 21 Aug 2013 20:37:53 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "ELPA".

The branch, master has been updated
       via  c313cab0b5092b410ed1631094bd5566f23e2fdb (commit)
      from  e057b1271ef4bd98488cfbfe40d8bdd35dce031b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c313cab0b5092b410ed1631094bd5566f23e2fdb
Author: Stefan Monnier <address@hidden>
Date:   Wed Aug 21 16:37:42 2013 -0400

    * packages/shen-mode/inf-shen.el: Require CL.  Fix up comment convention.
    Don't autoload variables unless there's a really good reason for it.
    Turn some comments into docstrings.
    (inferior-shen-mode-map): Initialize in the declaration.
    (inferior-shen-mode): Use define-derived-mode.
    (check-balanced-parens): `c' was not used.
    (shen-eval-region): Use with-current-buffer.
    * packages/shen-mode/shen-mode.el: Require CL.
    (calculate-lisp-indent-last-sexp): Declare.
    (shen-mode): Auto load.  Don't use ((lambda ..) ..) forms.
    (auto-mode-alist): Auto load the added entry.

diff --git a/packages/shen-mode/inf-shen.el b/packages/shen-mode/inf-shen.el
index dcbc4aa..a27d082 100644
--- a/packages/shen-mode/inf-shen.el
+++ b/packages/shen-mode/inf-shen.el
@@ -1,6 +1,6 @@
 ;;; inferior-shen-mode --- an inferior-shen mode
 
-;; Copyright (C) 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2013 Free Software Foundation, Inc.
 
 ;; Authors: Michael Ilseman, Eric Schulte <address@hidden>
 ;; Version: 0.1
@@ -27,6 +27,7 @@
 ;; This file defines an inferior Shen mode.
 
 ;;; Code:
+(eval-when-compile (require 'cl))
 (require 'comint)
 (require 'shen-mode)
 
@@ -37,22 +38,21 @@ 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 nil)
-(unless inferior-shen-mode-map
-  (setq inferior-shen-mode-map (copy-keymap comint-mode-map))
-;  (set-keymap-parent inferior-shen-mode-map shen-mode-shared-map)
-  (define-key inferior-shen-mode-map "\C-x\C-e" 'shen-eval-last-sexp)
-  (define-key inferior-shen-mode-map "\C-c\C-l" 'shen-load-file)
-  (define-key inferior-shen-mode-map "\C-c\C-k" 'shen-compile-file)
-  (define-key inferior-shen-mode-map "\C-c\C-a" 'shen-show-arglist)
-  (define-key inferior-shen-mode-map "\C-c\C-d" 'shen-describe-sym)
-  (define-key inferior-shen-mode-map "\C-c\C-f"
-    'shen-show-function-documentation)
-  (define-key inferior-shen-mode-map "\C-c\C-v"
-    'shen-show-variable-documentation))
-
-;;; These commands augment Shen mode, so you can process Shen code in
-;;; the source files.
+(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)
@@ -67,16 +67,16 @@ mode.  Default is whitespace followed by 0 or 1 
single-letter colon-keyword
 (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 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."
+;;  "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)
@@ -98,11 +98,9 @@ mode.  Default is whitespace followed by 0 or 1 
single-letter colon-keyword
     'shen-show-variable-documentation))
 
 
-;;;###autoload
 (defvar inferior-shen-program "shen"
   "*Program name for invoking an inferior Shen with for Inferior Shen mode.")
 
-;;;###autoload
 (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
@@ -112,7 +110,6 @@ 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.")
 
-;;;###autoload
 (defvar inferior-shen-prompt "^[^> \n]*>+:? *"
   "Regexp to recognise prompts in the Inferior Shen mode.
 Defaults to \"^[^> \\n]*>+:? *\", which works pretty good for Lucid, kcl,
@@ -164,13 +161,12 @@ 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].")
 
-;;;###autoload
 (defvar inferior-shen-mode-hook '()
   "*Hook for customising Inferior Shen mode.")
 
 (put 'inferior-shen-mode 'mode-class 'special)
 
-(defun inferior-shen-mode ()
+(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
@@ -210,18 +206,12 @@ 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."
-  (interactive)
-  (comint-mode)
   (set (make-local-variable 'font-lock-defaults) '(shen-font-lock-keywords))
   (setq comint-prompt-regexp inferior-shen-prompt)
-  (setq major-mode 'inferior-shen-mode)
-  (setq mode-name "Inferior Shen")
   (setq mode-line-process '(":%s"))
 
-  (use-local-map inferior-shen-mode-map)    ;c-c c-k for "kompile" file
   (setq comint-get-old-input (function shen-get-old-input))
-  (setq comint-input-filter (function shen-input-filter))
-  (run-hooks 'inferior-shen-mode-hook))
+  (setq comint-input-filter (function shen-input-filter)))
 
 (defun shen-get-old-input ()
   "Return a string containing the sexp ending at point."
@@ -287,7 +277,7 @@ containing the shen source code about to be evaluated.")
   "Check if parentheses in the region are balanced."
   (save-restriction (save-excursion
     (let ((deactivate-mark nil))
-      (condition-case c
+      (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."))))))))
@@ -311,8 +301,7 @@ Prefix argument means switch to the Shen buffer afterwards."
     (comint-send-string (inferior-shen-proc) "\n")
     (accept-process-output (inferior-shen-proc))
     (sit-for 0)
-    (save-excursion
-      (set-buffer inferior-shen-buffer)
+    (with-current-buffer inferior-shen-buffer
       (goto-char before-input)
       (setq result (buffer-substring (point) (point-at-eol)))
       (message "%s" result)
@@ -380,10 +369,10 @@ With argument, positions cursor at end of buffer."
     (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.
+;; 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")
@@ -404,42 +393,42 @@ With argument, positions cursor at end of 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
+;; 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
@@ -516,8 +505,8 @@ Used by these commands to determine defaults.")
 ;;; Ancillary functions
 ;;; ===================
 
-;;; Reads a string from the user.
 (defun shen-symprompt (prompt default)
+  "Read a string from the user."
   (list (let* ((prompt (if default
                           (format "%s (default %s): " prompt default)
                         (concat prompt ": ")))
@@ -525,9 +514,9 @@ Used by these commands to determine defaults.")
          (if (zerop (length ans)) default ans))))
 
 
-;;; Adapted from function-called-at-point in help.el.
+;; Adapted from function-called-at-point in help.el.
 (defun shen-fn-called-at-pt ()
-  "Returns the name of the function called in the current call.
+  "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
@@ -540,7 +529,7 @@ The value is nil if it can't find one."
     (error nil)))
 
 
-;;; Adapted from variable-at-point in help.el.
+;; Adapted from variable-at-point in help.el.
 (defun shen-var-at-pt ()
   (condition-case ()
       (save-excursion
diff --git a/packages/shen-mode/shen-mode.el b/packages/shen-mode/shen-mode.el
index 747679c..81c2829 100644
--- a/packages/shen-mode/shen-mode.el
+++ b/packages/shen-mode/shen-mode.el
@@ -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)
 
@@ -363,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)
@@ -398,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)

-----------------------------------------------------------------------

Summary of changes:
 packages/shen-mode/inf-shen.el  |  159 ++++++++++++++++++---------------------
 packages/shen-mode/shen-mode.el |   49 ++++++------
 2 files changed, 99 insertions(+), 109 deletions(-)


hooks/post-receive
-- 
ELPA



reply via email to

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