Skip to content

Commit

Permalink
Some docstrings and bugfixes
Browse files Browse the repository at this point in the history
Signed-off-by: Espen Wiborg <espenhw@grumblesmurf.org>
  • Loading branch information
espenhw committed Feb 28, 2009
1 parent 7d0c64b commit 0507538
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 103 deletions.
14 changes: 12 additions & 2 deletions src/main/lisp/malabar-abbrevs.el
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,18 @@
("ext" "extends")
("pa" "package")
("re" "return")
("#Test" hook malabar-abbrevs-create-test)))
("#Test" hook malabar-abbrevs-create-test))
"The list of abbrevs which should be recognized only in the
specified case.")

(defun malabar-abbrevs-delete-abbrev ()
"Delete the abbrev (prior to expanding)."
(when last-abbrev-text
(backward-delete-char-untabify (length last-abbrev-text))))

(defmacro define-malabar-abbrev-skeleton (name docstring interactor &rest skeleton)
"Define name as a skeleton which, as its first action, executes
`malabar-abbrevs-delete-abbrev'."
`(define-skeleton ,name
,docstring
,interactor '(malabar-abbrevs-delete-abbrev)
Expand All @@ -51,9 +56,14 @@
> "@Test" \n
> "public void " _ "() throws Exception {" \n
"}" > \n)

(defvar malabar-abbrevs-abbrev-regexp
"\\(?:^\\|\\s-\\)\\(#?\\w+\\)\\W*"
"The regexp to recognize abbrevs. Group one is used for abbrev
lookup.")

(defun malabar-abbrevs-setup ()
(abbrev-table-put malabar-mode-abbrev-table :regexp "\\(?:^\\|\\s-\\)\\(#?\\w+\\)\\W*")
(abbrev-table-put malabar-mode-abbrev-table :regexp malabar-abbrevs-abbrev-regexp)
(mapc (lambda (abbr)
(define-abbrev malabar-mode-abbrev-table (first abbr) (second abbr) (third abbr)
:case-fixed t :system 'force))
Expand Down
32 changes: 24 additions & 8 deletions src/main/lisp/malabar-groovy.el
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,35 @@
(concat "*" malabar-groovy-comint-name "*"))

(defvar malabar-groovy-compilation-buffer-name
(concat "*" malabar-groovy-comint-name " Compilation*"))
(concat "*Malabar Compilation*"))

(defvar malabar-groovy-command "groovysh")
(defvar malabar-groovy-command "groovysh"
"The command to execute the Groovy Shell. Include the full
path if necessary.")

(defvar malabar-groovy-options '("--color=false"))
(defvar malabar-groovy-options '("--color=false")
"Extra options to pass to groovysh.")

(defvar malabar-groovy-lib-dir "~/malabar/lib")
(defvar malabar-groovy-lib-dir "~/malabar/lib"
"The location of all Malabar's JARs.")

(defvar malabar-groovy-extra-classpath '("~/src/malabar/target/classes"))
(defvar malabar-groovy-extra-classpath '("~/src/malabar/target/classes")
"Extra classpath elements to pass to groovysh (mainly useful
for hacking on Malabar itself.")

(defvar malabar-groovy-mode-hook '())
(defvar malabar-groovy-mode-hook '()
"Hook that gets called when entering malabar-groovy-mode.")

(defvar malabar-groovy-prompt-regexp "^groovy:[^>]*> ")
(defvar malabar-groovy-prompt-regexp "^groovy:[^>]*> "
"Regexp to recognize the groovysh prompt.")

(defvar malabar-groovy-initial-statements
'("import org.grumblesmurf.malabar.*"
"import java.lang.reflect.*"))
"import java.lang.reflect.*")
"Statements to execute immediately after starting groovysh.")

(defun malabar-groovy-mode ()
"A major mode for the Groovy console."
(interactive)
(delay-mode-hooks (comint-mode))
;;(ansi-color-for-comint-mode-on)
Expand All @@ -64,6 +74,8 @@
(defvar malabar-groovy-comint-filter nil)

(defun malabar-groovy-start (&optional silent)
"Start groovy and wait for it to come up. If SILENT is NIL,
pop to the Groovy console buffer."
(interactive)
(unless (malabar-groovy-live-p)
(working-status-forms "Starting Groovy...%s" "done"
Expand Down Expand Up @@ -120,6 +132,7 @@
cell))

(defun malabar-groovy-eval (string)
"Pass STRING to groovysh for evaluation."
(unless (malabar-groovy-live-p)
(malabar-groovy-start t))
(when (malabar-groovy-live-p)
Expand All @@ -137,9 +150,12 @@
(malabar-groovy--eval-fix-output malabar-groovy--eval-output)))))

(defun malabar-groovy-eval-and-lispeval (string)
"Pass STRING to groovysh for evaluation, and read the output for Lisp use."
(car (read-from-string (car (malabar-groovy-eval string)))))

(defun malabar-groovy-eval-as-compilation (string)
"Passes STRING to groovysh for evaluation in a buffer in
`compilation-mode'."
(unless (malabar-groovy-live-p)
(malabar-groovy-start t))
(when (malabar-groovy-live-p)
Expand Down

0 comments on commit 0507538

Please sign in to comment.