(require 'cl-lib)
(require 'elisp-mode)
(require 'thingatpt)
+(require 'help-fns) ;el-search--make-docstring
;;;; Configuration stuff
(read-from-minibuffer prompt initial-contents el-search-read-expression-map read
(or hist 'read-expression-history) default)))
+(defvar el-search--initial-mb-contents nil)
+
(defun el-search--read-pattern (prompt &optional default read)
(let ((this-sexp (sexp-at-point)))
(minibuffer-with-setup-hook
;; code mainly from `pcase--make-docstring'
(let* ((main (documentation (symbol-function 'el-search-pattern) 'raw))
(ud (help-split-fundoc main 'pcase)))
- (require 'help-fns)
(with-temp-buffer
(insert (or (cdr ud) main))
(mapc
,@body))
(defun el-search--matcher (pattern &rest body)
- (let ((warning-suppress-log-types '((bytecomp))))
- (el-search--with-additional-pcase-macros
- (byte-compile
- `(lambda (expression)
- (pcase expression
- (,pattern ,@(or body (list t)))
- (_ nil)))))))
+ (eval
+ `(el-search--with-additional-pcase-macros
+ (let ((warning-suppress-log-types '((bytecomp))))
+ (byte-compile
+ (lambda (expression)
+ (pcase expression
+ (,pattern ,@(or body (list t)))
+ (_ nil))))))))
(defun el-search--match-p (matcher expression)
(funcall matcher expression))
(if (zerop nbr-skipped) ""
(format " (%d skipped)" nbr-skipped)))))
-;; We need a variable for the initial contents because we want to `call-interactively'
-;; `el-search-query-replace-read-args'
-(defvar el-search--initial-mb-contents nil)
-
(defun el-search-query-replace-read-args ()
(barf-if-buffer-read-only)
(let* ((from (el-search--read-pattern "Replace from: "))