Lint string, macros.el
More of the same type of linting... basically preferring `namespace-` instead of `namespace/`.
This commit is contained in:
		
							parent
							
								
									158f810981
								
							
						
					
					
						commit
						a638e15c0d
					
				
					 36 changed files with 176 additions and 204 deletions
				
			
		|  | @ -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)}' | ||||
| export const ${1:$$(string-lower->caps yas-text)} = '`(downcase (buffer-dirname))`/${1:$(string-caps->kebab yas-text)}' | ||||
|  | @ -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)}' | ||||
| 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)}' | ||||
|  | @ -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") | ||||
|  |  | |||
|  | @ -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.") | ||||
| 
 | ||||
|  |  | |||
|  | @ -85,7 +85,7 @@ Otherwise, open with `counsel-find-file'." | |||
|           (general-define-key | ||||
|            :prefix "<SPC>" | ||||
|            :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))))))) | ||||
|  |  | |||
|  | @ -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)) | ||||
|  |  | |||
|  | @ -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)))) | ||||
| 
 | ||||
|  |  | |||
|  | @ -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))) | ||||
|  |  | |||
|  | @ -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." | ||||
|  |  | |||
|  | @ -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)) | ||||
| 
 | ||||
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||||
|  |  | |||
|  | @ -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 () | ||||
|  |  | |||
|  | @ -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 () | ||||
|  |  | |||
|  | @ -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/"))))) | ||||
| 
 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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))) | ||||
| 
 | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -1,5 +1,9 @@ | |||
| ;;; macros.el --- Helpful variables for making my ELisp life more enjoyable -*- lexical-binding: t -*- | ||||
| ;; Authpr: William Carroll <wpcarro@gmail.com> | ||||
| 
 | ||||
| ;; Author: William Carroll <wpcarro@gmail.com> | ||||
| ;; 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) | ||||
|  |  | |||
|  | @ -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.")) | ||||
| 
 | ||||
|  |  | |||
|  | @ -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)) | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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." | ||||
|  |  | |||
|  | @ -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))) | ||||
|  |  | |||
|  | @ -1,5 +1,9 @@ | |||
| ;;; ssh.el --- When working remotely -*- 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: | ||||
| ;; Configuration to make remote work easier. | ||||
|  |  | |||
|  | @ -1,5 +1,9 @@ | |||
| ;;; stack.el --- Working with stacks in Elisp -*- lexical-binding: t -*- | ||||
| 
 | ||||
| ;; Author: William Carroll <wpcarro@gmail.com> | ||||
| ;; 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)) | ||||
|  |  | |||
|  | @ -1,5 +1,9 @@ | |||
| ;; string.el --- Library for working with strings -*- 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: | ||||
| ;; 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 | ||||
|  |  | |||
|  | @ -1,5 +1,9 @@ | |||
| ;;; struct.el --- Helpers for working with structs -*- lexical-binding: t -*- | ||||
| 
 | ||||
| ;; Author: William Carroll <wpcarro@gmail.com> | ||||
| ;; 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) | ||||
|  |  | |||
|  | @ -1,17 +1,27 @@ | |||
| ;; symbol.el --- Library for working with symbols. -*- 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: | ||||
| ;; 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)) | ||||
|   (symbol-as-string #'string-ensure-hookified x)) | ||||
| 
 | ||||
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||||
| ;; Predicates | ||||
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||||
| 
 | ||||
| (defun symbol/instance? (x) | ||||
| (defun symbol-instance? (x) | ||||
|   "Return t if X is a symbol." | ||||
|   (symbolp x)) | ||||
| 
 | ||||
|  |  | |||
|  | @ -2,8 +2,8 @@ | |||
| 
 | ||||
| ;; Author: William Carroll <wpcarro@gmail.com> | ||||
| ;; 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: | ||||
| 
 | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue