GithubHelp home page GithubHelp logo

ur4ltz / company-arduino Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yuutayamada/company-arduino

0.0 1.0 0.0 9 KB

Company-mode for Arduino using irony-mode and company-c-headers

Emacs Lisp 100.00%

company-arduino's Introduction

Company-arduino.el

This package is a set of configuration to let you auto-completion by using irony-mode, company-irony and company-c-headers on arduino-mode.

Prerequisite

This package need irony-mode, company-irony and company-c-headers packages. Please install those packages first. But if you are using MELPA, package.el will install dependencies automatically when you install this package. Also, you need irony-mode's setting, so please follow the irony-mode's instruction (https://github.com/Sarcasm/irony-mode).

Although you may prepared Arduino environment, you need it as well to refer to Arduino's header files. You can download from Arduino's web site (http://www.arduino.cc/en/Main/Software)

Installation

This package can install from via MELPA. So if you already set up MELPA, you can install it by using:

M-x package-install RET company-arduino RET

Usage

Set $ARDUINO_HOME environment variable as Arduino IDE's installed directory.

export ARDUINO_HOME=$HOME/share/devkit/arduino-1.6.3

Then put following configurations to your .emacs or somewhere.

;; If you installed this package from without MELPA, you may need
;; `(require 'company-arduino)'.
  
;; Configuration for irony.el
;; Add arduino's include options to irony-mode's variable.
(add-hook 'irony-mode-hook 'company-arduino-turn-on)
  
;; Configuration for company-c-headers.el
;; The `company-arduino-append-include-dirs' function appends
;; Arduino's include directories to the default directories
;; if `default-directory' is inside `company-arduino-home'. Otherwise
;; just returns the default directories.
;; Please change the default include directories accordingly.
(defun my-company-c-headers-get-system-path ()
  "Return the system include path for the current buffer."
  (let ((default '("/usr/include/" "/usr/local/include/")))
    (company-arduino-append-include-dirs default t)))
(setq company-c-headers-path-system 'my-company-c-headers-get-system-path)
  
;; Activate irony-mode on arduino-mode
(add-hook 'arduino-mode-hook 'irony-mode)

If you are already using company-irony and company-c-headers, you might have same setting. That case, you can omit below setting.

(add-to-list 'company-backends 'company-irony)
(add-to-list 'company-backends 'company-c-headers)

Note

This package's default configuration is set for Linux environment, which I'm currently using, so if you are using different environment (Mac or Windows), please change the Arduino's directory paths accordingly. Related variables: company-arduino-sketch-directory-regex, company-arduino-home, company-arduino-header, company-arduino-includes-dirs and irony-arduino-includes-options.

Pull-Requests are welcome

I'm a beginner of Arduino, so if you notice something wrong or have opinion to improve this package, let me know via GitHub issues:)

company-arduino's People

Contributors

stardiviner avatar ur4ltz avatar yuutayamada avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.