From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: automatic dired update Date: Sun, 4 Jan 2009 17:56:33 -0800 Message-ID: <001c01c96ed8$d69107b0$0200a8c0@us.oracle.com> References: <91299a37-5cd2-4b3e-a7c3-381bdf7f69a5@q30g2000prq.googlegroups.com><90548140-00a8-44f8-b8f0-6b4530f49933@v39g2000pro.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1231120740 32325 80.91.229.12 (5 Jan 2009 01:59:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 5 Jan 2009 01:59:00 +0000 (UTC) To: "'Xah Lee'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 05 03:00:11 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 1LJelF-0003Uo-Ei for geh-help-gnu-emacs@m.gmane.org; Mon, 05 Jan 2009 03:00:09 +0100 Original-Received: from localhost ([127.0.0.1]:38503 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LJek0-0007hg-14 for geh-help-gnu-emacs@m.gmane.org; Sun, 04 Jan 2009 20:58:52 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LJejB-00078f-Hq for help-gnu-emacs@gnu.org; Sun, 04 Jan 2009 20:58:01 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LJejA-00077c-K7 for help-gnu-emacs@gnu.org; Sun, 04 Jan 2009 20:58:01 -0500 Original-Received: from [199.232.76.173] (port=41424 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LJejA-00077K-4s for help-gnu-emacs@gnu.org; Sun, 04 Jan 2009 20:58:00 -0500 Original-Received: from acsinet11.oracle.com ([141.146.126.233]:25460) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LJej9-00083a-J6 for help-gnu-emacs@gnu.org; Sun, 04 Jan 2009 20:57:59 -0500 Original-Received: from acsinet13.oracle.com (acsinet13.oracle.com [141.146.126.235]) by acsinet11.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n051vpbd021804 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 5 Jan 2009 01:57:53 GMT Original-Received: from acsmt701.oracle.com (acsmt701.oracle.com [141.146.40.71]) by acsinet13.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n051uuKn005122; Mon, 5 Jan 2009 01:56:58 GMT Original-Received: from dradamslap1 (/141.144.80.6) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 05 Jan 2009 01:56:20 +0000 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 Thread-Index: Acluxuh/ge0uoBk2QbCp2SabbglpKQADpaEw X-Source-IP: acsmt701.oracle.com [141.146.40.71] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090204.496168C5.0214:SCFSTAT928724,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) 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:61065 Archived-At: > Does anyone know how to make dired auto-refresh? > For example, i have a dired buffer of dir xyz buried somewhere. > Then, i renamed some files in OS's Desktop. > Then, when i switch to dir xyz in emacs, i wish to see the updated > list without me having to type g to refresh. > originally i thought just some hook... something like > (add-hook 'dired-load-hook 'revert-buffer) > > but when actually trying to do it, apparently not that simple. > I thought it must be some function or variable that tells me when > buffer display is switched or updated... can't locate it. Good question. To use a hook to call `dired-revert', you need to find a hook that represents the "change" in interaction state that you make when you "switch" to the dired buffer. I'm not sure what hook that might be. Seems like you want something that kicks in whenever a particular window gets the focus, but I don't know of such a hook. `window-configuratino-change-hook' is probably not what you want, but maybe take a look. I think `change-major-mode-hook' won't do it, because that's only when the current buffer's mode changes. You could use a timer or, say, `display-time-hook' to do it periodically, but that's a sledge hammer. `first-change-hook' would presumably kick in for any change you made in Dired - you might look at that. `menu-bar-update-hook' kicks in whenever the menu-bar is updated - which is quite often - another sledge hammer. If you always switch buffers/windows with the mouse, maybe `mouse-leave-buffer-hook' would help. You could perhaps advise the commands you typically use to switch to the Dired buffer/window (`switch-to-buffer' or whatever), so they check for `dired-mode' and DTRT, but again, that's a bit of a sledge hammer. I'm probably not thinking clearly right now, but I don't see anything obvious as an elegant solution; sorry. But it's a good question. Maybe someone else has a good answer.