[emacs] tweaked cc-mode for Obj-J, new colour scheme, fix up comments
This commit is contained in:
parent
0ed8e4e63b
commit
085b3ec812
1 changed files with 84 additions and 93 deletions
177
emacs
177
emacs
|
|
@ -8,9 +8,9 @@
|
||||||
(defvar linux-p (string-match "gnu/linux" (symbol-name system-type)))
|
(defvar linux-p (string-match "gnu/linux" (symbol-name system-type)))
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; setup load paths ;;
|
;; setup load paths
|
||||||
;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defun add-to-load-path (file)
|
(defun add-to-load-path (file)
|
||||||
"Add FILE to `load-path' if it is readable."
|
"Add FILE to `load-path' if it is readable."
|
||||||
|
|
@ -22,9 +22,9 @@
|
||||||
(mapcar 'add-to-load-path load-paths))
|
(mapcar 'add-to-load-path load-paths))
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; global config ;;
|
;; global config
|
||||||
;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(setq inhibit-startup-message t)
|
(setq inhibit-startup-message t)
|
||||||
(setq make-backup-files nil)
|
(setq make-backup-files nil)
|
||||||
|
|
@ -72,18 +72,30 @@
|
||||||
(global-hl-line-mode 1)
|
(global-hl-line-mode 1)
|
||||||
|
|
||||||
;; To customize the background color
|
;; To customize the background color
|
||||||
(set-face-background 'hl-line "#191919")
|
(set-face-background 'hl-line "#131310")
|
||||||
|
(set-face-foreground 'hl-line "#fbb")
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; minimap ;;
|
;; minimap
|
||||||
;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(require 'minimap)
|
(require 'minimap)
|
||||||
|
|
||||||
;;;;;;;
|
|
||||||
;; c ;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;;;;
|
;; c
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(setq c-mode-hook
|
||||||
|
(function (lambda ()
|
||||||
|
(setq indent-tabs-mode nil)
|
||||||
|
(setq c-indent-level 4))))
|
||||||
|
|
||||||
|
(setq objc-mode-hook
|
||||||
|
(function (lambda ()
|
||||||
|
(setq indent-tabs-mode nil)
|
||||||
|
(setq c-indent-level 4))))
|
||||||
|
|
||||||
;; Make a non-standard key binding. We can put this in
|
;; Make a non-standard key binding. We can put this in
|
||||||
;; c-mode-base-map because c-mode-map, c++-mode-map, and so on,
|
;; c-mode-base-map because c-mode-map, c++-mode-map, and so on,
|
||||||
|
|
@ -92,35 +104,16 @@
|
||||||
(define-key c-mode-base-map "\r" 'newline-and-indent)) ; auto indent after inserting newline
|
(define-key c-mode-base-map "\r" 'newline-and-indent)) ; auto indent after inserting newline
|
||||||
(add-hook 'c-initialization-hook 'sjs-c-initialization-hook)
|
(add-hook 'c-initialization-hook 'sjs-c-initialization-hook)
|
||||||
|
|
||||||
;; offset customizations not in my-c-style
|
|
||||||
;; This will take precedence over any setting of the syntactic symbol
|
|
||||||
;; made by a style.
|
|
||||||
;; (setq c-offsets-alist '((member-init-intro . ++)))
|
|
||||||
|
|
||||||
;; Create my personal style.
|
;; Create my personal style.
|
||||||
(defconst my-c-style
|
(defconst my-c-style
|
||||||
'("linux"
|
'("linux"
|
||||||
(c-tab-always-indent . t)
|
(c-tab-always-indent . t)
|
||||||
(c-basic-offset . 4)
|
(c-basic-offset . 4)
|
||||||
;; (c-comment-only-line-offset . 4)
|
(c-cleanup-list . (brace-else-brace
|
||||||
;; (c-hanging-braces-alist . ((substatement-open after)
|
brace-elseif-brace
|
||||||
;; (brace-list-open)))
|
brace-catch-brace
|
||||||
;; (c-hanging-colons-alist . ((member-init-intro before)
|
empty-defun-braces
|
||||||
;; (inher-intro)
|
defun-close-semi)))
|
||||||
;; (case-label after)
|
|
||||||
;; (label after)
|
|
||||||
;; (access-label after)))
|
|
||||||
(c-cleanup-list . (list-close-comma
|
|
||||||
compact-empty-funcall
|
|
||||||
one-liner-defun
|
|
||||||
defun-close-semi))
|
|
||||||
;; (c-offsets-alist . ((arglist-close . c-lineup-arglist)
|
|
||||||
;; (substatement-open . 0)
|
|
||||||
;; (case-label . 4)
|
|
||||||
;; (block-open . 0)
|
|
||||||
;; (knr-argdecl-intro . -)))
|
|
||||||
;; (c-echo-syntactic-information-p . t)
|
|
||||||
)
|
|
||||||
"how sjs likes his C")
|
"how sjs likes his C")
|
||||||
(c-add-style "sjs" my-c-style)
|
(c-add-style "sjs" my-c-style)
|
||||||
|
|
||||||
|
|
@ -129,9 +122,11 @@
|
||||||
;; set my personal style for the current buffer
|
;; set my personal style for the current buffer
|
||||||
(c-set-style "sjs")
|
(c-set-style "sjs")
|
||||||
;; other customizations
|
;; other customizations
|
||||||
(setq tab-width 8
|
(setq tab-width 4
|
||||||
;; this will make sure spaces are used instead of tabs
|
;; this will make sure spaces are used instead of tabs
|
||||||
indent-tabs-mode nil)
|
indent-tabs-mode nil
|
||||||
|
c-syntactic-indentation t
|
||||||
|
c-tab-always-indent t)
|
||||||
(c-toggle-auto-newline 1))
|
(c-toggle-auto-newline 1))
|
||||||
;; (setq skeleton-pair t)
|
;; (setq skeleton-pair t)
|
||||||
;; (setq skeleton-autowrap t)
|
;; (setq skeleton-autowrap t)
|
||||||
|
|
@ -141,9 +136,9 @@
|
||||||
(add-hook 'c-mode-common-hook 'sjs-c-mode-common-hook)
|
(add-hook 'c-mode-common-hook 'sjs-c-mode-common-hook)
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; shell ;;
|
;; shell
|
||||||
;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;; chmod u+x files that have a shebang line
|
;; chmod u+x files that have a shebang line
|
||||||
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
|
(add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p)
|
||||||
|
|
@ -153,9 +148,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; ruby ;;
|
;; ruby
|
||||||
;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;; Based on http://infolab.stanford.edu/~manku/dotemacs.html
|
;; Based on http://infolab.stanford.edu/~manku/dotemacs.html
|
||||||
(autoload 'ruby-mode "ruby-mode"
|
(autoload 'ruby-mode "ruby-mode"
|
||||||
|
|
@ -177,17 +172,17 @@
|
||||||
(add-to-list 'auto-mode-alist '(".irbrc$" . ruby-mode))
|
(add-to-list 'auto-mode-alist '(".irbrc$" . ruby-mode))
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; haskell ;;
|
;; haskell
|
||||||
;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;; (if (file-readable-p "~/.emacs.d/haskell/haskell-site-file.el")
|
;; (if (file-readable-p "~/.emacs.d/haskell/haskell-site-file.el")
|
||||||
;; (load "~/.emacs.d/haskell/haskell-site-file.el" nil t))
|
;; (load "~/.emacs.d/haskell/haskell-site-file.el" nil t))
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; rails ;;
|
;; rails
|
||||||
;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;(require 'rails)
|
;(require 'rails)
|
||||||
|
|
||||||
|
|
@ -196,9 +191,9 @@
|
||||||
(require 'tagify)
|
(require 'tagify)
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; javascript ;;
|
;; javascript
|
||||||
;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(autoload 'js2-mode "js2-mode" nil t)
|
(autoload 'js2-mode "js2-mode" nil t)
|
||||||
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
|
(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode))
|
||||||
|
|
@ -213,9 +208,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; objective j ;;
|
;; objective j
|
||||||
;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(require 'objj-mode)
|
(require 'objj-mode)
|
||||||
|
|
||||||
|
|
@ -228,13 +223,16 @@
|
||||||
;; (c-add-style "objc" sjs-objc-style)
|
;; (c-add-style "objc" sjs-objc-style)
|
||||||
(setq tab-width 4
|
(setq tab-width 4
|
||||||
c-basic-offset tab-width
|
c-basic-offset tab-width
|
||||||
c-hanging-semi&comma-criteria nil))
|
c-hanging-semi&comma-criteria nil
|
||||||
|
c-indent-level tab-width
|
||||||
|
indent-tabs-mode nil
|
||||||
|
c-offsets-alist '((statement-cont . *))))
|
||||||
(add-hook 'objc-mode-hook 'my-objc-mode-hook)
|
(add-hook 'objc-mode-hook 'my-objc-mode-hook)
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; mojo (webOS) ;;
|
;; mojo (webos)
|
||||||
;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(require 'mojo)
|
(require 'mojo)
|
||||||
|
|
||||||
|
|
@ -243,9 +241,9 @@
|
||||||
(mojo-setup-mode-hooks 'css-mode-hook 'js2-mode-hook 'espresso-mode-hook 'html-mode-hook)
|
(mojo-setup-mode-hooks 'css-mode-hook 'js2-mode-hook 'espresso-mode-hook 'html-mode-hook)
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; inferior javascript ;;
|
;; inferior javascript
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(require 'js-comint)
|
(require 'js-comint)
|
||||||
;(setq inferior-js-program-command "/usr/local/bin/v8")
|
;(setq inferior-js-program-command "/usr/local/bin/v8")
|
||||||
|
|
@ -259,18 +257,18 @@
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; python ;;
|
;; python
|
||||||
;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;; handy but ugly as fuck
|
;; handy but ugly as fuck
|
||||||
(autoload 'whitespace-mode "whitespace"
|
(autoload 'whitespace-mode "whitespace"
|
||||||
"Toggle whitespace visualization." t)
|
"Toggle whitespace visualization." t)
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; erlang ;;
|
;; erlang
|
||||||
;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(setq load-path (cons "/opt/local/lib/erlang/lib/tools-2.6.5/emacs" load-path))
|
(setq load-path (cons "/opt/local/lib/erlang/lib/tools-2.6.5/emacs" load-path))
|
||||||
(setq erlang-root-dir "/opt/local/lib/erlang/otp")
|
(setq erlang-root-dir "/opt/local/lib/erlang/otp")
|
||||||
|
|
@ -278,9 +276,9 @@
|
||||||
(require 'erlang-start)
|
(require 'erlang-start)
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; markup ;;
|
;; markup
|
||||||
;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;; (require 'textile-mode)
|
;; (require 'textile-mode)
|
||||||
;; (add-to-list 'auto-mode-alist '("\\.textile\\'" . textile-mode))
|
;; (add-to-list 'auto-mode-alist '("\\.textile\\'" . textile-mode))
|
||||||
|
|
@ -289,10 +287,9 @@
|
||||||
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
|
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;
|
;; lisp and scheme
|
||||||
;; lisp and scheme ;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
;; recognize my non-standard emacs config location
|
;; recognize my non-standard emacs config location
|
||||||
(add-to-list 'auto-mode-alist '("config/emacs$" . emacs-lisp-mode))
|
(add-to-list 'auto-mode-alist '("config/emacs$" . emacs-lisp-mode))
|
||||||
|
|
@ -313,9 +310,9 @@
|
||||||
(add-hook 'inferior-scheme-mode-hook (lambda () (inferior-slime-mode t)))
|
(add-hook 'inferior-scheme-mode-hook (lambda () (inferior-slime-mode t)))
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; key bindings ;;
|
;; key bindings
|
||||||
;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;; can't seem to un-hijack cmd-`, so make it do something useful
|
;; can't seem to un-hijack cmd-`, so make it do something useful
|
||||||
(global-set-key "\M-`" 'other-window)
|
(global-set-key "\M-`" 'other-window)
|
||||||
|
|
@ -351,7 +348,10 @@
|
||||||
|
|
||||||
(global-set-key [f5] 'compile)
|
(global-set-key [f5] 'compile)
|
||||||
|
|
||||||
;; utilities
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; utilities customizations
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defun duplicate-line (&optional arg)
|
(defun duplicate-line (&optional arg)
|
||||||
"Duplicate the current line."
|
"Duplicate the current line."
|
||||||
|
|
@ -401,18 +401,9 @@
|
||||||
(require 'color-theme)
|
(require 'color-theme)
|
||||||
|
|
||||||
;; dark themes
|
;; dark themes
|
||||||
;; (color-theme-arjen) ;; easy on the eyes, but sucks for Ruby
|
;; (color-theme-charcoal-black) ;; pastels, low contrast ***
|
||||||
;; (color-theme-billw) ;; bright yellow and white, decent for Ruby
|
;; (color-theme-midnight) ;; grey comments, so-so ***
|
||||||
;; (color-theme-charcoal-black) ;; pastels, low contrast, decent for Ruby
|
(color-theme-taylor) ;; beige text, orange comments ****
|
||||||
;; (color-theme-dark-laptop) ;; red comments, so-so, decent for Ruby
|
|
||||||
;; (color-theme-euphoria) ;; pink and green, not too shabby
|
|
||||||
;; (color-theme-ld-dark) ;; easy on the eyes, low contrast, not bad
|
|
||||||
(color-theme-midnight) ;; pretty nice, but very basic, good for Ruby
|
|
||||||
;; (color-theme-pok-wob) ;; white and yellow, kind of lame
|
|
||||||
;; (color-theme-simple-1) ;; red comments, white text
|
|
||||||
;; (color-theme-taming-mr-arneson) ;; blue text, red comments, status bar blends into document
|
|
||||||
;; (color-theme-taylor) ;; beige text, orange comments
|
|
||||||
;; (color-theme-tty-dark)
|
|
||||||
))
|
))
|
||||||
|
|
||||||
(defun totd ()
|
(defun totd ()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue