handle searches of symbols with regex conflicts

This commit is contained in:
David Botton 2024-07-08 21:02:07 -04:00
parent e189b51c87
commit 17774657b6

View file

@ -184,7 +184,17 @@
(lambda (obj data) (lambda (obj data)
(declare (ignore obj)) (declare (ignore obj))
(when (current-editor-is-lisp app) (when (current-editor-is-lisp app)
(setf data (ppcre:regex-replace-all "\\" data "\\\\"))
(setf data (ppcre:regex-replace-all "\\*" data "\\*"))
(setf data (ppcre:regex-replace-all "\\(" data "\\("))
(setf data (ppcre:regex-replace-all "\\)" data "\\)"))
(setf data (ppcre:regex-replace-all "\\[" data "\\["))
(setf data (ppcre:regex-replace-all "\\]" data "\\]"))
(setf data (ppcre:regex-replace-all "\\^" data "\\^"))
(setf data (ppcre:regex-replace-all "\\$" data "\\$"))
(setf data (ppcre:regex-replace-all "\\%" data "\\%"))
(on-file-search editor :search data)))) (on-file-search editor :search data))))
;; system browse symbol
(js-execute editor (js-execute editor
(format nil (format nil
"~A.commands.addCommand({ "~A.commands.addCommand({
@ -200,7 +210,6 @@
(jquery editor))) (jquery editor)))
(set-on-event-with-data editor "clog-eval-form" (set-on-event-with-data editor "clog-eval-form"
(lambda (obj data) (lambda (obj data)
(declare (ignore obj))
(let ((p (parse-integer data :junk-allowed t)) (let ((p (parse-integer data :junk-allowed t))
(tv (text-value editor)) (tv (text-value editor))
(pk "CLOG-USER") (pk "CLOG-USER")
@ -307,21 +316,22 @@ var endRange = ~:*~A.session.doc.indexToPosition(endIndex);
(unless (equal s "") (unless (equal s "")
(with-input-from-string (i s) (with-input-from-string (i s)
(ignore-errors (ignore-errors
(let* ((pac (if (or (eq (current-editor-is-lisp app) t) (let* (;(pac (if (or (eq (current-editor-is-lisp app) t)
(eq (current-editor-is-lisp app) nil)) ; (eq (current-editor-is-lisp app) nil))
"CLOG-USER" ; "CLOG-USER"
(string-upcase (current-editor-is-lisp app)))) (pac (string-upcase (or (current-editor-is-lisp app)
package)))
(m (read i)) (m (read i))
(*PACKAGE* (find-package pac)) ;(*PACKAGE* (find-package pac))
(SWANK::*buffer-package* (find-package pac)) ;(SWANK::*buffer-package* (find-package pac))
(SWANK::*buffer-readtable* *readtable*) ;(SWANK::*buffer-readtable* *readtable*)
(ms (format nil "~A" m)) (ms (format nil "~A" m))
r) r)
(ignore-errors ;(ignore-errors
(setf r (swank::autodoc `(,ms swank::%CURSOR-MARKER%)))) ;(setf r (swank::autodoc `(,ms swank::%CURSOR-MARKER%))))
(if r ;(if r
(setf r (car r)) ;(setf r (car r))
(setf r (swank:operator-arglist ms package))) (setf r (swank:operator-arglist ms pac)) ;)
(when status (when status
(setf (advisory-title status) (documentation (find-symbol ms) 'function))) (setf (advisory-title status) (documentation (find-symbol ms) 'function)))
(when r (when r