summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnar Sveen <magnars@gmail.com>2021-07-02 07:37:05 +0200
committerMagnar Sveen <magnars@gmail.com>2021-07-02 07:37:28 +0200
commit382519de0cf39fd0df4ef8911427a975464f25a3 (patch)
treec3079b582523511e6c5442ebd775cf0b30974e30
parent51e0740e1f61f29bd64acd1afd83343a7168ba14 (diff)
Revert "Revert "refact: replace `if` with `unless` or `when` for more idiomatic code""
This reverts commit dc161a33951e7a74020a71592f66f340477074f0.
-rw-r--r--yaml-mode-expansions.el12
1 files changed, 6 insertions, 6 deletions
diff --git a/yaml-mode-expansions.el b/yaml-mode-expansions.el
index a9c90d3..6ebbd40 100644
--- a/yaml-mode-expansions.el
+++ b/yaml-mode-expansions.el
@@ -31,7 +31,7 @@
(defconst yaml-indent 2)
-(if (not (fboundp 'yaml-indent-offset))
+(unless (fboundp 'yaml-indent-offset))
(defalias 'yaml-indent-offset 'yaml-indent))
(defvar er--yaml-key-value-regex
@@ -57,17 +57,17 @@
(defun er--get-regex-indentation-level (regex)
"Return the indentation level of the code with respect to the REGEX passed."
- (if (looking-at regex)
- ;; Block start means that the next level is deeper.
- (+ (current-indentation) yaml-indent-offset)
+ (when (looking-at regex)
+ ;; Block start means that the next level is deeper.
+ (+ (current-indentation) yaml-indent-offset)
;; Assuming we're inside the block that we want to mark
(current-indentation)))
(defun er/mark-yaml-line-base (regex)
"Mark line of yaml file based on simple REGEX."
(back-to-indentation)
- (if (looking-at regex)
- (set-mark (line-end-position))))
+ (when (looking-at regex)
+ (set-mark (line-end-position))))
(defun er/mark-yaml-block-base (regex &optional next-indent-level)
"Mark yaml block based on REGEX passed. NEXT-INDENT-LEVEL can be used to search outer blocks when necessary."