zachmassia / platformio-mode Goto Github PK
View Code? Open in Web Editor NEWPlatformIO Integration for Emacs
License: GNU General Public License v3.0
PlatformIO Integration for Emacs
License: GNU General Public License v3.0
I have the mode enabled, but when I try to run the command inside the platfomio.ini buffer, the following error appears (I have the debug mode enabled):
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
locate-file-internal(nil ("./") nil #f(compiled-function (f) #<bytecode 0x400a65e5>))
locate-file(nil ("./") nil #f(compiled-function (f) #<bytecode 0x400a65e5>))
cd(nil)
compilation-start("platformio -f -c emacs run " platformio-compilation-mode)
platformio--exec("run ")
platformio--run(nil nil)
platformio-build(nil)
funcall-interactively(platformio-build nil)
call-interactively(platformio-build record nil)
command-execute(platformio-build record)
execute-extended-command(nil "platformio-build" "platformio-build")
funcall-interactively(execute-extended-command nil "platformio-build" "platformio-build")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
I am running platformio with the current (MELPA installed) platformio-mode.el. When compile errors are generated, the escape characters for cursor motion are causing problems with the error file,line matching in emacs. I can work around this in two ways so far:
export PLATFORMIO_NO_ANSI=true
export PLATFORMIO_FORCE_ANSI=false
resolves the issue.
platformio-mode.el
in the platformio--exec
function to run/build on line 81 from(cmd (concat "platformio -f -c emacs " target)))
(cmd (concat "platformio -f --no-ansi -c emacs " target)))
I was tying to figure out how to add the --no-ansi
flag to the platformio.ini file, but have had no luck with this yet.
I am running emacs 26.3 on Ubuntu20.04
Here is a list of my installed packages:
company-irony 1.1.0 installed
company-irony-c... 1.0.0 installed
csv-mode 1.15 installed
eldoc 1.11.0 installed
elpy 1.35.0 installed
flycheck 31 installed
flycheck-irony 0.1.0 installed
gnuplot 0.8.0 installed
lua-mode 20201010 installed
platformio-mode 0.2.2 installed
company 0.9.13 dependency
dash 2.18.1 dependency
epl 0.9 dependency
highlight-inden... 0.7.0 dependency
irony 1.4.0 dependency
pkg-info 0.6 dependency
projectile 2.3.0 dependency
pyvenv 1.21 dependency
s 1.12.0 dependency
yasnippet 0.14.0 dependency
Thank you for the nice package - Rick Sorensen
It seems there is a broken version dependancy with async package.
Hello,
Thank you for this package but I am getting an error every time I try to run a Command. It says that I am not a project.
My work around is to initialize a git repo for my project. How can I make projectile recognize the platformio.ini and assign it as a project?
Thank you
Not sure if this is a bug on my side with the setup but I have a flycheck error when using platformio-mode that states arduino.h cannot be found, but compile and upload still works.
This is the error when open emacs with debug-init:
Debugger entered--Lisp error: (void-function platformio-setup-compile-buffer)
(platformio-setup-compile-buffer)
eval-buffer(#<buffer *load*> nil "/home/brolin/.emacs" nil t) ; Reading at buffer position 9002
load-with-code-conversion("/home/brolin/.emacs" "/home/brolin/.emacs" t t)
load("~/.emacs" t t)
#[0 "�\205\262
Do you have an idea or any clue of what happens?
if platformio-mode support platformio's remote command would be really great.
i am developing firmware on WSL (cause emacs sucks on windws), and upload firmware using remote command cause my board attatched on remote server
There are no ;;;#autoload
markers for platformio-setup-compile-buffer
and platformio-conditionally-enable
I'm not sure if they are necessary for platformio-build
etc though.
Which makes it so the whole file must be loaded anyways.
It seems at some point last year, PlatformIO replaced .clang_complete
with .ccls
platformio/platformio-core@32181d1#diff-e738b6f558dbe86ed442f4b726ce803a44d5c26ed208c9f4c1f609f316a075b8
It no longer works with irony-mode
unfortunately. I've had to switch to ccls
and lsp-mode
to get things working again.
This is related to #10. I am also using spacemacs. No matter what I try, I can't get platformio-mode to use the correct directory when building. It always uses ~/code
, not ~/code/embedded/esp32/test/
(~/code/embedded/esp32/test/src/
is the current directory). I tried using cd
to correct the directory of the main.cpp buffer but it had no effect. I then went to the PIO buffer and changed the directory, but it had no effect. I tried the line (add-to-list 'projectile-project-root-files "platformio.ini")
in my .spacemacs, but it tells me Error in dotspacemacs/user-config: Symbol’s value as variable is void: projectile-project-root-files
.
I used describe-variable to look at default-directory
and it told me this:
default-directory is a variable defined in ‘C source code’.
Its value is "/home/vatrat/code/embedded/esp32/test/src/"
Local in buffer main.cpp; global value is nil
Automatically becomes permanently buffer-local when set.
This variable is safe as a file local variable if its value
satisfies the predicate ‘stringp’.
However, when I run C-c i b
or C-c i u
from the same file PIO shows
-*- mode: platformio-compilation; default-directory: "~/code/" -*-
PIOCompilation started at Mon Dec 4 19:16:17
platformio -f -c emacs run
Error: Please setup environments in `platformio.ini` file
PIOCompilation exited abnormally with code 1 at Mon Dec 4 19:16:18
Can you create a layer for Spacemacs?
Hello!
First of all, thanks for this great package! I've been using it for quite some time. Very neat and very useful!
Can we switch to depending on the project.el
(built-in), instead of the projectile.el
?
Currently, functions platformio-conditionally-enable
and platformio--exec
have been modified, in my local installation, to use project.el
and look like this:
(defun platformio-conditionally-enable ()
"Enable `platformio-mode' only when a `platformio.ini' file is present in project root."
(condition-case nil
(let* ((ini "platformio.ini")
(files (project-files (project-current t)))
(match (string-match-p ini (format "%s" files))))
(when match
(platformio-mode 1)))
(error nil)))
(defun platformio--exec (target)
"Call `platformio ... TARGET' in the root of the project."
(let* ((project (project-current t))
(default-directory (project-root project))
(buffers (project-buffers project))
(cmd (concat "platformio -f -c emacs " target)))
(unless default-directory
(user-error "Not in a project, aborting"))
(save-some-buffers (not compilation-ask-about-save)
(lambda ()
(when (member (current-buffer) buffers)
t)))
(compilation-start cmd 'platformio-compilation-mode)))
There are certainly more elegant ways of doing what I did above, but the functions do their job.
If I can suggest, perhaps the usage of projectile.el
could be preserved via some custom variable and some more code, for those who prefer it, but the mandatory dependency could come out with an implementation in the spirit of what I've been using in my settings.
What do you think?
Thanks!
I use clangd as my auto completion engine, how do we integrate it or is there not any support at all and how do we install and use new libraries?
platformio-mode uses the same miniterm as the pio CLI thats great except when invoking the device monitor one is told:
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
except all of these are key commands are clobbered by Emacs typically. So instead I have to switch to the buffer, delete the buffer, then delete the window. What am I missing? I'd love to be able to hit q to kill these windows, or something a little less clunky. Any ideas?
If I understand it correctly one has to run platformio init --ide emacs
to
regenerate the .clang_complete
file. Do you know if there some way to tell
platformio to only generate that specific template?
I'm all new to platformio, I have just used it with arduino a couple of hours
but it seems to me that something should maybe be added to this emacs package
for regenerating those clang completions to get irony-mode
working properly.
I've installed platformio-mode from MELPA. I notice that the Add
button in the platformio-boards menu ultimately invokes this code:
(defun platformio--exec (target)
"Call `platformio ... TARGET' in the root of the project."
(let ((default-directory (projectile-project-root))
(cmd (concat "platformio -f -c emacs " target)))
(unless default-directory
(user-error "Not in a projectile project, aborting"))
...
However, when in the *PlatformIO Boards* buffer, (projectile-project-root)
is (understandably) nil
, so the user-error is triggered, even when I've generated the menu from a file that's part of a Projectile project. For context, the default-directory
(not to be confused with your local variable) is my home directory. I've tried using the menu both with M-x
and from the Tools
menu.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.