David Kastrup <[EMAIL PROTECTED]> writes:

> That is not the same: the above will set beg and end to markers,

How "clever" ... I would NEVER have guessed that.

> whereas match-beginning/match-end happen to be integers.  However, the
> above will also create markers that are unused, so it would be saner
> to call (match-data) only once _if_ indeed markers are what is
> required.
>
> Unused markers slow done editing operations afterwards.  So even if
> markers _are_ what is wanted for some reason, they should be
> explicitly unseated with set-marker once they are no longer needed.


Which brings me to the suggestion that we add an optional arg to
set-match-data like this:

  (set-match-data list &optional destroy-markers)

and change save-match-data to use it 

(defmacro save-match-data (&rest body)
  "Execute the BODY forms, restoring the global value of the match data.
The value returned is the value of the last form in BODY."
  ;; It is better not to use backquote here,
  ;; because that makes a bootstrapping problem
  ;; if you need to recompile all the Lisp files using interpreted code.
  (declare (indent 0) (debug t))
  (list 'let
        '((save-match-data-internal (match-data)))
        (list 'unwind-protect
              (cons 'progn body)
              '(set-match-data save-match-data-internal t))))

-- 
Kim F. Storm <[EMAIL PROTECTED]> http://www.cua.dk



_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to