]> git.earman.xyz Git - emacsinit.git/commitdiff
Re-tab files, add defuns for doas/sudo with tramp
authorrearman <rearman@r717.net>
Wed, 1 Mar 2023 14:00:19 +0000 (09:00 -0500)
committerrearman <rearman@r717.net>
Wed, 1 Mar 2023 14:00:19 +0000 (09:00 -0500)
defuns.el
setq-defaults.el
work-eqs.el

index 4e7e6bba41fc94806ff2be367a9c48ed98bdcf96..7ae982235f11effd10352fd3b69d15c111c4869a 100644 (file)
--- a/defuns.el
+++ b/defuns.el
@@ -1,89 +1,89 @@
 ;; -*- lexical-binding: t; -*-
 ;; DEFUNS
 (defun open-line-below ()
-  "Creates a new empty line below the current line."
-  (interactive)
-  (end-of-line)
-  (newline)
-  (indent-for-tab-command))
+       "Creates a new empty line below the current line."
+       (interactive)
+       (end-of-line)
+       (newline)
+       (indent-for-tab-command))
 
 (defun open-line-above ()
-  "Creates a new empty line above the current line.
+       "Creates a new empty line above the current line.
 Can't go prev line first, edge case of beginning of buffer."
-  (interactive)
-  (beginning-of-line)
-  (newline)
-  (previous-line)
-  (indent-for-tab-command))
+       (interactive)
+       (beginning-of-line)
+       (newline)
+       (previous-line)
+       (indent-for-tab-command))
 
 (defun kill-bword-or-region ()
-  "Kill region if active, otherwise kill back one word."
-  (interactive)
-  (if (region-active-p)
-      (call-interactively 'kill-region)
-    (call-interactively 'backward-kill-word)))
+       "Kill region if active, otherwise kill back one word."
+       (interactive)
+       (if (region-active-p)
+                       (call-interactively 'kill-region)
+               (call-interactively 'backward-kill-word)))
 
 (defun backward-kill-line ()
-  "Kill back to beginning of line from point."
-  (interactive)
-  (kill-line 0))
+       "Kill back to beginning of line from point."
+       (interactive)
+       (kill-line 0))
 
 (defun backward-join-line ()
-  "A wrapper for join-line to make it go in the right direction."
-  (interactive)
-  (join-line 0))
+       "A wrapper for join-line to make it go in the right direction."
+       (interactive)
+       (join-line 0))
 
 (defun smart-beginning-of-line ()
-  "Move point to first non-whitespace character or beginning-of-line.
+       "Move point to first non-whitespace character or beginning-of-line.
 If point was already at that position, move point to beginning of line.
 Stolen from BrettWitty's dotemacs github repo."
-  (interactive "^")
-  (let ((oldpos (point)))
-    (back-to-indentation)
-    (and (= oldpos (point))
+       (interactive "^")
+       (let ((oldpos (point)))
+               (back-to-indentation)
+               (and (= oldpos (point))
         (beginning-of-line))))
 
 (defun eshell-send-on-close-paren ()
-  "Makes eshell act somewhat like genera.
+       "Makes eshell act somewhat like genera.
 Makes a closing paren execute the sexp.  Currently in test, look out for errors."
-  (interactive)
-  (insert-char ?\))
-  (let ((p (point)))
-    ;;(eshell-bol)
-    ;;(syntax-ppss-flush-cache (point))
-    ;;(goto-char p)
-    (cond ((= 0 (car (syntax-ppss)))
-          (eshell-send-input))
-         ((< (car (syntax-ppss)) 0)
-          (message "Check flush-cache"))
-         ((t nil)))))
+       (interactive)
+       (insert-char ?\))
+       (let ((p (point)))
+               ;;(eshell-bol)
+               ;;(syntax-ppss-flush-cache (point))
+               ;;(goto-char p)
+               (cond ((= 0 (car (syntax-ppss)))
+                (eshell-send-input))
+               ((< (car (syntax-ppss)) 0)
+                (message "Check flush-cache"))
+               ((t nil)))))
 
 (defun slot/get-queries (&optional pairs)
-  "Get multiple 'query-replace' pairs from the user.
+       "Get multiple 'query-replace' pairs from the user.
 PAIRS is a list of replacement pairs of the form (FROM . TO).
 Stolen from https://tony-zorman.com/posts/query-replace/2022-08-06-query-replace-many.html"
-  (-let* (((from to delim arg)
-          (query-replace-read-args
-           (s-join " "
-                   (-non-nil
-                    (list "Replacements"
-                          (cond ((eq current-prefix-arg '-) "backward")
+       (-let* (((from to delim arg)
+                (query-replace-read-args
+                       (s-join " "
+                               (-non-nil
+                                (list "Replace Strings"
+                                (cond ((eq current-prefix-arg '-) "backward")
                                 (current-prefix-arg         "word"))
-                          (when (use-region-p) "in region"))))
-           nil))                       ; no regexp-flag
-         (from-to (cons (regexp-quote from)
+                                (when (use-region-p) "in region"))))
+                       nil))                       ; no regexp-flag
+               (from-to (cons (regexp-quote from)
                         (s-replace "\\" "\\\\" to))))
-    ;; HACK: Since the default suggestion of replace.el will be
-    ;; the last one we've entered, an empty string will give us
-    ;; exactly that.  Instead of trying to fight against this,
-    ;; use it in order to signal an exit.
-    (if (-contains? pairs from-to)
+               ;; HACK: Since the default suggestion of replace.el will be
+               ;; the last one we've entered, an empty string will give us
+               ;; exactly that.  Instead of trying to fight against this,
+               ;; use it in order to signal an exit.
+               (if (-contains? pairs from-to)
        (list pairs delim arg)
-      (slot/get-queries (push from-to pairs)))))
+                       (slot/get-queries (push from-to pairs)))))
 
 (defun slot/replace-string-many
-    (pairs &optional delimited start end backward region-noncontiguous-p)
-  "Like 'replace-string', but query for several replacements.
+               (pairs &optional delimited start end backward region-noncontiguous-p)
+       "Like 'replace-string', but query for several replacements.
 Query for replacement pairs until the users enters an empty
 string (but see 'slot/get-queries').
 
@@ -91,61 +91,78 @@ Refer to 'query-replace' and 'perform-replace' for what the other
 arguments actually mean.
 Stolen from https://tony-zorman.com/posts/query-replace/2022-08-06-query-replace-many.html
 Edited and renamed to remove the Query."
-  (interactive
-   (let ((common (slot/get-queries)))
-     (list (nth 0 common) (nth 1 common)
-          (if (use-region-p) (region-beginning))
-          (if (use-region-p) (region-end))
-          (nth 2 common)
-          (if (use-region-p) (region-noncontiguous-p)))))
-  (perform-replace
-   (concat "\\(?:" (mapconcat #'car pairs "\\|") "\\)") ; build query
-   (cons (lambda (pairs _count)
-          (cl-loop for (from . to) in pairs
-                   when (string-match from (match-string 0))
-                   return to))
+       (interactive
+        (let ((common (slot/get-queries)))
+                (list (nth 0 common) (nth 1 common)
+                (if (use-region-p) (region-beginning))
+                (if (use-region-p) (region-end))
+                (nth 2 common)
+                (if (use-region-p) (region-noncontiguous-p)))))
+       (perform-replace
+        (concat "\\(?:" (mapconcat #'car pairs "\\|") "\\)") ; build query
+        (cons (lambda (pairs _count)
+                (cl-loop for (from . to) in pairs
+                               when (string-match from (match-string 0))
+                               return to))
         pairs)
-   nil :regexp
-   delimited nil nil start end backward region-noncontiguous-p))
+        nil :regexp
+        delimited nil nil start end backward region-noncontiguous-p))
 
 (defun slot/query-replace-many
-    (pairs &optional delimited start end backward region-noncontiguous-p)
-  "Like 'query-replace', but query for several replacements.
+               (pairs &optional delimited start end backward region-noncontiguous-p)
+       "Like 'query-replace', but query for several replacements.
 Query for replacement pairs until the users enters an empty
 string (but see 'slot/get-queries').
 
 Refer to 'query-replace' and 'perform-replace' for what the other
 arguments actually mean.
 Stolen from https://tony-zorman.com/posts/query-replace/2022-08-06-query-replace-many.html"
-  (interactive
-   (let ((common (slot/get-queries)))
-     (list (nth 0 common) (nth 1 common)
-          (when (use-region-p) (region-beginning))
-          (when (use-region-p) (region-end))
-          (nth 2 common)
-          (when (use-region-p) (region-noncontiguous-p)))))
-  (perform-replace
-   (concat "\\(?:" (mapconcat #'car pairs "\\|") "\\)") ; build query
-   (cons (lambda (pairs _count)
-          (cl-loop for (from . to) in pairs
-                   when (string-match from (match-string 0))
-                   return to))
+       (interactive
+        (let ((common (slot/get-queries)))
+                (list (nth 0 common) (nth 1 common)
+                (when (use-region-p) (region-beginning))
+                (when (use-region-p) (region-end))
+                (nth 2 common)
+                (when (use-region-p) (region-noncontiguous-p)))))
+       (perform-replace
+        (concat "\\(?:" (mapconcat #'car pairs "\\|") "\\)") ; build query
+        (cons (lambda (pairs _count)
+                (cl-loop for (from . to) in pairs
+                               when (string-match from (match-string 0))
+                               return to))
         pairs)
-   :query :regexp
-   delimited nil nil start end backward region-noncontiguous-p))
+        :query :regexp
+        delimited nil nil start end backward region-noncontiguous-p))
 
 (defun edit-keymap-planck ()
-  "Bring up planck keymap for editing."
-  (interactive)
-  (find-file "~/qmk_firmware/keyboards/planck/keymaps/ehrman/keymap.c"))
+       "Bring up planck keymap for editing."
+       (interactive)
+       (find-file "~/qmk_firmware/keyboards/planck/keymaps/ehrman/keymap.c"))
 
 (defun edit-keymap-tokyo60 ()
-  "Bring up tokyo60 keymap for editing."
-  (interactive)
-  (find-file "~/qmk_firmware/keyboards/tokyokeyboard/tokyo60/keymaps/ehrman/keymap.c"))
+       "Bring up tokyo60 keymap for editing."
+       (interactive)
+       (find-file "~/qmk_firmware/keyboards/tokyokeyboard/tokyo60/keymaps/ehrman/keymap.c"))
 
 (defun scratch-only ()
-  "Bring up the scratch buffer as the only visible buffer."
-  (interactive)
-  (switch-to-buffer "*scratch*")
-  (delete-other-windows))
+       "Bring up the scratch buffer as the only visible buffer."
+       (interactive)
+       (switch-to-buffer (get-buffer-create "*scratch*"))
+       (delete-other-windows))
+
+(unless (equal system-type 'windows-nt)
+       (if(equal system-type 'berkeley-unix)
+                       (defun doas ()
+                               "Use TRAMP to reopen the current buffer as root using doas."
+                               (interactive)
+                               (when buffer-file-name
+                                       (find-alternate-file
+                                        (concat "/doas:root@localhost:"
+                                                                        buffer-file-name))))
+               (defun sudo ()
+                       "Use TRAMP to reopen the current buffer as root using sudo."
+                       (interactive)
+                       (when buffer-file-name
+                               (find-alternate-file
+                                (concat "/doas:root@localhost:"
+                                                                buffer-file-name))))))
index 89ea1df7152459e7ea0dbfd7c900c4a3f178c42c..430a9504414e2d2ebc1da7129a4cb002e119c4f4 100644 (file)
@@ -1,40 +1,42 @@
 ;; -*- lexical-binding: t; -*-
 ;; SETQ AND DEFAULTS
 (setq-default indicate-empty-lines t
-             fill-column 80
-             read-file-name-completion-ignore-case t
-             read-buffer-completion-ignore-case t
-             cursor-type 'bar
-             cursor-in-non-selected-windows nil)
+                         fill-column 80
+                         read-file-name-completion-ignore-case t
+                         read-buffer-completion-ignore-case t
+                         cursor-type 'bar
+                         cursor-in-non-selected-windows 'hollow)
 
 (setq require-final-newline t
-      text-quoting-style 'straight
-      ring-bell-function 'ignore
-      use-short-answers t
-      mode-line-compact t
-      make-backup-files nil
-      auto-save-default nil
-      confirm-nonexistent-file-or-buffer nil
-      show-paren-delay 0
-      show-paren-style 'expression
-      blink-matching-paren 'jump
-      global-hl-line-sticky-flag t
-      echo-keystrokes 0.01
-      save-interprogram-paste-before-kill t
-      confirm-kill-emacs 'y-or-n-p
-      confirm-kill-processes nil
-      eshell-destroy-buffer-when-process-dies t
-      custom-file (concat user-emacs-directory "custom-set-variables.el")
-      ediff-window-setup-function 'ediff-setup-windows-plain
-      ediff-split-window-function (if (> (frame-width) 150)
-                                        'split-window-horizontally
-                                   'split-window-vertically)
-      prettify-symbols-alist '(("lambda" . 955)
-                              ("delta" . 120517)
-                              ("epsilon" . 120518)
-                              ("->" . 8594)
-                              ("<=" . 8804)
-                              (">=" . 8805)))
+         text-quoting-style 'straight
+         ring-bell-function 'ignore
+         use-short-answers t
+         mode-line-compact t
+         make-backup-files nil
+         auto-save-default nil
+         confirm-nonexistent-file-or-buffer nil
+         show-paren-delay 0
+         show-paren-style 'expression
+         blink-matching-paren 'jump
+         global-hl-line-sticky-flag t
+         echo-keystrokes 0.01
+         save-interprogram-paste-before-kill t
+         confirm-kill-emacs 'y-or-n-p
+         confirm-kill-processes nil
+         frame-title-format "%b - EMACS"
+         eshell-destroy-buffer-when-process-dies t
+         dired-listing-switches "-alv --group-directories-first"
+         custom-file (concat user-emacs-directory "custom-set-variables.el")
+         ediff-window-setup-function 'ediff-setup-windows-plain
+         ediff-split-window-function (if (> (frame-width) 150)
+                                                                         'split-window-horizontally
+                                                                       'split-window-vertically)
+         prettify-symbols-alist '(("lambda" . 955)
+                                                          ("delta" . 120517)
+                                                          ("epsilon" . 120518)
+                                                          ("->" . 8594)
+                                                          ("<=" . 8804)
+                                                          (">=" . 8805)))
 
 ;; OPTIONS
 (save-place-mode 1)
@@ -44,6 +46,7 @@
 (auto-fill-mode t)
 (midnight-mode t)
 (column-number-mode t)
+(file-name-shadow-mode t)
 (delete-selection-mode t)
 (global-hl-line-mode t)
 (global-prettify-symbols-mode t)
index 89719034f0f4d70d636d80f765ffec96b6e35ff0..e04051e7966feac51516cbb916f9951e7413e99e 100644 (file)
 ;; -*- lexical-binding: t; -*-
 ;; WORK (NON-EDITING) RELATED DEFUNS
 (defun square (x)
-  "Calculate the square of a value."
-  (expt x 2))
+       "Calculate the square of a value."
+       (expt x 2))
 
 (defun cube (x)
-  "Calculate the cube of a value."
-  (expt x 3))
+       "Calculate the cube of a value."
+       (expt x 3))
 
 (defun inv (x)
-  "Calculate the inverse of a value."
-  (/ 1 (float x)))
+       "Calculate the inverse of a value."
+       (/ 1 (float x)))
 
 (defun scaleval (pmax pmin emax emin &optional ai)
-  "Calculate the slope and offset given PLC Max/Min and Eng. Max/Min.
+       "Calculate the slope and offset given PLC Max/Min and Eng. Max/Min.
 With optional argument 'ai', also calculate a final scaled value from an input."
-  (let* ((div (/ (- pmax pmin) (- (float emax) (float emin))))
-        (ofst (- emin (/ pmin div))))
-      (if (eq nil ai)
-         (list div ofst)
-       (list div ofst (+ ofst (/ ai div))))))
+       (let* ((div (/ (- pmax pmin) (- (float emax) (float emin))))
+                                (ofst (- emin (/ pmin div))))
+               (if (eq nil ai)
+                               (list div ofst)
+                       (list div ofst (+ ofst (/ ai div))))))
 
 (defun cfm-circ (fpm radius)
-  "Calculate the CFM of a circular duct given fpm and radius (in)."
-  (list (* pi fpm (square (/ radius 12)))))
+       "Calculate the CFM of a circular duct given fpm and radius (in)."
+       (list (* pi fpm (square (/ radius 12)))))
 
 (defun cfm-rect (fpm width height)
-  "Calculate the CFM of a rectangular duct given fpm, width (in) and height (in)."
-  (list (* fpm (/ width 12) (/ height 12))))
+       "Calculate the CFM of a rectangular duct given fpm, width (in) and height (in)."
+       (list (* fpm (/ width 12) (/ height 12))))
 
 (defun pid-tune (Kᵤ Tᵤ &optional loop-type)
-  "Use the Ziegler-Nichols method to tune a P, PI or PID loop.
+       "Use the Ziegler-Nichols method to tune a P, PI or PID loop.
 Takes Kᵤ, Tᵤ and optional loop-type (P, PI, or PID [default]) as arguments,
  and returns appropriate kp, ki, and kd."
-  (cond ((or (equal 'p loop-type)
-            (equal 'P loop-type))
-        (list (* 0.5 Kᵤ)))
-       ((or (equal 'pi loop-type)
-            (equal 'PI loop-type))
-        (list (* 0.45 Kᵤ) (/ (* 0.54 Kᵤ) Tᵤ)))
-       (t
-        (list (* 0.6 Kᵤ) (/ (* 1.2 Kᵤ) Tᵤ) (/ (* 3.0 Kᵤ Tᵤ) 40)))))
+       (cond ((or (equal 'p loop-type)
+                                                (equal 'P loop-type))
+                                (list (* 0.5 Kᵤ)))
+                               ((or (equal 'pi loop-type)
+                                                (equal 'PI loop-type))
+                                (list (* 0.45 Kᵤ) (/ (* 0.54 Kᵤ) Tᵤ)))
+                               (t
+                                (list (* 0.6 Kᵤ) (/ (* 1.2 Kᵤ) Tᵤ) (/ (* 3.0 Kᵤ Tᵤ) 40)))))
 
 (defun gn-water-per-lb (temp humidity)
-  "Calculate the grains of water per lb of air, given temp (F) and humidity (%).
+       "Calculate the grains of water per lb of air, given temp (F) and
+humidity (%).
 Returns a list of Sat. Water Press., Hum. Ratio, and Gns water per lb air."
-  (let* ((sat-water-press (+ .0182795
-                            (* temp .001029904)
-                            (* (square temp) 0.00002579408)
-                            (* (cube temp) (* 2.400493 (expt 10 -7)))
-                            (* (expt temp 4) (* 8.100939 (expt 10 -10)))
-                            (* (expt temp 5) (* 3.256805 (expt 10 -11)))
-                            (* (expt temp 6) (* -1.001922 (expt 10 -13)))
-                            (* (expt temp 7) (* 2.44161 (expt 10 -16)))))
-        (hum-press (* (/ humidity 100.0) sat-water-press))
-        (hum-ratio (/ (* hum-press 0.62198) (- 14.7 hum-press)))
-        (gns-water-lb-air (* hum-ratio 7000)))
-    (list sat-water-press hum-ratio gns-water-lb-air)))
+       (let* ((sat-water-press (+ .0182795
+                                                                                                                (* temp .001029904)
+                                                                                                                (* (square temp) 0.00002579408)
+                                                                                                                (* (cube temp) (* 2.400493 (expt 10 -7)))
+                                                                                                                (* (expt temp 4) (* 8.100939 (expt 10 -10)))
+                                                                                                                (* (expt temp 5) (* 3.256805 (expt 10 -11)))
+                                                                                                                (* (expt temp 6) (* -1.001922 (expt 10 -13)))
+                                                                                                                (* (expt temp 7) (* 2.44161 (expt 10 -16)))))
+                                (hum-press (* (/ humidity 100.0) sat-water-press))
+                                (hum-ratio (/ (* hum-press 0.62198) (- 14.7 hum-press)))
+                                (gns-water-lb-air (* hum-ratio 7000)))
+               (list sat-water-press hum-ratio gns-water-lb-air)))
 
 (defun mm-to-in (mm)
-  "Convert milimeters to inches."
-  (/ mm 25.4))
+       "Convert milimeters to inches."
+       (/ mm 25.4))
 
 (defun in-to-mm (in)
-  "Convert milimeters to inches."
-  (* in 25.4))
+       "Convert milimeters to inches."
+       (* in 25.4))
 
 (defun k-to-c (tempk)
-  "Convert degrees Kelvin to degrees Celsius."
-  (- tempk 273.15))
+       "Convert degrees Kelvin to degrees Celsius."
+       (- tempk 273.15))
 
 (defun c-to-k (tempc)
-  "Convert degrees Celsius to degrees Kelvin."
-  (+ tempc 273.15))
+       "Convert degrees Celsius to degrees Kelvin."
+       (+ tempc 273.15))
 
 (defun c-to-f (tempc)
-  "Convert degrees Celsius to degrees Fahrenheit."
-  (+ (* tempc 1.8) 32.0))
+       "Convert degrees Celsius to degrees Fahrenheit."
+       (+ (* tempc 1.8) 32.0))
 
 (defun f-to-c (tempf)
-  "Convert degrees Fahrenheit to degrees Celsius."
-  (/ (- tempf 32.0) 1.8))
+       "Convert degrees Fahrenheit to degrees Celsius."
+       (/ (- tempf 32.0) 1.8))
 
 (defun k-to-f (tempk)
-  "Convert degrees Kelvin to degrees Fahrenheit.
+       "Convert degrees Kelvin to degrees Fahrenheit.
 Applies 'c-to-f' to 'k-to-c'."
-  (c-to-f (k-to-c tempk)))
+       (c-to-f (k-to-c tempk)))
 
 (defun f-to-k (tempf)
-  "Convert degrees Fahrenheit to degrees Kelvin.
+       "Convert degrees Fahrenheit to degrees Kelvin.
 Applies 'c-to-k' to 'f-to-c'."
-  (c-to-k (f-to-c tempf)))
+       (c-to-k (f-to-c tempf)))
 
 (defun max-counts (resolution)
-  "Calculate the max count for a PLC analog, given card's bit-resolution.
+       "Calculate the max count for a PLC analog, given card's bit-resolution.
 Formula is 1 - 2^(resolution)"
-  (- (expt 2 resolution) 1))
+       (- (expt 2 resolution) 1))
 
 (defun volts-to-counts (vin vmax resolution)
-  "Convert a voltage signal to a PLC count.
+       "Convert a voltage signal to a PLC count.
 Calculates a ratio of vin/vmax, then scales by 'max-counts'."
-  (* (/ (float vin) (float vmax)) (float (max-counts resolution))))
+       (* (/ (float vin) (float vmax)) (float (max-counts resolution))))
 
 (defun counts-to-volts (cin vmax resolution)
-  "Convert a PLC count to a voltage.
+       "Convert a PLC count to a voltage.
 Calculates a ratio of cin/'max-counts', then multiplies by vmax."
-  (* (/ cin (float (max-counts resolution))) vmax))
+       (* (/ cin (float (max-counts resolution))) vmax))
 
 (defun eff-imp (r1 &optional r2)
-  "Calculate the effective input impedance, given two resistances.
+       "Calculate the effective input impedance, given two resistances.
 For use in 'amps-to-volts' and related.  The handling of only one resistance
 given is done here, instead of doing it in every function that uses this."
-  (if (eq nil r2)
-      r1
-    (inv (+ (inv (float r1)) (inv (float r2))))))
+       (if (eq nil r2)
+                       r1
+               (inv (+ (inv (float r1)) (inv (float r2))))))
 
 (defun amps-to-volts (amps r1 &optional r2)
-  "Calculate the voltage, given amperage and impedance.
+       "Calculate the voltage, given amperage and impedance.
 Multiplies the amperage by the effective impedance calculated with 'eff-imp'."
-  (* amps (eff-imp r1 r2)))
+       (* amps (eff-imp r1 r2)))
 
 (defun volts-to-amps (volts r1 &optional r2)
-  "Calculate the amperage, given voltage and impedance.
+       "Calculate the amperage, given voltage and impedance.
 Divides the voltage by the effective impedance calculated with 'eff-imp'."
-  (/ volts (eff-imp r1 r2)))
+       (/ volts (eff-imp r1 r2)))
 
 (defun amps-to-counts (amps vmax resolution r1 &optional r2)
-  "Convert an amp signal to PLC Counts.
+       "Convert an amp signal to PLC Counts.
 Converts the amperage to a voltage using 'amps-to-volts' (with r1 and optional r2),
 then applies 'volts-to-counts' to the resulting voltage, vmax, and resolution."
-  (volts-to-counts (amps-to-volts amps r1 r2) vmax resolution))
+       (volts-to-counts (amps-to-volts amps r1 r2) vmax resolution))
 
 (defun count-range (type upper lower vmax resolution &optional r1 r2)
-  "Given an upper and lower signal, return the list of upper and lower PLC counts.
+       "Given an upper and lower signal, return the list of upper and lower PLC counts.
 Type takes either a v or an i, corresponding to a voltage or current signal.
 With a current signal, use r1 and maybe r2 to calculate 'amps-to-counts'.
 Otherwise ignore r1/r2 and calculate 'volts-to-counts'."
-  (cond ((or (equal 'v type)
-            (equal 'V type))
-        (list (volts-to-counts upper vmax resolution)
-              (volts-to-counts lower vmax resolution)))
-       ((or (equal 'i type)
-            (equal 'I type))
-        (list (amps-to-counts upper vmax resolution r1 r2)
-              (amps-to-counts lower vmax resolution r1 r2)))))
+       (cond ((or (equal 'v type)
+                                                (equal 'V type))
+                                (list (volts-to-counts upper vmax resolution)
+                                                        (volts-to-counts lower vmax resolution)))
+                               ((or (equal 'i type)
+                                                (equal 'I type))
+                                (list (amps-to-counts upper vmax resolution r1 r2)
+                                                        (amps-to-counts lower vmax resolution r1 r2)))))