[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)
- [nongnu] elpa/hl-block-mode b2f1c058be 61/64: Cleanup: remove redundant group, (continued)
- [nongnu] elpa/hl-block-mode b2f1c058be 61/64: Cleanup: remove redundant group, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 0593a1a77d 62/64: Cleanup: docstrings, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 9c5ee70df6 17/64: Cleanup: checkdoc warnings, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 83059c1050 18/64: Cleanup: use package prefix, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 047f9a972c 20/64: fix byte-compile nag, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 05a8c5119c 32/64: readme: link to melpa, tweaks to syntax highlighting, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 72840769e9 37/64: Cleanup: remove use of 'post-command-hook', ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 4a73d23ae2 43/64: Cleanup: over wide doc-string, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode bd54144b34 49/64: Cleanup: re-organize sections, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 333490cf2d 45/64: Add hl-block-multi-line option, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 3c49f80ada 50/64: Cleanup: replace 'if' with 'cond',
ELPA Syncer <=
- [nongnu] elpa/hl-block-mode f2ec1f167a 46/64: Correct type of hl-block-color-tint, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 2fb1cc165b 57/64: Simplify local bracket variable use, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 7e0452c768 64/64: Change URL to codeberg, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode a1c03970a0 59/64: Remove unnecessary requirement `seq`, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode d7e274c3f1 04/64: Update readme.rst, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode e7b5b014c9 10/64: Fix: localize hook & timer running when it shouldn't, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 28c9950a90 25/64: Fix for emacs 27, change in line highlighting, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode c6341f404e 44/64: Cleanup: store range data in cons cells instead of lists, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode e7ab79e713 36/64: Cleanup: add code-sections, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 7e0c6954f9 52/64: readme: document draw styles, ELPA Syncer, 2022/07/07