aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Ludlam2021-01-10 10:37:50 -0500
committerStefan Monnier2021-01-11 16:20:57 -0500
commitbb4399f647f0977fe560283351b325d2816cd129 (patch)
tree55eb52bd5829f3a116dd46a9f36b522996ecc953
parent002f9dc091ecaabbed38917a13748dd0d893fffd (diff)
downloademacs-bb4399f647f0977fe560283351b325d2816cd129.tar.gz
emacs-bb4399f647f0977fe560283351b325d2816cd129.zip
cedet/ede/auto.el:
(ede-calc-fromconfig): New method. Support functions in addition to string matchers. (ede-dirmatch-installed, ede-do-dirmatch): Use `ede-calc-fromconfig' to do conversion. Author: Eric Ludlam <zappo@gnu.org>
-rw-r--r--lisp/cedet/ede/auto.el24
1 files changed, 11 insertions, 13 deletions
diff --git a/lisp/cedet/ede/auto.el b/lisp/cedet/ede/auto.el
index ee75e297993..e1417d7806c 100644
--- a/lisp/cedet/ede/auto.el
+++ b/lisp/cedet/ede/auto.el
@@ -64,24 +64,22 @@ location is varied dependent on other complex criteria, this class
64can be used to define that match without loading the specific project 64can be used to define that match without loading the specific project
65into memory.") 65into memory.")
66 66
67(cl-defmethod ede-calc-fromconfig ((dirmatch ede-project-autoload-dirmatch))
68 "Calculate the value of :fromconfig from DIRMATCH."
69 (let* ((fc (oref dirmatch fromconfig))
70 (found (cond ((stringp fc) fc)
71 ((functionp fc) (funcall fc))
72 (t (error "Unknown dirmatch object match style.")))))
73 (expand-file-name found)
74 ))
75
67(cl-defmethod ede-dirmatch-installed ((dirmatch ede-project-autoload-dirmatch)) 76(cl-defmethod ede-dirmatch-installed ((dirmatch ede-project-autoload-dirmatch))
68 "Return non-nil if the tool DIRMATCH might match is installed on the system." 77 "Return non-nil if the tool DIRMATCH might match is installed on the system."
69 (let ((fc (oref dirmatch fromconfig))) 78 (file-exists-p (ede-calc-fromconfig dirmatch)))
70
71 (cond
72 ;; If the thing to match is stored in a config file.
73 ((stringp fc)
74 (file-exists-p fc))
75
76 ;; Add new types of dirmatches here.
77
78 ;; Error for weird stuff
79 (t (error "Unknown dirmatch type.")))))
80
81 79
82(cl-defmethod ede-do-dirmatch ((dirmatch ede-project-autoload-dirmatch) file) 80(cl-defmethod ede-do-dirmatch ((dirmatch ede-project-autoload-dirmatch) file)
83 "Does DIRMATCH match the filename FILE." 81 "Does DIRMATCH match the filename FILE."
84 (let ((fc (oref dirmatch fromconfig))) 82 (let ((fc (ede-calc-fromconfig dirmatch)))
85 83
86 (cond 84 (cond
87 ;; If the thing to match is stored in a config file. 85 ;; If the thing to match is stored in a config file.