branch: scratch/expand-region commit dc161a33951e7a74020a71592f66f340477074f0 Author: Magnar Sveen <magn...@gmail.com> Commit: Magnar Sveen <magn...@gmail.com>
Revert "refact: replace `if` with `unless` or `when` for more idiomatic code" This reverts commit 8f1e82537dd633b09a764943d62c8da613a486b4. --- yaml-mode-expansions.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yaml-mode-expansions.el b/yaml-mode-expansions.el index 6ebbd40f81..a9c90d3b4d 100644 --- a/yaml-mode-expansions.el +++ b/yaml-mode-expansions.el @@ -31,7 +31,7 @@ (defconst yaml-indent 2) -(unless (fboundp 'yaml-indent-offset)) +(if (not (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." - (when (looking-at regex) - ;; Block start means that the next level is deeper. - (+ (current-indentation) yaml-indent-offset) + (if (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) - (when (looking-at regex) - (set-mark (line-end-position)))) + (if (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."