;;; pulse.el --- Pulsing Overlays
-;;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;;; Copyright (C) 2007-2013 Free Software Foundation, Inc.
;; Author: Eric M. Ludlam <eric@siege-engine.com>
+;; Version: 1.0
;; This file is part of GNU Emacs.
;;
;; `pulse-momentary-highlight-one-line' - Pulse a single line at POINT.
;; `pulse-momentary-highlight-region' - Pulse a region.
-;; `pulse-momentary-highlight-overlay' - Pulse an overlay
+;; `pulse-momentary-highlight-overlay' - Pulse an overlay.
;; These three functions will just blink the specified area if
;; the version of Emacs you are using doesn't support pulsing.
;;
(error nil)))
(defcustom pulse-flag (pulse-available-p)
- "*Non-nil means to pulse the overlay face for momentary highlighting.
-Pulsing involves a bright highlight that slowly shifts to the background
-color. Non-nil just means to highlight with an unchanging color for a short
-time.
+ "Whether to use pulsing for momentary highlighting.
+Pulsing involves a bright highlight that slowly shifts to the
+background color.
+
+If the value is nil, highlight with an unchanging color until a
+key is pressed.
+If the value is `never', do no coloring at all.
+Any other value means to do the default pulsing behavior.
If `pulse-flag' is non-nil, but `pulse-available-p' is nil, then
this flag is ignored."
(:background "#AAAA33"))
(((class color) (background light))
(:background "#FFFFAA")))
- "*Face used at beginning of a highight."
+ "Face used at beginning of a highlight."
:group 'pulse)
(defface pulse-highlight-face
(:background "#AAAA33"))
(((class color) (background light))
(:background "#FFFFAA")))
- "*Face used during a pulse for display. *DO NOT CUSTOMIZE*
+ "Face used during a pulse for display. *DO NOT CUSTOMIZE*
Face used for temporary highlighting of tags for effect."
:group 'pulse)
(defun pulse (&optional face)
"Pulse the colors on our highlight face.
-If optional FACE is provide, reset the face to FACE color,
+If optional FACE is provided, reset the face to FACE color,
instead of `pulse-highlight-start-face'.
Be sure to call `pulse-reset-face' after calling pulse."
(unwind-protect
Optional argument FACE specifies the fact to do the highlighting."
(overlay-put o 'original-face (overlay-get o 'face))
(add-to-list 'pulse-momentary-overlay o)
- (if (or (not pulse-flag) (not (pulse-available-p)))
- ;; Provide a face... clear on next command
- (progn
- (overlay-put o 'face (or face 'pulse-highlight-start-face))
- (add-hook 'pre-command-hook
- 'pulse-momentary-unhighlight)
- )
- ;; pulse it.
- (unwind-protect
+ (if (eq pulse-flag 'never)
+ nil
+ (if (or (not pulse-flag) (not (pulse-available-p)))
+ ;; Provide a face... clear on next command
(progn
- (overlay-put o 'face 'pulse-highlight-face)
- ;; The pulse function puts FACE onto 'pulse-highlight-face.
- ;; Thus above we put our face on the overlay, but pulse
- ;; with a reference face needed for the color.
- (pulse face))
- (pulse-momentary-unhighlight))))
+ (overlay-put o 'face (or face 'pulse-highlight-start-face))
+ (add-hook 'pre-command-hook
+ 'pulse-momentary-unhighlight))
+ ;; pulse it.
+ (unwind-protect
+ (progn
+ (overlay-put o 'face 'pulse-highlight-face)
+ ;; The pulse function puts FACE onto 'pulse-highlight-face.
+ ;; Thus above we put our face on the overlay, but pulse
+ ;; with a reference face needed for the color.
+ (pulse face))
+ (pulse-momentary-unhighlight)))))
(defun pulse-momentary-unhighlight ()
"Unhighlight a line recently highlighted."
(provide 'pulse)
-;; arch-tag: 6e2f78c1-65b3-4164-a141-872cb1552959
;;; pulse.el ends here