unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Stefan Monnier'" <monnier@iro.umontreal.ca>
Cc: 'Eli Zaretskii' <eliz@gnu.org>, emacs-devel@gnu.org
Subject: RE: next emacs version?
Date: Sat, 20 Mar 2010 13:29:03 -0700	[thread overview]
Message-ID: <85D696D9907C42A389AA65E4BC83CDD7@us.oracle.com> (raw)
In-Reply-To: <jwvr5nebykc.fsf-monnier+emacs@gnu.org>

> >> checking (string-match directory-listing-before-filename-regexp 
> >> <wellcraftedteststring>) might work at least as well for
> >> the problem at hand.
> 
> > Ugh. It could be done, but as I said earlier:
> 
> >>> FWIW, the regexp in question,
> >>> `directory-listing-before-filename-regexp', is
> >>> among the hairiest I've come across (have a look
> >>> - quite amusing), and I don't think it's a good idea to
> >>> try to test against that value.
> 
> The test I propose above is not to test the value of
> directory-listing-before-filename-regexp but its behavior.
> Basically: figure out the bug that the change was intended to fix, and
> then use the thing that triggered the bug as the string to pass to
> string-match (presumably the match will succeed in one case 
> and fail in the other).

Double-ugh, in that case.

That would involve my code with the bug-fix code (logic). It would impose
complexity, obscurity, and possibly an additional maintenance (evolution)
burden.

My code is pretty much unrelated to the bug fix code - it just uses the regexp
for font-locking. I don't even explicitly call any function that uses the
regexp.

This is all I'm doing. This is an entry in font-lock-keywords. It fontifies (1)
the date+time and also (2) the file name (w/o suffix):

(list dired-move-to-filename-regexp  ; Hairy regexp
      (if (or (not (fboundp 'version<))
              (version< emacs-version "23.2"))
          (list 1 'diredp-date-time t t)
        (list 2 'diredp-date-time t t)) ; Date/time
      (list "\\(.+\\)$" nil nil   ; File w/o suffix
            (list 0 diredp-file-name 'keep t)))

The #5597 bug fix was this: "Use stricter matching for iso-style dates, to avoid
false matches with date-like filenames (Bug#5597)."

I might be misunderstanding what you're suggesting. Feel free to show explicitly
what you have in mind, based on the specifics of my use case.

According to bug #5597, a file name that would provoke the (unfixed) bug would
be "~/2010-02-18\ foo". How would you pass that to `string-match'? Would you
wrap that call with `condition-case' to see if an error is raised? Is that your
idea? 

Is the following what you are suggesting?

(list dired-move-to-filename-regexp  ; Hairy regexp
      (if (condition-case nil
              (string-match
               dired-move-to-filename-regexp
               "-rw-rw-rw- 1 10 2010-04-01 2010-04-01 foo"))
             (error nil))
          (list 1 'diredp-date-time t t)
        (list 2 'diredp-date-time t t)) ; Date/time
      (list "\\(.+\\)$" nil nil   ; File w/o suffix
            (list 0 diredp-file-name 'keep t)))

I'm not sure what the 2nd arg to `string-match' should be here. The 2nd arg I
used is no doubt wrong. It does _not_ fail to match in versions (that support
ISO dates in Dired) prior to the bug fix.

In fact, in `emacs -Q' on Windows at least (which uses `ls-lisp'), I cannot even
reproduce the bug (e.g. in 23.1). I can create a file named "2010-04-01 foo"; it
appears fine in Dired (including mouse-face); and RET visits it just fine.

So for the moment what I think you're suggesting sounds like a can of worms. But
I'd like to learn what you really meant.





  reply	other threads:[~2010-03-20 20:29 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-19 11:23 next emacs version? Drew Adams
2010-03-19 13:22 ` Eli Zaretskii
2010-03-19 17:29   ` Drew Adams
2010-03-19 18:09     ` Eli Zaretskii
2010-03-19 18:46       ` Drew Adams
2010-03-19 19:02         ` Eli Zaretskii
2010-03-19 20:02           ` Drew Adams
2010-03-19 21:15             ` Eli Zaretskii
2010-03-19 21:23               ` Drew Adams
2010-03-20  2:35                 ` Ken Raeburn
2010-03-20  2:39                   ` Lennart Borgman
2010-03-20  3:42                     ` Óscar Fuentes
2010-03-20 15:51                       ` Lennart Borgman
2010-03-20  5:31                     ` Ken Raeburn
2010-03-23  2:05                     ` Stephen J. Turnbull
2010-03-20  3:38                   ` Drew Adams
2010-03-20  5:31                     ` Ken Raeburn
2010-03-20  6:51                       ` Drew Adams
2010-03-20  5:31                     ` Ken Raeburn
2010-03-20  6:51                       ` Drew Adams
2010-03-23  2:34                     ` Stephen J. Turnbull
2010-03-23  5:01                       ` Miles Bader
2010-03-23  5:39                       ` Drew Adams
2010-03-20  3:51                 ` Jason Rumney
2010-03-20  6:47                   ` Drew Adams
2010-03-20  8:39                   ` Eli Zaretskii
2010-03-20 14:58                     ` Drew Adams
2010-03-20 16:22                       ` Eli Zaretskii
2010-03-20  8:11                 ` Eli Zaretskii
2010-03-19 20:55           ` Stefan Monnier
2010-03-19 21:16             ` Drew Adams
2010-03-20 19:10               ` Stefan Monnier
2010-03-20 20:29                 ` Drew Adams [this message]
2010-03-20 21:53                   ` Stefan Monnier
2010-03-20 23:09                     ` Drew Adams
2010-03-20 23:26                       ` Drew Adams
2010-03-22  1:22                       ` Stefan Monnier
2010-03-22  7:22                         ` Drew Adams
2010-03-22 13:52                           ` Stefan Monnier
2010-03-21 21:34     ` Thien-Thi Nguyen
2010-03-21 23:20       ` Drew Adams
2010-03-19 14:52 ` Chong Yidong

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=85D696D9907C42A389AA65E4BC83CDD7@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 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).