From: Michael Albinus <michael.albinus@gmx.de>
To: "Loris Bennett" <loris.bennett@fu-berlin.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Comparing last modification time without dired?
Date: Fri, 07 Nov 2014 10:05:44 +0100 [thread overview]
Message-ID: <87ioiridnb.fsf@gmx.de> (raw)
In-Reply-To: <87ioir76zj.fsf@hornfels.zedat.fu-berlin.de> (Loris Bennett's message of "Fri, 07 Nov 2014 09:25:04 +0100")
"Loris Bennett" <loris.bennett@fu-berlin.de> 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.
next prev parent reply other threads:[~2014-11-07 9:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-07 7:29 Comparing last modification time without dired? Loris Bennett
2014-11-07 8:08 ` Michael Albinus
[not found] ` <mailman.13098.1415347725.1147.help-gnu-emacs@gnu.org>
2014-11-07 8:25 ` Loris Bennett
2014-11-07 8:50 ` H. Dieter Wilhelm
2014-11-07 9:05 ` Michael Albinus [this message]
[not found] ` <mailman.13102.1415351159.1147.help-gnu-emacs@gnu.org>
2014-11-07 10:24 ` Loris Bennett
2014-11-07 11:58 ` Michael Albinus
2014-11-07 12:04 ` Michael Heerdegen
2014-11-07 14:38 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ioiridnb.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=help-gnu-emacs@gnu.org \
--cc=loris.bennett@fu-berlin.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.