ZachMassia / PlatformIO-Mode

PlatformIO Integration for Emacs
GNU General Public License v3.0
68 stars 20 forks source link

ansi cursor escape codes prevent finding source file for compiler errors #13

Open ricksorensen opened 3 years ago

ricksorensen commented 3 years ago

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:

  1. Modifying system .bashrc to define

    export PLATFORMIO_NO_ANSI=true 
    export PLATFORMIO_FORCE_ANSI=false

    resolves the issue.

  2. Changing command in platformio-mode.el in the platformio--exec function to run/build on line 81 from (cmd (concat "platformio -f -c emacs " target))) to (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

ZachMassia commented 3 years ago

Hi Rick,

Glad you like the package!

I had the morning off today so I finally got to sit down and take a look at this.

I'm guessing from the reading I did that there is no value in trying to keep these escape codes and properly format everything?

If so, I did find a few pages of interest:

--no-ansi seems to be the cleanest way of dealing with this.

They also provide the PLATFORMIO_NO_ANSI env var.

To be honest I don't even have platformio installed right now. I'll get everything set up on my end and see how the output looks.