From: "Loris Bennett" <loris.bennett@fu-berlin.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Comparing last modification time without dired?
Date: Fri, 07 Nov 2014 11:24:20 +0100 [thread overview]
Message-ID: <87ioirqpez.fsf@hornfels.zedat.fu-berlin.de> (raw)
In-Reply-To: mailman.13102.1415351159.1147.help-gnu-emacs@gnu.org
Hi Michael,
Michael Albinus <michael.albinus@gmx.de> writes:
> "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")))
Stealing your code, I get
Wrong type argument: stringp, #<buffer alternative_cluster_software.org>
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.
next prev parent reply other threads:[~2014-11-07 10:24 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
[not found] ` <mailman.13102.1415351159.1147.help-gnu-emacs@gnu.org>
2014-11-07 10:24 ` Loris Bennett [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ioirqpez.fsf@hornfels.zedat.fu-berlin.de \
--to=loris.bennett@fu-berlin.de \
--cc=help-gnu-emacs@gnu.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).