From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8002 invoked from network); 28 Apr 2005 06:55:50 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 Apr 2005 06:55:50 -0000 Received: (qmail 86564 invoked from network); 28 Apr 2005 06:55:44 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 Apr 2005 06:55:44 -0000 Received: (qmail 26122 invoked by alias); 28 Apr 2005 06:55:42 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21201 Received: (qmail 26109 invoked from network); 28 Apr 2005 06:55:41 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 28 Apr 2005 06:55:41 -0000 Received: (qmail 86288 invoked from network); 28 Apr 2005 06:55:41 -0000 Received: from h34-aclarke.sv.meer.net (HELO ofb3.ofb.net) (205.217.153.34) by a.mx.sunsite.dk with SMTP; 28 Apr 2005 06:55:34 -0000 Received: from a5 (unknown [66.81.100.52]) by ofb3.ofb.net (Postfix) with ESMTP id 8947120702F6; Wed, 27 Apr 2005 23:53:06 -0700 (PDT) Received: from frederik by a5 with local (Exim 4.44) id 1DR2sX-0002Er-UW; Wed, 27 Apr 2005 23:52:05 -0700 Date: Wed, 27 Apr 2005 23:52:05 -0700 From: Frederik Eaton To: zsh-workers@sunsite.dk Cc: john@foo.net Subject: history idea Message-ID: <20050428065205.GC6338@a5.repetae.net> Reply-To: frederik@ofb.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.8i X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 Hi, I have an idea for extending the usual shell history semantics. It is to add a mechanism to zsh so that when the shell executes a command, the command can communicate back to shell some lines which should be added to the end of the history. This would be useful in a number of ways. When working on the command line we often enter and exit programs which provide new command-entry "modes", from which a certain class of tasks can be accomplished conveniently. This describes almost every interactive application: web browsers, editors, mail readers, etc. But it would be nice to have a record of the things that are done in these sub-modes, which is easily available to the shell. For instance if I open a web browser with "w3m http://some_url" and then while inside the browser I visit "http://another_url", it would be nice to see "w3m http://another_url" in my command history after the original "w3m http://some_url". Same with files opened in an editor. It might not be so desirable for mail readers, I don't know. Of course, if you used such a feature, your history would become full of crap that you'd never care about. Navigating it with "{down,up}-line-or-history" after a long browser session would be impractical. You'd have to switch to using the history search commands. The advantage is that you'd have a complete searchable record of everything you do. I don't know what it's called, but I think microsoft may have been working on something like this. I don't know about the functionality of "google desktop" but some might be included. Now, being able to search *inside* the web pages or files you recently viewed is another matter, but implementing that would be a lot easier if they were often listed in the shell history as I'm proposing. This would subsume web browser history, and a lot of other things. To implement this, the shell could have an environment variable pointing to a unix domain socket to which new history lines can be sent. (A point of detail. If a command wants to add to the shell history, but it has been run by an intermediate command, then any extra history lines it wants to add would be sent to the first shell above it in the process tree... but something in-between should be able to intercept and transform them. So for instance if you have a script which opens a web browser (probably text-based) to do a google search for a given term, and while you're in the browser you do several more searches, then the browser process could communicate the browser command lines corresponding to these searches to the script, which would rewrite those URLs which corresponded to google searches into equivalent invocations of itself, and pass them on to the shell... (i.e. changing "w3m 'http://www.google.com/search?btnG=1&q=foo&hl=en&lr='" to "google foo" if the script is named "google").) Anyway, I hope this conveys the concept. Maybe it will never end up in zsh but in any case I'd be interested to hear what people think. Frederik -- http://ofb.net/~frederik/