From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Loris Bennett" Newsgroups: gmane.emacs.help Subject: Re: Comparing last modification time without dired? Date: Fri, 07 Nov 2014 11:24:20 +0100 Organization: Freie Universitaet Berlin Message-ID: <87ioirqpez.fsf@hornfels.zedat.fu-berlin.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 1415355924 29279 80.91.229.3 (7 Nov 2014 10:25:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Nov 2014 10:25:24 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 07 11:25:18 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 1XmgjF-00016j-HN for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Nov 2014 11:25:17 +0100 Original-Received: from localhost ([::1]:59296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmgjF-00089d-5j for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Nov 2014 05:25:17 -0500 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 56 Original-X-Trace: news.uni-berlin.de EbOxAxHUc+YXHafunUfM2wlPnVjf8+mwqtI/Snn6Nbw/QH Cancel-Lock: sha1:hIWsMK0TORh8a0dPfCNFCUwCB/A= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:208543 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:100820 Archived-At: Hi Michael, Michael Albinus writes: > "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"))) Stealing your code, I get Wrong type argument: stringp, # as soon as I call my-buffer-file-newer-than-file-p However, if I run it with "emacs -q" it works. So something in my .emacs must be screwing things up. I thought maybe using uniqify was the problem, but toggling it didn't make any difference. Any ideas what the problem might be? Cheers, Loris >> Cheers, >> >> Loris > > Best regards, Michael. > -- This signature is currently under construction.