lex-hl

Highlight lexically bound variables
git clone git://jamzattack.xyz/lex-hl.git
Log | Files | Refs

commit da286f0ca8888b48fe1ff5f491ad5652815915b9
parent ddae80132ee0c777fb08b0674278bdac90a72489
Author: Jamie Beardslee <jdb@jamzattack.xyz>
Date:   Fri, 11 Sep 2020 19:19:31 +1200

Add a minor mode

Diffstat:
Mlex-hl.el | 21+++++++++++++++++++++
1 file changed, 21 insertions(+), 0 deletions(-)

diff --git a/lex-hl.el b/lex-hl.el @@ -28,6 +28,10 @@ ;; `lex-hl-prompt': Prompt from a list of forms to highlight. ;; `lex-hl-top-level': Highlight the top-level form at point. +;; A minor mode is provided to add keybindings for these commands. +;; To enable it in emacs-lisp-mode: +;; (add-hook 'emacs-lisp-mode-hook #'hexl-hl-mode) + ;; To add a new highlighter, simply define a function takes a single ;; argument (a sexp, e.g. `(let ((a 1) (b 2)) (+ a b))') and ;; highlights the names of the variables bound within that sexp. @@ -170,5 +174,22 @@ See the variable `lex-hl-forms' for a list of supported forms." (goto-char (match-beginning 0)) (lex-hl-sexp-at-point))))) + +;;; Minor mode + +(defvar lex-hl-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "C-c '") #'lex-hl-prompt) + (define-key map (kbd "C-c ,") #'lex-hl-top-level) + (define-key map (kbd "C-c .") #'lex-hl-nearest) + map)) + +;;;###autoload +(define-minor-mode lex-hl-mode + "Add some keybindings to highlight lexical variables. + +\\{lex-hl-mode-map}" + nil "" lex-hl-mode-map) + (provide 'lex-hl) ;;; lex-hl.el ends here