From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.help Subject: Re: Comparing last modification time without dired? Date: Fri, 07 Nov 2014 10:05:44 +0100 Message-ID: <87ioiridnb.fsf@gmx.de> References: <87wq7779kx.fsf@hornfels.zedat.fu-berlin.de> <87ioir76zj.fsf@hornfels.zedat.fu-berlin.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1415351177 16144 80.91.229.3 (7 Nov 2014 09:06:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Nov 2014 09:06:17 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Loris Bennett" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 07 10:06:08 2014 Return-path: Envelope-to: geh-help-gnu-emacs@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 1XmfUe-0003km-0o for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Nov 2014 10:06:08 +0100 Original-Received: from localhost ([::1]:59035 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmfUd-000337-GE for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Nov 2014 04:06:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35303) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmfUO-00032p-JK for help-gnu-emacs@gnu.org; Fri, 07 Nov 2014 04:05:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmfUI-0003Ok-Sf for help-gnu-emacs@gnu.org; Fri, 07 Nov 2014 04:05:52 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:55545) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmfUI-0003Oe-Ie for help-gnu-emacs@gnu.org; Fri, 07 Nov 2014 04:05:46 -0500 Original-Received: from detlef.gmx.de ([87.146.56.248]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0M7Xi3-1XzXg61lPL-00xITg; Fri, 07 Nov 2014 10:05:45 +0100 In-Reply-To: <87ioir76zj.fsf@hornfels.zedat.fu-berlin.de> (Loris Bennett's message of "Fri, 07 Nov 2014 09:25:04 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-Provags-ID: V03:K0:emidiJMCUhttGWHkdMgtyxmg78+ya3EoW1JWrcqkAPbA1S/hrMI 8LvBOBMiOAjnBRmUC8AMWgpvSkG6kWi/eilYT13ZBXt6fdHkiLfh27yKchOgKkaVqkB06ev z/RU/vtXY3V/FD1+bFOwD4F1DX9VEzKoGUrUVCrhh8O9kDojpWykr32tyFZcylRqon2KkiT iwsWbcqyhhTB95WZlqPSg== X-UI-Out-Filterresults: notjunk:1; X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 212.227.15.15 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:100818 Archived-At: "Loris Bennett" writes: > Hi Michael, Hi Loris, >>> If I have two buffers and want to see which of the corresponding files >>> is the more recent, is there a faster way of doing it than running dired >>> for each of the corresponding directories? >> >> (file-newer-than-file-p (buffer-file-name buf1) (buffer-file-name buf2)) > > Thanks for this. If I want to do this as part of an interactive > function, how would I invoke the choice of buffers like ediff-buffers > does? Steal the code from ediff-buffers. Untested: (defun my-buffer-file-newer-than-file-p (buffer-A buffer-B) (interactive (list (read-buffer "Buffer A to compare: " (cons (current-buffer) nil)) (read-buffer "Buffer B to compare: "))) (message (if (file-newer-than-file-p (buffer-file-name (get-buffer buffer-A)) (buffer-file-name (get-buffer buffer-B))) "Yes" "No"))) > Cheers, > > Loris Best regards, Michael.