eval-region-or-last-sexp

This commit is contained in:
Ivan Malison 2014-12-24 04:17:38 -05:00
parent 57f0c7f6a1
commit ee33c8dca0

View File

@ -150,6 +150,10 @@
`(setq ,name ,value) `(setq ,name ,value)
`(defvar ,name ,value))) `(defvar ,name ,value)))
(defun eval-region-or-last-sexp ()
(interactive)
(if (region-active-p) (call-interactively 'eval-region) (call-interactively 'eval-last-sexp)))
(defun undo-redo (&optional arg) (defun undo-redo (&optional arg)
(interactive "P") (interactive "P")
(if arg (undo-tree-redo) (undo-tree-undo))) (if arg (undo-tree-redo) (undo-tree-undo)))
@ -1158,6 +1162,7 @@ marking if it still had that."
(define-key lisp-mode-shared-map (kbd "C-c C-r") 'eval-and-replace) (define-key lisp-mode-shared-map (kbd "C-c C-r") 'eval-and-replace)
(define-key lisp-mode-shared-map (kbd "C-c o r") 'up-list-region) (define-key lisp-mode-shared-map (kbd "C-c o r") 'up-list-region)
(define-key lisp-mode-shared-map (kbd "C-c o o") 'up-list-back) (define-key lisp-mode-shared-map (kbd "C-c o o") 'up-list-back)
(define-key lisp-mode-shared-map (kbd "C-x C-e") 'eval-region-or-last-sexp)
;; ============================================================================= ;; =============================================================================
;; Python ;; Python