emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/hl-block-mode 3c49f80ada 50/64: Cleanup: replace 'if' with


From: ELPA Syncer
Subject: [nongnu] elpa/hl-block-mode 3c49f80ada 50/64: Cleanup: replace 'if' with 'cond'
Date: Thu, 7 Jul 2022 12:00:08 -0400 (EDT)

branch: elpa/hl-block-mode
commit 3c49f80ada5679d044fcb6d071ea0134e039cd9c
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>

    Cleanup: replace 'if' with 'cond'
    
    Personal preference.
---
 hl-block-mode.el | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/hl-block-mode.el b/hl-block-mode.el
index 1ad5dad6f8..416981b4dc 100644
--- a/hl-block-mode.el
+++ b/hl-block-mode.el
@@ -27,10 +27,8 @@
 
 ;;; Usage
 
-;; (hl-block-mode)        ; activate in the current buffer
-;; (global-hl-block-mode) ; activate globally for all buffers
-;;
-;; Currently only curly braces are supported (C-family languages).
+;; (hl-block-mode)        ; activate in the current buffer.
+;; (global-hl-block-mode) ; activate globally for all buffers.
 
 
 ;;; Code:
@@ -105,9 +103,11 @@ Useful for languages that use S-expressions to avoid 
overly nested highlighting.
 PT is typically the '(point)'."
   (let ((beg (ignore-errors (elt (syntax-ppss pt) 1))))
     (when beg
-      (if (char-equal hl-block-bracket (char-after beg))
-        beg
-        (hl-block--syntax-prev-bracket (1- beg))))))
+      (cond
+        ((char-equal hl-block-bracket (char-after beg))
+          beg)
+        (t
+          (hl-block--syntax-prev-bracket (1- beg)))))))
 
 
 (defun hl-block--find-range (pt)
@@ -208,9 +208,11 @@ Argument BLOCK-LIST represents start-end ranges of braces."
                     :background
                     (hl-block--color-values-as-string
                       (let ((i-tint (- block-list-len i)))
-                        (if do-highlight
-                          (hl-block--color-tint-add bg-color bg-color-tint 
i-tint)
-                          (hl-block--color-tint-sub bg-color bg-color-tint 
i-tint))))
+                        (cond
+                          (do-highlight
+                            (hl-block--color-tint-add bg-color bg-color-tint 
i-tint))
+                          (t
+                            (hl-block--color-tint-sub bg-color bg-color-tint 
i-tint)))))
                     :extend t)))
 
               (overlay-put elem-overlay-beg 'face hl-face)
@@ -268,9 +270,11 @@ Argument BLOCK-LIST represents start-end ranges of braces."
 
     (when block-list
       (setq block-list
-        (if (cdr block-list)
-          (reverse block-list)
-          (cons (cons (point-min) (point-max)) block-list)))
+        (cond
+          ((cdr block-list)
+            (reverse block-list))
+          (t
+            (cons (cons (point-min) (point-max)) block-list))))
 
       (cond
         ((eq hl-block-style 'color-tint)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]