[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 00d2c0c 11/24: Add lv-force-update
From: |
Oleh Krehel |
Subject: |
[elpa] master 00d2c0c 11/24: Add lv-force-update |
Date: |
Fri, 01 May 2015 14:27:15 +0000 |
branch: master
commit 00d2c0c6f97fe2910849cdc4cddb77d24bc73e51
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add lv-force-update
* hydra.el (hydra-keyboard-quit): Don't clear the message when
`hydra--ignore' is t.
* lv.el (lv-force-update): New defvar.
(lv-message): Refresh the window unless both the window contents haven't
changed and `lv-force-update' is nil.
Fixes #121
---
hydra.el | 7 ++++---
lv.el | 24 +++++++++++++-----------
2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/hydra.el b/hydra.el
index 8c2a046..45daf2f 100644
--- a/hydra.el
+++ b/hydra.el
@@ -387,9 +387,10 @@ Return DEFAULT if PROP is not in H."
(hydra-disable)
(cancel-timer hydra-timeout-timer)
(cancel-timer hydra-message-timer)
- (if hydra-lv
- (lv-delete-window)
- (message ""))
+ (unless hydra--ignore
+ (if hydra-lv
+ (lv-delete-window)
+ (message "")))
nil)
(defun hydra--hint (body heads)
diff --git a/lv.el b/lv.el
index 69e8497..76094b5 100644
--- a/lv.el
+++ b/lv.el
@@ -56,22 +56,24 @@
(set-window-parameter lv-wnd 'no-other-window t))
(select-window ori)))))
+(defvar lv-force-update t
+ "When non-nil, `lv-message' will refresh even for the same string.")
+
(defun lv-message (format-string &rest args)
"Set LV window contents to (`format' FORMAT-STRING ARGS)."
- (let* ((ori (selected-window))
- (str (apply #'format format-string args))
+ (let* ((str (apply #'format format-string args))
(n-lines (cl-count ?\n str))
deactivate-mark
golden-ratio-mode)
- (select-window (lv-window))
- (unless (string= (buffer-string) str)
- (delete-region (point-min) (point-max))
- (insert str)
- (setq-local window-min-height n-lines)
- (setq truncate-lines (> n-lines 1))
- (fit-window-to-buffer nil nil 1))
- (goto-char (point-min))
- (select-window ori)))
+ (with-selected-window (lv-window)
+ (unless (and (string= (buffer-string) str)
+ (null lv-force-update))
+ (delete-region (point-min) (point-max))
+ (insert str)
+ (setq-local window-min-height n-lines)
+ (setq truncate-lines (> n-lines 1))
+ (fit-window-to-buffer nil nil 1))
+ (goto-char (point-min)))))
(defun lv-delete-window ()
"Delete LV window and kill its buffer."
- [elpa] master 8ded725 01/24: hydra.el (hydra--input-method-function): Move before first use, (continued)
- [elpa] master 8ded725 01/24: hydra.el (hydra--input-method-function): Move before first use, Oleh Krehel, 2015/05/01
- [elpa] master 8be0bff 02/24: hydra-examples.el: Add a defvar, Oleh Krehel, 2015/05/01
- [elpa] master 192c5b0 03/24: Allow heads to conditionally exit, Oleh Krehel, 2015/05/01
- [elpa] master ad8def1 04/24: Match e.g. "C-d C-o" in docstring, Oleh Krehel, 2015/05/01
- [elpa] master f472834 05/24: hydra.el (hydra--format): Be non-greedy with width spec, Oleh Krehel, 2015/05/01
- [elpa] master 0b1b966 06/24: hydra.el (hydra-face-teal): Fixup doc, Oleh Krehel, 2015/05/01
- [elpa] master 1601991 07/24: Fix the regex once more and add test, Oleh Krehel, 2015/05/01
- [elpa] master c43e1cf 08/24: Add `lv-delete-window' function, Oleh Krehel, 2015/05/01
- [elpa] master b9d0687 09/24: Update `outline-regexp' and `indent-tabs-mode' file locals, Oleh Krehel, 2015/05/01
- [elpa] master 01248b1 10/24: Use one less ; for local vars, Oleh Krehel, 2015/05/01
- [elpa] master 00d2c0c 11/24: Add lv-force-update,
Oleh Krehel <=
- [elpa] master 824f105 12/24: Optionally separate lv window and echo area using a thin line, Oleh Krehel, 2015/05/01
- [elpa] master dd02b16 13/24: .dir-locals.el: Add, Oleh Krehel, 2015/05/01
- [elpa] master bf48e63 14/24: lv.el (lv-force-update): Be nil by default, Oleh Krehel, 2015/05/01
- [elpa] master 0ae560a 15/24: lv.el (lv-message): Use `lv-use-separator', Oleh Krehel, 2015/05/01
- [elpa] master 270c38b 16/24: Add a work-around for pop-to-buffer / dedicated bug, Oleh Krehel, 2015/05/01
- [elpa] master 8db62bf 17/24: Make *LV* window fixed size, Oleh Krehel, 2015/05/01
- [elpa] master 6524a2c 19/24: hydra.el (hydra-fontify-head-default): Fixup, Oleh Krehel, 2015/05/01
- [elpa] master 319ac87 20/24: hydra.el (hydra-key-format-spec): Declare obsolete, Oleh Krehel, 2015/05/01
- [elpa] master c78367f 21/24: hydra.el (hydra-cell-format): Change to defvar, Oleh Krehel, 2015/05/01
- [elpa] master 2bc9146 22/24: hydra.el: Use add/remove-function. Fix warning., Oleh Krehel, 2015/05/01