Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add protobuf layer #8234

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions layers/+lang/protobuf/README.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#+TITLE: Protocol Buffers layer
#+HTML_HEAD_EXTRA: <link rel="stylesheet" type="text/css" href="../../../css/readtheorg.css" />

* Table of Contents :TOC_4_org:noexport:
- [[Description][Description]]
- [[Features][Features]]
- [[Install][Install]]

* Description
Highlighting and syntax checking for [[https://developers.google.com/protocol-buffers/][Protocol Buffer]] files.

Uses Google's [[https://github.com/google/protobuf/blob/master/editors/protobuf-mode.el][protobuf-mode]] with [[https://github.com/edvorg/flycheck-protobuf][flycheck-protobuf]].

* Features
+ Syntax Highlighting
+ Syntax checking using Flycheck (=protoc= compiler must be available)
+ Correct Indentation and commenting
+ Quickly browse file contents using =M-x helm-imenu= and =M-x imenu=.

* Install
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =protobuf= to the existing =dotspacemacs-configuration-layers= list in this
file.
28 changes: 28 additions & 0 deletions layers/+lang/protobuf/packages.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
;;; packages.el --- Protocol Buffers Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Amol Mandhane <https://github.com/amol-mandhane>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3

(setq protobuf-packages
'(
flycheck
protobuf-mode
))

(defun protobuf/init-protobuf-mode ()
(use-package protobuf-mode
:init (progn
(defun spacemacs//setup-protobuf-imenu ()
"Setup imenu regex for protocol buffers."
(setq imenu-generic-expression '((nil "^[[:space:]]*\\(message\\|service\\|enum\\)[[:space:]]+\\([[:alnum:]]+\\)"
2))))
(add-hook 'protobuf-mode-hook 'spacemacs//setup-protobuf-imenu))))

(defun protobuf/post-init-flycheck ()
(spacemacs/add-flycheck-hook 'protobuf-mode))