[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/nix-mode c81c03b35e 403/500: nix-repl: use history file
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/nix-mode c81c03b35e 403/500: nix-repl: use history file |
Date: |
Sat, 29 Jan 2022 08:27:49 -0500 (EST) |
branch: elpa/nix-mode
commit c81c03b35e10b79add7f18c7867ef76f120ab7ba
Author: Brian Leung <leungbk@mailfence.com>
Commit: Brian Leung <leungbk@mailfence.com>
nix-repl: use history file
---
nix-repl.el | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/nix-repl.el b/nix-repl.el
index 440b4a5962..d1fb5026d0 100644
--- a/nix-repl.el
+++ b/nix-repl.el
@@ -34,10 +34,33 @@
(define-key map "\t" 'completion-at-point)
map))
+(defun nix-repl-save-all-histories ()
+ "Call `comint-write-input-ring' for all `nix-repl-mode' buffers."
+ (dolist (buf (buffer-list))
+ (with-current-buffer buf
+ (when (eq major-mode 'nix-repl-mode)
+ (comint-write-input-ring)))))
+
(define-derived-mode nix-repl-mode comint-mode "Nix-REPL"
"Interactive prompt for Nix."
(setq-local comint-prompt-regexp nix-prompt-regexp)
(setq-local comint-prompt-read-only t)
+ (let* ((is-remote (file-remote-p default-directory))
+ (maybe-xdg-data-home (if is-remote
+ (shell-command-to-string "echo -n
$XDG_DATA_HOME")
+ (or (getenv "XDG_DATA_HOME")
+ "")))
+ (path-prefix (if (string-empty-p maybe-xdg-data-home)
+ "~/.local/share"
+ maybe-xdg-data-home))
+ (history-path (concat
+ is-remote
+ path-prefix
+ "/nix/repl-history")))
+ (setq-local comint-input-ring-file-name history-path))
+ (comint-read-input-ring t)
+ (add-hook 'kill-buffer-hook #'comint-write-input-ring nil 'local)
+ (add-hook 'kill-emacs-hook #'nix-repl-save-all-histories nil 'local)
(add-hook 'completion-at-point-functions
#'nix-repl-completion-at-point nil 'local))
- [nongnu] elpa/nix-mode 1090226479 224/500: nix-repl-show -> nix-repl, (continued)
- [nongnu] elpa/nix-mode 1090226479 224/500: nix-repl-show -> nix-repl, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 588246b499 229/500: Fix escaping of characters, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode a5bf79a563 425/500: Merge pull request #120 from znewman01/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 7593b023a7 405/500: Merge pull request #110 from leungbk/repl-history, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 1fdf8e654a 444/500: Merge pull request #132 from league/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 8e20de5ba7 462/500: Merge pull request #134 from nagy/store-path, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 01e37b6761 464/500: Merge pull request #139 from akirak/fix/nix-24-for-25, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 8a05b88eb3 448/500: Fix a typo, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 207e5c0a92 455/500: nix-format.el: Add nix-format-before-save, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 86b7195b3e 010/500: Use warning font lock for upper case vars, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode c81c03b35e 403/500: nix-repl: use history file,
ELPA Syncer <=
- [nongnu] elpa/nix-mode c19e103eee 430/500: Add support nix 2.4 flakes in search, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 5fa017c6ad 393/500: Merge pull request #105 from rossabaker/completions, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 0380e03203 406/500: Merge pull request #109 from yilinwei/master, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode aef98227cc 419/500: Merge branch 'master' into derived-nix-drv-mode, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode ffcab906b8 407/500: Makefile: add nix-mode project directory to 'load-path' in 'run' target, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode da7e638f2f 451/500: Spell out command argument, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode c4abb64a64 494/500: nix-flake: Add a comment, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 21ed086cca 008/500: Fix flycheck complaints., ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 4fe6058fb4 142/500: allow escape sequences inside sh-mode block, ELPA Syncer, 2022/01/29
- [nongnu] elpa/nix-mode 1268096ba7 136/500: Merge pull request #27 from ljli/close-open-fix, ELPA Syncer, 2022/01/29