branch: elpa/helm
commit ab8ad31f24e97174fcebaba60506232da86f631b
Author: Thierry Volpiatto <[email protected]>
Commit: Thierry Volpiatto <[email protected]>

    Fix eshell history error
    
    Declare fns and vars and ensure em-hist is loaded.
---
 helm-eshell.el | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/helm-eshell.el b/helm-eshell.el
index 08c9f3ac13..781c60f54f 100644
--- a/helm-eshell.el
+++ b/helm-eshell.el
@@ -40,8 +40,12 @@
 (declare-function eshell-backward-argument "esh-mode" (&optional arg))
 (declare-function helm-quote-whitespace "helm-lib")
 (declare-function eshell-skip-prompt "em-prompt")
-(defvar eshell-special-chars-outside-quoting)
+(declare-function eshell-read-history "em-hist")
+(declare-function eshell-get-history "em-hist")
 
+(defvar eshell-special-chars-outside-quoting)
+(defvar eshell-history-ring)
+(defvar eshell-hist-ignoredups)
 
 (defgroup helm-eshell nil
   "Helm completion and history for Eshell."
@@ -196,21 +200,23 @@ at point."
 ;;; Eshell history.
 ;;
 ;;
+(defun helm-eshell-history-candidates ()
+  (require 'em-hist)
+  (eshell-read-history)
+  (with-helm-current-buffer
+    (cl-loop for c from 0 to (ring-length eshell-history-ring)
+             for elm = (eshell-get-history c)
+             unless (and (member elm lst)
+                         eshell-hist-ignoredups)
+             collect elm into lst
+             finally return lst)))
+
 (defclass helm-eshell-history-source (helm-source-sync)
   ((init :initform
          (lambda ()
            ;; Same comment as in `helm-source-esh'.
            (remove-hook 'minibuffer-setup-hook 'eshell-mode)))
-   (candidates
-    :initform
-    (lambda ()
-      (with-helm-current-buffer
-        (cl-loop for c from 0 to (ring-length eshell-history-ring)
-                 for elm = (eshell-get-history c)
-                 unless (and (member elm lst)
-                             eshell-hist-ignoredups)
-                 collect elm into lst
-                 finally return lst))))
+   (candidates :initform #'helm-eshell-history-candidates)
    (nomark :initform t)
    (multiline :initform t)
    (keymap :initform 'helm-eshell-history-map)

Reply via email to