branch: master
commit a57ac0c8ff7a12d880e772e932ff3d7be1d3dca7
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
counsel.el (counsel-unicode-char): Add own history
Also make "C-M-n", "C-M-p", and `ivy-resume' work properly.
---
counsel.el | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/counsel.el b/counsel.el
index a4b47d9..7d2745a 100644
--- a/counsel.el
+++ b/counsel.el
@@ -285,11 +285,16 @@
(require 'info-look)
(info-lookup 'symbol symbol mode))
+(defvar counsel-unicode-char-history nil
+ "History for `counsel-unicode-char'.")
+
;;;###autoload
(defun counsel-unicode-char ()
"Insert a Unicode character at point."
(interactive)
(let ((minibuffer-allow-text-properties t))
+ (setq counsel-completion-beg (point))
+ (setq counsel-completion-end (point))
(ivy-read "Unicode name: "
(mapcar (lambda (x)
(propertize
@@ -297,7 +302,12 @@
'result (cdr x)))
(ucs-names))
:action (lambda (char)
- (insert-char (get-text-property 0 'result char))))))
+ (with-ivy-window
+ (delete-region counsel-completion-beg
counsel-completion-end)
+ (setq counsel-completion-beg (point))
+ (insert-char (get-text-property 0 'result char))
+ (setq counsel-completion-end (point))))
+ :history 'counsel-unicode-char-history)))
(declare-function cider-sync-request:complete "ext:cider-client")
;;;###autoload