Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Depend on built-in project.el. #24

Open
fernandodemorais-jf opened this issue Jun 25, 2022 · 2 comments
Open

Depend on built-in project.el. #24

fernandodemorais-jf opened this issue Jun 25, 2022 · 2 comments

Comments

@fernandodemorais-jf
Copy link

fernandodemorais-jf commented Jun 25, 2022

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!

@jayemar
Copy link

jayemar commented Apr 11, 2023

I would love to have the option to use project.el instead of projectile as I don't use projectile anywhere else. @fernandodemorais-jf if you already have working code I'd be happy to help you work on getting a merge request put together to submit to the project.

@jayemar
Copy link

jayemar commented Jan 3, 2025

I just created PR #28 to remove the dependency on projectile

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants