[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sweeprolog 6e5c822fc8 116/166: ADDED: sweep-colourise-buff
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sweeprolog 6e5c822fc8 116/166: ADDED: sweep-colourise-buffer-on-idle user option, on by default |
Date: |
Fri, 30 Sep 2022 04:59:30 -0400 (EDT) |
branch: elpa/sweeprolog
commit 6e5c822fc8b1f08c2dae28c88c616ca0876f3bf3
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
ADDED: sweep-colourise-buffer-on-idle user option, on by default
---
NEWS.org | 23 +++++++++++++++++++++--
README.org | 15 ++++++++++++++-
sweep.el | 31 +++++++++++++++++++------------
3 files changed, 54 insertions(+), 15 deletions(-)
diff --git a/NEWS.org b/NEWS.org
index d8d2628106..0e459a18d2 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -2,14 +2,14 @@
#+author: Eshel Yaron
#+email: me@eshelyaron.com
#+language: en
-#+options: ':t toc:nil num:nil
+#+options: ':t toc:nil num:nil ^:{}
#+startup: content indent
#+MACRO: version (eval (mapconcat #'number-to-string (save-current-buffer
(with-current-buffer (find-file (expand-file-name "sweep.el"
(file-name-directory $1))) (package-desc-version (package-buffer-info)))) "."))
This file is about changes in =sweep= up to version
{{{version({{{input-file}}})}}}.
-* New commands available in sweep {{{version({{{input-file}}})}}}
+* New commands available in =sweep= {{{version({{{input-file}}})}}}
** New command =sweep-load-buffer=.
@@ -20,12 +20,31 @@ the current buffer by default.
Follows file specifications in =sweep-mode= buffers.
+
* New keybindings in =sweep-mode= buffers
** =C-c C-l= is now bound to =sweep-load-buffer=.
** =C-c C-o= is now bound to =sweep-find-file-at-point=.
+* New user options available in =sweep= {{{version({{{input-file}}})}}}
+
+** New user option =sweep-colourise-buffer-on-idle=
+
+This option is a boolean flag that determines whether to enable
+automatic updating of semantic highlighting in =sweep-mode= buffers.
+
+** New user option =sweep-colourise-buffer-min-interval=
+
+This option determines the minimum number of idle seconds that =sweep=
+will wait before updating semantic highlighting in a =sweep-mode=
+buffer.
+
+** New user option =sweep-colourise-buffer-max-size=
+
+This option determines the maximum size of a =sweep-mode= buffer for
+which =sweep= will periodically update semantic highlighting on idle.
+
* New keybindings in =sweep-prefix-map=
diff --git a/README.org b/README.org
index ac95947936..58d396f557 100644
--- a/README.org
+++ b/README.org
@@ -292,7 +292,8 @@ is performed on demand. When a buffer is first opened in
=sweep-mode=,
its entire contents are analyzed to collect and cache cross reference
data, and the buffer is highlighted accordingly. In contrast, when
editing and moving around the buffer, a faster, local analysis is
-invoked to updated the semantic highlighting.
+invoked to updated the semantic highlighting in response to changes in
+the buffer.
#+FINDEX: sweep-colourise-buffer
At any point in a =sweep-mode= buffer, the command =C-c C-c= (or =M-x
@@ -300,6 +301,18 @@ sweep-colourise-buffer=) can be used to update the cross
reference
cache and highlight the buffer accordingly. This may be useful
e.g. after defining a new predicate.
+#+VINDEX: sweep-colourise-buffer-on-idle
+#+VINDEX: sweep-colourise-buffer-max-size
+#+VINDEX: sweep-colourise-buffer-min-interval
+If the user option =sweep-colourise-buffer-on-idle= is set to non-nil
+(as it is by default), =sweep-mode= also updates semantic highlighting
+in the buffer whenever Emacs is idle for a reasonable amount of time,
+unless the buffer is larger than the value of the
+=sweep-colourise-buffer-max-size= user option ( 100,000 by default).
+The minimum idle time to wait before automatically updating semantic
+highlighting can be set via the user option
+=sweep-colourise-buffer-min-interval=.
+
#+CINDEX: sweep-faces
=sweep= defines more than 60 different faces (named sets of properties
that determine the appearance of a specific text in Emacs buffers, see
diff --git a/sweep.el b/sweep.el
index addc416481..8a30ea6831 100644
--- a/sweep.el
+++ b/sweep.el
@@ -32,6 +32,12 @@
"SWI-Prolog Embedded in Emacs."
:group 'prolog)
+(defcustom sweep-colourise-buffer-on-idle t
+ "If non-nil, update highlighting of `sweep-mode' buffers on idle."
+ :package-version '((sweep . "0.2.0"))
+ :type 'boolean
+ :group 'sweep)
+
(defcustom sweep-colourise-buffer-max-size 100000
"Maximum buffer size to recolourise on idle."
:package-version '((sweep . "0.2.0"))
@@ -1345,18 +1351,19 @@ Interactively, POINT is set to the current point."
(add-hook 'xref-backend-functions #'sweep--xref-backend nil t)
(add-hook 'file-name-at-point-functions #'sweep-file-at-point nil t)
(add-hook 'completion-at-point-functions
#'sweep-completion-at-point-function nil t)
- (setq sweep--timer (run-with-idle-timer (max
sweep-colourise-buffer-min-interval
- (* 10
sweep--colourise-buffer-duration))
- t
- (let ((buffer (current-buffer)))
- (lambda ()
- (unless (<
sweep-colourise-buffer-max-size
- (buffer-size buffer))
- (sweep-colourise-buffer
buffer))))))
- (add-hook 'kill-buffer-hook
- (lambda ()
- (when (timerp sweep--timer)
- (cancel-timer sweep--timer)))))
+ (when sweep-colourise-buffer-on-idle
+ (setq sweep--timer (run-with-idle-timer (max
sweep-colourise-buffer-min-interval
+ (* 10
sweep--colourise-buffer-duration))
+ t
+ (let ((buffer (current-buffer)))
+ (lambda ()
+ (unless (<
sweep-colourise-buffer-max-size
+ (buffer-size
buffer))
+ (sweep-colourise-buffer
buffer))))))
+ (add-hook 'kill-buffer-hook
+ (lambda ()
+ (when (timerp sweep--timer)
+ (cancel-timer sweep--timer))))))
;;;; Testing:
- [nongnu] elpa/sweeprolog ea04f467b9 027/166: ADDED: sweep-pack-install for interactively installing packs, (continued)
- [nongnu] elpa/sweeprolog ea04f467b9 027/166: ADDED: sweep-pack-install for interactively installing packs, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 25bda86c48 032/166: Use load-file-path instead of custom hack, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog c5b1504ca8 033/166: ADDED: sweep-top-level command and appropriate mode, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog a06906287f 036/166: ADDED: sweep_funcall/2, 3 for calling Elisp functions from Prolog, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 5b23e9819b 038/166: DOC: Add Prolog initialization section to the manual, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 4e4d8508cd 039/166: ENHANCED: Allow using swipl compiled with GMP, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 4b4b28f15a 007/166: Add module descriptions to sweep-find-module annotation function, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 0078ef8ff0 060/166: ENHANCED: syntax errors coloring, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog e38825d0e2 066/166: ENHANCED: use a distinct face for structured comments, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 84e6182685 077/166: FIXED: detect "|:" prompt in the top-level, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 6e5c822fc8 116/166: ADDED: sweep-colourise-buffer-on-idle user option, on by default,
ELPA Syncer <=
- [nongnu] elpa/sweeprolog a7ce69558e 111/166: Makefile: Use "--batch" instead of "-batch" for consistency, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 5b54d23b8b 086/166: ENHANCED: apply an appropriate face to global predicate calls, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog d9b8ffccda 107/166: ADDED: (sweep-mode-map): bind C-c C-o to sweep-find-file-at-point, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog ecc36d67e1 089/166: FIXED: handle some missing color terms, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog f72ebe6d62 127/166: ENHANCHED: automatic syntax aware autoindentation in sweep-mode, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog ccaa53a19c 147/166: DOC: update installation instruction to reflect inclusion in swipl, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog c8192b8c31 145/166: DOC: document imenu support in sweep-mode buffers, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 6b9e2a7833 139/166: Tweak README to prevent a hosting platform from failing to render it, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 79bf5b78b8 042/166: Run `make check` with libswipl preloaded, ELPA Syncer, 2022/09/30
- [nongnu] elpa/sweeprolog 97440dda21 043/166: DOC: update the manual to reflect the latest GMP deconflication, ELPA Syncer, 2022/09/30