emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/subr.el


From: Richard M . Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/subr.el
Date: Sun, 29 May 2005 04:34:47 -0400

Index: emacs/lisp/subr.el
diff -c emacs/lisp/subr.el:1.458 emacs/lisp/subr.el:1.459
*** emacs/lisp/subr.el:1.458    Thu May 26 09:43:46 2005
--- emacs/lisp/subr.el  Sun May 29 08:34:46 2005
***************
*** 1996,2009 ****
        (buffer-substring-no-properties (match-beginning num)
                                        (match-end num)))))
  
! (defun looking-back (regexp &optional limit)
    "Return non-nil if text before point matches regular expression REGEXP.
  Like `looking-at' except matches before point, and is slower.
  LIMIT if non-nil speeds up the search by specifying how far back the
! match can start."
!   (not (null
!       (save-excursion
!         (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t)))))
  
  (defconst split-string-default-separators "[ \f\t\n\r\v]+"
    "The default value of separators for `split-string'.
--- 1996,2029 ----
        (buffer-substring-no-properties (match-beginning num)
                                        (match-end num)))))
  
! (defun looking-back (regexp &optional limit greedy)
    "Return non-nil if text before point matches regular expression REGEXP.
  Like `looking-at' except matches before point, and is slower.
  LIMIT if non-nil speeds up the search by specifying how far back the
! match can start.
! 
! If GREEDY is non-nil, extend the match backwards as far as possible,
! stopping when a single additional previous character cannot be part
! of a match for REGEXP."
!   (let ((start (point))
!       (pos
!        (save-excursion
!          (and (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t)
!               (point)))))
!     (if (and greedy pos)
!       (save-restriction
!         (narrow-to-region (point-min) start)
!         (while (and (> pos (point-min))
!                     (save-excursion
!                       (goto-char pos)
!                       (backward-char 1)
!                       (looking-at (concat "\\(?:"  regexp "\\)\\'"))))
!           (setq pos (1- pos)))
!         (save-excursion
!           (goto-char pos)
!           (looking-at (concat "\\(?:"  regexp "\\)\\'")))))
!     (not (null pos))))
! 
  
  (defconst split-string-default-separators "[ \f\t\n\r\v]+"
    "The default value of separators for `split-string'.




reply via email to

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