@@ -219,7 +219,7 @@ Invokes `idris-repl-mode-hook'."
219
219
(set (make-local-variable 'indent-tabs-mode ) nil )
220
220
(add-hook 'idris-event-hooks 'idris-repl-event-hook-function )
221
221
(add-hook 'kill-buffer-hook 'idris-repl-remove-event-hook-function nil t )
222
- (when idris-repl-history-file
222
+ (when ( idris-repl-history-file-f)
223
223
(idris-repl-safe-load-history)
224
224
(add-hook 'kill-buffer-hook
225
225
'idris-repl-safe-save-history nil t ))
@@ -537,22 +537,31 @@ The handler will use qeuery to ask the use if the error should be ingored."
537
537
nil
538
538
(signal (car err) (cdr err))))))
539
539
540
+ (defun idris-repl-history-file-f ()
541
+ " Return repl history file.
542
+
543
+ Use `idris-repl-history-file' if set or fallback
544
+ to filepath computed from the `idris-interpreter-path' ."
545
+ (or idris-repl-history-file
546
+ ; ; We should use `file-name-concat' but it is only in Emacs version 28+
547
+ (concat " ~/." (file-name-nondirectory idris-interpreter-path) " /idris-history.eld" )))
548
+
540
549
(defun idris-repl-read-history-filename ()
541
550
(read-file-name " Use Idris REPL history from file: "
542
- idris-repl-history-file))
551
+ ( idris-repl-history-file-f) ))
543
552
544
553
(defun idris-repl-load-history (&optional filename )
545
554
" Set the current Idris REPL history.
546
555
It can be read either from FILENAME or `idris-repl-history-file' or
547
556
from a user defined filename."
548
557
(interactive (list (idris-repl-read-history-filename)))
549
- (let ((file (or filename idris-repl-history-file)))
558
+ (let ((file (or filename ( idris-repl-history-file-f) )))
550
559
(setq idris-repl-input-history (idris-repl-read-history file))))
551
560
552
561
(defun idris-repl-read-history (&optional filename )
553
562
" Read and return the history from FILENAME.
554
563
The default value for FILENAME is `idris-repl-history-file' ."
555
- (let ((file (or filename idris-repl-history-file)))
564
+ (let ((file (or filename ( idris-repl-history-file-f) )))
556
565
(cond ((not (file-readable-p file)) '())
557
566
(t (with-temp-buffer
558
567
(insert-file-contents file)
@@ -564,7 +573,7 @@ When Idris is setup to always load the old history and one uses only
564
573
one instance of idris all the time, there is no need to merge the
565
574
files and this function is sufficient."
566
575
(interactive (list (idris-repl-read-history-filename)))
567
- (let ((file (or filename idris-repl-history-file))
576
+ (let ((file (or filename ( idris-repl-history-file-f) ))
568
577
(hist (or history idris-repl-input-history)))
569
578
(unless (file-writable-p file)
570
579
(error (format " History file not writable: %s " file)))
0 commit comments