all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Herbert Euler" <herberteuler@hotmail.com>
To: william.xwl@gmail.com, emacs-devel@gnu.org
Subject: RE: propose: dired-isearch.el --- isearch in Dired
Date: Thu, 09 Aug 2007 10:37:16 +0800	[thread overview]
Message-ID: <BAY143-F382CED15C2755D37D14929DAE00@phx.gbl> (raw)
In-Reply-To: <874pjaiv45.fsf@gmail.com>

Without applying Juri's proposal, this is an implementation that
resolves both the two bugs mentioned in my previous message: the
regexp "^" bug and searching goes into fields other than file names
bug.  I think other functions (e.g. dired-re-search-backward) can be
implemented this way too.

(defun dired-next-file-name (point bound)
  (let* ((start (cond ((= point 1)
                       (if (get-char-property point 'help-echo)
                           point
                         (next-single-property-change point 'help-echo)))
                      ((get-char-property point 'help-echo)
                       (if (get-char-property (1- point) 'help-echo)
                           (progn
                             (setq point
                                   (next-single-property-change point
                                                                'help-echo))
                             (next-single-property-change point 'help-echo))
                         point))
                      (t
                       (next-single-property-change point 'help-echo))))
         (end (when start
                (next-single-property-change start 'help-echo))))
    (when (and end (< end bound))
      (goto-char start)
      (buffer-substring start end))))

(defun dired-re-search-forward (regexp &optional bound noerror count)
  "In Dired, run `re-search-forward' but match only at file names."
  (let ((start (point))
        (not-found nil)
        name
        match-data)
    (save-excursion
      (unless bound
        (setq bound (point-max)))
      (while (and (prog1 (setq name (dired-next-file-name start bound))
                    (unless name (setq not-found t)))
                  (not (string-match regexp name)))
        (setq start (1+ (point))))
      (unless not-found
        (setq match-data (list (+ (point) (match-beginning 0))
                               (+ (point) (match-end 0))))
        (set-match-data match-data)
        (nth 1 match-data)))))

Please consider rewriting other functions this way.

Regards,
Guanpeng Xu

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

      parent reply	other threads:[~2007-08-09  2:37 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-08  3:05 propose: dired-isearch.el --- isearch in Dired William Xu
2007-08-08  3:47 ` Levin
2007-08-08  5:29   ` William Xu
2007-08-08  8:12     ` Herbert Euler
2007-08-08  8:16 ` Miles Bader
2007-08-08  9:35   ` William Xu
2007-08-08 13:01   ` Stefan Monnier
2007-08-09  2:45     ` Miles Bader
2007-08-08 18:46 ` Stefan Monnier
2007-08-08 22:54   ` Juri Linkov
2008-07-23 20:34     ` Juri Linkov
2008-07-24  6:41       ` Mathias Dahl
2008-07-25  0:32         ` Juri Linkov
2008-07-24 13:53       ` Stefan Monnier
2008-07-24 15:52         ` Drew Adams
2008-07-24 17:20           ` Stefan Monnier
2008-07-24 17:31             ` dired-details status [was: isearch in Dired] Drew Adams
2008-07-25  0:33         ` isearch in Dired Juri Linkov
2008-07-25  0:40           ` Lennart Borgman (gmail)
2008-07-29 15:44             ` word search (Re: isearch in Dired) Juri Linkov
2008-07-29 17:22               ` Chong Yidong
2008-07-30 16:50                 ` Juri Linkov
2008-07-31 12:35                   ` Juri Linkov
2008-07-31 14:10                     ` Stefan Monnier
2008-07-31 15:16                       ` Juri Linkov
2008-07-31 16:30                         ` Stefan Monnier
2008-07-31 15:24                       ` Stefan Monnier
2008-07-29 15:45           ` isearch in Dired Juri Linkov
2008-07-29 17:56             ` Stefan Monnier
2008-07-30 14:29               ` Juri Linkov
2007-08-09  2:46   ` propose: dired-isearch.el --- " William Xu
2007-08-09  0:06 ` Richard Stallman
2007-08-09  1:53   ` William Xu
2007-08-09 23:11     ` Richard Stallman
2007-08-10  1:42       ` William Xu
2007-08-10  8:37         ` Mathias Dahl
2007-08-10  9:22           ` David Kastrup
2007-08-10 15:56           ` Drew Adams
2007-08-11 10:52             ` William Xu
2007-08-11 15:15               ` Drew Adams
2007-08-11 16:58               ` Robert J. Chassell
2007-08-12  1:02                 ` Drew Adams
2007-08-12 20:46               ` Juri Linkov
2007-08-12 21:43                 ` Drew Adams
2007-08-12 23:23                   ` Juri Linkov
2007-08-13  9:14                     ` Mathias Megyei
2007-08-13  9:24                       ` Andreas Schwab
2007-08-13 13:09                         ` Mathias Dahl
2007-08-09 16:07   ` Drew Adams
2007-08-09  2:37 ` Herbert Euler [this message]

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=BAY143-F382CED15C2755D37D14929DAE00@phx.gbl \
    --to=herberteuler@hotmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=william.xwl@gmail.com \
    /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.