* Comparing last modification time without dired?
@ 2014-11-07 7:29 Loris Bennett
2014-11-07 8:08 ` Michael Albinus
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Loris Bennett @ 2014-11-07 7:29 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
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?
Cheers,
Loris
--
This signature is currently under construction.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Comparing last modification time without dired?
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 14:38 ` Drew Adams
2 siblings, 0 replies; 9+ messages in thread
From: Michael Albinus @ 2014-11-07 8:08 UTC (permalink / raw)
To: Loris Bennett; +Cc: help-gnu-emacs
"Loris Bennett" <loris.bennett@fu-berlin.de> writes:
> Hi,
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))
> Cheers,
>
> Loris
Best regards, Michael.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Comparing last modification time without dired?
[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
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Loris Bennett @ 2014-11-07 8:25 UTC (permalink / raw)
To: help-gnu-emacs
Hi Michael,
Michael Albinus <michael.albinus@gmx.de> writes:
> "Loris Bennett" <loris.bennett@fu-berlin.de> writes:
>
>> Hi,
>
> 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?
>> Cheers,
>>
>> Loris
>
> Best regards, Michael.
>
Cheers,
Loris
--
This signature is currently under construction.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Comparing last modification time without dired?
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>
2 siblings, 0 replies; 9+ messages in thread
From: H. Dieter Wilhelm @ 2014-11-07 8:50 UTC (permalink / raw)
To: help-gnu-emacs
"Loris Bennett" <loris.bennett@fu-berlin.de> writes:
> Hi Michael,
>
> Michael Albinus <michael.albinus@gmx.de> writes:
>
>> "Loris Bennett" <loris.bennett@fu-berlin.de> writes:
>>
>>> Hi,
>>
>> 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?
(defun bla (buf1 buf2)
(interactive "bbuffer1\nbbuffer2")
...
)
Could already be sufficent for your needs.
Dieter
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Comparing last modification time without dired?
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>
2 siblings, 0 replies; 9+ messages in thread
From: Michael Albinus @ 2014-11-07 9:05 UTC (permalink / raw)
To: Loris Bennett; +Cc: help-gnu-emacs
"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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Comparing last modification time without dired?
[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
0 siblings, 2 replies; 9+ messages in thread
From: Loris Bennett @ 2014-11-07 10:24 UTC (permalink / raw)
To: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Comparing last modification time without dired?
2014-11-07 10:24 ` Loris Bennett
@ 2014-11-07 11:58 ` Michael Albinus
2014-11-07 12:04 ` Michael Heerdegen
1 sibling, 0 replies; 9+ messages in thread
From: Michael Albinus @ 2014-11-07 11:58 UTC (permalink / raw)
To: Loris Bennett; +Cc: help-gnu-emacs
"Loris Bennett" <loris.bennett@fu-berlin.de> writes:
> Hi Michael,
Hi Loris,
> 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?
Bisect your .emacs.
> Cheers,
>
> Loris
Best regards, Michael.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Comparing last modification time without dired?
2014-11-07 10:24 ` Loris Bennett
2014-11-07 11:58 ` Michael Albinus
@ 2014-11-07 12:04 ` Michael Heerdegen
1 sibling, 0 replies; 9+ messages in thread
From: Michael Heerdegen @ 2014-11-07 12:04 UTC (permalink / raw)
To: help-gnu-emacs
"Loris Bennett" <loris.bennett@fu-berlin.de> writes:
> > (read-buffer "Buffer A to compare: " (cons (current-buffer) nil))
> Wrong type argument: stringp, #<buffer alternative_cluster_software.org>
This obviously happens with helm-mode. I wouldn't call this a bug in
helm though, since `read-buffer' returns a string, so the default
value(s) should be specified as strings as well:
(read-buffer "Buffer A to compare: " (cons (buffer-name) nil))
BTW, one could limit the candidates to choose from to buffers that are
currently displayed, if you would prefer that. You could also get the
selection done by clicking windows with the mouse like
`ediff-windows-linewise' does in trunk.
Michael.
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: Comparing last modification time without dired?
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 14:38 ` Drew Adams
2 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2014-11-07 14:38 UTC (permalink / raw)
To: Loris Bennett, help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 1099 bytes --]
> 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?
With Icicles: `C-- C-x C-f TAB`
That is, with a negative prefix arg, `C-x C-f' shows the last
modification date along with the (absolute) file name. See
attached screenshot.
This date/time is part of the (multi-)completion candidate.
You can type patterns to limit the matches by file name or
date/time, or both.
You can use `C-,' to sort the matching candidates in
different ways, including these date/time-related ways:
* by last file modification time
* by last file access time
* by last use as input, first; alphabetically, if same time
* by last use as input, first; by last access, if same time
* by last use, directories first
* by second parts (the date/time here) alphabetically
When you hit `C-,' the available sort orders are presented
as completion candidates. Choose one. to reorder the
candidates. Sort order applies to both candidate display
and cycling.
[-- Attachment #2: throw-file-candidates-by-date.png --]
[-- Type: image/png, Size: 19202 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-11-07 14:38 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-11-07 11:58 ` Michael Albinus
2014-11-07 12:04 ` Michael Heerdegen
2014-11-07 14:38 ` Drew Adams
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).