From a638e15c0dd14a25e6f032b08de5ee1575677497 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Mon, 31 Aug 2020 23:28:47 +0100 Subject: Lint string, macros.el More of the same type of linting... basically preferring `namespace-` instead of `namespace/`. --- emacs/.emacs.d/snippets/rjsx-mode/redux-action | 2 +- .../.emacs.d/snippets/rjsx-mode/typed-redux-action | 2 +- emacs/.emacs.d/wpc/alist.el | 2 +- emacs/.emacs.d/wpc/bag.el | 2 +- emacs/.emacs.d/wpc/bookmark.el | 2 +- emacs/.emacs.d/wpc/buffer.el | 4 +- emacs/.emacs.d/wpc/bytes.el | 2 +- emacs/.emacs.d/wpc/cache.el | 2 +- emacs/.emacs.d/wpc/colorscheme.el | 2 +- emacs/.emacs.d/wpc/cycle.el | 38 ++++++------- emacs/.emacs.d/wpc/display.el | 8 +-- emacs/.emacs.d/wpc/fonts.el | 4 +- emacs/.emacs.d/wpc/functions.el | 2 +- emacs/.emacs.d/wpc/irc.el | 10 ++-- emacs/.emacs.d/wpc/kbd.el | 8 +-- emacs/.emacs.d/wpc/keyboard.el | 14 ++--- emacs/.emacs.d/wpc/list.el | 2 +- emacs/.emacs.d/wpc/macros.el | 64 +++++++--------------- emacs/.emacs.d/wpc/pulse-audio.el | 6 +- emacs/.emacs.d/wpc/scope.el | 4 +- emacs/.emacs.d/wpc/screen-brightness.el | 4 +- emacs/.emacs.d/wpc/scrot.el | 2 +- emacs/.emacs.d/wpc/set.el | 2 +- emacs/.emacs.d/wpc/ssh.el | 4 ++ emacs/.emacs.d/wpc/stack.el | 8 ++- emacs/.emacs.d/wpc/string.el | 63 ++++++++------------- emacs/.emacs.d/wpc/struct.el | 42 +++++++------- emacs/.emacs.d/wpc/symbol.el | 32 ++++++----- emacs/.emacs.d/wpc/timestring.el | 2 +- emacs/.emacs.d/wpc/window-manager.el | 8 +-- emacs/.emacs.d/wpc/window.el | 2 +- emacs/.emacs.d/wpc/wpc-dired.el | 12 +++- emacs/.emacs.d/wpc/wpc-golang.el | 3 +- emacs/.emacs.d/wpc/wpc-org.el | 7 ++- emacs/.emacs.d/wpc/wpc-prolog.el | 2 +- emacs/.emacs.d/wpc/wpc-ui.el | 7 --- 36 files changed, 176 insertions(+), 204 deletions(-) (limited to 'emacs/.emacs.d') diff --git a/emacs/.emacs.d/snippets/rjsx-mode/redux-action b/emacs/.emacs.d/snippets/rjsx-mode/redux-action index 7d24ffee4165..a6df4b62bfea 100644 --- a/emacs/.emacs.d/snippets/rjsx-mode/redux-action +++ b/emacs/.emacs.d/snippets/rjsx-mode/redux-action @@ -2,4 +2,4 @@ # name: redux-action # key: rax # -- -export const ${1:$$(string/lower->caps yas-text)} = '`(downcase (buffer-dirname))`/${1:$(string/caps->kebab yas-text)}' \ No newline at end of file +export const ${1:$$(string-lower->caps yas-text)} = '`(downcase (buffer-dirname))`/${1:$(string-caps->kebab yas-text)}' \ No newline at end of file diff --git a/emacs/.emacs.d/snippets/rjsx-mode/typed-redux-action b/emacs/.emacs.d/snippets/rjsx-mode/typed-redux-action index c50e1f9d2e95..7f7eb5aca275 100644 --- a/emacs/.emacs.d/snippets/rjsx-mode/typed-redux-action +++ b/emacs/.emacs.d/snippets/rjsx-mode/typed-redux-action @@ -2,4 +2,4 @@ # name: typed-redux-action # key: trax # -- -export const ${1:$$(string/lower->caps yas-text)}: '`(downcase (buffer-dirname))`/${1:$(string/caps->kebab yas-text)}' = '`(downcase (buffer-dirname))`/${1:$(string/caps->kebab yas-text)}' \ No newline at end of file +export const ${1:$$(string-lower->caps yas-text)}: '`(downcase (buffer-dirname))`/${1:$(string-caps->kebab yas-text)}' = '`(downcase (buffer-dirname))`/${1:$(string-caps->kebab yas-text)}' \ No newline at end of file diff --git a/emacs/.emacs.d/wpc/alist.el b/emacs/.emacs.d/wpc/alist.el index 21885b1fc2ee..574960a89276 100644 --- a/emacs/.emacs.d/wpc/alist.el +++ b/emacs/.emacs.d/wpc/alist.el @@ -233,7 +233,7 @@ In this case, the last writer wins, which is B." ;; - update-all ;; Scratch-pad -(macros/comment +(macros-comment (progn (setq person '((first-name . "William") (first-name . "William") diff --git a/emacs/.emacs.d/wpc/bag.el b/emacs/.emacs.d/wpc/bag.el index c9511b18e737..3f2d7c664813 100644 --- a/emacs/.emacs.d/wpc/bag.el +++ b/emacs/.emacs.d/wpc/bag.el @@ -45,7 +45,7 @@ (alist/has-key? x (bag-xs xs))) ;; TODO: Tabling this for now since working with structs seems to be -;; disappointingly difficult. Where is `struct/update'? +;; disappointingly difficult. Where is `struct-update'? ;; (defun bag/add (x xs) ;; "Add X to XS.") diff --git a/emacs/.emacs.d/wpc/bookmark.el b/emacs/.emacs.d/wpc/bookmark.el index 77fddd86fa98..1cb3843b7aae 100644 --- a/emacs/.emacs.d/wpc/bookmark.el +++ b/emacs/.emacs.d/wpc/bookmark.el @@ -85,7 +85,7 @@ Otherwise, open with `counsel-find-file'." (general-define-key :prefix "" :states '(normal) - (string/concat "j" (bookmark-kbd b)) + (string-concat "j" (bookmark-kbd b)) ;; TODO: Consider `cl-labels' so `which-key' minibuffer is more ;; helpful. (lambda () (interactive) (bookmark/open b))))))) diff --git a/emacs/.emacs.d/wpc/buffer.el b/emacs/.emacs.d/wpc/buffer.el index e91b7712149a..766f569ce9c5 100644 --- a/emacs/.emacs.d/wpc/buffer.el +++ b/emacs/.emacs.d/wpc/buffer.el @@ -121,7 +121,7 @@ Return a reference to that buffer." (if (> (ts-diff (ts-now) last-called) buffer/source-code-timeout) (progn - (struct/set! source-code-cycle + (struct-set! source-code-cycle cycle (cycle/from-list (buffer/source-code-buffers)) buffer/source-code-cycle-state) @@ -129,7 +129,7 @@ Return a reference to that buffer." buffer/source-code-cycle-state))) (funcall cycle-fn cycle) (switch-to-buffer (cycle/current cycle))) - (struct/set! source-code-cycle + (struct-set! source-code-cycle last-called (ts-now) buffer/source-code-cycle-state)) diff --git a/emacs/.emacs.d/wpc/bytes.el b/emacs/.emacs.d/wpc/bytes.el index 9780a8efc426..660fa3219469 100644 --- a/emacs/.emacs.d/wpc/bytes.el +++ b/emacs/.emacs.d/wpc/bytes.el @@ -83,7 +83,7 @@ ('gigabyte (tuple/from bytes/gb "GB")) ('terabyte (tuple/from bytes/tb "TB")) ('petabyte (tuple/from bytes/pb "PB"))))) - (string/format "%d%s" + (string-format "%d%s" (round x (tuple/first base-and-unit)) (tuple/second base-and-unit)))) diff --git a/emacs/.emacs.d/wpc/cache.el b/emacs/.emacs.d/wpc/cache.el index ebe581786f7b..421125745e38 100644 --- a/emacs/.emacs.d/wpc/cache.el +++ b/emacs/.emacs.d/wpc/cache.el @@ -44,7 +44,7 @@ (defun cache/touch (x xs) "Ensure value X in cache, XS, is front of the list. If X isn't in XS (using `equal'), insert it at the front." - (struct/update + (struct-update cache xs (>> (list/reject (lambda (y) (equal x y))) diff --git a/emacs/.emacs.d/wpc/colorscheme.el b/emacs/.emacs.d/wpc/colorscheme.el index 73916166961d..97ad59e960d8 100644 --- a/emacs/.emacs.d/wpc/colorscheme.el +++ b/emacs/.emacs.d/wpc/colorscheme.el @@ -72,7 +72,7 @@ Cycle prev otherwise." (cycle/next colorscheme/whitelist) (cycle/prev colorscheme/whitelist)))) (colorscheme/set theme) - (message (s-concat "Active theme: " (symbol/to-string theme))))) + (message (s-concat "Active theme: " (symbol-to-string theme))))) (defun colorscheme/next () "Disable the currently active theme and load the next theme." diff --git a/emacs/.emacs.d/wpc/cycle.el b/emacs/.emacs.d/wpc/cycle.el index 5a3a50006ae9..413a0933cbc2 100644 --- a/emacs/.emacs.d/wpc/cycle.el +++ b/emacs/.emacs.d/wpc/cycle.el @@ -94,16 +94,16 @@ underlying struct." "Return the next value in `XS' and update `current-index'." (let* ((current-index (cycle-current-index xs)) (next-index (next-index-> 0 (cycle/count xs) current-index))) - (struct/set! cycle previous-index current-index xs) - (struct/set! cycle current-index next-index xs) + (struct-set! cycle previous-index current-index xs) + (struct-set! cycle current-index next-index xs) (nth next-index (cycle-xs xs)))) (defun cycle/prev (xs) "Return the previous value in `XS' and update `current-index'." (let* ((current-index (cycle-current-index xs)) (next-index (next-index<- 0 (cycle/count xs) current-index))) - (struct/set! cycle previous-index current-index xs) - (struct/set! cycle current-index next-index xs) + (struct-set! cycle previous-index current-index xs) + (struct-set! cycle current-index next-index xs) (nth next-index (cycle-xs xs)))) (defun cycle/current (cycle) @@ -118,8 +118,8 @@ underlying struct." "Jump to the I index of XS." (let ((current-index (cycle-current-index xs)) (next-index (math/mod i (cycle/count xs)))) - (struct/set! cycle previous-index current-index xs) - (struct/set! cycle current-index next-index xs)) + (struct-set! cycle previous-index current-index xs) + (struct-set! cycle current-index next-index xs)) xs) (defun cycle/focus (p cycle) @@ -155,19 +155,19 @@ ITEM is the first item in XS that t for `equal'." If there is no currently focused item, add X to the beginning of XS." (if (cycle/empty? xs) (progn - (struct/set! cycle xs (list x) xs) - (struct/set! cycle current-index 0 xs) - (struct/set! cycle previous-index nil xs)) + (struct-set! cycle xs (list x) xs) + (struct-set! cycle current-index 0 xs) + (struct-set! cycle previous-index nil xs)) (let ((curr-i (cycle-current-index xs)) (prev-i (cycle-previous-index xs))) (if curr-i (progn - (struct/set! cycle xs (-insert-at curr-i x (cycle-xs xs)) xs) - (when (>= prev-i curr-i) (struct/set! cycle previous-index (1+ prev-i) xs)) - (when curr-i (struct/set! cycle current-index (1+ curr-i) xs))) + (struct-set! cycle xs (-insert-at curr-i x (cycle-xs xs)) xs) + (when (>= prev-i curr-i) (struct-set! cycle previous-index (1+ prev-i) xs)) + (when curr-i (struct-set! cycle current-index (1+ curr-i) xs))) (progn - (struct/set! cycle xs (cons x (cycle-xs xs)) xs) - (when prev-i (struct/set! cycle previous-index (1+ prev-i) xs)))) + (struct-set! cycle xs (cons x (cycle-xs xs)) xs) + (when prev-i (struct-set! cycle previous-index (1+ prev-i) xs)))) xs))) (defun cycle/remove (x xs) @@ -181,13 +181,13 @@ If X is the currently focused value, after it's deleted, current-index will be (let ((curr-i (cycle-current-index xs)) (prev-i (cycle-previous-index xs)) (rm-i (-elem-index x (cycle-xs xs)))) - (struct/set! cycle xs (-remove-at rm-i (cycle-xs xs)) xs) + (struct-set! cycle xs (-remove-at rm-i (cycle-xs xs)) xs) (when prev-i - (when (> prev-i rm-i) (struct/set! cycle previous-index (1- prev-i) xs)) - (when (= prev-i rm-i) (struct/set! cycle previous-index nil xs))) + (when (> prev-i rm-i) (struct-set! cycle previous-index (1- prev-i) xs)) + (when (= prev-i rm-i) (struct-set! cycle previous-index nil xs))) (when curr-i - (when (> curr-i rm-i) (struct/set! cycle current-index (1- curr-i) xs)) - (when (= curr-i rm-i) (struct/set! cycle current-index nil xs))) + (when (> curr-i rm-i) (struct-set! cycle current-index (1- curr-i) xs)) + (when (= curr-i rm-i) (struct-set! cycle current-index nil xs))) xs)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/emacs/.emacs.d/wpc/display.el b/emacs/.emacs.d/wpc/display.el index c2ecfe0f3f34..4e58e18e36d8 100644 --- a/emacs/.emacs.d/wpc/display.el +++ b/emacs/.emacs.d/wpc/display.el @@ -48,7 +48,7 @@ The car models the enabled state of my laptop display; the cdr models the (interactive) (prelude-start-process :name "display/enable-4k" - :command (string/format + :command (string-format "xrandr --output %s --above %s --primary --auto --size 3840x2160 --rate 30.00 --dpi 144" display/4k-monitor display/laptop-monitor))) @@ -58,7 +58,7 @@ The car models the enabled state of my laptop display; the cdr models the (interactive) (prelude-start-process :name "display/disable-4k" - :command (string/format "xrandr --output %s --off" + :command (string-format "xrandr --output %s --off" display/4k-monitor))) (defun display/enable-laptop () @@ -68,7 +68,7 @@ Sometimes this is useful when I'm sharing my screen in a Google Hangout and I (interactive) (prelude-start-process :name "display/disable-laptop" - :command (string/format "xrandr --output %s --auto" + :command (string-format "xrandr --output %s --auto" display/laptop-monitor))) (defun display/disable-laptop () @@ -78,7 +78,7 @@ Sometimes this is useful when I'm sharing my screen in a Google Hangout and I (interactive) (prelude-start-process :name "display/disable-laptop" - :command (string/format "xrandr --output %s --off" + :command (string-format "xrandr --output %s --off" display/laptop-monitor))) (defun display/cycle-display-states () diff --git a/emacs/.emacs.d/wpc/fonts.el b/emacs/.emacs.d/wpc/fonts.el index 48bbf5e081a6..0fe7c578f248 100644 --- a/emacs/.emacs.d/wpc/fonts.el +++ b/emacs/.emacs.d/wpc/fonts.el @@ -87,7 +87,7 @@ (defun fonts/set (font &optional size) "Change the font to `FONT' with option integer, SIZE, in pixels." (if (maybe-some? size) - (set-frame-font (string/format "%s %s" font size) nil t) + (set-frame-font (string-format "%s %s" font size) nil t) (set-frame-font font nil t))) (defun fonts/whitelist-set (font) @@ -107,7 +107,7 @@ The size of the font is determined by `fonts/size'." "Message the currently enabled font." (interactive) (message - (string/format "[fonts] Current font: \"%s\"" + (string-format "[fonts] Current font: \"%s\"" (fonts/current)))) (defun fonts/current () diff --git a/emacs/.emacs.d/wpc/functions.el b/emacs/.emacs.d/wpc/functions.el index d9f1a1e96017..24f2516be455 100644 --- a/emacs/.emacs.d/wpc/functions.el +++ b/emacs/.emacs.d/wpc/functions.el @@ -111,7 +111,7 @@ (defun wpc/evil-replace-under-point () "Faster than typing %s//thing/g." (interactive) - (let ((term (s-replace "/" "\\/" (symbol/to-string (symbol-at-point))))) + (let ((term (s-replace "/" "\\/" (symbol-to-string (symbol-at-point))))) (save-excursion (evil-ex (concat "%s/\\b" term "\\b/"))))) diff --git a/emacs/.emacs.d/wpc/irc.el b/emacs/.emacs.d/wpc/irc.el index 1787c8566f17..64af2538f8aa 100644 --- a/emacs/.emacs.d/wpc/irc.el +++ b/emacs/.emacs.d/wpc/irc.el @@ -87,7 +87,7 @@ (defun irc/message (x) "Print message X in a structured way." - (message (string/format "[irc.el] %s" x))) + (message (string-format "[irc.el] %s" x))) ;; TODO: Integrate Google setup with Freenode setup. @@ -136,7 +136,7 @@ (erc-join-channel (cycle/next cycle)) (irc/message - (string/format "Current IRC channel: %s" (cycle/current cycle)))))) + (string-format "Current IRC channel: %s" (cycle/current cycle)))))) (defun irc/prev-channel () "Join the previous channel for the active server." @@ -146,10 +146,10 @@ (erc-join-channel (cycle/prev cycle)) (irc/message - (string/format "Current IRC channel: %s" (cycle/current cycle)))))) + (string-format "Current IRC channel: %s" (cycle/current cycle)))))) -(add-hook 'erc-mode-hook (disable auto-fill-mode)) -(add-hook 'erc-mode-hook (disable company-mode)) +(add-hook 'erc-mode-hook (macros-disable auto-fill-mode)) +(add-hook 'erc-mode-hook (macros-disable company-mode)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Keybindings diff --git a/emacs/.emacs.d/wpc/kbd.el b/emacs/.emacs.d/wpc/kbd.el index 9201f258693f..dd47845e65b5 100644 --- a/emacs/.emacs.d/wpc/kbd.el +++ b/emacs/.emacs.d/wpc/kbd.el @@ -50,7 +50,7 @@ Values for F include: - workspace - x11" (prelude-assert (alist/has-key? f kbd/prefixes)) - (string/format + (string-format "%s-%s" (alist/get f kbd/prefixes) x)) @@ -69,14 +69,14 @@ Values for F include: (interactive) (message "[kbd] Awaiting keypress...") (let ((key (read-key))) - (clipboard/copy (string/format "%s" key)) - (message (string/format "[kbd] \"%s\" copied!" key)))) + (clipboard/copy (string-format "%s" key)) + (message (string-format "[kbd] \"%s\" copied!" key)))) (defun kbd/print-keycode () "Prints the pressed keybinding." (interactive) (message "[kbd] Awaiting keypress...") - (message (string/format "[kbd] keycode: %s" (read-key)))) + (message (string-format "[kbd] keycode: %s" (read-key)))) (provide 'kbd) ;;; kbd.el ends here diff --git a/emacs/.emacs.d/wpc/keyboard.el b/emacs/.emacs.d/wpc/keyboard.el index 91f17faa12fd..2a970d18d824 100644 --- a/emacs/.emacs.d/wpc/keyboard.el +++ b/emacs/.emacs.d/wpc/keyboard.el @@ -45,7 +45,7 @@ (defun keyboard/message (x) "Message X in a structured way." - (message (string/format "[keyboard.el] %s" x))) + (message (string-format "[keyboard.el] %s" x))) (cl-defun keyboard/set-key-repeat (&key (rate keyboard/repeat-rate) @@ -53,7 +53,7 @@ "Use xset to set the key-repeat RATE and DELAY." (prelude-start-process :name "keyboard/set-key-repeat" - :command (string/format "xset r rate %s %s" delay rate))) + :command (string-format "xset r rate %s %s" delay rate))) ;; NOTE: Settings like this are machine-dependent. For instance I only need to ;; do this on my laptop and other devices where I don't have access to my split @@ -78,7 +78,7 @@ (setq keyboard/repeat-rate (number/inc keyboard/repeat-rate)) (keyboard/set-key-repeat :rate keyboard/repeat-rate) (keyboard/message - (string/format "Rate: %s" keyboard/repeat-rate))) + (string-format "Rate: %s" keyboard/repeat-rate))) (defun keyboard/dec-repeat-rate () "Decrement `keyboard/repeat-rate'." @@ -86,7 +86,7 @@ (setq keyboard/repeat-rate (number/dec keyboard/repeat-rate)) (keyboard/set-key-repeat :rate keyboard/repeat-rate) (keyboard/message - (string/format "Rate: %s" keyboard/repeat-rate))) + (string-format "Rate: %s" keyboard/repeat-rate))) (defun keyboard/inc-repeat-delay () "Increment `keyboard/repeat-delay'." @@ -94,7 +94,7 @@ (setq keyboard/repeat-delay (number/inc keyboard/repeat-delay)) (keyboard/set-key-repeat :delay keyboard/repeat-delay) (keyboard/message - (string/format "Delay: %s" keyboard/repeat-delay))) + (string-format "Delay: %s" keyboard/repeat-delay))) (defun keyboard/dec-repeat-delay () "Decrement `keyboard/repeat-delay'." @@ -102,13 +102,13 @@ (setq keyboard/repeat-delay (number/dec keyboard/repeat-delay)) (keyboard/set-key-repeat :delay keyboard/repeat-delay) (keyboard/message - (string/format "Delay: %s" keyboard/repeat-delay))) + (string-format "Delay: %s" keyboard/repeat-delay))) (defun keyboard/print-key-repeat () "Print the currently set values for key repeat." (interactive) (keyboard/message - (string/format "Rate: %s. Delay: %s" + (string-format "Rate: %s. Delay: %s" keyboard/repeat-rate keyboard/repeat-delay))) diff --git a/emacs/.emacs.d/wpc/list.el b/emacs/.emacs.d/wpc/list.el index 64b3a846a9d8..bf4dc1ca178d 100644 --- a/emacs/.emacs.d/wpc/list.el +++ b/emacs/.emacs.d/wpc/list.el @@ -79,7 +79,7 @@ "" (list/reduce (list/first xs) (lambda (x acc) - (string/concat acc joint x)) + (string-concat acc joint x)) (list/tail xs)))) (defun list/length (xs) diff --git a/emacs/.emacs.d/wpc/macros.el b/emacs/.emacs.d/wpc/macros.el index 5f7c93902e3e..e7fd16229efb 100644 --- a/emacs/.emacs.d/wpc/macros.el +++ b/emacs/.emacs.d/wpc/macros.el @@ -1,5 +1,9 @@ ;;; macros.el --- Helpful variables for making my ELisp life more enjoyable -*- lexical-binding: t -*- -;; Authpr: William Carroll + +;; Author: William Carroll +;; Version: 0.0.1 +;; URL: https://git.wpcarro.dev/wpcarro/briefcase +;; Package-Requires: ((emacs "24")) ;;; Commentary: ;; This file contains helpful variables that I use in my ELisp development. @@ -9,51 +13,44 @@ ;;; Code: +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Dependencies +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (require 'f) (require 'string) (require 'symbol) -;; TODO: Support `xi' lambda shorthand macro. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Library +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defmacro enable (mode) +(defmacro macros-enable (mode) "Helper for enabling `MODE'. Useful in `add-hook' calls. Some modes, like `linum-mode' need to be called as `(linum-mode 1)', so `(add-hook mode #'linum-mode)' won't work." `#'(lambda nil (,mode 1))) -(defmacro disable (mode) +(defmacro macros-disable (mode) "Helper for disabling `MODE'. Useful in `add-hook' calls." `#'(lambda nil (,mode -1))) -(defmacro add-hooks (modes callback) - "Add multiple `MODES' for the `CALLBACK'. -Usage: (add-hooks '(one-mode-hook 'two-mode-hook) #'fn)" - `(dolist (mode ,modes) - (add-hook mode ,callback))) - -(defmacro add-hook-before-save (mode f) +(defmacro macros-add-hook-before-save (mode f) "Register a hook, `F', for a mode, `MODE' more conveniently. Usage: (add-hook-before-save 'reason-mode-hook #'refmt-before-save)" `(add-hook ,mode (lambda () (add-hook 'before-save-hook ,f)))) -;; TODO: Debug. -(defmacro macros/ilambda (&rest body) - "Surrounds `BODY' with an interactive lambda function." - `(lambda () - (interactive) - ,@body)) - ;; TODO: Privatize? -(defun namespace () +(defun macros--namespace () "Return the namespace for a function based on the filename." (->> (buffer-file-name) f-filename f-base)) -(defmacro macros/comment (&rest _) +(defmacro macros-comment (&rest _) "Empty comment s-expresion where `BODY' is ignored." `nil) @@ -64,31 +61,10 @@ Usage: (add-hook-before-save 'reason-mode-hook #'refmt-before-save)" `(lambda (,sym) (->> ,sym ,@forms)))) -;; TOOD: Support this. -(cl-defmacro macros/test - (&key function - test - args - expect - equality) - (let* ((namespace (namespace)) - (test-name (string/->symbol - (s-concat namespace - "/" - "test" - "/" - (s-chop-prefix - (s-concat namespace "/") - (symbol/to-string function)))))) - `(ert-deftest ,test-name () - ,test - (should (,equality (apply ,function ,args) - ,expect))))) - -(defmacro macros/support-file-extension (ext mode) +(defmacro macros-support-file-extension (ext mode) "Register MODE to automatically load with files ending with EXT extension. -Usage: (macros/support-file-extension \"pb\" protobuf-mode)" - (let ((extension (string/format "\\.%s\\'" ext))) +Usage: (macros-support-file-extension \"pb\" protobuf-mode)" + (let ((extension (string-format "\\.%s\\'" ext))) `(add-to-list 'auto-mode-alist '(,extension . ,mode)))) (provide 'macros) diff --git a/emacs/.emacs.d/wpc/pulse-audio.el b/emacs/.emacs.d/wpc/pulse-audio.el index 34f4ab21767c..d22cace46de9 100644 --- a/emacs/.emacs.d/wpc/pulse-audio.el +++ b/emacs/.emacs.d/wpc/pulse-audio.el @@ -30,7 +30,7 @@ (defun pulse-audio--message (x) "Output X to *Messages*." - (message (string/format "[pulse-audio.el] %s" x))) + (message (string-format "[pulse-audio.el] %s" x))) (defun pulse-audio-toggle-mute () "Mute the default sink." @@ -53,7 +53,7 @@ (interactive) (prelude-start-process :name "pulse-audio-decrease-volume" - :command (string/format "pactl set-sink-volume @DEFAULT_SINK@ -%s%%" + :command (string-format "pactl set-sink-volume @DEFAULT_SINK@ -%s%%" pulse-audio--step-size)) (pulse-audio--message "Volume decreased.")) @@ -62,7 +62,7 @@ (interactive) (prelude-start-process :name "pulse-audio-increase-volume" - :command (string/format "pactl set-sink-volume @DEFAULT_SINK@ +%s%%" + :command (string-format "pactl set-sink-volume @DEFAULT_SINK@ +%s%%" pulse-audio--step-size)) (pulse-audio--message "Volume increased.")) diff --git a/emacs/.emacs.d/wpc/scope.el b/emacs/.emacs.d/wpc/scope.el index 48aa85ad0e5d..14924e33ff55 100644 --- a/emacs/.emacs.d/wpc/scope.el +++ b/emacs/.emacs.d/wpc/scope.el @@ -37,7 +37,7 @@ The newest bindings eclipse the oldest." (defun scope/push-new (xs) "Push a new, empty scope onto XS." - (struct/update scope + (struct-update scope scopes (>> (stack/push (alist/new))) xs)) @@ -65,7 +65,7 @@ The newest bindings eclipse the oldest." (defun scope/set (k v xs) "Set value, V, at key, K, in XS for the current scope." - (struct/update scope + (struct-update scope scopes (>> (stack/map-top (>> (alist/set k v)))) xs)) diff --git a/emacs/.emacs.d/wpc/screen-brightness.el b/emacs/.emacs.d/wpc/screen-brightness.el index 6d7d762d54c6..1d11fc4d8641 100644 --- a/emacs/.emacs.d/wpc/screen-brightness.el +++ b/emacs/.emacs.d/wpc/screen-brightness.el @@ -30,7 +30,7 @@ (interactive) (prelude-start-process :name "screen-brightness/increase" - :command (string/format "xbacklight -inc %s" screen-brightness/step-size)) + :command (string-format "xbacklight -inc %s" screen-brightness/step-size)) (message "[screen-brightness.el] Increased screen brightness.")) (defun screen-brightness/decrease () @@ -38,7 +38,7 @@ (interactive) (prelude-start-process :name "screen-brightness/decrease" - :command (string/format "xbacklight -dec %s" screen-brightness/step-size)) + :command (string-format "xbacklight -dec %s" screen-brightness/step-size)) (message "[screen-brightness.el] Decreased screen brightness.")) (provide 'screen-brightness) diff --git a/emacs/.emacs.d/wpc/scrot.el b/emacs/.emacs.d/wpc/scrot.el index caeb25da3bcb..efd22e2b1437 100644 --- a/emacs/.emacs.d/wpc/scrot.el +++ b/emacs/.emacs.d/wpc/scrot.el @@ -34,7 +34,7 @@ See scrot's man page for more information.") This currently only works for PNG files because that's what I'm outputting" (call-process "xclip" nil nil nil "-selection" "clipboard" "-t" "image/png" path) - (message (string/format "[scrot.el] Image copied to clipboard!"))) + (message (string-format "[scrot.el] Image copied to clipboard!"))) (defmacro scrot/call (&rest args) "Call scrot with ARGS." diff --git a/emacs/.emacs.d/wpc/set.el b/emacs/.emacs.d/wpc/set.el index d15fa0653e6b..c24fbbd57442 100644 --- a/emacs/.emacs.d/wpc/set.el +++ b/emacs/.emacs.d/wpc/set.el @@ -45,7 +45,7 @@ (defun set/add (x xs) "Add X to set XS." - (struct/update set + (struct-update set xs (lambda (table) (let ((table-copy (ht-copy table))) diff --git a/emacs/.emacs.d/wpc/ssh.el b/emacs/.emacs.d/wpc/ssh.el index 0b11eb258525..4176872847dc 100644 --- a/emacs/.emacs.d/wpc/ssh.el +++ b/emacs/.emacs.d/wpc/ssh.el @@ -1,5 +1,9 @@ ;;; ssh.el --- When working remotely -*- lexical-binding: t -*- + ;; Author: William Carroll +;; Version: 0.0.1 +;; URL: https://git.wpcarro.dev/wpcarro/briefcase +;; Package-Requires: ((emacs "24")) ;;; Commentary: ;; Configuration to make remote work easier. diff --git a/emacs/.emacs.d/wpc/stack.el b/emacs/.emacs.d/wpc/stack.el index 052ed881d20f..c7d9cbefe441 100644 --- a/emacs/.emacs.d/wpc/stack.el +++ b/emacs/.emacs.d/wpc/stack.el @@ -1,5 +1,9 @@ ;;; stack.el --- Working with stacks in Elisp -*- lexical-binding: t -*- + ;; Author: William Carroll +;; Version: 0.0.1 +;; URL: https://git.wpcarro.dev/wpcarro/briefcase +;; Package-Requires: ((emacs "25.1")) ;;; Commentary: ;; A stack is a LIFO queue. @@ -46,7 +50,7 @@ (defun stack/push (x xs) "Push `X' on `XS'." - (struct/update stack + (struct-update stack xs (>> (list/cons x)) xs)) @@ -57,7 +61,7 @@ "Return the stack, `XS', without the top element. Since I cannot figure out a nice way of return tuples in Elisp, if you want to look at the first element, use `stack/peek' before running `stack/pop'." - (struct/update stack + (struct-update stack xs (>> list/tail) xs)) diff --git a/emacs/.emacs.d/wpc/string.el b/emacs/.emacs.d/wpc/string.el index c6145c907f23..9d18029690f5 100644 --- a/emacs/.emacs.d/wpc/string.el +++ b/emacs/.emacs.d/wpc/string.el @@ -1,5 +1,9 @@ ;; string.el --- Library for working with strings -*- lexical-binding: t -*- + ;; Author: William Carroll +;; Version: 0.0.1 +;; URL: https://git.wpcarro.dev/wpcarro/briefcase +;; Package-Requires: ((emacs "24")) ;;; Commentary: ;; Library for working with string. @@ -19,56 +23,53 @@ ;; Library ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defconst string/test? t - "When t, run the tests.") - -(defun string/contains? (c x) +(defun string-contains? (c x) "Return t if X is in C." (s-contains? c x)) -(defun string/hookify (x) +(defun string-hookify (x) "Append \"-hook\" to X." (s-append "-hook" x)) -(defun string/split (y x) +(defun string-split (y x) "Map string X into a list of strings that were separated by Y." (s-split y x)) -(defun string/ensure-hookified (x) +(defun string-ensure-hookified (x) "Ensure that X has \"-hook\" appended to it." (if (s-ends-with? "-hook" x) x - (string/hookify x))) + (string-hookify x))) -(defun string/format (x &rest args) +(defun string-format (x &rest args) "Format template string X with ARGS." (apply #'format (cons x args))) -(defun string/concat (&rest strings) +(defun string-concat (&rest strings) "Joins `STRINGS' into onto string." (apply #'s-concat strings)) -(defun string/->symbol (string) +(defun string-->symbol (string) "Maps `STRING' to a symbol." (intern string)) -(defun string/<-symbol (symbol) +(defun string-<-symbol (symbol) "Maps `SYMBOL' into a string." (symbol-name symbol)) -(defun string/prepend (prefix x) +(defun string-prepend (prefix x) "Prepend `PREFIX' onto `X'." (s-concat prefix x)) -(defun string/append (postfix x) +(defun string-append (postfix x) "Appen `POSTFIX' onto `X'." (s-concat x postfix)) -(defun string/surround (s x) +(defun string-surround (s x) "Surrounds `X' one each side with `S'." (->> x - (string/prepend s) - (string/append s))) + (string-prepend s) + (string-append s))) ;; TODO: Define a macro for defining a function and a test. @@ -76,25 +77,25 @@ ;; Casing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun string/caps->kebab (x) +(defun string-caps->kebab (x) "Change the casing of `X' from CAP_CASE to kebab-case." (->> x s-downcase (s-replace "_" "-"))) -(defun string/kebab->caps (x) +(defun string-kebab->caps (x) "Change the casing of X from CAP_CASE to kebab-case." (->> x s-upcase (s-replace "-" "_"))) -(defun string/lower->caps (x) +(defun string-lower->caps (x) "Change the casing of X from lowercase to CAPS_CASE." (->> x s-upcase (s-replace " " "_"))) -(defun string/lower->kebab (x) +(defun string-lower->kebab (x) "Change the casing of `X' from lowercase to kebab-case." (s-replace " " "-" x)) @@ -102,27 +103,9 @@ ;; Predicates ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defun string/instance? (x) +(defun string-instance? (x) "Return t if X is a string." (stringp x)) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Tests -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; (when string/test? -;; (prelude-assert -;; (string= -;; (string/surround "-*-" "surround") -;; "-*-surround-*-")) -;; (prelude-assert -;; (string= -;; (string/caps->kebab "CAPS_CASE_STRING") -;; "caps-case-string")) -;; (prelude-assert -;; (string= -;; (string/kebab->caps "kebab-case-string") -;; "KEBAB_CASE_STRING"))) - (provide 'string) ;;; string.el ends here diff --git a/emacs/.emacs.d/wpc/struct.el b/emacs/.emacs.d/wpc/struct.el index dd1bcd00ef59..35957e834449 100644 --- a/emacs/.emacs.d/wpc/struct.el +++ b/emacs/.emacs.d/wpc/struct.el @@ -1,5 +1,9 @@ ;;; struct.el --- Helpers for working with structs -*- lexical-binding: t -*- + ;; Author: William Carroll +;; Version: 0.0.1 +;; URL: https://git.wpcarro.dev/wpcarro/briefcase +;; Package-Requires: ((emacs "24.3")) ;;; Commentary: ;; Provides new macros for working with structs. Also provides adapter @@ -10,12 +14,6 @@ ;;; Code: -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Wish list -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; - TODO: Replace `symbol-name' and `intern' calls with isomorphism. - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Dependencies ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -27,44 +25,44 @@ ;; Library ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(defvar struct/enable-tests? t +(defvar struct--enable-tests? t "When t, run the test suite defined herein.") -(defmacro struct/update (type field f xs) +(defmacro struct-update (type field f xs) "Apply F to FIELD in XS, which is a struct of TYPE. This is immutable." (let ((copier (->> type symbol-name - (string/prepend "copy-") + (string-prepend "copy-") intern)) (accessor (->> field symbol-name - (string/prepend (string/concat (symbol-name type) "-")) + (string-prepend (string-concat (symbol-name type) "-")) intern))) `(let ((copy (,copier ,xs))) (setf (,accessor copy) (funcall ,f (,accessor copy))) copy))) -(defmacro struct/set (type field x xs) +(defmacro struct-set (type field x xs) "Immutably set FIELD in XS (struct TYPE) to X." (let ((copier (->> type symbol-name - (string/prepend "copy-") + (string-prepend "copy-") intern)) (accessor (->> field symbol-name - (string/prepend (string/concat (symbol-name type) "-")) + (string-prepend (string-concat (symbol-name type) "-")) intern))) `(let ((copy (,copier ,xs))) (setf (,accessor copy) ,x) copy))) -(defmacro struct/set! (type field x xs) +(defmacro struct-set! (type field x xs) "Set FIELD in XS (struct TYPE) to X mutably. This is an adapter interface to `setf'." (let ((accessor (->> field symbol-name - (string/prepend (string/concat (symbol-name type) "-")) + (string-prepend (string-concat (symbol-name type) "-")) intern))) `(progn (setf (,accessor ,xs) ,x) @@ -74,14 +72,14 @@ This is an adapter interface to `setf'." ;; Tests ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(when struct/enable-tests? +(when struct--enable-tests? (cl-defstruct dummy name age) - (defvar test-dummy (make-dummy :name "Roofus" :age 19)) - (struct/set! dummy name "Doofus" test-dummy) - (prelude-assert (string= "Doofus" (dummy-name test-dummy))) - (let ((result (struct/set dummy name "Shoofus" test-dummy))) - ;; Test the immutability of `struct/set' - (prelude-assert (string= "Doofus" (dummy-name test-dummy))) + (defvar struct--test-dummy (make-dummy :name "Roofus" :age 19)) + (struct-set! dummy name "Doofus" struct--test-dummy) + (prelude-assert (string= "Doofus" (dummy-name struct--test-dummy))) + (let ((result (struct-set dummy name "Shoofus" struct--test-dummy))) + ;; Test the immutability of `struct-set' + (prelude-assert (string= "Doofus" (dummy-name struct--test-dummy))) (prelude-assert (string= "Shoofus" (dummy-name result))))) (provide 'struct) diff --git a/emacs/.emacs.d/wpc/symbol.el b/emacs/.emacs.d/wpc/symbol.el index 9119b29470fd..fac182090a73 100644 --- a/emacs/.emacs.d/wpc/symbol.el +++ b/emacs/.emacs.d/wpc/symbol.el @@ -1,17 +1,27 @@ ;; symbol.el --- Library for working with symbols. -*- lexical-binding: t -*- + ;; Author: William Carroll +;; Version: 0.0.1 +;; URL: https://git.wpcarro.dev/wpcarro/briefcase +;; Package-Requires: ((emacs "24")) ;;; Commentary: ;; Library for working with symbols. ;;; Code: -;; TODO: Why is ivy mode map everywhere? +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Dependencies +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'string) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Library +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Symbols -(defun symbol/as-string (callback x) +(defun symbol-as-string (callback x) "Treat the symbol, X, as a string while applying CALLBACK to it. Coerce back to a symbol on the way out." (->> x @@ -19,23 +29,19 @@ Coerce back to a symbol on the way out." callback #'intern)) -(defun symbol/to-string (x) +(defun symbol-to-string (x) "Map `X' into a string." - (string/<-symbol x)) + (string-<-symbol x)) -(defun symbol/hookify (x) +(defun symbol-hookify (x) "Append \"-hook\" to X when X is a symbol." - (symbol/as-string #'string/hookify x)) + (symbol-as-string #'string-hookify x)) -(defun symbol/ensure-hookified (x) +(defun symbol-ensure-hookified (x) "Ensure that X has \"-hook\" appended to it when X is a symbol." - (symbol/as-string #'string/ensure-hookified x)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Predicates -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (symbol-as-string #'string-ensure-hookified x)) -(defun symbol/instance? (x) +(defun symbol-instance? (x) "Return t if X is a symbol." (symbolp x)) diff --git a/emacs/.emacs.d/wpc/timestring.el b/emacs/.emacs.d/wpc/timestring.el index a6a6653539b3..3685c0f3e250 100644 --- a/emacs/.emacs.d/wpc/timestring.el +++ b/emacs/.emacs.d/wpc/timestring.el @@ -2,8 +2,8 @@ ;; Author: William Carroll ;; Version: 0.0.1 +;; URL: https://git.wpcarro.dev/wpcarro/briefcase ;; Package-Requires: ((emacs "25.1")) -;; Homepage: https://user.git.corp.google.com/wpcarro/briefcase ;;; Commentary: diff --git a/emacs/.emacs.d/wpc/window-manager.el b/emacs/.emacs.d/wpc/window-manager.el index ce535e7d182e..f36e967b1dbc 100644 --- a/emacs/.emacs.d/wpc/window-manager.el +++ b/emacs/.emacs.d/wpc/window-manager.el @@ -88,7 +88,7 @@ (defun window-manager--alert (x) "Message X with a structured format." - (alert (string/concat "[exwm] " x))) + (alert (string-concat "[exwm] " x))) ;; Use Emacs as my primary window manager. (use-package exwm @@ -274,10 +274,10 @@ Ivy is used to capture the user's input." (interactive) (let* ((name->cmd `(("Lock" . ,window-manager--xsecurelock) ("Logout" . "sudo systemctl stop lightdm") - ("Suspend" . ,(string/concat + ("Suspend" . ,(string-concat window-manager--xsecurelock " && systemctl suspend")) - ("Hibernate" . ,(string/concat + ("Hibernate" . ,(string-concat window-manager--xsecurelock " && systemctl hibernate")) ("Reboot" . "systemctl reboot") @@ -313,7 +313,7 @@ Currently using super- as the prefix for switching workspaces." (window-manager--named-workspace-label workspace) window-manager--named-workspaces)) (window-manager--alert - (string/format "Switched to: %s" + (string-format "Switched to: %s" (window-manager--named-workspace-label workspace)))) (defun window-manager--switch (label) diff --git a/emacs/.emacs.d/wpc/window.el b/emacs/.emacs.d/wpc/window.el index c0a4d5765694..ee3c109b79b4 100644 --- a/emacs/.emacs.d/wpc/window.el +++ b/emacs/.emacs.d/wpc/window.el @@ -30,7 +30,7 @@ nil))) ;; TODO: Find a way to incorporate these into function documentation. -(macros/comment +(macros-comment (window-find "*scratch*")) (defun window-delete (window) diff --git a/emacs/.emacs.d/wpc/wpc-dired.el b/emacs/.emacs.d/wpc/wpc-dired.el index 2b2b64ad36a5..f440c5272519 100644 --- a/emacs/.emacs.d/wpc/wpc-dired.el +++ b/emacs/.emacs.d/wpc/wpc-dired.el @@ -11,9 +11,15 @@ ;;; Code: -;; TODO: Ensure sorting in dired is by type. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Dependencies +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; TODO: Rename wpc-dired.el to file-management.el +(require 'macros) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Configuration +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (progn (require 'dired) @@ -32,7 +38,7 @@ "f" #'project-find-file "-" (lambda () (interactive) (find-alternate-file ".."))) (general-add-hook 'dired-mode-hook - (list (enable dired-hide-details-mode) + (list (macros-enable dired-hide-details-mode) #'auto-revert-mode))) (progn diff --git a/emacs/.emacs.d/wpc/wpc-golang.el b/emacs/.emacs.d/wpc/wpc-golang.el index 50c26fd5bfcd..8fe68860bfa5 100644 --- a/emacs/.emacs.d/wpc/wpc-golang.el +++ b/emacs/.emacs.d/wpc/wpc-golang.el @@ -15,6 +15,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'prelude) +(require 'macros) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Configuration @@ -40,7 +41,7 @@ (add-hook 'go-mode-hook (lambda () (set (make-local-variable 'compile-command) "go build -v"))) - (add-hook-before-save 'go-mode-hook #'gofmt-before-save)) + (macros-add-hook-before-save 'go-mode-hook #'gofmt-before-save)) (provide 'wpc-golang) ;;; wpc-golang.el ends here diff --git a/emacs/.emacs.d/wpc/wpc-org.el b/emacs/.emacs.d/wpc/wpc-org.el index 99ccc3979d45..8d8b76b74ebd 100644 --- a/emacs/.emacs.d/wpc/wpc-org.el +++ b/emacs/.emacs.d/wpc/wpc-org.el @@ -15,6 +15,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'f) +(require 'macros) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Configuration @@ -24,15 +25,15 @@ :config (evil-set-initial-state 'org-mode 'normal) (general-add-hook 'org-mode-hook - (list (disable linum-mode) - (disable company-mode))) + (list (macros-disable linum-mode) + (macros-disable company-mode))) (setq org-startup-folded nil) (setq org-todo-keywords '((sequence "TODO" "BLOCKED" "DONE"))) (general-unbind 'normal org-mode-map "M-h" "M-j" "M-k" "M-l")) (use-package org-bullets :config - (general-add-hook 'org-mode-hook (enable org-bullets-mode))) + (general-add-hook 'org-mode-hook (macros-enable org-bullets-mode))) (provide 'wpc-org) ;;; wpc-org.el ends here diff --git a/emacs/.emacs.d/wpc/wpc-prolog.el b/emacs/.emacs.d/wpc/wpc-prolog.el index be3c0895e61d..b891a7df6912 100644 --- a/emacs/.emacs.d/wpc/wpc-prolog.el +++ b/emacs/.emacs.d/wpc/wpc-prolog.el @@ -14,7 +14,7 @@ ;; TODO: Notice that the .pl extension conflicts with Perl files. This may ;; become a problem should I start working with Perl. -(macros/support-file-extension "pl" prolog-mode) +(macros-support-file-extension "pl" prolog-mode) (provide 'wpc-prolog) ;;; wpc-prolog.el ends here diff --git a/emacs/.emacs.d/wpc/wpc-ui.el b/emacs/.emacs.d/wpc/wpc-ui.el index 1dad4a0c32ba..ca17486616da 100644 --- a/emacs/.emacs.d/wpc/wpc-ui.el +++ b/emacs/.emacs.d/wpc/wpc-ui.el @@ -69,13 +69,6 @@ ;; disable toolbar (tool-bar-mode -1) -;; TODO: Re-enable `linum-mode' when I figure out why the theming is so ugly. -;; enable line numbers -;; (general-add-hook '(prog-mode-hook -;; text-mode-hook -;; conf-mode-hook) -;; (enable linum-mode)) - ;; set default buffer for Emacs (setq initial-buffer-choice constants/current-project) -- cgit 1.4.1