[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hl-block-mode e7ab79e713 36/64: Cleanup: add code-sections
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hl-block-mode e7ab79e713 36/64: Cleanup: add code-sections |
Date: |
Thu, 7 Jul 2022 12:00:07 -0400 (EDT) |
branch: elpa/hl-block-mode
commit e7ab79e7139e898423eb510d52978fbadcdcf556
Author: Campbell Barton <ideasman42@gmail.com>
Commit: Campbell Barton <ideasman42@gmail.com>
Cleanup: add code-sections
---
hl-block-mode.el | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/hl-block-mode.el b/hl-block-mode.el
index bcd12f1261..7aea45af68 100644
--- a/hl-block-mode.el
+++ b/hl-block-mode.el
@@ -37,6 +37,10 @@
(require 'seq)
+
+;; ---------------------------------------------------------------------------
+;; Custom Variables
+
(defcustom hl-block-bracket ?{
"Character to use as a starting bracket (defaults to '{').
Set to nil to use all brackets."
@@ -58,6 +62,19 @@ Set to nil to use all brackets."
:group 'hl-block-mode
:type 'string)
+
+;; ---------------------------------------------------------------------------
+;; Internal Variables
+
+(defvar-local hl-block-overlay nil)
+
+;; Global timer.
+(defvar hl-block--delay-timer nil)
+
+
+;; ---------------------------------------------------------------------------
+;; Internal Functions/Macros
+
(defun hl-block--syntax-prev-bracket (pt)
"A version of `syntax-ppss' to match curly braces.
PT is typically the '(point)'."
@@ -92,8 +109,6 @@ PT is typically the '(point)'."
Inverse of `color-values'."
(format "#%02x%02x%02x" (ash r -8) (ash g -8) (ash b -8)))
-(defvar-local hl-block-overlay nil)
-
(defun hl-block--overlay-clear ()
"Clear all overlays."
(mapc 'delete-overlay hl-block-overlay)
@@ -139,9 +154,6 @@ Inverse of `color-values'."
(setq end-prev end)))
(cdr block-list))))))
-;; Timer
-(defvar hl-block--delay-timer nil)
-
(defun hl-block--overlay-refresh-from-timer ()
"Ensure this mode has not been disabled before highlighting.
This can happen when switching buffers."
@@ -155,6 +167,10 @@ This can happen when switching buffers."
(setq hl-block--delay-timer
(run-with-idle-timer hl-block-delay t
'hl-block--overlay-refresh-from-timer)))
+
+;; ---------------------------------------------------------------------------
+;; Internal Mode Management
+
(defun hl-block-mode-enable ()
"Turn on 'hl-block-mode' for the current buffer."
(add-hook 'post-command-hook #'hl-block--overlay-delay nil t))
@@ -171,6 +187,9 @@ This can happen when switching buffers."
(when (and (not (minibufferp)) (not (bound-and-true-p hl-block-mode)))
(hl-block-mode 1)))
+;; ---------------------------------------------------------------------------
+;; Public API
+
;;;###autoload
(define-minor-mode hl-block-mode
"Highlight block under the cursor."
- [nongnu] elpa/hl-block-mode 333490cf2d 45/64: Add hl-block-multi-line option, (continued)
- [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, 2022/07/07
- [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 <=
- [nongnu] elpa/hl-block-mode 7e0c6954f9 52/64: readme: document draw styles, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode d080364c64 58/64: Use a string for hl-block-bracket characters, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 3dd29cfbf2 63/64: Cleanup: use brief SPDX license, ELPA Syncer, 2022/07/07
- [nongnu] elpa/hl-block-mode 933cee11e3 02/64: Add readme, ELPA Syncer, 2022/07/07