emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/arduino-mode a468e63 035/107: Add basic support for file v


From: ELPA Syncer
Subject: [nongnu] elpa/arduino-mode a468e63 035/107: Add basic support for file variables
Date: Sun, 29 Aug 2021 10:58:12 -0400 (EDT)

branch: elpa/arduino-mode
commit a468e636b9fd79a1b686e15909e1bdf8fee18208
Author: Bernd Wachter <bwachter-spam@lart.info>
Commit: Bernd Wachter <bwachter-spam@lart.info>

    Add basic support for file variables
---
 ede-arduino.el | 62 +++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 37 insertions(+), 25 deletions(-)

diff --git a/ede-arduino.el b/ede-arduino.el
index fe221d9..18c39cb 100644
--- a/ede-arduino.el
+++ b/ede-arduino.el
@@ -338,32 +338,44 @@ Argument COMMAND is the command to use for compiling the 
target."
   "Guess which libraries this sketch use."
   (interactive)
   (let* ((libs nil)
-         (libdir nil)
          (sketch (ede-arduino-guess-sketch))
-         (orig-buffer (get-file-buffer sketch))
-         (buff nil)
-         (tmp nil))
-    (save-current-buffer
-      (setq buff (find-file-noselect sketch))
-      (set-buffer buff)
-      (save-excursion
-        (goto-char (point-min))
-        (while (re-search-forward "#include <\\([[:word:]_]+\\).h>" nil t)
-          (setq tmp (match-string 1))
-          (unless (file-exists-p (concat tmp ".h"))
-            ;; TODO: realpath
-            (let* ((lib (match-string 1))
-                   (libdir (ede-arduino-libdir lib))
-                   (util (expand-file-name "utility" libdir)))
-              ;; Some libraries need a utility added to the library list.
-              (when (file-exists-p util)
-                (push (concat lib "/utility") libs))
-              ;; Push real lib after the utility
-              (push lib libs)
-              )))))
-    (when (not orig-buffer) (kill-buffer buff))
-    libs))
-
+         (sketch-buffer (find-file-noselect sketch))
+         (arduino-libraries
+          (save-current-buffer
+            (set-buffer sketch-buffer)
+            (if (boundp 'arduino-libraries)
+                arduino-libraries
+              nil)))
+         )
+    (cond
+     (arduino-libraries
+      (dolist (lib (split-string arduino-libraries))
+        (push lib libs)))
+     (t
+      (let* ((libdir nil)
+             (orig-buffer (get-file-buffer sketch))
+             (buff nil)
+             (tmp nil))
+        (save-current-buffer
+          (setq buff (find-file-noselect sketch))
+          (set-buffer buff)
+          (save-excursion
+            (goto-char (point-min))
+            (while (re-search-forward "#include <\\([[:word:]_]+\\).h>" nil t)
+              (setq tmp (match-string 1))
+              (unless (file-exists-p (concat tmp ".h"))
+                ;; TODO: realpath
+                (let* ((lib (match-string 1))
+                       (libdir (ede-arduino-libdir lib))
+                       (util (expand-file-name "utility" libdir)))
+                  ;; Some libraries need a utility added to the library list.
+                  (when (file-exists-p util)
+                    (push (concat lib "/utility") libs))
+                  ;; Push real lib after the utility
+                  (push lib libs)
+                  )))))
+        (when (not orig-buffer) (kill-buffer buff)))))
+        libs))
 
 (defun ede-arduino-guess-sketch ()
   "Return the file that is the core of the current project sketch."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]