More Elisp linting
In order for this to scale, I need to solve two things: 1. Ad-hoc ignore fill-column rules for URLs and other exceptions. 2. Run Elisp flychecker without evaluating my Elisp code and firing its side-effects.
This commit is contained in:
		
							parent
							
								
									3b2fffe954
								
							
						
					
					
						commit
						718899c629
					
				
					 19 changed files with 62 additions and 67 deletions
				
			
		| 
						 | 
					@ -199,8 +199,10 @@ Mutative variant of `alist-delete'."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; TODO: Should I support `alist-find-key' and `alist-find-value' variants?
 | 
					;; TODO: Should I support `alist-find-key' and `alist-find-value' variants?
 | 
				
			||||||
(defun alist-find (p xs)
 | 
					(defun alist-find (p xs)
 | 
				
			||||||
  "Apply a predicate fn, P, to each key and value in XS and return the key of
 | 
					  "Find an element in XS.
 | 
				
			||||||
  the first element that returns t."
 | 
					
 | 
				
			||||||
 | 
					Apply a predicate fn, P, to each key and value in XS and return the key of the
 | 
				
			||||||
 | 
					first element that returns t."
 | 
				
			||||||
  (let ((result (list-find (lambda (x) (funcall p (car x) (cdr x))) xs)))
 | 
					  (let ((result (list-find (lambda (x) (funcall p (car x) (cdr x))) xs)))
 | 
				
			||||||
    (if result
 | 
					    (if result
 | 
				
			||||||
        (car result)
 | 
					        (car result)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -117,7 +117,7 @@ Return a reference to that buffer."
 | 
				
			||||||
;; encapsulates all of this behavior.
 | 
					;; encapsulates all of this behavior.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun buffer-cycle (cycle-fn)
 | 
					(defun buffer-cycle (cycle-fn)
 | 
				
			||||||
  "Cycle forwards or backwards through `buffer-source-code-buffers'."
 | 
					  "Using CYCLE-FN, move through `buffer-source-code-buffers'."
 | 
				
			||||||
  (let ((last-called (source-code-cycle-last-called
 | 
					  (let ((last-called (source-code-cycle-last-called
 | 
				
			||||||
                      buffer-source-code-cycle-state))
 | 
					                      buffer-source-code-cycle-state))
 | 
				
			||||||
        (cycle (source-code-cycle-cycle
 | 
					        (cycle (source-code-cycle-cycle
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
;;; constants.el --- Constants for organizing my Emacs -*- lexical-binding: t -*-
 | 
					;;; constants.el --- Constants for organizing my Elisp -*- lexical-binding: t -*-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; Author: William Carroll <wpcarro@gmail.com>
 | 
					;; Author: William Carroll <wpcarro@gmail.com>
 | 
				
			||||||
;; Version: 0.0.1
 | 
					;; Version: 0.0.1
 | 
				
			||||||
| 
						 | 
					@ -26,7 +26,7 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defconst constants-ci?
 | 
					(defconst constants-ci?
 | 
				
			||||||
  (maybe-some? (getenv "CI"))
 | 
					  (maybe-some? (getenv "CI"))
 | 
				
			||||||
  "True when Emacs is running in CI.")
 | 
					  "Encoded as t when Emacs is running in CI.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defconst constants-briefcase
 | 
					(defconst constants-briefcase
 | 
				
			||||||
  (getenv "BRIEFCASE")
 | 
					  (getenv "BRIEFCASE")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,9 +1,9 @@
 | 
				
			||||||
;;; cycle.el --- Simple module for working with cycles. -*- lexical-binding: t -*-
 | 
					;;; cycle.el --- Simple module for working with cycles -*- lexical-binding: t -*-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; Author: William Carroll <wpcarro@gmail.com>
 | 
					;; Author: William Carroll <wpcarro@gmail.com>
 | 
				
			||||||
;; Version: 0.0.1
 | 
					;; Version: 0.0.1
 | 
				
			||||||
;; URL: https://git.wpcarro.dev/wpcarro/briefcase
 | 
					;; URL: https://git.wpcarro.dev/wpcarro/briefcase
 | 
				
			||||||
;; Package-Requires: ((emacs "24"))
 | 
					;; Package-Requires: ((emacs "24.3"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;; Commentary:
 | 
					;;; Commentary:
 | 
				
			||||||
;; Something like this may already exist, but I'm having trouble finding it, and
 | 
					;; Something like this may already exist, but I'm having trouble finding it, and
 | 
				
			||||||
| 
						 | 
					@ -56,7 +56,7 @@
 | 
				
			||||||
  "Return the list representation of a cycle, XS."
 | 
					  "Return the list representation of a cycle, XS."
 | 
				
			||||||
  (cycle-xs xs))
 | 
					  (cycle-xs xs))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun next-index<- (lo hi x)
 | 
					(defun cycle--next-index<- (lo hi x)
 | 
				
			||||||
  "Return the next index in a cycle when moving downwards.
 | 
					  "Return the next index in a cycle when moving downwards.
 | 
				
			||||||
- `LO' is the lower bound.
 | 
					- `LO' is the lower bound.
 | 
				
			||||||
- `HI' is the upper bound.
 | 
					- `HI' is the upper bound.
 | 
				
			||||||
| 
						 | 
					@ -65,7 +65,7 @@
 | 
				
			||||||
      (- hi 1)
 | 
					      (- hi 1)
 | 
				
			||||||
    (- x 1)))
 | 
					    (- x 1)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun next-index-> (lo hi x)
 | 
					(defun cycle--next-index-> (lo hi x)
 | 
				
			||||||
  "Return the next index in a cycle when moving upwards.
 | 
					  "Return the next index in a cycle when moving upwards.
 | 
				
			||||||
- `LO' is the lower bound.
 | 
					- `LO' is the lower bound.
 | 
				
			||||||
- `HI' is the upper bound.
 | 
					- `HI' is the upper bound.
 | 
				
			||||||
| 
						 | 
					@ -97,7 +97,7 @@ underlying struct."
 | 
				
			||||||
(defun cycle-next (xs)
 | 
					(defun cycle-next (xs)
 | 
				
			||||||
  "Return the next value in `XS' and update `current-index'."
 | 
					  "Return the next value in `XS' and update `current-index'."
 | 
				
			||||||
  (let* ((current-index (cycle-current-index xs))
 | 
					  (let* ((current-index (cycle-current-index xs))
 | 
				
			||||||
         (next-index (next-index-> 0 (cycle-count xs) current-index)))
 | 
					         (next-index (cycle--next-index-> 0 (cycle-count xs) current-index)))
 | 
				
			||||||
    (struct-set! cycle previous-index current-index xs)
 | 
					    (struct-set! cycle previous-index current-index xs)
 | 
				
			||||||
    (struct-set! cycle current-index next-index xs)
 | 
					    (struct-set! cycle current-index next-index xs)
 | 
				
			||||||
    (nth next-index (cycle-xs xs))))
 | 
					    (nth next-index (cycle-xs xs))))
 | 
				
			||||||
| 
						 | 
					@ -105,7 +105,7 @@ underlying struct."
 | 
				
			||||||
(defun cycle-prev (xs)
 | 
					(defun cycle-prev (xs)
 | 
				
			||||||
  "Return the previous value in `XS' and update `current-index'."
 | 
					  "Return the previous value in `XS' and update `current-index'."
 | 
				
			||||||
  (let* ((current-index (cycle-current-index xs))
 | 
					  (let* ((current-index (cycle-current-index xs))
 | 
				
			||||||
         (next-index (next-index<- 0 (cycle-count xs) current-index)))
 | 
					         (next-index (cycle--next-index<- 0 (cycle-count xs) current-index)))
 | 
				
			||||||
    (struct-set! cycle previous-index current-index xs)
 | 
					    (struct-set! cycle previous-index current-index xs)
 | 
				
			||||||
    (struct-set! cycle current-index next-index xs)
 | 
					    (struct-set! cycle current-index next-index xs)
 | 
				
			||||||
    (nth next-index (cycle-xs xs))))
 | 
					    (nth next-index (cycle-xs xs))))
 | 
				
			||||||
| 
						 | 
					@ -136,7 +136,7 @@ underlying struct."
 | 
				
			||||||
      (error "No element in cycle matches predicate"))))
 | 
					      (error "No element in cycle matches predicate"))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun cycle-focus-item (x xs)
 | 
					(defun cycle-focus-item (x xs)
 | 
				
			||||||
  "Focus ITEM in cycle XS.
 | 
					  "Focus item, X, in cycle XS.
 | 
				
			||||||
ITEM is the first item in XS that t for `equal'."
 | 
					ITEM is the first item in XS that t for `equal'."
 | 
				
			||||||
  (cycle-focus (lambda (y) (equal x y)) xs))
 | 
					  (cycle-focus (lambda (y) (equal x y)) xs))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,13 +3,17 @@
 | 
				
			||||||
;; Author: William Carroll <wpcarro@gmail.com>
 | 
					;; Author: William Carroll <wpcarro@gmail.com>
 | 
				
			||||||
;; Version: 0.0.1
 | 
					;; Version: 0.0.1
 | 
				
			||||||
;; URL: https://git.wpcarro.dev/wpcarro/briefcase
 | 
					;; URL: https://git.wpcarro.dev/wpcarro/briefcase
 | 
				
			||||||
;; Package-Requires: ((emacs "24"))
 | 
					;; Package-Requires: ((emacs "25.1"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;; Commentary:
 | 
					;;; Commentary:
 | 
				
			||||||
;; Functions for querying device information.
 | 
					;; Functions for querying device information.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;; Code:
 | 
					;;; Code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
 | 
					;; Dependencies
 | 
				
			||||||
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(require 'dash)
 | 
					(require 'dash)
 | 
				
			||||||
(require 'alist)
 | 
					(require 'alist)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,17 +13,19 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;; Code:
 | 
					;;; Code:
 | 
				
			||||||
(defun functions-evil-window-vsplit-right ()
 | 
					(defun functions-evil-window-vsplit-right ()
 | 
				
			||||||
 | 
					  "Split the window vertically and focus the right half."
 | 
				
			||||||
  (interactive)
 | 
					  (interactive)
 | 
				
			||||||
  (evil-window-vsplit)
 | 
					  (evil-window-vsplit)
 | 
				
			||||||
  (windmove-right))
 | 
					  (windmove-right))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun functions-evil-window-split-down ()
 | 
					(defun functions-evil-window-split-down ()
 | 
				
			||||||
 | 
					  "Split the window horizontal and focus the bottom half."
 | 
				
			||||||
  (interactive)
 | 
					  (interactive)
 | 
				
			||||||
  (evil-window-split)
 | 
					  (evil-window-split)
 | 
				
			||||||
  (windmove-down))
 | 
					  (windmove-down))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun functions-create-snippet ()
 | 
					(defun functions-create-snippet ()
 | 
				
			||||||
  "Creates a window split and then opens the Yasnippet editor."
 | 
					  "Create a window split and then opens the Yasnippet editor."
 | 
				
			||||||
  (interactive)
 | 
					  (interactive)
 | 
				
			||||||
  (evil-window-vsplit)
 | 
					  (evil-window-vsplit)
 | 
				
			||||||
  (call-interactively #'yas-new-snippet))
 | 
					  (call-interactively #'yas-new-snippet))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@
 | 
				
			||||||
;; Author: William Carroll <wpcarro@gmail.com>
 | 
					;; Author: William Carroll <wpcarro@gmail.com>
 | 
				
			||||||
;; Version: 0.0.1
 | 
					;; Version: 0.0.1
 | 
				
			||||||
;; URL: https://git.wpcarro.dev/wpcarro/briefcase
 | 
					;; URL: https://git.wpcarro.dev/wpcarro/briefcase
 | 
				
			||||||
;; Package-Requires: ((emacs "24"))
 | 
					;; Package-Requires: ((emacs "25.1"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;; Commentary:
 | 
					;;; Commentary:
 | 
				
			||||||
;; Need to decide which client I will use for IRC.
 | 
					;; Need to decide which client I will use for IRC.
 | 
				
			||||||
| 
						 | 
					@ -60,14 +60,14 @@
 | 
				
			||||||
                             irc-server->channels)))))
 | 
					                             irc-server->channels)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun irc-channel->server (server->channels channel)
 | 
					(defun irc-channel->server (server->channels channel)
 | 
				
			||||||
  "Resolve an IRC server from a given CHANNEL."
 | 
					  "Using SERVER->CHANNELS, resolve an IRC server from a given CHANNEL."
 | 
				
			||||||
  (let ((result (alist-find (lambda (k v) (cycle-contains? channel v))
 | 
					  (let ((result (alist-find (lambda (k v) (cycle-contains? channel v))
 | 
				
			||||||
                            server->channels)))
 | 
					                            server->channels)))
 | 
				
			||||||
    (prelude-assert (maybe-some? result))
 | 
					    (prelude-assert (maybe-some? result))
 | 
				
			||||||
    result))
 | 
					    result))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun irc-channel->cycle (server->channels channel)
 | 
					(defun irc-channel->cycle (server->channels channel)
 | 
				
			||||||
  "Resolve an IRC's channels cycle from a given CHANNEL."
 | 
					  "Using SERVER->CHANNELS, resolve an IRC's channels cycle from CHANNEL."
 | 
				
			||||||
  (alist-get (irc-channel->server server->channels channel)
 | 
					  (alist-get (irc-channel->server server->channels channel)
 | 
				
			||||||
             server->channels))
 | 
					             server->channels))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -98,7 +98,7 @@
 | 
				
			||||||
;; TODO: Support function or KBD for switching to an ERC buffer.
 | 
					;; TODO: Support function or KBD for switching to an ERC buffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun irc-kill-all-erc-processes ()
 | 
					(defun irc-kill-all-erc-processes ()
 | 
				
			||||||
  "Kills all ERC buffers and processes."
 | 
					  "Kill all ERC buffers and processes."
 | 
				
			||||||
  (interactive)
 | 
					  (interactive)
 | 
				
			||||||
  (->> (erc-buffer-list)
 | 
					  (->> (erc-buffer-list)
 | 
				
			||||||
       (-map #'kill-buffer)))
 | 
					       (-map #'kill-buffer)))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -83,7 +83,7 @@ This value defaults to 25.")
 | 
				
			||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun ivy-clipmenu-parse-content (x)
 | 
					(defun ivy-clipmenu-parse-content (x)
 | 
				
			||||||
  "Parse the label from the entry in clipmenu's line-cache."
 | 
					  "Parse the label from the entry, X, in clipmenu's line-cache."
 | 
				
			||||||
  (->> (s-split " " x)
 | 
					  (->> (s-split " " x)
 | 
				
			||||||
       (-drop 1)
 | 
					       (-drop 1)
 | 
				
			||||||
       (s-join " ")))
 | 
					       (s-join " ")))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,8 +40,7 @@ with the key and value from KV."
 | 
				
			||||||
       (message "%s process finished." process)))))
 | 
					       (message "%s process finished." process)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun ivy-helpers-list-external-commands ()
 | 
					(defun ivy-helpers-list-external-commands ()
 | 
				
			||||||
  "Creates a list of all external commands available on $PATH while filtering
 | 
					  "Create a list of all external commands available on $PATH."
 | 
				
			||||||
NixOS wrappers."
 | 
					 | 
				
			||||||
  (cl-loop
 | 
					  (cl-loop
 | 
				
			||||||
   for dir in (split-string (getenv "PATH") path-separator)
 | 
					   for dir in (split-string (getenv "PATH") path-separator)
 | 
				
			||||||
   when (and (file-exists-p dir) (file-accessible-directory-p dir))
 | 
					   when (and (file-exists-p dir) (file-accessible-directory-p dir))
 | 
				
			||||||
| 
						 | 
					@ -56,8 +55,7 @@ NixOS wrappers."
 | 
				
			||||||
   finally return (sort completions 'string-lessp)))
 | 
					   finally return (sort completions 'string-lessp)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun ivy-helpers-run-external-command ()
 | 
					(defun ivy-helpers-run-external-command ()
 | 
				
			||||||
  "Prompts the user with a list of all installed applications and
 | 
					  "Prompts the user with a list of all installed applications to launch."
 | 
				
			||||||
lets them select one to launch."
 | 
					 | 
				
			||||||
  (interactive)
 | 
					  (interactive)
 | 
				
			||||||
  (let ((external-commands-list (ivy-helpers-list-external-commands)))
 | 
					  (let ((external-commands-list (ivy-helpers-list-external-commands)))
 | 
				
			||||||
    (ivy-read "Command:" external-commands-list
 | 
					    (ivy-read "Command:" external-commands-list
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@
 | 
				
			||||||
;; Author: William Carroll <wpcarro@gmail.com>
 | 
					;; Author: William Carroll <wpcarro@gmail.com>
 | 
				
			||||||
;; Version: 0.0.1
 | 
					;; Version: 0.0.1
 | 
				
			||||||
;; URL: https://git.wpcarro.dev/wpcarro/briefcase
 | 
					;; URL: https://git.wpcarro.dev/wpcarro/briefcase
 | 
				
			||||||
;; Package-Requires: ((emacs "24"))
 | 
					;; Package-Requires: ((emacs "25.1"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;; Commentary:
 | 
					;;; Commentary:
 | 
				
			||||||
;; In order to stay organized, I'm attempting to dedicate KBD prefixes to
 | 
					;; In order to stay organized, I'm attempting to dedicate KBD prefixes to
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -123,8 +123,8 @@
 | 
				
			||||||
  `(exwm-input-set-key (kbd ,c) ,fn))
 | 
					  `(exwm-input-set-key (kbd ,c) ,fn))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(keybindings-exwm "C-M-v" #'ivy-clipmenu-copy)
 | 
					(keybindings-exwm "C-M-v" #'ivy-clipmenu-copy)
 | 
				
			||||||
(keybindings-exwm "<XF86MonBrightnessUp>" #'screen-brightness/increase)
 | 
					(keybindings-exwm "<XF86MonBrightnessUp>" #'screen-brightness-increase)
 | 
				
			||||||
(keybindings-exwm "<XF86MonBrightnessDown>" #'screen-brightness/decrease)
 | 
					(keybindings-exwm "<XF86MonBrightnessDown>" #'screen-brightness-decrease)
 | 
				
			||||||
(keybindings-exwm "<XF86AudioMute>" #'pulse-audio/toggle-mute)
 | 
					(keybindings-exwm "<XF86AudioMute>" #'pulse-audio/toggle-mute)
 | 
				
			||||||
(keybindings-exwm "<XF86AudioLowerVolume>" #'pulse-audio/decrease-volume)
 | 
					(keybindings-exwm "<XF86AudioLowerVolume>" #'pulse-audio/decrease-volume)
 | 
				
			||||||
(keybindings-exwm "<XF86AudioRaiseVolume>" #'pulse-audio/increase-volume)
 | 
					(keybindings-exwm "<XF86AudioRaiseVolume>" #'pulse-audio/increase-volume)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,10 +71,10 @@
 | 
				
			||||||
  (interactive)
 | 
					  (interactive)
 | 
				
			||||||
  ;; TODO: Ensure these work once the tokenizing in prelude-start-process works
 | 
					  ;; TODO: Ensure these work once the tokenizing in prelude-start-process works
 | 
				
			||||||
  ;; as expected.
 | 
					  ;; as expected.
 | 
				
			||||||
  (start-process "keyboard-swap-caps-lock-and-escape" nil "/usr/bin/xmodmap" "-e"
 | 
					  (start-process "keyboard-swap-caps-lock-and-escape"
 | 
				
			||||||
                 "remove Lock = Caps_Lock")
 | 
					                 nil "/usr/bin/xmodmap" "-e" "remove Lock = Caps_Lock")
 | 
				
			||||||
  (start-process "keyboard-swap-caps-lock-and-escape" nil "/usr/bin/xmodmap" "-e"
 | 
					  (start-process "keyboard-swap-caps-lock-and-escape"
 | 
				
			||||||
                 "keysym Caps_Lock = Escape"))
 | 
					                 nil "/usr/bin/xmodmap" "-e" "keysym Caps_Lock = Escape"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun keyboard-inc-repeat-rate ()
 | 
					(defun keyboard-inc-repeat-rate ()
 | 
				
			||||||
  "Increment `keyboard-repeat-rate'."
 | 
					  "Increment `keyboard-repeat-rate'."
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@
 | 
				
			||||||
;; Author: William Carroll <wpcarro@gmail.com>
 | 
					;; Author: William Carroll <wpcarro@gmail.com>
 | 
				
			||||||
;; Version: 0.0.1
 | 
					;; Version: 0.0.1
 | 
				
			||||||
;; URL: https://git.wpcarro.dev/wpcarro/briefcase
 | 
					;; URL: https://git.wpcarro.dev/wpcarro/briefcase
 | 
				
			||||||
;; Package-Requires: ((emacs "24"))
 | 
					;; Package-Requires: ((emacs "25.1"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;; Commentary:
 | 
					;;; Commentary:
 | 
				
			||||||
;; Some wrappers to obtain battery information.
 | 
					;; Some wrappers to obtain battery information.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,10 +15,13 @@
 | 
				
			||||||
;; My friend, @tazjin, has a modeline setup that I think is more compatible with
 | 
					;; My friend, @tazjin, has a modeline setup that I think is more compatible with
 | 
				
			||||||
;; EXWM, so I'm going to base my setup off of his.
 | 
					;; EXWM, so I'm going to base my setup off of his.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(use-package telephone-line)
 | 
					(use-package telephone-line)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun modeline-bottom-right-window? ()
 | 
					(defun modeline-bottom-right-window? ()
 | 
				
			||||||
  "Determines whether the last (i.e. bottom-right) window of the
 | 
					  "Determines whether the last (i.e.
 | 
				
			||||||
 | 
					bottom-right) window of the
 | 
				
			||||||
active frame is showing the buffer in which this function is
 | 
					active frame is showing the buffer in which this function is
 | 
				
			||||||
  executed."
 | 
					  executed."
 | 
				
			||||||
  (let* ((frame (selected-frame))
 | 
					  (let* ((frame (selected-frame))
 | 
				
			||||||
| 
						 | 
					@ -28,9 +31,7 @@
 | 
				
			||||||
    (eq (current-buffer) (window-buffer last-window))))
 | 
					    (eq (current-buffer) (window-buffer last-window))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun modeline-maybe-render-time ()
 | 
					(defun modeline-maybe-render-time ()
 | 
				
			||||||
  "Renders the mode-line-misc-info string for display in the
 | 
					  "Conditionally renders the `mode-line-misc-info' string.
 | 
				
			||||||
  mode-line if the currently active window is the last one in the
 | 
					 | 
				
			||||||
  frame.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  The idea is to not display information like the current time,
 | 
					  The idea is to not display information like the current time,
 | 
				
			||||||
  load, battery levels on all buffers."
 | 
					  load, battery levels on all buffers."
 | 
				
			||||||
| 
						 | 
					@ -47,7 +48,8 @@
 | 
				
			||||||
      (format "[%s]" exwm-workspace-current-index)))
 | 
					      (format "[%s]" exwm-workspace-current-index)))
 | 
				
			||||||
  ;; Define a highlight font for ~ important ~ information in the last
 | 
					  ;; Define a highlight font for ~ important ~ information in the last
 | 
				
			||||||
  ;; window.
 | 
					  ;; window.
 | 
				
			||||||
  (defface special-highlight '((t (:foreground "white" :background "#5f627f"))) "")
 | 
					  (defface special-highlight
 | 
				
			||||||
 | 
					    '((t (:foreground "white" :background "#5f627f"))) "")
 | 
				
			||||||
  (add-to-list 'telephone-line-faces
 | 
					  (add-to-list 'telephone-line-faces
 | 
				
			||||||
               '(highlight . (special-highlight . special-highlight)))
 | 
					               '(highlight . (special-highlight . special-highlight)))
 | 
				
			||||||
  (setq telephone-line-lhs
 | 
					  (setq telephone-line-lhs
 | 
				
			||||||
| 
						 | 
					@ -61,7 +63,6 @@
 | 
				
			||||||
        telephone-line-primary-right-separator 'telephone-line-tan-right
 | 
					        telephone-line-primary-right-separator 'telephone-line-tan-right
 | 
				
			||||||
        telephone-line-secondary-left-separator 'telephone-line-tan-hollow-left
 | 
					        telephone-line-secondary-left-separator 'telephone-line-tan-hollow-left
 | 
				
			||||||
        telephone-line-secondary-right-separator 'telephone-line-tan-hollow-right)
 | 
					        telephone-line-secondary-right-separator 'telephone-line-tan-hollow-right)
 | 
				
			||||||
 | 
					 | 
				
			||||||
  (telephone-line-mode 1))
 | 
					  (telephone-line-mode 1))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(provide 'modeline)
 | 
					(provide 'modeline)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -108,21 +108,6 @@ While this function is undeniably trivial, I have unintentionally done (- 1 x)
 | 
				
			||||||
  "Add one to `X'."
 | 
					  "Add one to `X'."
 | 
				
			||||||
  (+ x 1))
 | 
					  (+ x 1))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; TODO: Does this belong in a math module?  Is math too vague?  Or is number
 | 
					 | 
				
			||||||
;; too vague?
 | 
					 | 
				
			||||||
;; TODO: Resolve the circular dependency that this introduces with series.el,
 | 
					 | 
				
			||||||
;; and then re-enable this function and its tests below.
 | 
					 | 
				
			||||||
;; (defun number-factorial (x)
 | 
					 | 
				
			||||||
;;   "Return factorial of `X'."
 | 
					 | 
				
			||||||
;;   (cond
 | 
					 | 
				
			||||||
;;    ((number-negative? x) (error "Will not take factorial of negative numbers"))
 | 
					 | 
				
			||||||
;;    ((= 0 x) 1)
 | 
					 | 
				
			||||||
;;    ;; NOTE: Using `series/range' introduces a circular dependency because:
 | 
					 | 
				
			||||||
;;    ;; series -> number -> series.  Conceptually, however, this should be
 | 
					 | 
				
			||||||
;;    ;; perfectly acceptable.
 | 
					 | 
				
			||||||
;;    (t (->> (series/range 1 x)
 | 
					 | 
				
			||||||
;;            (list-reduce 1 #'*)))))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
;; Tests
 | 
					;; Tests
 | 
				
			||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,7 +3,7 @@
 | 
				
			||||||
;; Author: William Carroll <wpcarro@gmail.com>
 | 
					;; Author: William Carroll <wpcarro@gmail.com>
 | 
				
			||||||
;; Version: 0.0.1
 | 
					;; Version: 0.0.1
 | 
				
			||||||
;; URL: https://git.wpcarro.dev/wpcarro/briefcase
 | 
					;; URL: https://git.wpcarro.dev/wpcarro/briefcase
 | 
				
			||||||
;; Package-Requires: ((emacs "24"))
 | 
					;; Package-Requires: ((emacs "25.1"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;; Commentary:
 | 
					;;; Commentary:
 | 
				
			||||||
;; Exposing an API for working with a scope data structure in a non-mutative
 | 
					;; Exposing an API for working with a scope data structure in a non-mutative
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,9 @@
 | 
				
			||||||
;;; screen-brightness.el --- Control laptop screen brightness -*- lexical-binding: t -*-
 | 
					;;; screen-brightness.el --- Control laptop screen brightness -*- lexical-binding: t -*-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; Author: 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:
 | 
					;;; Commentary:
 | 
				
			||||||
;; Mainly just Elisp wrappers around `xbacklight`.
 | 
					;; Mainly just Elisp wrappers around `xbacklight`.
 | 
				
			||||||
| 
						 | 
					@ -19,27 +22,27 @@
 | 
				
			||||||
;; Constants
 | 
					;; Constants
 | 
				
			||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defconst screen-brightness/step-size 15
 | 
					(defconst screen-brightness-step-size 15
 | 
				
			||||||
  "The size of the increment or decrement step for the screen's brightness.")
 | 
					  "The size of the increment or decrement step for the screen's brightness.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
;; Library
 | 
					;; Library
 | 
				
			||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
					;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun screen-brightness/increase ()
 | 
					(defun screen-brightness-increase ()
 | 
				
			||||||
  "Increase the screen brightness."
 | 
					  "Increase the screen brightness."
 | 
				
			||||||
  (interactive)
 | 
					  (interactive)
 | 
				
			||||||
  (prelude-start-process
 | 
					  (prelude-start-process
 | 
				
			||||||
   :name "screen-brightness/increase"
 | 
					   :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."))
 | 
					  (message "[screen-brightness.el] Increased screen brightness."))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun screen-brightness/decrease ()
 | 
					(defun screen-brightness-decrease ()
 | 
				
			||||||
  "Decrease the screen brightness."
 | 
					  "Decrease the screen brightness."
 | 
				
			||||||
  (interactive)
 | 
					  (interactive)
 | 
				
			||||||
  (prelude-start-process
 | 
					  (prelude-start-process
 | 
				
			||||||
   :name "screen-brightness/decrease"
 | 
					   :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."))
 | 
					  (message "[screen-brightness.el] Decreased screen brightness."))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(provide 'screen-brightness)
 | 
					(provide 'screen-brightness)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
;; string.el --- Library for working with strings -*- lexical-binding: t -*-
 | 
					;;; string.el --- Library for working with strings -*- lexical-binding: t -*-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; Author: William Carroll <wpcarro@gmail.com>
 | 
					;; Author: William Carroll <wpcarro@gmail.com>
 | 
				
			||||||
;; Version: 0.0.1
 | 
					;; Version: 0.0.1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
;; symbol.el --- Library for working with symbols. -*- lexical-binding: t -*-
 | 
					;;; symbol.el --- Library for working with symbols -*- lexical-binding: t -*-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; Author: William Carroll <wpcarro@gmail.com>
 | 
					;; Author: William Carroll <wpcarro@gmail.com>
 | 
				
			||||||
;; Version: 0.0.1
 | 
					;; Version: 0.0.1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue