* mu4e: some better escaping for queries with backslashes
This commit is contained in:
@ -805,7 +805,6 @@ non-nill, don't raise an error when the docid is not found."
|
|||||||
(unless ignore-missing
|
(unless ignore-missing
|
||||||
(mu4e-error "Cannot find message with docid %S" docid)))))
|
(mu4e-error "Cannot find message with docid %S" docid)))))
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defun mu4e~headers-search-execute (expr ignore-history)
|
(defun mu4e~headers-search-execute (expr ignore-history)
|
||||||
"Search in the mu database for EXPR, and switch to the output
|
"Search in the mu database for EXPR, and switch to the output
|
||||||
buffer for the results. If IGNORE-HISTORY is true, do *not* update
|
buffer for the results. If IGNORE-HISTORY is true, do *not* update
|
||||||
@ -829,7 +828,7 @@ the query history stack."
|
|||||||
'face 'mu4e-title-face)))
|
'face 'mu4e-title-face)))
|
||||||
(switch-to-buffer buf)
|
(switch-to-buffer buf)
|
||||||
(mu4e~proc-find
|
(mu4e~proc-find
|
||||||
(replace-regexp-in-string "\"" "\\\\\"" expr) ;; escape "\"
|
expr
|
||||||
mu4e-headers-show-threads
|
mu4e-headers-show-threads
|
||||||
mu4e-headers-sortfield
|
mu4e-headers-sortfield
|
||||||
mu4e-headers-sort-revert
|
mu4e-headers-sort-revert
|
||||||
|
|||||||
@ -312,6 +312,12 @@ The results are reporter through either (:update ... ) or (:error)
|
|||||||
sexp, which are handled my `mu4e-error-func', respectively."
|
sexp, which are handled my `mu4e-error-func', respectively."
|
||||||
(mu4e~proc-send-command "remove docid:%d" docid))
|
(mu4e~proc-send-command "remove docid:%d" docid))
|
||||||
|
|
||||||
|
(defun mu4e~proc-escape-query (query)
|
||||||
|
"Escape the query QUERY for transport, in particular, backslashes
|
||||||
|
and double-quotes."
|
||||||
|
(let ((esc (replace-regexp-in-string "\\\\" "\\\\\\\\" query)))
|
||||||
|
(replace-regexp-in-string "\"" "\\\\\"" esc)))
|
||||||
|
|
||||||
(defun mu4e~proc-find (query threads sortfield revert maxnum)
|
(defun mu4e~proc-find (query threads sortfield revert maxnum)
|
||||||
"Start a database query for QUERY. If THREADS is non-nil, show
|
"Start a database query for QUERY. If THREADS is non-nil, show
|
||||||
results in threaded fasion, SORTFIELD is a symbol describing the
|
results in threaded fasion, SORTFIELD is a symbol describing the
|
||||||
@ -323,7 +329,7 @@ result. The variables `mu4e-error-func' contain the function that
|
|||||||
will be called for, resp., a message (header row) or an error."
|
will be called for, resp., a message (header row) or an error."
|
||||||
(mu4e~proc-send-command
|
(mu4e~proc-send-command
|
||||||
"find query:\"%s\" threads:%s sortfield:%s reverse:%s maxnum:%d"
|
"find query:\"%s\" threads:%s sortfield:%s reverse:%s maxnum:%d"
|
||||||
query
|
(mu4e~proc-escape-query query)
|
||||||
(if threads "true" "false")
|
(if threads "true" "false")
|
||||||
;; sortfield is e.g. ':subject'; this removes the ':'
|
;; sortfield is e.g. ':subject'; this removes the ':'
|
||||||
(if (null sortfield) "nil" (substring (symbol-name sortfield) 1))
|
(if (null sortfield) "nil" (substring (symbol-name sortfield) 1))
|
||||||
|
|||||||
Reference in New Issue
Block a user