;;; Code:
(eval-when-compile (require 'cl-lib))
-
(require 'subr-x)
+(require 'avy)
(defface el-free-variable '((t :inherit underline))
"Face for highlighting free variables in Emacs Lisp code.")
(replace-region-contents beg end (lambda () str))
(user-error "No expression at point")))
+(defun el-code-pos-p (&optional pos) (null (nth 8 (syntax-ppss pos))))
+
+(defun el-jump ()
+ (interactive)
+ (avy-jump "[([]"
+ :window-flip t
+ :beg (save-excursion (beginning-of-defun) (point))
+ :end (save-excursion (end-of-defun) (point))
+ :action #'avy-action-goto
+ :pred #'el-code-pos-p))
+
+(defun el-last ()
+ (interactive "" el-mode)
+ (up-list 1 t t) (backward-char))
+
+(defun el-backward-down ()
+ (interactive)
+ (backward-sexp)
+ (down-list)
+ (el-last))
+
(defvar-keymap el-mode-map
- :doc "Keymap for `el-mode'."
+ :suppress t
"r" #'raise-sexp
"t" #'transpose-sexps
"u" #'backward-up-list
"\"" #'insert-pair
"/" #'undo
"c" #'el-insert-function-call
- "s" #'el-edit-sexp
+ "e" #'end-of-defun
"x" #'eval-defun
"a" #'beginning-of-defun
- "e" #'end-of-defun
- "m" #'mark-sexp)
+ "s" #'el-edit-sexp
+ "i" #'el-insert-sexp
+ "l" #'el-last
+ "p" #'el-backward-down
+ "j" #'el-jump
+ "m" #'mark-sexp
+ "." #'xref-find-definitions
+ "," #'xref-go-back)
;;;###autoload
(define-derived-mode el-mode prog-mode "EL"