Make `org-make-tags-matcher' lexical binding friendly

* lisp/org.el (org-make-tags-matcher): Return a function instead of
  a sexp.  Refactor code.
(org--matcher-tags-todo-only): New variable.  Replace `todo-only'
dynamic binding.
(org-scan-tags): Apply changes to `org-make-tags-matcher'.
(org-match-sparse-tree):
(org-map-entries): Use new variable.

* lisp/org-crypt.el (org-encrypt-entries):
(org-decrypt-entries): Use new variable.

* lisp/org-clock.el (org-clock-get-table-data): Apply changes to
  `org-make-tags-matcher'.

* lisp/org-agenda.el (org-tags-view): Use new variable.
This commit is contained in:
Nicolas Goaziou 2016-01-09 20:24:21 +01:00
parent 2ec03e18b8
commit 60339bd55f

View file

@ -252,9 +252,8 @@ to dead or no buffer."
(defun org-contacts-db () (defun org-contacts-db ()
"Return the latest Org Contacts Database." "Return the latest Org Contacts Database."
(let* (todo-only (let* ((org--matcher-tags-todo-only nil)
(contacts-matcher (contacts-matcher (cdr (org-make-tags-matcher org-contacts-matcher)))
(cdr (org-make-tags-matcher org-contacts-matcher)))
result) result)
(when (org-contacts-db-need-update-p) (when (org-contacts-db-need-update-p)
(let ((progress-reporter (let ((progress-reporter
@ -288,10 +287,9 @@ to dead or no buffer."
(error "File %s is not in `org-mode'" file)) (error "File %s is not in `org-mode'" file))
(setf result (setf result
(append result (append result
(org-scan-tags (org-scan-tags 'org-contacts-at-point
'org-contacts-at-point contacts-matcher
contacts-matcher org--matcher-tags-todo-only)))))
todo-only)))))
(progress-reporter-update progress-reporter (setq i (1+ i)))) (progress-reporter-update progress-reporter (setq i (1+ i))))
(setf org-contacts-db result (setf org-contacts-db result
org-contacts-last-update (current-time)) org-contacts-last-update (current-time))