#+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=.
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=
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
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
"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"))
(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: