branch: master commit 0c30e3fced7d5037da7523a82132769320c466a9 Author: Basil L. Contovounesios <conto...@tcd.ie> Commit: Basil L. Contovounesios <conto...@tcd.ie>
counsel.el: Minor compile history cleanup (counsel-compile-get-filtered-history): Simplify loop. Do not mangle match data. Fix variable names. --- counsel.el | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/counsel.el b/counsel.el index 11f4b64..1f05795 100644 --- a/counsel.el +++ b/counsel.el @@ -5236,16 +5236,15 @@ The optional BLDDIR is useful for other helpers that have found (defun counsel-compile-get-filtered-history (&optional dir) "Return a compile history relevant to current project." (let ((root (or dir (funcall counsel-compile-root-function))) - (kept-history)) - (mapc - (lambda (hist) - (let ((srcdir (get-text-property 0 'srcdir hist)) - (blddir (get-text-property 0 'blddir hist))) - (when (or (and srcdir (string-match srcdir root)) - (and blddir (string-match blddir root))) - (push hist kept-history)))) - counsel-compile-history) - kept-history)) + history) + (dolist (item counsel-compile-history) + (let ((srcdir (get-text-property 0 'srcdir item)) + (blddir (get-text-property 0 'blddir item))) + ;; FIXME: File names are not regexps! + (when (or (and srcdir (string-match-p srcdir root)) + (and blddir (string-match-p blddir root))) + (push item history)))) + history)) (defun counsel--get-compile-candidates (&optional dir) "Return the list of compile commands.