all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
Subject: Re: CVS directories in completion-ignored-extensions
Date: 06 Jan 2004 09:08:25 +0900	[thread overview]
Message-ID: <87r7yeq6py.fsf@tc-1-100.kawasaki.gol.ne.jp> (raw)
In-Reply-To: E1AdYxe-00051S-SS@fencepost.gnu.org

Richard Stallman <rms@gnu.org> writes:
> > I've always thought it would be nice, instead of having multiple
> > variables each of which contain a different types of entry, to have
> > something like `completion-ignored-names', where each element could
> > be either: a string (which is matched using just `equal'), or a list
> > like (regexp REGEXP), which the matcher would treat accordingly.
> 
> That is a good idea.

Ok, how about something like:

   (defun string-matcher-member (string matcher)
     "Return non-nil if STRING is matched by the `string matcher' MATCHER.
   MATCHER should be a list, where each element is either a string,
   which will be compared with STRING using `equal', or a cons of the
   form (regexp REGEXP), in which case REGEXP will be compared with
   STRING using `string-match'.  The actual return value is the first
   element of MATCHER that matches."
     (let (test)
       (while matcher
         (setq test (pop matcher))
         (if (cond ((stringp test) 
                    (equal string test))
                   ((eq (car-safe test) 'regexp)
                    (if (consp (cdr test))
                        (string-match (car-safe (cdr-safe test)) string)
                      (string-match (cdr-safe test) string))))
             (setq matcher nil)
           (setq test nil)))
       test))

The name `string-matcher-member' is kind of ugly, but at least it
seems fairly clear; maybe someone can think of a better name.

The nice thing is that this is basically backward-compatible with existing
lists of strings that are matched exactly, so perhaps some of them could
be retro-fitted accordingly (e.g.  `dabbrev-ignored-buffer-names').

[`special-display-buffer-names' is similar (it has a corresponding
`special-display-regexps'), but because it itself gives special treatment
to list members that are cons-cells, doesn't fit exactly into such a
scheme (maybe it could be finessed, I don't know).]

-Miles
-- 
`Suppose Korea goes to the World Cup final against Japan and wins,' Moon said.
`All the past could be forgiven.'   [NYT]

  reply	other threads:[~2004-01-06  0:08 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-30  8:01 CVS directories in completion-ignored-extensions Eli Zaretskii
2003-12-30 23:44 ` Eric Hanchrow
2003-12-31  1:08   ` Luc Teirlinck
2003-12-31  1:34     ` Miles Bader
2003-12-31  5:51       ` Eli Zaretskii
2004-01-01  5:49       ` Eli Zaretskii
2004-01-01 21:10         ` Richard Stallman
2004-01-02  0:31           ` Miles Bader
2004-01-02  1:06           ` Kim F. Storm
2004-01-02  9:21             ` Eli Zaretskii
2004-01-03 11:52             ` Eli Zaretskii
2004-01-04 18:53               ` Richard Stallman
2004-01-04 23:17                 ` Stefan Monnier
2004-01-04 23:59                   ` Miles Bader
2004-01-05 17:56                     ` Richard Stallman
2004-01-06  0:08                       ` Miles Bader [this message]
2004-01-06  0:52                         ` Kenichi Handa
2004-01-06  1:54                           ` Miles Bader
2004-01-06  3:00                             ` Kenichi Handa
2005-01-19 11:34                               ` Kim F. Storm
2005-01-19 14:57                                 ` Stefan Monnier
2005-01-19 15:52                                   ` Kim F. Storm
2005-01-19 16:07                                     ` Stefan Monnier
2004-01-06  5:55                         ` Eli Zaretskii
2004-01-06  6:26                           ` Miles Bader
2004-01-07  2:40                         ` Richard Stallman
2004-01-01 21:27         ` Kim F. Storm

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r7yeq6py.fsf@tc-1-100.kawasaki.gol.ne.jp \
    --to=miles@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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.