From de3d7d099fac304f464a37b0a4943bf309631ba5 Mon Sep 17 00:00:00 2001 From: Akib Azmain Turja Date: Sat, 23 Sep 2023 21:57:21 +0600 Subject: [PATCH] New command eat-line-load-input-history-from-file * eat.el (eat-line-load-input-history-from-file): New command. --- eat.el | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/eat.el b/eat.el index 56ccf18..331ad0b 100644 --- a/eat.el +++ b/eat.el @@ -6001,6 +6001,23 @@ character." ?: (zero-or-more digit) ?\;))))))) +(defun eat-line-load-input-history-from-file (file format) + "Load input history from FILE. + +FORMAT is the format of FILE." + (interactive + (let ((file (read-file-name "History file: "))) + (list file (completing-read + "History file format: " '("bash" "zsh") + nil t (pcase (file-name-nondirectory file) + (".bash_history" "bash") + (".zsh_history" "zsh")))))) + (let ((str nil)) + (with-temp-buffer + (insert-file-contents file) + (setq str (buffer-string))) + (eat--line-populate-input-ring str format))) + (defun eat--line-ask-for-regexp-arg (prompt) "Return list of regexp and prefix arg using PROMPT." (let* (;; Don't clobber this.