emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: next emacs version?


From: Stefan Monnier
Subject: Re: next emacs version?
Date: Sun, 21 Mar 2010 21:22:12 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

>>> That would involve my code with the bug-fix code (logic).
>> Not at all.  It simply amounts to writing the unit-test that checks
>> whether the bug is fixed: (string-match <regexp> <problematic-dired-line>)
>> It's simple and robust.

> That's precisely what I mean by involving my code with the bug-fix
> code: adding a unit-test for an unrelated bug fix in the middle of
> font-lock keywords. Extra code-coupling.

> *Why* the regexp is the way it is (better support for file names that
> include ISO dates, or whatever) is unimportant for the font-lock code
> logic. That code should not care how the regexp does its job of
> matching a date and file-name or which formats are currently
> supported. All that the font-lock code cares about is picking up the
> correct regexp group for the date+time info.

Now that you say what you want, I can even agree that there's a better
solution which is to just check what you want:

   (list dired-move-to-filename-regexp
         (let ((test "<some random dired line>"))
           (when (string-match dired-move-to-filename-regexp test)
             (list
              (cond
               ((equal (match-string 2 test) "<the line's date>") 2)
               ((equal (match-string 1 test) "<the line's date>") 1))
              'diredp-date-time t t)))
           (list 1 'diredp-date-time t t))
         (list "\\(.+\\)$" nil nil   ; File w/o suffix
               (list 0 diredp-file-name 'keep t)))

You could even loop through all submatches to find the one which matches
the date.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]