LQOM7R4AZ3RWO2IJYDBZSKIMCWEAWIBGK7TUXOUWLB5GEEC4EJRQC
AGDU4ZNAL7FBVYSNKX4NNQXWTNDJBJFYWX35OI7YQCZRQ5QP5DYQC
RXCY7LD6ZRIOIKZEYKLMCYPMQPXF4DOEEFBDLVR2B22BXLZJFFBQC
A3TVGLVHSVLMEHLHB3TPBSD3QGNVGX3DIK6BEBDTTHWBNW4ALMRAC
ZE4ODOC2XPVNE3BWM4YFTGXISCELSYO44R2IDTGTNZ2AEEBTRHWAC
PDGOEBKHWX4BPJZIU2HMZLL3347XWKQRRFTYBVEG6QR5FY5VTB6QC
LSR4IWD7PPXDHYXRZARJIQJLRJDSZS53ZDHCARSGCLPVBFJDRYSQC
3AJMURUY5ZVID7Y5CMJXHSRT2ZZUCHZAWP7V77FTEPNLSD7UFVZQC
CRMDNCEZXWFBTFS3UQYWC5FI4L5AIFW5K2Y7PQDTT3WHP42OD4DAC
ZUIJCISEPY6SGEMA2TO3EW6KGZ7F34GL5ZCIQVCOTRCSRGWDNRSQC
SDVKYDKG2CRKVGOBU5YE3KVAXYIQR6364NHDDGER44YLJD4WXYVAC
PRE42LRLBF7CR3L7ERIPSQJJTDAQQ4UJ2H5KOHSVX7TL4STJXYNAC
ZYEHQDDB635RZOU4YDJYS5SPJ6BBZEWGSYLNABXRTW5OA4AXU7LQC
EXAAZOG2JLG5KEWTMOT4Z4DKAZHFTQDGYH4VGSXD2GMKCCNKLD2QC
QOFZQTHBDKC2GARYN6I3BUMCGYYMIRSBWQ4F5YHY52QBE3HHXQBQC
T6AJ2U27VBZRYWEGYSPKY4A7NU3FFXROISTS3KTT5O7QDWZ2K7TAC
RYJS56WZEVE7ZX5TXMQUZLB5ET6523U5VHTHLJLYKNBEHSTVSVEQC
(vector (remove-duplicates (sort (fwoar:json-nav--with-collector (c)
(fwoar:json-nav--pierce-vectors
(lambda (next)
(when next
(map nil #'c
(hash-table-keys next))))
data))
'string<)
:test 'equal)))
(vector (cl-remove-duplicates (sort (fwoar:json-nav--with-collector (c)
(fwoar:json-nav--pierce-vectors
(lambda (next)
(when next
(cl-map nil #'c
(hash-table-keys next))))
data))
'string<)
:test 'equal)))
(setf (buffer-string)
(json-serialize (fwoar:json-nav--get-path fwoar:json-nav--data
(reverse path))
:null-object nil))
(erase-buffer)
(insert (json-serialize (fwoar:json-nav--get-path fwoar:json-nav--data
(reverse path))
:null-object nil))
(defun fwoar::spotlight-validate-or-make-dummy-process (input)
(cond
((< (length input) helm-rg-input-min-search-chars)
(helm-rg--make-dummy-process
input
(format "must be at least %d characters" helm-rg-input-min-search-chars)))
(t t)))
;; (defun fwoar::spotlight-validate-or-make-dummy-process (input)
;; (cond
;; ((< (length input) helm-rg-input-min-search-chars)
;; (helm-rg--make-dummy-process
;; input
;; (format "must be at least %d characters" helm-rg-input-min-search-chars)))
;; (t t)))
(defun fwoar::spotlight-search (s)
(s-split "\n" (shell-command-to-string
(format "mdfind %s"
(shell-quote-argument s)))))
(defun fwoar::spotlight-search ()
"Invoke ripgrep in `helm-rg--current-dir' with `helm-pattern'.
Make a dummy process if the input is empty with a clear message to the user."
(let* ((input helm-pattern))
(pcase-exhaustive (fwoar::spotlight-validate-or-make-dummy-process input)
((and (pred processp) x)
(setq helm-rg--last-argv nil)
x)
(`t
(let* ((rg-regexp (helm-rg--helm-pattern-to-ripgrep-regexp input))
(argv (helm-rg--construct-argv rg-regexp))
(real-proc (helm-rg--make-process-from-argv argv)))
(setq helm-rg--last-argv argv)
real-proc)))))
;; (defun fwoar::spotlight-search (s)
;; (s-split "\n" (shell-command-to-string
;; (format "mdfind %s"
;; (shell-quote-argument s)))))
(defvar *fwoar::spotlight-source*
(helm-build-async-source
"find files with spotlight"
:candidates-process 'fwoar::spotlight-search
:action (helm-make-actions
"Open" #'find-file)
))
(defun fwoar:spotlight-search ()
(interactive)
(helm (list )
:input ":write-image"
:prompt "Spotlight expression: "
))
;; (defun fwoar::spotlight-search ()
;; "Invoke ripgrep in `helm-rg--current-dir' with `helm-pattern'.
;; Make a dummy process if the input is empty with a clear message to the user."
;; (let* ((input helm-pattern))
;; (pcase-exhaustive (fwoar::spotlight-validate-or-make-dummy-process input)
;; ((and (pred processp) x)
;; (setq helm-rg--last-argv nil)
;; x)
;; (`t
;; (let* ((rg-regexp (helm-rg--helm-pattern-to-ripgrep-regexp input))
;; (argv (helm-rg--construct-argv rg-regexp))
;; (real-proc (helm-rg--make-process-from-argv argv)))
;; (setq helm-rg--last-argv argv)
;; real-proc)))))
;;
;; (defvar *fwoar::spotlight-source*
;; (helm-build-async-source
;; "find files with spotlight"
;; :candidates-process 'fwoar::spotlight-search
;; :action (helm-make-actions
;; "Open" #'find-file)
;; ))
;; (defun fwoar:spotlight-search ()
;; (interactive)
;; (helm (list )
;; :input ":write-image"
;; :prompt "Spotlight expression: "
;; ))
`(flet ,(loop for (name raw-args namespaced) in fwoar:*namespaced-funs*
for rest-arg = (cl-find-if (data-lens:just-after
(lambda (it)
(member it '(&rest &body))))
raw-args)
for args = (cl-remove-if (lambda (it)
(or (eql it rest-arg)
(and (symbolp it)
(= ?&
(elt
(symbol-name it)
0)))))
raw-args)
`(flet ,(cl-loop for (name raw-args namespaced) in fwoar:*namespaced-funs*
for rest-arg = (cl-find-if (data-lens:just-after
(lambda (it)
(member it '(&rest &body))))
raw-args)
for args = (cl-remove-if (lambda (it)
(or (eql it rest-arg)
(and (symbolp it)
(= ?&
(elt
(symbol-name it)
0)))))
raw-args)
collect `(,name ,raw-args
(,@(if rest-arg
`(apply ',namespaced)
(list namespaced))
,@(mapcar (lambda (it)
(if (listp it)
(car it)
it))
args)
,@(when rest-arg
(list rest-arg)))))
collect `(,name ,raw-args
(,@(if rest-arg
`(apply ',namespaced)
(list namespaced))
,@(mapcar (lambda (it)
(if (listp it)
(car it)
it))
args)
,@(when rest-arg
(list rest-arg)))))
(comment
(fwoar:def-ns-fun regex-match (regex)
(lambda (data)
(cl-ppcre:scan-to-strings regex data))))
;; (comment
;; (fwoar:def-ns-fun regex-match (regex)
;; (lambda (data)
;; (cl-ppcre:scan-to-strings regex data))))