((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)
(defun slot/replace-string-many
(pairs &optional delimited start end backward region-noncontiguous-p)
- "Like `replace-string', but query for several replacements.
+ "Like 'replace-string', but query for several replacements.
Query for replacement pairs until the users enters an empty
-string (but see `slot/get-queries').
+string (but see 'slot/get-queries').
-Refer to `query-replace' and `perform-replace' for what the other
+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."
(defun slot/query-replace-many
(pairs &optional delimited start end backward region-noncontiguous-p)
- "Like `query-replace', but query for several replacements.
+ "Like 'query-replace', but query for several replacements.
Query for replacement pairs until the users enters an empty
-string (but see `slot/get-queries').
+string (but see 'slot/get-queries').
-Refer to `query-replace' and `perform-replace' for what the other
+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
(defun k-to-f (tempk)
"Convert degrees Kelvin to degrees Fahrenheit.
-Applies `c-to-f' to `k-to-c'."
+Applies 'c-to-f' to 'k-to-c'."
(c-to-f (k-to-c tempk)))
(defun f-to-k (tempf)
"Convert degrees Fahrenheit to degrees Kelvin.
-Applies `c-to-k' to `f-to-c'."
+Applies 'c-to-k' to 'f-to-c'."
(c-to-k (f-to-c tempf)))
(defun max-counts (resolution)
(defun volts-to-counts (vin vmax resolution)
"Convert a voltage signal to a PLC count.
-Calculates a ratio of vin/vmax, then scales by `max-counts'."
+Calculates a ratio of vin/vmax, then scales by 'max-counts'."
(* (/ (float vin) (float vmax)) (float (max-counts resolution))))
(defun counts-to-volts (cin vmax resolution)
"Convert a PLC count to a voltage.
-Calculates a ratio of cin/`max-counts', then multiplies by vmax."
+Calculates a ratio of cin/'max-counts', then multiplies by vmax."
(* (/ cin (float (max-counts resolution))) vmax))
(defun eff-imp (r1 &optional r2)
"Calculate the effective input impedance, given two resistances.
-For use in `amps-to-volts' and related. The handling of only one resistance
+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
(defun amps-to-volts (amps r1 &optional r2)
"Calculate the voltage, given amperage and impedance.
-Multiplies the amperage by the effective impedance calculated with `eff-imp'."
+Multiplies the amperage by the effective impedance calculated with 'eff-imp'."
(* amps (eff-imp r1 r2)))
(defun volts-to-amps (volts r1 &optional r2)
"Calculate the amperage, given voltage and impedance.
-Divides the voltage by the effective impedance calculated with `eff-imp'."
+Divides the voltage by the effective impedance calculated with 'eff-imp'."
(/ volts (eff-imp r1 r2)))
(defun amps-to-counts (amps vmax resolution r1 &optional r2)
"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."
+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))
(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.
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'."
+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)