More eval bindings for elisp.
This commit is contained in:
parent
04895b4c28
commit
0620ed55b6
|
@ -220,6 +220,21 @@ the current state and point position."
|
|||
(setq p2 (point))))
|
||||
(set-mark p1)))
|
||||
|
||||
;; eval lisp helpers
|
||||
(defun spacemacs/eval-region ()
|
||||
(interactive)
|
||||
(eval-region (region-beginning) (region-end))
|
||||
(evil-normal-state))
|
||||
|
||||
;; idea from http://www.reddit.com/r/emacs/comments/312ge1/i_created_this_function_because_i_was_tired_of/
|
||||
(defun spacemacs/eval-current-form ()
|
||||
"Looks for the current def* or set* command then evaluates, unlike `eval-defun', does not go to topmost function"
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(search-backward-regexp "(def\\|(set")
|
||||
(forward-list)
|
||||
(call-interactively 'eval-last-sexp)))
|
||||
|
||||
;; from magnars
|
||||
(defun eval-and-replace ()
|
||||
"Replace the preceding sexp with its value."
|
||||
|
@ -798,8 +813,7 @@ If ASCII si not provided then UNICODE is used instead."
|
|||
((system-is-mswindows) (w32-shell-execute "open" (replace-regexp-in-string "/" "\\" file-path)))
|
||||
((system-is-mac) (shell-command (format "open \"%s\"" file-path)))
|
||||
((system-is-linux) (let ((process-connection-type nil))
|
||||
(start-process "" nil "xdg-open" file-path)))
|
||||
)))
|
||||
(start-process "" nil "xdg-open" file-path))))))
|
||||
|
||||
(defun spacemacs/next-error (&optional n reset)
|
||||
"Dispatch to flycheck or standard emacs error."
|
||||
|
|
|
@ -293,7 +293,10 @@ Ensure that helm is required before calling FUNC."
|
|||
;; emacs-lisp -----------------------------------------------------------------
|
||||
(evil-leader/set-key-for-mode 'emacs-lisp-mode
|
||||
"me$" 'lisp-state-eval-sexp-end-of-line
|
||||
"meb" 'eval-buffer
|
||||
"mec" 'spacemacs/eval-current-form
|
||||
"mee" 'eval-last-sexp
|
||||
"mer" 'spacemacs/eval-region
|
||||
"mef" 'eval-defun
|
||||
"mel" 'lisp-state-eval-sexp-end-of-line
|
||||
"m," 'lisp-state-toggle-lisp-state
|
||||
|
|
Loading…
Reference in a new issue