Selaa lähdekoodia

Add custom.el and capnp mode

Remove C-a like M-m in setup-editing.el
master
ßingen 9 vuotta sitten
vanhempi
commit
fc25ae780f
5 muutettua tiedostoa jossa 118 lisäystä ja 2 poistoa
  1. +0
    -1
      .gitignore
  2. +38
    -0
      custom.el
  3. +2
    -0
      init.el
  4. +77
    -0
      lisp/capnp-mode.el
  5. +1
    -1
      lisp/setup-editing.el

+ 0
- 1
.gitignore Näytä tiedosto

@@ -2,7 +2,6 @@
/.emacs.desktop
/auto-save-list
/.session
/custom.el
*.elc
CVS
.svn

+ 38
- 0
custom.el Näytä tiedosto

@@ -0,0 +1,38 @@
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes (quote (sanityinc-tomorrow-night)))
'(custom-safe-themes (quote ("06f0b439b62164c6f8f84fdda32b62fb50b6d00e8b01c2208e55543a6337433a" "4cf3221feff536e2b3385209e9b9dc4c2e0818a69a1cdb4b522756bcdf4e00a4" default)))
'(org-startup-truncated nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;;(eval-after-load "js2-mode"
;; '(progn
;; (setq-default js2-basic-offset 4)
;;))

;;http://stackoverflow.com/a/803828
(desktop-save-mode 1)

; http://emacswiki.org/emacs/AutoIndentation#toc2
;;; Indentation for python

;; Ignoring electric indentation
(defun electric-indent-ignore-python (char)
"Ignore electric indentation for python-mode"
(if (equal major-mode 'python-mode)
'no-indent
nil))
(add-hook 'electric-indent-functions 'electric-indent-ignore-python)

;; Enter key executes newline-and-indent
(defun set-newline-and-indent ()
"Map the return key with `newline-and-indent'"
(local-set-key (kbd "RET") 'newline-and-indent))
(add-hook 'python-mode-hook 'set-newline-and-indent)

+ 2
- 0
init.el Näytä tiedosto

@@ -64,6 +64,8 @@
(require 'setup-cedet)
(require 'setup-editing)

(require 'capnp-mode)

(require 'init-crontab)
(require 'init-markdown)
(require 'init-csv)

+ 77
- 0
lisp/capnp-mode.el Näytä tiedosto

@@ -0,0 +1,77 @@
;;; 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))
;;

(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)

+ 1
- 1
lisp/setup-editing.el Näytä tiedosto

@@ -169,7 +169,7 @@ point reaches the beginning or end of the buffer, stop there."
(when (= orig-point (point))
(move-beginning-of-line 1))))

(global-set-key (kbd "C-a") 'prelude-move-beginning-of-line)
;(global-set-key (kbd "C-a") 'prelude-move-beginning-of-line)

(defadvice kill-ring-save (before slick-copy activate compile)
"When called interactively with no active region, copy a single

Loading…
Peruuta
Tallenna