unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Two questions about thumbs.el
@ 2004-04-26 13:31 Juanma Barranquero
  2004-04-26 16:39 ` Kim F. Storm
  2004-05-24 14:08 ` Richard Stallman
  0 siblings, 2 replies; 7+ messages in thread
From: Juanma Barranquero @ 2004-04-26 13:31 UTC (permalink / raw)


Fist: There are a few .el files with no copyright and no comment about
them being in the public domain.

Most of them are quite small or even trivial:

  forms-d2.el
  forms-pass.el
  patcomp.el
  obsolete/sc.el
  term/apollo.el
  term/bobcat.el
  term/vt*.el

but thumbs.el is a 700+ lines file. Shouldn't it have a copyright line?


Now, the real question:

(when (not (fboundp 'time-less-p))
  (defun time-less-p (t1 t2)
    "Say whether time T1 is less than time T2."
    (or (< (car t1) (car t2))
        (and (= (car t1) (car t2))
             (< (nth 1 t1) (nth 1 t2))))))

This code introduces a symbol time-less-p, which could confuse feature
checks. Wouldn't it be better:

(if (fboundp 'time-less-p)
    (defalias 'thumbs-time-less-p 'time-less-p)
  (defun thumbs-time-less-p (t1 t2)
    "Say whether time T1 is less than time T2."
    (or (< (car t1) (car t2))
        (and (= (car t1) (car t2))
             (< (nth 1 t1) (nth 1 t2)))))))


Third question (yeah, I lied on the subject): There are at least eight
versions of the time-less-p code:

calendar/time-date: time-less-p
calendar/timeclock: timeclock-time-less-p
pcomplete:          pcomplete-time-less-p
speedbar:           speedbar-check-obj-this-line (fragment)
thumbs:             time-less-p
autoload:           autoload-before-p
eshell/esh-util:    eshell-time-less-p
net/tramp-smb:      tramp-smb-time-less-p (fragment)

speedbar, eshell and tramp have a life outside of Emacs, so they need
their own definitions for compatibility, but the others could be
"reunified" by using calendar/time-date's version (time-date.elc is
quite small, about 4K).

Is there any reason not to do it, other than not wanting them to load
calendar/time-date.elc?

Note: I'm not sure about autoload, because without testing it I don't
know if there'll be a problem for autoload to use an autoloaded function.

                                                                Juanma

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two questions about thumbs.el
  2004-04-26 13:31 Two questions about thumbs.el Juanma Barranquero
@ 2004-04-26 16:39 ` Kim F. Storm
  2004-04-26 16:58   ` Juanma Barranquero
  2004-05-24 14:08 ` Richard Stallman
  1 sibling, 1 reply; 7+ messages in thread
From: Kim F. Storm @ 2004-04-26 16:39 UTC (permalink / raw)
  Cc: emacs-devel

Juanma Barranquero <jmbarranquero@wke.es> writes:

> Third question (yeah, I lied on the subject): There are at least eight
> versions of the time-less-p code:
> 
> calendar/time-date: time-less-p
> calendar/timeclock: timeclock-time-less-p
> pcomplete:          pcomplete-time-less-p
> speedbar:           speedbar-check-obj-this-line (fragment)
> thumbs:             time-less-p
> autoload:           autoload-before-p
> eshell/esh-util:    eshell-time-less-p
> net/tramp-smb:      tramp-smb-time-less-p (fragment)
> 
> speedbar, eshell and tramp have a life outside of Emacs, so they need
> their own definitions for compatibility, but the others could be
> "reunified" by using calendar/time-date's version (time-date.elc is
> quite small, about 4K).

This functionality is obviously generally useful.
Maybe time-less-p should be defined in subr.el?

> Note: I'm not sure about autoload, because without testing it I don't
> know if there'll be a problem for autoload to use an autoloaded function.

I don't this that's a problem, but in any case defining it in subr.el
would fix that nevertheless.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two questions about thumbs.el
  2004-04-26 16:39 ` Kim F. Storm
@ 2004-04-26 16:58   ` Juanma Barranquero
  2004-04-27 16:29     ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Juanma Barranquero @ 2004-04-26 16:58 UTC (permalink / raw)


On 26 Apr 2004 18:39:21 +0200, storm@cua.dk (Kim F. Storm) wrote:

> This functionality is obviously generally useful.
> Maybe time-less-p should be defined in subr.el?

time-less-p, time-subtract, time-add, time-to-days, time-to-day-in-year
and date-leap-year-p are all documented on the *Time Calculations* node
of the Emacs Lisp manual. It feels a bit weird to have one on subr.el
and the rest on calendar/time-date.el

OTOH, it seems like time-less-p is the only one generally used, so I
suppose you're right.

Opinions?

                                                           /L/e/k/t/u

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two questions about thumbs.el
  2004-04-26 16:58   ` Juanma Barranquero
@ 2004-04-27 16:29     ` Richard Stallman
  2004-04-27 18:09       ` Juanma Barranquero
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2004-04-27 16:29 UTC (permalink / raw)
  Cc: emacs-devel

    time-less-p, time-subtract, time-add, time-to-days, time-to-day-in-year
    and date-leap-year-p are all documented on the *Time Calculations* node
    of the Emacs Lisp manual. It feels a bit weird to have one on subr.el
    and the rest on calendar/time-date.el

If time-less-p is used more often, it may be worth putting in subr.el.
But autoloading time-date.el will work too.  So another solution is
simply for the other packages to use time-less-p, with no other
change.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two questions about thumbs.el
  2004-04-27 16:29     ` Richard Stallman
@ 2004-04-27 18:09       ` Juanma Barranquero
  0 siblings, 0 replies; 7+ messages in thread
From: Juanma Barranquero @ 2004-04-27 18:09 UTC (permalink / raw)


On Tue, 27 Apr 2004 12:29:16 -0400, Richard Stallman <rms@gnu.org> wrote:

> So another solution is
> simply for the other packages to use time-less-p, with no other
> change.

OK, I'll modify the modules (except speedbar, tramp and eshell) to use
time-less-p.

                                                           /L/e/k/t/u

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two questions about thumbs.el
  2004-04-26 13:31 Two questions about thumbs.el Juanma Barranquero
  2004-04-26 16:39 ` Kim F. Storm
@ 2004-05-24 14:08 ` Richard Stallman
  2004-05-24 14:32   ` Juanma Barranquero
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2004-05-24 14:08 UTC (permalink / raw)
  Cc: emacs-devel

    Third question (yeah, I lied on the subject): There are at least eight
    versions of the time-less-p code:

    calendar/time-date: time-less-p
    calendar/timeclock: timeclock-time-less-p
    pcomplete:          pcomplete-time-less-p
    speedbar:           speedbar-check-obj-this-line (fragment)
    thumbs:             time-less-p
    autoload:           autoload-before-p
    eshell/esh-util:    eshell-time-less-p
    net/tramp-smb:      tramp-smb-time-less-p (fragment)


calendar/time-date.elc is meant as a file of utilities
precisely for the use of such facilities.

So let's convert them all to use time-less-p.
(I already eliminated the copy from thumbs.el,
though I haven't installed those changes yet.)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Two questions about thumbs.el
  2004-05-24 14:08 ` Richard Stallman
@ 2004-05-24 14:32   ` Juanma Barranquero
  0 siblings, 0 replies; 7+ messages in thread
From: Juanma Barranquero @ 2004-05-24 14:32 UTC (permalink / raw)
  Cc: emacs-devel


On Mon, 24 May 2004 10:08:11 -0400
Richard Stallman <rms@gnu.org> wrote:

> So let's convert them all to use time-less-p.
> (I already eliminated the copy from thumbs.el,
> though I haven't installed those changes yet.)

About a month ago I modified timeclock, pcomplete, thumbs and autoload
to use (but not define) time-less-p. In fact, pcomplete didn't even
use/need it, so I just removed the definition of pcomplete-time-less-p.

speedbar, eshell and tramp I didn't touch because they have also an
independent life outside Emacs and it's better if the maintainers decide.

                                                                Juanma

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-05-24 14:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-26 13:31 Two questions about thumbs.el Juanma Barranquero
2004-04-26 16:39 ` Kim F. Storm
2004-04-26 16:58   ` Juanma Barranquero
2004-04-27 16:29     ` Richard Stallman
2004-04-27 18:09       ` Juanma Barranquero
2004-05-24 14:08 ` Richard Stallman
2004-05-24 14:32   ` Juanma Barranquero

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).