diff options
Diffstat (limited to 'emacs/.emacs.d/wpc/kbd.el')
-rw-r--r-- | emacs/.emacs.d/wpc/kbd.el | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/emacs/.emacs.d/wpc/kbd.el b/emacs/.emacs.d/wpc/kbd.el index dd47845e65b5..08e16df90150 100644 --- a/emacs/.emacs.d/wpc/kbd.el +++ b/emacs/.emacs.d/wpc/kbd.el @@ -1,5 +1,9 @@ ;;; kbd.el --- Elisp keybinding -*- lexical-binding: t -*- + ;; Author: William Carroll <wpcarro@gmail.com> +;; Version: 0.0.1 +;; URL: https://git.wpcarro.dev/wpcarro/briefcase +;; Package-Requires: ((emacs "24")) ;;; Commentary: ;; In order to stay organized, I'm attempting to dedicate KBD prefixes to @@ -27,52 +31,52 @@ ;; Constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defconst kbd/prefixes +(defconst kbd-prefixes '((workspace . "s") (x11 . "C-s")) "Mapping of functions to designated keybinding prefixes to stay organized.") ;; Assert that no keybindings are colliding. (prelude-assert - (= (alist/count kbd/prefixes) - (->> kbd/prefixes - alist/values - set/from-list - set/count))) + (= (alist-count kbd-prefixes) + (->> kbd-prefixes + alist-values + set-from-list + set-count))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Library ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun kbd/raw (f x) +(defun kbd-raw (f x) "Return the string keybinding for function F and appendage X. Values for F include: - workspace - x11" - (prelude-assert (alist/has-key? f kbd/prefixes)) + (prelude-assert (alist-has-key? f kbd-prefixes)) (string-format "%s-%s" - (alist/get f kbd/prefixes) + (alist-get f kbd-prefixes) x)) -(defun kbd/for (f x) +(defun kbd-for (f x) "Return the `kbd' for function F and appendage X. Values for F include: - workspace - x11" - (kbd (kbd/raw f x))) + (kbd (kbd-raw f x))) ;; TODO: Prefer copying human-readable versions to the clipboard. Right now ;; this isn't too useful. -(defun kbd/copy-keycode () +(defun kbd-copy-keycode () "Copy the pressed key to the system clipboard." (interactive) (message "[kbd] Awaiting keypress...") (let ((key (read-key))) - (clipboard/copy (string-format "%s" key)) + (clipboard-copy (string-format "%s" key)) (message (string-format "[kbd] \"%s\" copied!" key)))) -(defun kbd/print-keycode () +(defun kbd-print-keycode () "Prints the pressed keybinding." (interactive) (message "[kbd] Awaiting keypress...") |