emacs-devel
[Top][All Lists]
Advanced

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

Re: wdired.el 1.7 --- Rename files editing their names in dired buffers


From: Juan Leon Lahoz Garcia
Subject: Re: wdired.el 1.7 --- Rename files editing their names in dired buffers
Date: Thu, 08 Nov 2001 02:51:14 -0500

>>>>> "rms" == Richard Stallman <address@hidden> writes:

    rms> That loop by characters is slow. Instead, use
    rms> text-property-not-all to see if any character has a non-nil
    rms> `read-only' property.

OK. Here is a new patch to `perform-replace', more efficient (no extra
function is needed and no loop by characters is done in elisp code):

1- Surround the whole body of the `perform-replace' body with a

  (if (not buffer-read-only)
      (progn

...

)


2- Replace these lines:

  (funcall search-function search-string limit t)
  ;; For speed, use only integers and
  ;; reuse the list used last time.
  (match-data t real-match-data)))))

by these:

  (let ((match-found
         (funcall search-function search-string limit t)))
    (while
        (and match-found
             (text-property-any 
              (max 1 (1- (match-beginning 0))) (match-end 0)
              'read-only t))
      (setq match-found
            (funcall search-function search-string limit t)))
    ;; For speed, use only integers and
    ;; reuse the list used last time.
    (and match-found
         (match-data t real-match-data)))))))


Again, I supposes that style and maybe performance could be improved.
And it should be tested in sceneries that I cannot imagine.

And maybe we have to ask ourself if intangible properties should have
to be taken into account also (they are not taken into account in
search-forward and friends, so replace commands work "funny" with
them. But wait, they are not taken into account in many other emacs
commands that don't work well with buffers with arbitrary intangible
zones).

--
Leon




reply via email to

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