mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 18:40:39 -08:00
(looking-back): New function to check for regular expression before point.
This commit is contained in:
parent
a44c6ff342
commit
498535fbfc
1 changed files with 13 additions and 0 deletions
13
lisp/subr.el
13
lisp/subr.el
|
|
@ -1820,6 +1820,19 @@ STRING should be given if the last search was by `string-match' on STRING."
|
|||
(buffer-substring-no-properties (match-beginning num)
|
||||
(match-end num)))))
|
||||
|
||||
(defun looking-back (regexp)
|
||||
"Return t if text before point matches regular expression REGEXP.
|
||||
This function modifies the match data that `match-beginning',
|
||||
`match-end' and `match-data' access; save and restore the match
|
||||
data if you want to preserve them."
|
||||
(save-excursion
|
||||
(let ((beg (point)))
|
||||
(if (re-search-backward regexp nil t)
|
||||
(if (= (match-end 0) beg)
|
||||
t
|
||||
nil)
|
||||
nil))))
|
||||
|
||||
(defconst split-string-default-separators "[ \f\t\n\r\v]+"
|
||||
"The default value of separators for `split-string'.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue