mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-03 10:53:23 +00:00
; Fix last change
* lisp/pulse.el (pulse-faces, pulse-face-duration): * etc/NEWS: Fix documentation of last change. (Bug#77715)
This commit is contained in:
parent
b25139a532
commit
3b2b0424cf
2 changed files with 21 additions and 12 deletions
7
etc/NEWS
7
etc/NEWS
|
@ -1946,6 +1946,13 @@ New faces have been added to 'icomplete-vertical-mode':
|
||||||
This is intended for customizing directory-local variables in the
|
This is intended for customizing directory-local variables in the
|
||||||
current directory's ".dir-locals.el" file.
|
current directory's ".dir-locals.el" file.
|
||||||
|
|
||||||
|
** Pulse
|
||||||
|
|
||||||
|
--
|
||||||
|
*** New function 'pulse-faces'.
|
||||||
|
This function pulses a specified list of faces. The pulse duration is
|
||||||
|
determined by the new user option 'pulse-face-duration'.
|
||||||
|
|
||||||
** Miscellaneous
|
** Miscellaneous
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
|
@ -228,32 +228,34 @@ Only pulses the line if `pulse-command-advice-flag' is non-nil."
|
||||||
(pulse-momentary-highlight-one-line (point))))
|
(pulse-momentary-highlight-one-line (point))))
|
||||||
|
|
||||||
;;; Pulse faces
|
;;; Pulse faces
|
||||||
;; Functions for pulse any defined face.
|
;; Functions for pulsing any defined face(s).
|
||||||
(require 'face-remap)
|
(require 'face-remap)
|
||||||
|
|
||||||
(defcustom pulse-face-duration pulse-delay
|
(defcustom pulse-face-duration pulse-delay
|
||||||
"Time (in seconds) used for pulse face duration."
|
"Time (in seconds) used for `pulse-faces' duration."
|
||||||
:type 'number
|
:type 'number
|
||||||
:group 'pulse
|
:group 'pulse
|
||||||
:version "31.1")
|
:version "31.1")
|
||||||
|
|
||||||
;; FIXME: The pulse smooth effect cannot be archieved here due
|
;; FIXME: The pulse's smooth effect cannot be achieved here because
|
||||||
;; the face remaping will not work well for that.
|
;; the face-remaping will not work well for that.
|
||||||
(defun pulse-faces (faces &optional with-face)
|
(defun pulse-faces (faces &optional with-face)
|
||||||
"Pulse FACES with face WITH-FACE (if defined) briefly.
|
"Briefly pulse FACES by using attributes of face WITH-FACE (if defined).
|
||||||
FACES must be a list of faces to pulse.
|
FACES should be a list of faces to pulse.
|
||||||
WITH-FACE is optional, it can be a defined face or a list of face
|
WITH-FACE is optional, it can be a defined face or a list
|
||||||
properties to apply."
|
of face properties to apply. If nil or omitted, it defaults
|
||||||
|
to `pulse-highlight-face'."
|
||||||
(when-let* (((numberp pulse-face-duration)) ; Ensure time is a number
|
(when-let* (((numberp pulse-face-duration)) ; Ensure time is a number
|
||||||
(with-face (or with-face 'pulse-highlight-face))
|
(with-face (or with-face 'pulse-highlight-face))
|
||||||
(in-buffer (current-buffer))
|
(in-buffer (current-buffer))
|
||||||
(cookies (mapcar (lambda (f)
|
(cookies (mapcar (lambda (f)
|
||||||
(if (consp with-face)
|
(if (consp with-face)
|
||||||
(apply #'face-remap-add-relative f with-face)
|
(apply #'face-remap-add-relative
|
||||||
|
f with-face)
|
||||||
(face-remap-add-relative f with-face)))
|
(face-remap-add-relative f with-face)))
|
||||||
faces)))
|
faces)))
|
||||||
;; Use run-with-timer if the duration is very long for not blocking
|
;; Use run-with-timer if the duration is very long, so as to avoid
|
||||||
;; emacs, otherwise fallback to sleep-for.
|
;; blocking emacs; otherwise fall back to 'sleep-for'.
|
||||||
(if (> pulse-face-duration 0.1)
|
(if (> pulse-face-duration 0.1)
|
||||||
(run-with-timer pulse-face-duration 0
|
(run-with-timer pulse-face-duration 0
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
@ -264,7 +266,7 @@ properties to apply."
|
||||||
(mapc #'face-remap-remove-relative cookies)))))
|
(mapc #'face-remap-remove-relative cookies)))))
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(progn
|
(progn
|
||||||
;; redisplay for apply the face remap
|
;; Redisplay to apply the face remapping.
|
||||||
(redisplay)
|
(redisplay)
|
||||||
(sleep-for pulse-face-duration))
|
(sleep-for pulse-face-duration))
|
||||||
(mapc #'face-remap-remove-relative cookies)))))
|
(mapc #'face-remap-remove-relative cookies)))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue