emacs-pretest-bug
[Top][All Lists]
Advanced

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

match-string-no-properties simplification


From: Jesper Harder
Subject: match-string-no-properties simplification
Date: Sun, 11 Jan 2004 22:42:15 +0100
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

`match-string-no-properties' can be written simpler by using
`substring-no-properties' rather than `substring' followed by
`set-text-properties'.


2004-01-11  Jesper Harder  <address@hidden>

        * subr.el (match-string-no-properties): Use substring-no-properties.

*** /home/harder/emacs/lisp/subr.el.~1.375.~    Wed Jan  7 15:41:15 2004
--- /home/harder/emacs/lisp/subr.el     Sun Jan 11 22:33:51 2004
***************
*** 1964,1973 ****
  STRING should be given if the last search was by `string-match' on STRING."
    (if (match-beginning num)
        (if string
!         (let ((result
!                (substring string (match-beginning num) (match-end num))))
!           (set-text-properties 0 (length result) nil result)
!           result)
        (buffer-substring-no-properties (match-beginning num)
                                        (match-end num)))))
  
--- 1964,1971 ----
  STRING should be given if the last search was by `string-match' on STRING."
    (if (match-beginning num)
        (if string
!         (substring-no-properties string (match-beginning num)
!                                  (match-end num))
        (buffer-substring-no-properties (match-beginning num)
                                        (match-end num)))))

reply via email to

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