Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
6f45f963
Commit
6f45f963
authored
Jan 12, 2015
by
Brian Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added syntax highlighting for emacs
parent
defc469c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
0 deletions
+89
-0
CONTRIBUTORS
CONTRIBUTORS
+1
-0
README.md
highlighting/emacs/README.md
+13
-0
capnp-mode.el
highlighting/emacs/capnp-mode.el
+75
-0
No files found.
CONTRIBUTORS
View file @
6f45f963
...
@@ -9,6 +9,7 @@ Joshua Warner <joshuawarner32@gmail.com>: cmake build, AnyStruct/AnyList, other
...
@@ -9,6 +9,7 @@ Joshua Warner <joshuawarner32@gmail.com>: cmake build, AnyStruct/AnyList, other
Scott Purdy <scott@fer.io>: kj/std iostream interface
Scott Purdy <scott@fer.io>: kj/std iostream interface
Bryan Borham <bjboreham@gmail.com>: Initial MSVC support
Bryan Borham <bjboreham@gmail.com>: Initial MSVC support
Philip Quinn <p@partylemon.com>: cmake build and other assorted bits
Philip Quinn <p@partylemon.com>: cmake build and other assorted bits
Brian Taylor <el.wubo@gmail.com>: emacs syntax highlighting
This file does not list people who maintain their own Cap'n Proto
This file does not list people who maintain their own Cap'n Proto
implementations as separate projects. Those people are awesome too! :)
implementations as separate projects. Those people are awesome too! :)
highlighting/emacs/README.md
0 → 100644
View file @
6f45f963
Syntax Coloring for Emacs
=========================
How to use:
Add this to your .emacs file (altering the path to wherever your
capnproto directory lives):
```
elisp
(
add-to-list
'load-path
"~/src/capnproto/highlighting/emacs"
)
(
require
'capnp-mode
)
(
add-to-list
'auto-mode-alist
'
(
"\\.capnp\\'"
.
capnp-mode
))
```
highlighting/emacs/capnp-mode.el
0 → 100644
View file @
6f45f963
;;; capnp-mode.el --- major mode for editing Capn' Proto Files
;; This is free and unencumbered software released into the public domain.
;; Author: Brian Taylor <el.wubo@gmail.com>
;; Version: 1.0.0
;;; Commentary:
;; Provides basic syntax highlighting for capnp files.
;;
;; To use:
;;
;; Add something like this to your .emacs file:
;;
;; (add-to-list 'load-path "~/src/capnproto/highlighting/emacs")
;; (require 'capnp-mode)
;; (add-to-list 'auto-mode-alist '("\\.capnp\\'" . capnp-mode))
;;
;;; Code:
;; command to comment/uncomment text
(
defun
capnp-comment-dwim
(
arg
)
"Comment or uncomment current line or region in a smart way.
For detail, see `comment-dwim'."
(
interactive
"*P"
)
(
require
'newcomment
)
(
let
(
(
comment-start
"#"
)
(
comment-end
""
)
)
(
comment-dwim
arg
)))
(
defvar
capnp--syntax-table
(
let
((
syn-table
(
make-syntax-table
)))
;; bash style comment: “# …”
(
modify-syntax-entry
?#
"< b"
syn-table
)
(
modify-syntax-entry
?\n
"> b"
syn-table
)
syn-table
)
"Syntax table for `capnp-mode'."
)
(
defvar
capnp--keywords
'
(
"struct"
"enum"
"interface"
"union"
"import"
"using"
"const"
"annotation"
"extends"
"in"
"of"
"on"
"as"
"with"
"from"
"fixed"
)
"Keywords in `capnp-mode'."
)
(
defvar
capnp--types
'
(
"union"
"group"
"Void"
"Bool"
"Int8"
"Int16"
"Int32"
"Int64"
"UInt8"
"UInt16"
"UInt32"
"UInt64"
"Float32"
"Float64"
"Text"
"Data"
"AnyPointer"
"AnyStruct"
"Capability"
"List"
)
"Types in `capnp-mode'."
)
(
defvar
capnp--font-lock-keywords
`
(
(
,
(
regexp-opt
capnp--keywords
'words
)
.
font-lock-keyword-face
)
(
,
(
regexp-opt
capnp--types
'words
)
.
font-lock-type-face
)
(
"@\\w+"
.
font-lock-constant-face
))
"Font lock definitions in `capnp-mode'."
)
;;;###autoload
(
define-derived-mode
capnp-mode
prog-mode
"capn-mode is a major mode for editing capnp protocol files"
:syntax-table
capnp--syntax-table
(
setq
font-lock-defaults
'
((
capnp--font-lock-keywords
)))
(
setq
mode-name
"capnp"
)
(
define-key
capnp-mode-map
[remap
comment-dwim]
'capnp-comment-dwim
))
(
provide
'capnp-mode
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment