summaryrefslogtreecommitdiff
path: root/.emacs.d/init-spw.el
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-02-03 23:29:22 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-02-03 23:29:22 -0700
commitd1e1ddfb8a17422856bf896c59040915ea323bc7 (patch)
tree744c062e75ac1a613bfe6e5aa6b8cb776744b001 /.emacs.d/init-spw.el
parent3cf238ddba098199be59a9e52e1812bf4246cd96 (diff)
downloaddotfiles-d1e1ddfb8a17422856bf896c59040915ea323bc7.tar.gz
readability
Diffstat (limited to '.emacs.d/init-spw.el')
-rw-r--r--.emacs.d/init-spw.el26
1 files changed, 12 insertions, 14 deletions
diff --git a/.emacs.d/init-spw.el b/.emacs.d/init-spw.el
index 2321854a..4e72399e 100644
--- a/.emacs.d/init-spw.el
+++ b/.emacs.d/init-spw.el
@@ -2808,20 +2808,18 @@ mutt's review view, after exiting EDITOR."
;;
;; note that we can't use `beginning-of-defun' as not every top
;; level perl block is a defun to Emacs
- (let ((start)
- (count 0))
- (cl-loop do (setq start (point))
- (ignore-errors (backward-up-list))
- (setq count (1+ count))
- until (= start (point)))
- (if (= count 1)
- ;; we didn't move; do whole buffer
- (spw/perltidy-region (point-min) (point-max))
- ;; tidy the top level block
- (let ((begin (line-beginning-position)))
- (forward-sexp)
- (forward-line)
- (spw/perltidy-region begin (point))))))))
+ (cl-loop for count upfrom 1
+ for start = (point)
+ do (ignore-errors (backward-up-list))
+ until (= start (point))
+ finally (if (= count 1)
+ ;; we didn't move; do whole buffer
+ (spw/perltidy-region (point-min) (point-max))
+ ;; tidy the top level block
+ (let ((begin (line-beginning-position)))
+ (forward-sexp)
+ (forward-line)
+ (spw/perltidy-region begin (point))))))))
(with-eval-after-load 'cperl-mode
(define-key cperl-mode-map "\C-ciu" #'spw/perl-add-use)