From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Ye Wenbin" Newsgroups: gmane.emacs.help Subject: how to scroll other buffer to beginning Date: Thu, 13 Jul 2006 13:39:40 +0800 Organization: Personal Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8 Content-Transfer-Encoding: Quoted-Printable X-Trace: sea.gmane.org 1152771831 7839 80.91.229.2 (13 Jul 2006 06:23:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 13 Jul 2006 06:23:51 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 13 08:23:48 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G0ubz-0006Cz-BN for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Jul 2006 08:23:47 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G0uby-0006kc-PE for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Jul 2006 02:23:46 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G0twG-0002Gm-M4 for help-gnu-emacs@gnu.org; Thu, 13 Jul 2006 01:40:40 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G0twD-0002Ga-Lr for help-gnu-emacs@gnu.org; Thu, 13 Jul 2006 01:40:40 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G0twD-0002GX-JZ for help-gnu-emacs@gnu.org; Thu, 13 Jul 2006 01:40:37 -0400 Original-Received: from [64.233.162.198] (helo=nz-out-0102.google.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1G0txu-0001rR-Ld for help-gnu-emacs@gnu.org; Thu, 13 Jul 2006 01:42:22 -0400 Original-Received: by nz-out-0102.google.com with SMTP id 13so50673nzp for ; Wed, 12 Jul 2006 22:40:36 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:date:to:subject:from:organization:content-type:mime-version:content-transfer-encoding:message-id:user-agent; b=SMRh440eiLx64AXdIvk/4qzti5MI7XCiI4pzJ287RHHLsqImC/x/WpYeldc2nAC2q1nb0zkdKW/Rh4ZjIKSmU0mQImmTPV1y2CtlHPMj6FLzil/KeeXfjTUONsD693XO6XjhIHQ4fAt3j8k35rA64santPFMLH7dcU4qEQ04owg= Original-Received: by 10.36.18.3 with SMTP id 3mr633965nzr; Wed, 12 Jul 2006 22:40:36 -0700 (PDT) Original-Received: from localhost.localdomain ( [218.17.227.208]) by mx.gmail.com with ESMTP id 23sm852036nzn.2006.07.12.22.40.34; Wed, 12 Jul 2006 22:40:36 -0700 (PDT) Original-To: help-gnu-emacs@gnu.org User-Agent: Opera Mail/9.00 (Linux) X-Mailman-Approved-At: Thu, 13 Jul 2006 02:23:30 -0400 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:35935 Archived-At: I wrote a perl script to count directory size, when I write this functio= n, I found that when the "*Shell Command Output*" buffer is displayed, the = = buffer can't scroll to beginning. How to avoid it? (defun ywb-dired-count-dir-size () (interactive) (let ((dir (dired-get-filename nil t)) proc) (when (file-directory-p dir) (with-current-buffer (get-buffer-create "*Shell Command Output*")= (erase-buffer) (setq proc (start-process-shell-command "dirsize" (current-buffer) "/home/ywb/bin/dirsize " dir= )) (while (eq (process-status proc) 'run) (sleep-for 0 100) (message "%s" (process-status proc))) (display-buffer (current-buffer) t) (beginning-of-buffer))))) (define-key dired-mode-map " " 'ywb-dired-count-dir-size) this is my perl script for test: #!/usr/bin/perl -w # dirsize --- Caculate directory size # Last modify Time-stamp: # Version: v 0.0 2006/07/06 06:03:53 # Author: Ye Wenbin use strict; use warnings; use File::Find; my $dir =3D shift; exit unless -d $dir; printf "$dir size: %s\n", dirsize($dir); sub dirsize { my $dir =3D shift; my $kb =3D 1024; my $mb =3D 1024*1024; my $total =3D 0; my $count =3D sub { if (-f $_) { $total +=3D -s $_; } }; find($count, $dir); if ($total > $mb) { return sprintf("%.2f", $total/$mb)." M"; } else { return sprintf("%.2f", $total/$kb)." K"; } } -- = Using Opera's revolutionary e-mail client: http://www.opera.com/mail/