From fa900da0d826614d3d4dd00002312d3fa33b6b25 Mon Sep 17 00:00:00 2001 From: Michael Heerdegen Date: Sat, 26 Sep 2015 00:43:46 +0200 Subject: [PATCH] new function el-search--end-of-sexp; use it --- packages/el-search/el-search.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/el-search/el-search.el b/packages/el-search/el-search.el index 3e982bb1c..1ad895aa2 100644 --- a/packages/el-search/el-search.el +++ b/packages/el-search/el-search.el @@ -243,6 +243,10 @@ expression." (concat "'" (el-search--print this-sexp)))) read)) +(defun el-search--end-of-sexp () + ;;Point must be at sexp beginning + (or (scan-sexps (point) 1) (point-max))) + (defun el-search--goto-next-sexp () "Move point to the beginning of the next sexp. Don't move if already at beginning of a sexp." @@ -362,7 +366,7 @@ return nil (no error)." (defvar el-search-keep-hl nil) (defun el-search-hl-sexp-at-point () - (let ((bounds (list (point) (scan-sexps (point) 1)))) + (let ((bounds (list (point) (el-search--end-of-sexp)))) (if (overlayp el-search-hl-overlay) (apply #'move-overlay el-search-hl-overlay bounds) (overlay-put (setq el-search-hl-overlay (apply #'make-overlay bounds)) @@ -434,7 +438,7 @@ return nil (no error)." (setq opoint (point)) (unless replace-all (el-search-hl-sexp-at-point)) (let* ((read-mapping (el-search--create-read-map)) - (region (list (point) (scan-sexps (point) 1))) + (region (list (point) (el-search--end-of-sexp))) (substring (apply #'buffer-substring-no-properties region)) (expr (read substring)) (replaced-this nil) -- 2.39.2