From d5f798c721734ab5cbf402166b9ec91a13cdfd58 Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Wed, 30 Dec 2015 01:36:36 +0100 Subject: [PATCH] factor out `el-search--search-pattern-1' --- packages/el-search/el-search.el | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el index 8724071ed..ce37d916f 100644 --- a/packages/el-search/el-search.el +++ b/packages/el-search/el-search.el @@ -409,13 +409,8 @@ of the definitions is limited to \"el-search\"." (goto-char (match-end 0))) (t (forward-char)))) -(defun el-search--search-pattern (pattern &optional noerror) - "Search elisp buffer with `pcase' PATTERN. -Set point to the beginning of the occurrence found and return -point. Optional second argument, if non-nil, means if fail just -return nil (no error)." - - (let ((matcher (el-search--matcher pattern)) (match-beg nil) (opoint (point)) current-expr) +(defun el-search--search-pattern-1 (matcher &optional noerror) + (let ((match-beg nil) (opoint (point)) current-expr) ;; when inside a string or comment, move past it (let ((syntax-here (syntax-ppss))) @@ -441,6 +436,13 @@ return nil (no error)." (if noerror nil (signal 'end-of-buffer nil))) match-beg)) +(defun el-search--search-pattern (pattern &optional noerror) + "Search elisp buffer with `pcase' PATTERN. +Set point to the beginning of the occurrence found and return +point. Optional second argument, if non-nil, means if fail just +return nil (no error)." + (el-search--search-pattern-1 (el-search--matcher pattern) noerror)) + (defun el-search--do-subsexps (pos do-fun &optional ret-fun bound) ;; In current buffer, for any expression start between POS and BOUND ;; or (point-max), in order, call two argument function DO-FUN with -- 2.39.2