emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/eat de3d7d099f 5/5: New command eat-line-load-input-histor


From: ELPA Syncer
Subject: [nongnu] elpa/eat de3d7d099f 5/5: New command eat-line-load-input-history-from-file
Date: Sat, 23 Sep 2023 13:00:01 -0400 (EDT)

branch: elpa/eat
commit de3d7d099fac304f464a37b0a4943bf309631ba5
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>

    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 56ccf187cd..331ad0b1ba 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]