branch: scratch/expand-region commit 8f1e82537dd633b09a764943d62c8da613a486b4 Author: Aaron Gonzales <aaronzi...@ucla.edu> Commit: Magnar Sveen <magn...@gmail.com>
refact: replace `if` with `unless` or `when` for more idiomatic code --- 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 a9c90d3b4d..6ebbd40f81 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."