mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
Improved emacs mode.
This commit is contained in:
parent
da1ab600b8
commit
55b7acce83
@ -27,9 +27,6 @@ mode. Default is whitespace followed by 0 or 1 single-letter colon-keyword
|
||||
(let ((map (copy-keymap comint-mode-map)))
|
||||
(define-key map "\C-x\C-e" #'inf-carp-eval-last-sexp)
|
||||
(define-key map "\C-c\C-l" #'inf-carp-load-file)
|
||||
(define-key map "\C-c\C-a" #'inf-carp-show-arglist)
|
||||
(define-key map "\C-c\C-t" #'inf-carp-show-var-type)
|
||||
(define-key map "\C-c\C-s" #'inf-carp-show-var-source)
|
||||
(define-key map "\C-c\M-o" #'inf-carp-clear-repl-buffer)
|
||||
(easy-menu-define inf-carp-mode-menu map
|
||||
"Inferior Carp REPL Menu"
|
||||
@ -40,31 +37,28 @@ mode. Default is whitespace followed by 0 or 1 single-letter colon-keyword
|
||||
"--"
|
||||
["Show arglist" inf-carp-show-arglist t]
|
||||
;;["Show documentation for var" inf-carp-show-var-documentation t]
|
||||
["Show source for var" inf-carp-show-var-source t]
|
||||
;;["Show info for var" inf-carp-show-var-info t]
|
||||
"--"
|
||||
["Clear REPL" inf-carp-clear-repl-buffer]))
|
||||
map))
|
||||
|
||||
(defvar inf-carp-minor-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map "\M-\C-x" #'inf-carp-eval-defun) ; Gnu convention
|
||||
(define-key map "\C-x\C-e" #'inf-carp-eval-last-sexp) ; Gnu convention
|
||||
(define-key map "\M-\C-x" #'inf-carp-eval-defun)
|
||||
(define-key map "\C-x\C-e" #'inf-carp-eval-last-sexp)
|
||||
(define-key map "\C-c\C-e" #'inf-carp-eval-last-sexp)
|
||||
(define-key map "\C-c\C-c" #'inf-carp-build)
|
||||
(define-key map (kbd "<s-return>") #'inf-carp-eval-defun) ; Light Table style
|
||||
(define-key map "\C-c\C-k" #'inf-carp-eval-buffer)
|
||||
(define-key map "\C-c\C-c" #'inf-carp-build-and-run)
|
||||
(define-key map (kbd "<s-return>") #'inf-carp-eval-defun)
|
||||
(define-key map "\C-c\C-k" #'inf-carp-build)
|
||||
(define-key map "\C-c\C-r" #'inf-carp-eval-region)
|
||||
(define-key map "\C-c\C-n" #'inf-carp-eval-form-and-next)
|
||||
(define-key map "\C-c\C-z" #'inf-carp-switch-to-repl)
|
||||
(define-key map "\C-c\C-i" #'inf-carp-show-ns-vars)
|
||||
(define-key map "\C-c\C-A" #'inf-carp-apropos)
|
||||
(define-key map "\C-c\C-m" #'inf-carp-macroexpand)
|
||||
(define-key map "\C-c\C-l" #'inf-carp-load-file)
|
||||
(define-key map "\C-c\C-a" #'inf-carp-show-arglist)
|
||||
;;(define-key map "\C-c\C-v" #'inf-carp-show-var-documentation)
|
||||
(define-key map "\C-c\C-t" #'inf-carp-show-var-type)
|
||||
(define-key map "\C-c\C-s" #'inf-carp-show-var-source)
|
||||
(define-key map "\C-c\M-n" #'inf-carp-set-ns)
|
||||
(define-key map "\C-c\C-l" #'inf-carp-eval-buffer)
|
||||
;; TODO:
|
||||
;; (define-key map "\C-c\C-v" #'inf-carp-show-var-documentation)
|
||||
;; (define-key map "\C-c\C-t" #'inf-carp-show-var-type)
|
||||
|
||||
(easy-menu-define inf-carp-minor-mode-menu map
|
||||
"Inferior Carp Minor Mode Menu"
|
||||
'("Inf-Carp"
|
||||
@ -78,11 +72,7 @@ mode. Default is whitespace followed by 0 or 1 single-letter colon-keyword
|
||||
["Switch to REPL" inf-carp-switch-to-repl t]
|
||||
["Set REPL ns" inf-carp-set-ns t]
|
||||
"--"
|
||||
["Show arglist" inf-carp-show-arglist t]
|
||||
;;["Show documentation for var" inf-carp-show-var-documentation t]
|
||||
["Show source for var" inf-carp-show-var-source t]
|
||||
["Show vars in ns" inf-carp-show-ns-varst]
|
||||
["Apropos" inf-carp-apropos t]
|
||||
["Macroexpand" inf-carp-macroexpand t]))
|
||||
map))
|
||||
|
||||
@ -246,7 +236,7 @@ to continue it."
|
||||
(t str)))
|
||||
|
||||
(defvar inf-carp-project-root-files
|
||||
'("project.clj" "build.boot" "project.carp")
|
||||
'("project.carp")
|
||||
"A list of files that can be considered project markers.")
|
||||
|
||||
(defun inf-carp-project-root ()
|
||||
@ -413,30 +403,24 @@ Used by this command to determine defaults."
|
||||
;;; ===============
|
||||
|
||||
(defcustom inf-carp-build-command
|
||||
"(build)\n"
|
||||
"(do (reload) (build))\n"
|
||||
"Command to build the project."
|
||||
:type 'string
|
||||
:group 'inf-carp)
|
||||
|
||||
(defcustom inf-carp-build-and-run-command
|
||||
"(build) (run)\n"
|
||||
"(do (reload) (build) (run))\n"
|
||||
"Command to build and run the project."
|
||||
:type 'string
|
||||
:group 'inf-carp)
|
||||
|
||||
(defcustom inf-carp-var-bake-command
|
||||
"(bake %s)\n"
|
||||
"Command to bake a form."
|
||||
:type 'string
|
||||
:group 'inf-carp)
|
||||
|
||||
(defcustom inf-carp-var-type-command
|
||||
"(type %s)\n"
|
||||
"Command to query inferior Carp for a var's type."
|
||||
:type 'string
|
||||
:group 'inf-carp)
|
||||
|
||||
(defcustom inf-carp-var-source-command
|
||||
(defcustom inf-carp-var-info-command
|
||||
"(info %s)\n"
|
||||
"Command to query inferior Carp for a var's source."
|
||||
:type 'string
|
||||
@ -459,37 +443,12 @@ Used by this command to determine defaults."
|
||||
:type 'string
|
||||
:group 'inf-carp)
|
||||
|
||||
(defcustom inf-carp-ns-vars-command
|
||||
"(carp.repl/dir %s)\n"
|
||||
"Command to show the public vars in a namespace."
|
||||
:type 'string
|
||||
:group 'inf-carp)
|
||||
|
||||
(defcustom inf-carp-set-ns-command
|
||||
"(carp.core/in-ns '%s)\n"
|
||||
"Command to set the namespace of the inferior Carp process."
|
||||
:type 'string
|
||||
:group 'inf-carp)
|
||||
|
||||
(defcustom inf-carp-apropos-command
|
||||
"(doseq [var (sort (carp.repl/apropos \"%s\"))]
|
||||
(println (str var)))\n"
|
||||
"Command to invoke apropos."
|
||||
:type 'string
|
||||
:group 'inf-carp)
|
||||
|
||||
(defcustom inf-carp-macroexpand-command
|
||||
"(expand '%s)\n"
|
||||
"Command to invoke macroexpand."
|
||||
:type 'string
|
||||
:group 'inf-carp)
|
||||
|
||||
(defcustom inf-carp-macroexpand-1-command
|
||||
"(carp.core/macroexpand-1 '%s)\n"
|
||||
"Command to invoke macroexpand-1."
|
||||
:type 'string
|
||||
:group 'inf-carp)
|
||||
|
||||
;;; Ancillary functions
|
||||
;;; ===================
|
||||
|
||||
@ -559,12 +518,6 @@ See variable `inf-carp-var-type-command'."
|
||||
(interactive (inf-carp-symprompt "Var type" (inf-carp-var-at-pt)))
|
||||
(comint-proc-query (inf-carp-proc) (format inf-carp-var-type-command var)))
|
||||
|
||||
(defun inf-carp-show-var-source (var)
|
||||
"Send a command to the inferior Carp to give source for VAR.
|
||||
See variable `inf-carp-var-source-command'."
|
||||
(interactive (inf-carp-symprompt "Var source" (inf-carp-var-at-pt)))
|
||||
(comint-proc-query (inf-carp-proc) (format inf-carp-var-source-command var)))
|
||||
|
||||
(defun inf-carp-arglist (fn)
|
||||
"Send a query to the inferior Carp for the arglist for function FN.
|
||||
See variable `inf-carp-arglist-command'."
|
||||
|
Loading…
Reference in New Issue
Block a user