Helm/Notmuch: Remove patch-helm-notmuch since it's been merged upstream
parent
f137a82739
commit
d42dd8e8ab
|
@ -37,7 +37,6 @@
|
||||||
|
|
||||||
(when (require 'helm-notmuch nil t)
|
(when (require 'helm-notmuch nil t)
|
||||||
(setq helm-notmuch-match-incomplete-words t)
|
(setq helm-notmuch-match-incomplete-words t)
|
||||||
(require 'patch-helm-notmuch)
|
|
||||||
(dolist (map (list notmuch-search-mode-map
|
(dolist (map (list notmuch-search-mode-map
|
||||||
notmuch-hello-mode-map
|
notmuch-hello-mode-map
|
||||||
notmuch-show-mode-map
|
notmuch-show-mode-map
|
||||||
|
|
|
@ -1,84 +0,0 @@
|
||||||
;; TODO: Send PR.
|
|
||||||
|
|
||||||
(defun helm-notmuch-candidate-formatter (cand)
|
|
||||||
"Format the single entry CAND."
|
|
||||||
(if (not (string-match-p "\\[" cand))
|
|
||||||
""
|
|
||||||
(let ((text (substring cand (+ 2 helm-notmuch-thread-id-length)))
|
|
||||||
(id (substring cand 0 helm-notmuch-thread-id-length))
|
|
||||||
cstart astart alen tstart tags)
|
|
||||||
(with-temp-buffer
|
|
||||||
(insert text)
|
|
||||||
(goto-char (point-min))
|
|
||||||
|
|
||||||
;; Align message counts
|
|
||||||
(search-forward "[")
|
|
||||||
(setq cstart (point))
|
|
||||||
(search-forward "]")
|
|
||||||
(save-excursion
|
|
||||||
(save-restriction
|
|
||||||
(narrow-to-region cstart (point))
|
|
||||||
(goto-char (point-min))
|
|
||||||
(when (re-search-forward "\([0-9]\+\)" nil t)
|
|
||||||
(replace-match ""))))
|
|
||||||
(forward-char)
|
|
||||||
(just-one-space (- helm-notmuch-thread-count-width
|
|
||||||
(- (point) cstart)))
|
|
||||||
(forward-char)
|
|
||||||
|
|
||||||
;; Align (and truncate) authors
|
|
||||||
(setq astart (point))
|
|
||||||
(search-forward ";")
|
|
||||||
(delete-char -1)
|
|
||||||
(setq alen (- (point) astart))
|
|
||||||
(if (> alen helm-notmuch-author-width)
|
|
||||||
(progn
|
|
||||||
(delete-region (- (point) (- alen
|
|
||||||
(- helm-notmuch-author-width 3)))
|
|
||||||
(point))
|
|
||||||
(insert "..."))
|
|
||||||
(just-one-space (- (+ helm-notmuch-author-width 1) alen)))
|
|
||||||
|
|
||||||
;; Colour tags
|
|
||||||
(goto-char (- (point-max) 1))
|
|
||||||
(save-excursion
|
|
||||||
(search-backward "(")
|
|
||||||
(setq tstart (+ (point) 1)))
|
|
||||||
(setq tags (split-string (buffer-substring tstart (point))))
|
|
||||||
(delete-region tstart (point))
|
|
||||||
(insert (notmuch-tag-format-tags tags tags))
|
|
||||||
|
|
||||||
;; Colour the whole line according to tags
|
|
||||||
(notmuch-search-color-line (point-min) (point-max) tags)
|
|
||||||
(setq text (buffer-string)))
|
|
||||||
(cons text id))))
|
|
||||||
|
|
||||||
(defun helm-notmuch-maybe-match-incomplete (pattern)
|
|
||||||
(if helm-notmuch-match-incomplete-words
|
|
||||||
(mapconcat #'identity
|
|
||||||
(mapcar (lambda (term)
|
|
||||||
(if (string-match-p "^[[:alnum:]]+$" term)
|
|
||||||
(concat term "*")
|
|
||||||
term))
|
|
||||||
(split-string pattern))
|
|
||||||
" ")
|
|
||||||
pattern))
|
|
||||||
|
|
||||||
(defun helm-notmuch-show (_candidate)
|
|
||||||
"Display CANDIDATE using notmuch-show, retaining the query context."
|
|
||||||
(helm-window-show-buffers
|
|
||||||
(save-window-excursion
|
|
||||||
(cl-loop for candidate in (helm-marked-candidates)
|
|
||||||
collect (progn (notmuch-show candidate nil nil
|
|
||||||
(helm-notmuch-maybe-match-incomplete
|
|
||||||
helm-pattern))
|
|
||||||
(current-buffer))))))
|
|
||||||
|
|
||||||
(defun helm-notmuch-search (candidate)
|
|
||||||
"Display notmuch query in notmuch-search buffer, highlighting CANDIDATE."
|
|
||||||
(notmuch-search (helm-notmuch-maybe-match-incomplete
|
|
||||||
(with-helm-buffer helm-input-local))
|
|
||||||
nil
|
|
||||||
(replace-regexp-in-string "^thread:" "" candidate)))
|
|
||||||
|
|
||||||
(provide 'patch-helm-notmuch)
|
|
Loading…
Reference in New Issue