This commit is contained in:
Jean-Philippe Bernardy 2016-02-07 23:26:47 +01:00
parent afe8cf0f67
commit 424c4fbd7e

View file

@ -1,6 +1,10 @@
;;; boon-main.el --- An Ergonomic Command Mode -*- lexical-binding: t -*- ;;; boon-main.el --- An Ergonomic Command Mode -*- lexical-binding: t -*-
;;; Commentary: ;;; Commentary:
;; This file contains (most of) the boon commands. These commands are
;; typically bound to a key in boon-keys or boon-colemak.
;;; Code: ;;; Code:
(require 'boon-core) (require 'boon-core)
@ -10,6 +14,9 @@
(require 'multiple-cursors) (require 'multiple-cursors)
(require 'subr-x) (require 'subr-x)
;;; Jumping to definitions (at point):
(defun boon-find-elisp-thing-at-point () (defun boon-find-elisp-thing-at-point ()
"Find an elisp thing at point. "Find an elisp thing at point.
Search preferentially for a function, then a variable." Search preferentially for a function, then a variable."
@ -21,6 +28,7 @@ Search preferentially for a function, then a variable."
(t (call-interactively 'helm-apropos))))) (t (call-interactively 'helm-apropos)))))
(defun boon-find-tag-at-point () (defun boon-find-tag-at-point ()
"Find the symbol at point in the current tags table."
(interactive) (interactive)
(let ((symb (thing-at-point 'symbol))) (let ((symb (thing-at-point 'symbol)))
(cond (symb (find-tag symb)) (cond (symb (find-tag symb))
@ -107,7 +115,7 @@ NOTE: Do not run for every cursor."
(call-interactively 'boon-mark-region)))) (call-interactively 'boon-mark-region))))
(defun boon-deactivate-mark () (defun boon-deactivate-mark ()
"Drop deactivate the mark robustly." "Deactivate the mark robustly."
(mc/execute-command-for-all-fake-cursors (lambda () (interactive) (deactivate-mark))) (mc/execute-command-for-all-fake-cursors (lambda () (interactive) (deactivate-mark)))
(deactivate-mark t)) (deactivate-mark t))
@ -124,7 +132,7 @@ NOTE: Do not run for every cursor."
(current-column))) (current-column)))
(defun boon-enclose (enclosure regs) (defun boon-enclose (enclosure regs)
"Wrap, with the ENCLOSURE the regions given as REGS." "Wrap with the given ENCLOSURE the regions given as REGS."
(interactive (list (boon-spec-enclosure) (boon-spec-region "enclose"))) (interactive (list (boon-spec-enclosure) (boon-spec-region "enclose")))
;; (message "boon-enclose regs=%s" regs) ;; (message "boon-enclose regs=%s" regs)
(dolist (reg (mapcar 'boon-reg-to-markers regs)) (dolist (reg (mapcar 'boon-reg-to-markers regs))
@ -210,7 +218,7 @@ When repeated, fix the spacing if necessary."
(defun boon-fix-a-space () (defun boon-fix-a-space ()
"Fix the text to have exactly one space at the point. "Fix the text to have exactly one space at the point.
Return nil if no changes are made." Return nil if no changes are made, t otherwise."
(cond ((and (looking-at " ") (looking-back " ")) (cond ((and (looking-at " ") (looking-back " "))
(delete-char 1) (delete-char 1)
t) t)