From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Mauger Newsgroups: gmane.emacs.devel Subject: Re: Deffering redisplay in COMINT Date: Sun, 6 Jan 2013 00:09:52 -0800 (PST) Message-ID: <1357459792.82082.YahooMailNeo@web160901.mail.bf1.yahoo.com> References: <1354842513.76326.YahooMailNeo@web160901.mail.bf1.yahoo.com> <87obhi1j85.fsf@gmail.com> Reply-To: Michael Mauger NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1357459799 5626 80.91.229.3 (6 Jan 2013 08:09:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 6 Jan 2013 08:09:59 +0000 (UTC) Cc: Emacs Devel To: Vitalie Spinu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 06 09:10:16 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TrlJ8-00077s-K0 for ged-emacs-devel@m.gmane.org; Sun, 06 Jan 2013 09:10:14 +0100 Original-Received: from localhost ([::1]:32854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrlIt-0002JL-3Y for ged-emacs-devel@m.gmane.org; Sun, 06 Jan 2013 03:09:59 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:57493) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TrlIp-0002IP-FT for emacs-devel@gnu.org; Sun, 06 Jan 2013 03:09:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TrlIo-0005nK-Ag for emacs-devel@gnu.org; Sun, 06 Jan 2013 03:09:55 -0500 Original-Received: from nm16-vm0.bullet.mail.bf1.yahoo.com ([98.139.212.253]:26813) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1TrlIo-0005nD-61 for emacs-devel@gnu.org; Sun, 06 Jan 2013 03:09:54 -0500 Original-Received: from [98.139.212.147] by nm16.bullet.mail.bf1.yahoo.com with NNFMP; 06 Jan 2013 08:09:53 -0000 Original-Received: from [98.139.212.193] by tm4.bullet.mail.bf1.yahoo.com with NNFMP; 06 Jan 2013 08:09:53 -0000 Original-Received: from [127.0.0.1] by omp1002.mail.bf1.yahoo.com with NNFMP; 06 Jan 2013 08:09:53 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 160313.90367.bm@omp1002.mail.bf1.yahoo.com Original-Received: (qmail 3163 invoked by uid 60001); 6 Jan 2013 08:09:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1357459792; bh=aBisVDLO2MZSuuXQHpdSCtF1tx0BjUDl2s2heKw59U0=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=qmubFy51BhmnNekXD7Kjug4KpDQhtRvtzGTBHjJm8DOVh82lgHgdkOamL8gEbMNfj0h6Bm3Huy9wj8C+a4H++9KXA94zQZ64277Pwu515ekt53UvBCR6+9CozPaokL6Lwi9mjdiz5V2MYbtyU9onFW0Gu0Vi2lmZjF6zzqn4Kzo= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=X260jXpau97cUrgKPC39kwzOBGj/eCYaUDHQlJb7atsCfYzu/dH8p0iwA70C8MoYGG+7yKbuU7mPMIMdCX9RxMX12pVvPPwI0HfoD6CjvJSBDxnih38sWNRy5CvBWo5BaKHUq6e/BRmip7KLBaLjLRMepYrCpB8XecIHUGkGICY=; X-YMail-OSG: 9PLN_s0VM1mtiflVwnDyRk2Cqy.xfiTmJBM0Kd3zvsQhEYM JS9jGk6BYy0DMjthXe7A40icxKmMjoAF_KJZx1Ahr9XW1Tc2AHN3tZAVUSSl KFGcy6Ipzi6eVjCbTEStBpSRaShYHKVqZnbx1YjBFvlKgp0X8nLuSAclIRwG 7nStR3aJlytkWdSIIr9PSD7_t_b1yR97NPYf37o1siAnDA4eIxIVIB15fUPY 8pKNOLnL3_N8PUZAuflfWAeNtY6zq5iUKAAOveoNn6dWsdOL2Apz.JkgzrVa SvXMdeBb7VLIt4OWC_Tb2GraPNfPEz0CR6L4T6xzFX4o0p4TGT1rvo_KHAnO zIRTzCiOOlDGN3VLmmgAJMtPzRUKzyY1SCcfrfrn3UCyC_8iKY_1PDckNviN sbWaUYYDJAwn0TBqmMTHm7_fDTGyd4BeY2GFh5VcaBqo0jWnh0lkrFetfVJw eGkiKgLI5nJwtdfrgkOvNl3LzAXd.x5asd_Qv8x66bkUdfVLYO7Ly50X7IF_ 7JUqFMPvBSg-- Original-Received: from [98.216.52.54] by web160901.mail.bf1.yahoo.com via HTTP; Sun, 06 Jan 2013 00:09:52 PST X-Rocket-MIMEInfo: 001.001, Pl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCj4gVml0YWxpZSBTcGludSA8c3BpbnV2aXRAZ21haWwuY29tPgo.IG9uwqBUdWVzZGF5LCBEZWNlbWJlciAyNSwgMjAxMiA2OjA5IEFNIHdyb3RlOgo.IAo.wqAgPj4gTWljaGFlbCBNYXVnZXIgPG1tYXVnQHlhaG9vLmNvbT4KPsKgID4.IG9uIFRodSwgNiBEZWMgMjAxMiAxNzowODozMyAtMDgwMCAoUFNUKSB3cm90ZToKPgo.wqAgPiBJbiBzcWwtaW50ZXJhY3RpdmUtbW9kZSwgYcKgZGVyaXZhdGl2ZcKgb2YgY29taW50LCBJIHdpbGwgc3VibWl0IGEBMAEBAQE- X-Mailer: YahooMailWebService/0.8.129.483 In-Reply-To: <87obhi1j85.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 98.139.212.253 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:156094 Archived-At: >________________________________=0A> Vitalie Spinu =0A= > on=A0Tuesday, December 25, 2012 6:09 AM wrote:=0A> =0A>=A0 >> Michael Mau= ger =0A>=A0 >> on Thu, 6 Dec 2012 17:08:33 -0800 (PST) wro= te:=0A>=0A>=A0 > In sql-interactive-mode, a=A0derivative=A0of comint, I wil= l submit a SELECT=0A>=A0 > statement that returns many very long rows (2000= + characters per line). =A0The=0A>=A0 > redisplay fireworks that follow are= impressive but slow. =A0 As text streams to=0A>=A0 > the buffer with `auto= -hscroll-mode' enabled the screen flashes as it redraws the=0A>=A0 > buffer= with more lines of data and scrolled horizontally in different places=0A>= =A0 > until all the data stream is complete. =A0=0A>=0A....=0A>=0A>=A0 > My= only thought is that I could route the output to a temp buffer until I see= =0A>=A0 > the prompt at the end of a chunk=0A>=0A>To the best of my knowled= ge this is the only way out. But it is not bad=0A>at all. You have to repla= ce comint-output-filter with your own filter=0A>that does that. The filter = is triggered each time emacs receives output=0A>from the sub-process (rough= ly 500 chars last time I counted).=A0 It's=0A>pretty trivial to wait for a = prompt at the end of output chunk, and you=0A>will be surprised how reliabl= e this procedure actually is. =0A>=0A>This is how we do it in ESS:=0A>=0A>= =A0=A0=A0(defun ess-wait-for-process (proc &optional sec-prompt wait force-= redisplay)=0A....=0A>=0A>=0A=0AThanks for your input. =A0I took a look, but= that approach makes emacs=A0=0Amodal, in that it locks up until the output= is complete. =A0I want to still=0Ahave a responsive editor since it make t= ake a while before results start=0Ato appear. =A0But I've come up with a so= lution that gets reasonable=A0=0Aperformance and only has a minor functiona= l impact.=0A=0AI'll give a brief description here, and I'll release this as= a SQL-related=A0=0Aadd-in in the ELPA shortly.=0A=0AIt's set up as a minor= mode so it can be disabled in case it causes=A0=0Aproblems. =A0When it's e= nabled, it activates a pre and post output hooks.=0AThe pre hook only activ= ates if the mode is enabled and truncate-lines=0Ais set. =A0When active, it= disables auto-hscroll-mode. =A0It then appends=A0=0Athe output text to a t= emporary buffer=A0and then returns=A0a=A0window's=0Awidth worth of characte= rs of each line in the temp buffer to=A0=0Abe written to the=A0output buffe= r. =A0The output appears to fill each=A0=0Aline without the display slowdow= n due to long displayed lines.=0AAnd because hscroll is turned off, the tex= t merely flows up the=0Ascreen quickly.=0A=0AWhen the post=A0output hook is= called and it detects=A0when the last=0Aoutput text matches the=A0prompt r= egexp, then it iterates thru=A0=0Athe temporary buffer and the=A0output buf= fer starting at=A0=0Acomint-last-input-end. =A0It takes each line=A0after t= he window-=0Awidth worth of characters from the temp buffer and inserts the= m=0Aat the end of each=A0line=A0in the output buffer. =A0Once the output=A0= =0Abuffer has been filled in with all the off-window text it re-enables=0At= he horizontal scrolling.=0A=0AThe result is fast smooth scrolling and an of= ten=A0unnoticeable=A0=0Ahesitation when it is complete. =A0It's not vital t= o have this to=A0=0Ause=A0sql-mode, but having it as an add-on minor mode e= liminates=A0=0Aa significant distraction when doing query development in Em= acs.