[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/hyperbole 5119a4c 17/51: hui-em-but.el: Properly highli
From: |
Stefan Monnier |
Subject: |
[elpa] externals/hyperbole 5119a4c 17/51: hui-em-but.el: Properly highlight explicit buttons when loading |
Date: |
Sun, 12 Jul 2020 18:10:10 -0400 (EDT) |
branch: externals/hyperbole
commit 5119a4ca58efbd039583080ea59e3f8ab99aeaf0
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>
hui-em-but.el: Properly highlight explicit buttons when loading
---
Changes | 7 +++++++
hui-em-but.el | 56 +++++++++++++++++++++++++++++---------------------------
2 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/Changes b/Changes
index 8d2e8a4..3ffbd56 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,10 @@
+2020-01-31 Bob Weiner <rsw@gnu.org>
+
+* hui-em-but.el (hproperty:set-flash-color):
+ (hproperty:set-face-after-init): Resolved issue that explicit
buttons were not
+ being highlighted upon load and that explicit and named implicit buttons
were not flashing
+ properly when activated due to improper face settings.
+
2020-01-29 Bob Weiner <rsw@gnu.org>
* hpath.el (hpath:markup-link-anchor-regexp): Prevent matches to files like:
".#a.org"
diff --git a/hui-em-but.el b/hui-em-but.el
index 38e5294..a8329ed 100644
--- a/hui-em-but.el
+++ b/hui-em-but.el
@@ -1,4 +1,4 @@
-;;; hui-em-but.el --- GNU Emacs button highlighting and flashing support
+;; hui-em-but.el --- GNU Emacs button highlighting and flashing support
;;
;; Author: Bob Weiner
;;
@@ -16,9 +16,7 @@
;;; Code:
-(when noninteractive
- ;; FIXME: Loading a file should always be harmless!
- (error "(hui-em-but.el): Load only when running GNU Emacs interactively"))
+(unless noninteractive
;;; ************************************************************************
;;; Other required Elisp libraries
@@ -138,7 +136,7 @@ highlighted."
(defun hproperty:but-delete (&optional pos)
(let ((but (hproperty:but-get pos)))
- (if but (delete-overlay but))))
+ (when but (delete-overlay but))))
;;; ************************************************************************
;;; Private functions
@@ -311,21 +309,23 @@ highlighted."
(defun hproperty:cycle-but-color (&optional color)
"Switch button color to optional COLOR name or next item referenced by
hproperty:color-ptr."
(interactive "sHyperbole button color: ")
- (if (not (display-color-p))
- nil
- (if color (setq hproperty:color-ptr nil))
+ (when (display-color-p)
+ (when color (setq hproperty:color-ptr nil))
(set-face-foreground
hproperty:but-face (or color (car (hproperty:list-cycle
hproperty:color-ptr hproperty:good-colors))))
(hproperty:set-flash-color)
- (sit-for 0) ;; Force display update
+ (sit-for 0) ;; Force display update
t))
(defun hproperty:set-flash-color ()
"Set button flashing colors based upon current color set."
- (if (not (display-color-p))
- nil
- (set-face-background hproperty:flash-face (hproperty:but-color))
- (set-face-foreground hproperty:flash-face (hproperty:background))))
+ (when (display-color-p)
+ (set-face-foreground hproperty:flash-face (if hproperty:but-face
+ (face-background
hproperty:but-face)
+ (hproperty:background)))
+ (set-face-background hproperty:flash-face (if hproperty:but-face
+ (face-foreground
hproperty:but-face)
+ (hproperty:but-color)))))
(defun hproperty:but-p (&optional pos)
"Return non-nil at point or optional POS iff face is eq to
hproperty:but-face."
@@ -353,7 +353,7 @@ highlighted."
(unwind-protect
(progn
(hproperty:set-but-face start hproperty:flash-face)
- (sit-for (/ hproperty:but-flash-time 10000.0))) ;; Force display
update
+ (sit-for (/ hproperty:but-flash-time 5000.0))) ;; Force display
update
(hproperty:set-but-face start a)
(sit-for 0))) ;; Force display update
(if (and ibut (not prev)) (hproperty:but-delete start))))
@@ -402,8 +402,7 @@ highlighted."
(skip-chars-forward "^ \t\n\r")
(hproperty:but-add start (point) hproperty:item-face)
))
- (sit-for 0) ;; Force display update
- )
+ (sit-for 0)) ;; Force display update
(defun hproperty:select-line (&optional pnt)
"Select line in current buffer at optional position PNT using
hproperty:item-face."
@@ -411,8 +410,7 @@ highlighted."
(save-excursion
(beginning-of-line)
(hproperty:but-add (point) (progn (end-of-line) (point))
hproperty:item-face))
- (sit-for 0) ;; Force display update
- )
+ (sit-for 0)) ;; Force display update
;;; ************************************************************************
;;; Private variables
@@ -427,17 +425,19 @@ highlighted."
(defun hproperty:set-face-after-init ()
(set-face-foreground hproperty:but-face (hproperty:but-color))
- (set-face-background hproperty:but-face (hproperty:background)))
-(if after-init-time
- (hproperty:set-face-after-init)
- (add-hook 'after-init-hook #'hproperty:set-face-after-init))
+ (set-face-background hproperty:but-face (hproperty:background))
+ (when (or (not hproperty:highlight-face)
+ (equal (face-background hproperty:highlight-face)
(hproperty:background))
+ (equal (face-foreground hproperty:highlight-face)
(hproperty:foreground)))
+ ;; Reverse foreground and background colors for default block-style
highlighting.
+ (hproperty:set-item-highlight (hproperty:foreground)
(hproperty:background)))
+ (hproperty:set-flash-color))
(defvar hproperty:flash-face
(progn (defface hbut-flash nil "Hyperbole face for flashing hyper-buttons."
:group 'hyperbole-buttons)
'hbut-flash)
"Hyperbole face for flashing hyper-buttons.")
-(hproperty:set-flash-color)
(defvar hproperty:item-button nil
"Button used to highlight an item in a listing buffer.")
@@ -445,11 +445,13 @@ highlighted."
(defvar hproperty:item-face nil "Item marking face.")
(defvar hproperty:highlight-face nil
"Item highlighting face. Use (hproperty:set-item-highlight) to set.")
-(if hproperty:highlight-face
- nil
- ;; Reverse foreground and background colors for default block-style
highlighting.
- (hproperty:set-item-highlight (hproperty:foreground) (hproperty:background)))
(provide 'hui-em-but)
+(if after-init-time
+ (hproperty:set-face-after-init)
+ (add-hook 'after-init-hook #'hproperty:set-face-after-init))
+
+)
+
;;; hui-em-but.el ends here
- [elpa] externals/hyperbole fc7c511 15/51: Merge branch 'master' of hyperbole, (continued)
- [elpa] externals/hyperbole fc7c511 15/51: Merge branch 'master' of hyperbole, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 4f0a651 16/51: hproperty:but-flash-time - revert value from 0.05 back to 1000, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole c30a718 18/51: Fix out-of-date imenu index after buffer changes, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 766ac22 04/51: Large commit of RSW changes, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 9e2b4ba 08/51: hui-select.el - remove require of kotl-mode; caused cyclical loads, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 8e6ea41 12/51: Fix ibut handling in programming modes; add button links to glossary, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole ad4dc9f 09/51: Makefile - add missing gzipped tar file dependency to 'ftp' target, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 0e1203c 32/51: Publish 7.1.0 test release, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole c565349 33/51: Fix entry addition which was failing due to level handling change, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole db4dd6c 13/51: Use float for delay instead of looping (#21), Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 5119a4c 17/51: hui-em-but.el: Properly highlight explicit buttons when loading,
Stefan Monnier <=
- [elpa] externals/hyperbole 9a94a8f 19/51: Fix hproperty:item-highlight-color init error; add regional 'throw', Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 45fff9a 23/51: Many bug fixes and improvements, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 6e55a34 34/51: Fix ebut:get calls to send file as 3rd arg, not 2nd, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole b430d10 36/51: hpath:find: Was called with point in the source, not referent buffer, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 3d26ccb 40/51: Fix require of 'help-mode' instead of 'help' to remedy 'make bin', Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 56e88ca 47/51: Merge branch 'master' of hyperbole, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 2f52190 44/51: Koutliner: Add support for Emacs visual-line commands, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 2253ac2 50/51: V7.1.2 release, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 7184b30 51/51: Fix ibut:delete, Stefan Monnier, 2020/07/12
- [elpa] externals/hyperbole 07c0664 21/51: Org-mode local binding of M-RET activates Hyperbole implicit buttons, Stefan Monnier, 2020/07/12