zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayne@clari.net>
To: Peter Stephenson <pws@ibmth.df.unipi.it>
Cc: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: history improvements for 3.1.5-pws-17 and 3.0.6-pre-2
Date: Sat, 08 May 1999 16:43:27 -0700	[thread overview]
Message-ID: <199905082343.QAA08737@bebop.clari.net> (raw)
In-Reply-To: pws's message of Sat, 08 May 1999 16:01:21 +0200. <9905081401.AA40488@ibmth.df.unipi.it>

Peter Stephenson writes:
> after I've typed something in one shell, and hit return in another
> shell, I expect to be able just to use up-line-or-history to get to
> what's in the other shell

I'm torn on the issue, because sometimes I want to up-arrow through
the total history, and sometimes I just want to press ^P and run the
last command that I ran in this window, no exceptions.  If you'd
like to change the current behavior for the up/down commands, apply
this patch:

Index: Src/Zle/zle_hist.c
@@ -461,7 +461,7 @@
 int
 zle_goto_hist(int ev, int n)
 {
-    Histent he = movehistent(quietgethist(ev), n, HIST_FOREIGN);
+    Histent he = movehistent(quietgethist(ev), n, 0);
     if (!he)
 	return 0;
     zle_setline(he);

Note that this change doesn't affect ! references, so !! would
still run the last command that was run in the current shell.

I'd be interested in suggestions for how we can let the user choose
between local-history and full-history movement.  Perhaps a toggle
command?  Or a bindable prefix (so I can have ^P ignore shared
history, and Up-Arrow include it)?  I like this idea.

> I'd like to suggest that any zle reference to the history [...]
> causes the newly imported stuff to be visible.

I think that some zle commands, such as accept_and_infer_next_
history, should remain unaffected by foreign commands.

> for some reason due to the internal handling it's not enough to
> make what I just typed in shell 1 appear [...] It only happens
> after I've typed a new command in shell 2, which can't be a
> history command or a blank line

I think you've misinterpreted what's going on.  The current code
waits until the command _finishes_ before adding it to the history
file.  I did this because the extended_history format contains the
finish time of the command.  I also don't like this delay in adding
the command, though, so I think we add the command after it is typed,
and just live with the fact that all the finish times will be the
same as the start times when using incremental_append_history (which
is used by shared_history).

Here's the change to append the history in hend() rather than
hbegin():

Index: Src/hist.c
@@ -671,8 +671,6 @@
     if (hist_ring && !hist_ring->ftim)
 	hist_ring->ftim = time(NULL);
     if (interact && isset(SHINSTDIN) && !strin) {
-	if (isset(SHAREHISTORY) || isset(INCREMENTALAPPENDHISTORY))
-	    savehistfile(NULL, 1, HFILE_USE_OPTIONS | HFILE_FAST);
 	histactive = HA_ACTIVE;
 	attachtty(mypgrp);
 	if (!hist_ring)
@@ -962,6 +960,8 @@
     zfree(chwords, chwordlen*sizeof(short));
     chline = NULL;
     histactive = 0;
+    if (isset(SHAREHISTORY) || isset(INCREMENTALAPPENDHISTORY))
+	savehistfile(NULL, 1, HFILE_USE_OPTIONS | HFILE_FAST);
     return !(flag & HISTFLAG_NOEXEC || errflag);
 }
 
Thanks for the feedback -- I appreciate it!

..wayne..


  reply	other threads:[~1999-05-08 23:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-08  2:50 Wayne Davison
1999-05-08 14:01 ` Peter Stephenson
1999-05-08 23:43   ` Wayne Davison [this message]
1999-05-10  7:53     ` Peter Stephenson
1999-05-11  9:39       ` PATCH: history improvements for 3.1.5-pws-17 Wayne Davison
1999-05-29  7:26         ` Bart Schaefer
1999-05-29  7:08       ` PATCH: history improvements for 3.1.5-pws-17 and 3.0.6-pre-2 Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199905082343.QAA08737@bebop.clari.net \
    --to=wayne@clari.net \
    --cc=pws@ibmth.df.unipi.it \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).