"If two windows are open, toggle their split layout between vert. and horiz.
Stolen from http://whattheemacsd.com"
(interactive)
- (if (= (count-windows) 2)
+ (when (= (count-windows) 2)
(let* ((this-win-buffer (window-buffer))
(next-win-buffer (window-buffer (next-window)))
(this-win-edges (window-edges (selected-window)))
(delete-other-windows)
(let ((first-win (selected-window)))
(funcall splitter)
- (if this-win-2nd (other-window 1))
+ (when this-win-2nd (other-window 1))
(set-window-buffer (selected-window) this-win-buffer)
(set-window-buffer (next-window) next-win-buffer)
(select-window first-win)
- (if this-win-2nd (other-window 1))))))
+ (when this-win-2nd (other-window 1))))))
(defun rotate-windows ()
"Rotate your windows.
(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))
+ (when (use-region-p) (region-beginning))
+ (when (use-region-p) (region-end))
(nth 2 common)
- (if (use-region-p) (region-noncontiguous-p)))))
+ (when (use-region-p) (region-noncontiguous-p)))))
(perform-replace
(concat "\\(?:" (mapconcat #'car pairs "\\|") "\\)") ; build query
(cons (lambda (pairs _count)
("\\.docx\\'" "word" (file))
("\\.adpro\\'" "PoductivitySuite" (file))))
(load (expand-file-name "win-defuns.el" user-emacs-directory)))
- (progn (setq openwith-associations '(("\\.pdf\\'" "zathura" (file))
- ("\\.xls\\'" "libreoffice" (file))
- ("\\.xlsx\\'" "libreoffice" (file))
- ("\\.doc\\'" "libreoffice" (file))
- ("\\.docx\\'" "libreoffice" (file))))))
+ (setq openwith-associations '(("\\.pdf\\'" "zathura" (file))
+ ("\\.xls\\'" "libreoffice" (file))
+ ("\\.xlsx\\'" "libreoffice" (file))
+ ("\\.doc\\'" "libreoffice" (file))
+ ("\\.docx\\'" "libreoffice" (file)))))
(custom-set-variables
;; custom-set-variables was added by Custom.
(use-package dash
:ensure t)
-(if (not (eq system-type 'windows-nt))
+(unless (eq system-type 'windows-nt)
(progn
(use-package slime :ensure t)
(use-package ledger-mode :ensure t)))
(defun scaleval (pmax pmin emax emin &optional ai)
"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)))))
- (let ((ofst (- emin (/ pmin div))))
+ (let* ((div (/ (- pmax pmin) (- (float emax) (float emin))))
+ (ofst (- emin (/ pmin div))))
(if (eq nil ai)
(list div ofst)
- (let ((final (+ ofst (/ ai div))))
- (list div ofst final))))))
+ (list div ofst (+ ofst (/ ai div))))))
(defun cfm-circ (fpm radius)
"Calculate the CFM of a circular duct given fpm and radius (in)."
(defun gn-water-per-lb (temp 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))))))
- (let ((hum-press (* (/ humidity 100.0) sat-water-press)))
- (let ((hum-ratio (/ (* hum-press 0.62198) (- 14.7 hum-press))))
- (let ((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."