From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: pjb@informatimago.com (Pascal J. Bourguignon) Newsgroups: gmane.emacs.help Subject: Re: page-at-a-time output for M-x shell Date: Mon, 13 Jul 2009 23:43:21 +0200 Organization: Informatimago Message-ID: <87fxd0gsxy.fsf@galatea.local> References: <30a09a22-cd05-44b6-9b82-8a7e6c1796d5@x3g2000yqa.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1247524856 12729 80.91.229.12 (13 Jul 2009 22:40:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 13 Jul 2009 22:40:56 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 14 00:40:49 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MQUCW-0000qX-Io for geh-help-gnu-emacs@m.gmane.org; Tue, 14 Jul 2009 00:40:48 +0200 Original-Received: from localhost ([127.0.0.1]:59891 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MQUCV-0000Ht-SS for geh-help-gnu-emacs@m.gmane.org; Mon, 13 Jul 2009 18:40:47 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!newsserver.news.garr.it!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 95 Original-X-Trace: individual.net 7oYRrgodbD1sGt/V7VtfMQixXiY+1XK7LjYAFN/xYMWHlmVHW1 Cancel-Lock: sha1:OTM3MTgyOWVjOTBhNzMxMTUxOTVhOTcwNDRiNTkyZDYyMjA0NjhlZA== sha1:nGB8xrYQUOIVHhd+GqYVR4mIMX8= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.3 (darwin) Original-Xref: news.stanford.edu gnu.emacs.help:170849 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:66046 Archived-At: Francis Moreau writes: > Hello, > > M-x term has a nice feature 'page-at-a-time' which I'd like to have in > M-x shell specially because commands like > > $ cmd-with-a-lof-of-output | less > WARNING: terminal is not fully functional > - (press RETURN) > > doesn't work properly. > > Does anybody know some trick here ? So, it seems that you don't like PgUp and PgDn, and you don't like M-x term RET. Then if you insist om M-x shell, you will have to write your own pager that doesn't require a smart terminal (which shell is not): [pjb@galatea :0.0 ~]$ cat ~/bin/epager #!/bin/bash HEIGHT=${HEIGHT:=25} eof=0 while [ $eof -eq 0 ] ; do i=0 while [ $i -lt $HEIGHT -a $eof -eq 0 ] ; do line='' read line if [ $? -eq 0 ] ; then printf "%s\n" "$line" else eof=1 fi i=$(( $i + 1 )) done read -p 'Press RET to continue, q RET to abort:' rep < /dev/tty if [ "$rep" = 'q' ] ; then eof=1 fi done [pjb@galatea :0.0 ~]$ cat /home/pjb/tmp/misc/wang | HEIGHT=10 epager Hao Wang, logicien americain. L'algorithme en question a ete publie en 1960 dans l'IBM Journal, article intitule "Toward Mechanical Mathematics", avec des variantes et une extension au calcul des predicats. Il s'agit ici du "premier programme" de Wang, systeme "P". L'article a ete ecrit en 1958, et les experiences effectuees sur IBM 704 - machine a lampes, 32 k mots de 36 bits, celle-la meme qui vit naitre LISP a la meme epoque. Le programme a ete ecrit en assembleur (Fortran Press RET to continue, q RET to abort: existait, mais il ne s'etait pas encore impose) et l'auteur estime que "there is very little in the program that is not straightforward". Il observe que les preuves engendrees sont "essentiellement des arbres", et annonce que la machine a demontre 220 theoremes du calcul des propositions (tautologies) en 3 minutes. Il en tire argument pour la superiorite d'une approche algorithmique par rapport a une approche heuristique comme celle du "Logic Theorist" de Newell, Shaw et Simon (a partir de 1956 sur la machine JOHNNIAC de la Rand Corporation): un debat qui dure encore... Press RET to continue, q RET to abort: Cet algorithme a ete popularise par J. McCarthy, comme exemple-fanion d'application de LISP. Il figure dans le manuel de la premiere version de LISP (LISP 1, sur IBM 704 justement, le manuel est date de Mars 1960), et il a ete repris dans le celebre "LISP 1.5 Programmer's Manual" publie en 1962 par MIT Press, un des maitres-livres de l'Informatique. Press RET to continue, q RET to abort: [pjb@galatea :0.0 ~]$ cat /home/pjb/tmp/misc/wang | HEIGHT=10 epager Hao Wang, logicien americain. L'algorithme en question a ete publie en 1960 dans l'IBM Journal, article intitule "Toward Mechanical Mathematics", avec des variantes et une extension au calcul des predicats. Il s'agit ici du "premier programme" de Wang, systeme "P". L'article a ete ecrit en 1958, et les experiences effectuees sur IBM 704 - machine a lampes, 32 k mots de 36 bits, celle-la meme qui vit naitre LISP a la meme epoque. Le programme a ete ecrit en assembleur (Fortran Press RET to continue, q RET to abort:q [pjb@galatea :0.0 ~]$ -- __Pascal Bourguignon__