Skip to content

Commit 4bfb0bc

Browse files
committed
initial.es cleanup
1 parent 72cb42c commit 4bfb0bc

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

initial.es

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,28 @@ fn %pathsearch name { access -n $name -1e -xf $path }
579579

580580
if {~ <=$&primitives execfailure} {fn-%exec-failure = $&execfailure}
581581

582+
# The %write-history hook is used in interactive contexts to write
583+
# command input to the history file (and/or readline's in-memory
584+
# history log). By default, $&writehistory (which is available if
585+
# readline is compiled in) will write to readline's history log if
586+
# $max-history-length allows, and will write to the file designated
587+
# by $history if that variable is set and the file it points to
588+
# exists and is writeable.
589+
590+
if {~ <=$&primitives writehistory} {
591+
fn-%write-history = $&writehistory
592+
} {
593+
fn %write-history input {
594+
if {!~ $history ()} {
595+
if {access -w $history} {
596+
echo $input >> $history
597+
} {
598+
history = ()
599+
}
600+
}
601+
}
602+
}
603+
582604

583605
#
584606
# Read-eval-print loops
@@ -625,24 +647,9 @@ if {~ <=$&primitives execfailure} {fn-%exec-failure = $&execfailure}
625647
# The parsed code is executed only if it is non-empty, because otherwise
626648
# result gets set to zero when it should not be.
627649

628-
fn-%is-interactive = $&isinteractive
629650
fn-%parse = $&parse
630651
fn-%batch-loop = $&batchloop
631-
632-
633-
if {~ <=$&primitives writehistory} {
634-
fn-%write-history = $&writehistory
635-
} {
636-
fn %write-history input {
637-
if {!~ $history ()} {
638-
if {access -w $history} {
639-
echo $input >> $history
640-
} {
641-
history = ()
642-
}
643-
}
644-
}
645-
}
652+
fn-%is-interactive = $&isinteractive
646653

647654
fn %interactive-loop {
648655
let (result = <=true) {

0 commit comments

Comments
 (0)