EMACS: init file is once again one big file
This commit is contained in:
parent
a7dd6805b2
commit
503e99197f
27 changed files with 419 additions and 13925 deletions
45
emacs
45
emacs
|
@ -1,45 +0,0 @@
|
|||
;; -*- mode: Emacs-Lisp; -*-
|
||||
(add-to-list 'load-path "~/.emacs.d/elisp")
|
||||
(add-to-list 'load-path "~/.emacs.d/naquadah-theme")
|
||||
(add-to-list 'load-path "~/.emacs.d/elisp/markdown-mode")
|
||||
(add-to-list 'load-path "~/.emacs.d/elisp/git-commit-mode")
|
||||
|
||||
(setq d-dir "~/.emacs.d/")
|
||||
(setq elisp-dir (concat d-dir "elisp/"))
|
||||
|
||||
(setq d-el-files (directory-files d-dir nil "^[0-9]\\{2\\}-\.*el$"))
|
||||
(setq elisp-el-files (directory-files elisp-dir nil "\\.el$"))
|
||||
|
||||
;; Compile 3rd party elisp files
|
||||
(byte-recompile-directory elisp-dir)
|
||||
(while elisp-el-files
|
||||
(let ((my-elisp-file-name (concat elisp-dir (car elisp-el-files))))
|
||||
(if (not (file-exists-p (concat my-elisp-file-name "c")))
|
||||
(byte-compile-file my-elisp-file-name))
|
||||
(setq elisp-el-files (cdr elisp-el-files))))
|
||||
|
||||
;; Compile my elisp files
|
||||
(byte-recompile-directory d-dir)
|
||||
(while d-el-files
|
||||
(let ((my-file-name (concat d-dir (car d-el-files))))
|
||||
(if (not (file-exists-p (concat my-file-name "c")))
|
||||
(byte-compile-file my-file-name))
|
||||
(load (substring my-file-name 0 (- (length my-file-name) 3)))
|
||||
(setq d-el-files (cdr d-el-files))))
|
||||
|
||||
(add-to-list 'compilation-finish-functions 'my-comp-finish-function)
|
||||
|
||||
(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.
|
||||
'(org-agenda-files (quote ("~/documents/org/main.org")))
|
||||
'(safe-local-variable-values (quote ((Mode . shell-script) (ispell-local-dictionary . nl)))))
|
||||
(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.
|
||||
)
|
||||
(put 'narrow-to-region 'disabled nil)
|
|
@ -1,40 +0,0 @@
|
|||
(defun what-face (pos)
|
||||
"Find out which face the current position uses"
|
||||
(interactive "d")
|
||||
(let ((face (or (get-char-property (point) 'read-face-name)
|
||||
(get-char-property (point) 'face))))
|
||||
(if face
|
||||
(message "Face: %s" face)
|
||||
(message "No face at %d" pos))))
|
||||
|
||||
(defun my-comp-finish-function (buf str)
|
||||
"Don't show compilation window if everything went ok"
|
||||
(if (string-match "exited abnormally" str)
|
||||
;; there were errors
|
||||
(message "compilation errors, press C-x ` to visit")
|
||||
;; no errors, make the compilation window go away in 0.5 seconds
|
||||
(run-at-time 0.5 nil 'delete-windows-on buf)
|
||||
(message "NO COMPILATION ERRORS!")))
|
||||
|
||||
(defun show-whitespace ()
|
||||
(interactive)
|
||||
(whitespace-mode t))
|
||||
|
||||
(defun fullscreen ()
|
||||
(interactive)
|
||||
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
|
||||
'(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
|
||||
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
|
||||
'(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)))
|
||||
|
||||
(defun c-toggle-header-source ()
|
||||
(interactive)
|
||||
(let ((ext (file-name-extension (buffer-file-name)))
|
||||
(noext (file-name-sans-extension (buffer-file-name))))
|
||||
(if (string= (substring ext 0 1) "c")
|
||||
(find-file (concat noext ".h"))
|
||||
(find-file (concat noext ".c")))))
|
||||
|
||||
(defun browse-to-current-file ()
|
||||
(interactive)
|
||||
(browse-url buffer-file-name))
|
|
@ -1,12 +0,0 @@
|
|||
(add-to-list 'auto-mode-alist '("\\.vala$" . vala-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.vapi$" . vala-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.cs$" . csharp-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.bat$" . batch-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.php[345]?$" . php-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . javascript-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.mdwn$" . markdown-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.markdown$" . markdown-mode))
|
||||
|
||||
(add-to-list 'file-coding-system-alist '("\\.vala$" . utf-8))
|
||||
(add-to-list 'file-coding-system-alist '("\\.vapi$" . utf-8))
|
|
@ -1,30 +0,0 @@
|
|||
;; Currently support for [ ] | & ! . + = - / % * , ( ) < > { } ? : ->
|
||||
(defun add-my-c-keywords (mode append)
|
||||
;; Add ! at the beginning of font lock
|
||||
(font-lock-add-keywords
|
||||
mode
|
||||
'(("\\([!()]\\)" 1 font-lock-operator-face)))
|
||||
;; Add the rest at the end of font lock
|
||||
(font-lock-add-keywords
|
||||
mode
|
||||
'(("\\(->\\|[\\[|.+=&/%*,{}:?<>-]\\|\\]\\)" 1 font-lock-operator-face)
|
||||
("\\(;\\)" 1 font-lock-end-statement)) append))
|
||||
|
||||
(defun add-my-php-keywords (mode)
|
||||
(add-my-c-keywords mode 1)
|
||||
(font-lock-add-keywords
|
||||
mode
|
||||
;; Currently support for =>
|
||||
'(("\\(\\=>\\)" 1 font-lock-operator-face))))
|
||||
|
||||
;(add-my-c-keywords 'c-mode 1)
|
||||
;(add-my-php-keywords 'php-mode)
|
||||
;(add-my-c-keywords 'javascript-mode nil)
|
||||
|
||||
;(make-face 'font-lock-operator-face)
|
||||
;(make-face 'font-lock-end-statement)
|
||||
;(defvar font-lock-operator-face 'font-lock-operator-face)
|
||||
;(defvar font-lock-end-statement 'font-lock-end-statement)
|
||||
|
||||
;(set-face-foreground 'font-lock-operator-face "#EDD400")
|
||||
;(set-face-foreground 'font-lock-end-statement "#888A85")
|
|
@ -1,4 +0,0 @@
|
|||
(global-set-key "\C-m" 'newline-and-indent)
|
||||
; Automatically indent on newline
|
||||
(global-set-key (kbd "C-x n r") 'narrow-to-region)
|
||||
(global-set-key (kbd "<f9>") 'compile)
|
|
@ -1,16 +0,0 @@
|
|||
(autoload 'vala-mode "vala-mode"
|
||||
"A Major mode for editing Vala files" t)
|
||||
(autoload 'csharp-mode "csharp-mode"
|
||||
"A Major mode for editing C# files" t)
|
||||
(autoload 'javascript-mode "javascript"
|
||||
"A Major mode for editing JavaScript files" t)
|
||||
(autoload 'sqlplus-mode "sqlplus"
|
||||
"A Major mode for communicating with Oracle" t)
|
||||
(autoload 'batch-mode "batch-mode"
|
||||
"A Major mode for editing Batch files" t)
|
||||
(autoload 'lua-mode "lua-mode"
|
||||
"A Major mode for editing Lua files" t)
|
||||
(autoload 'php-mode "php-mode-improved"
|
||||
"A Major mode for editing PHP files" t)
|
||||
(autoload 'graphviz-dot-mode "graphviz-dot-mode"
|
||||
"A Major mode for editing graphviz dot files" t)
|
|
@ -1,14 +0,0 @@
|
|||
(require 'naquadah-theme)
|
||||
|
||||
;; Extension to the naquadah theme
|
||||
(naquadah-theme-set-faces
|
||||
'naquadah
|
||||
|
||||
;; markdown-mode
|
||||
'(markdown-link-face (:inherit 'link))
|
||||
'(markdown-header-face-1 (:inherit 'org-level-1))
|
||||
'(markdown-header-face-2 (:inherit 'org-level-2))
|
||||
'(markdown-header-face-3 (:inherit 'org-level-3))
|
||||
'(markdown-header-face-4 (:inherit 'org-level-4))
|
||||
'(markdown-header-face-5 (:inherit 'org-level-5))
|
||||
'(markdown-header-face-6 (:inherit 'org-level-6)))
|
|
@ -1,55 +0,0 @@
|
|||
(add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-10:antialias=true"))
|
||||
|
||||
(setq-default indent-tabs-mode nil) ; spaces, no tabs
|
||||
(setq inhibit-startup-message t ; don't show welcome screen
|
||||
require-final-newline t ; always append a newline to a
|
||||
; file, if it doesn't have one
|
||||
font-lock-maximum-decoration t ; denotes my interest in maximum
|
||||
; possible fontification
|
||||
inhibit-default-init t ; don't load default init
|
||||
scroll-conservatively 10000 ; scroll only one line
|
||||
browse-url-browser-function 'browse-url-generic
|
||||
browse-url-generic-program "conkeror"
|
||||
whitespace-style '(face trailing)
|
||||
backup-directory-alist ; backup file location
|
||||
`((".*" .
|
||||
,temporary-file-directory))
|
||||
auto-save-file-name-transforms ; autosave file location
|
||||
`((".*" ,temporary-file-directory
|
||||
t)))
|
||||
|
||||
(if (not window-system)
|
||||
(setq linum-format "%d ")) ; add a space if we're in text
|
||||
; mode
|
||||
|
||||
(fset 'yes-or-no-p 'y-or-n-p) ; switch yes or no to y or n
|
||||
|
||||
(tool-bar-mode -1) ; no toolbar
|
||||
(menu-bar-mode -1) ; no menubar
|
||||
(scroll-bar-mode -1) ; no scrollbars
|
||||
(line-number-mode -1) ; don't show line number in
|
||||
; splitter
|
||||
(global-linum-mode t) ; Show line numbers in gutter
|
||||
(column-number-mode t) ; show column number in splitter
|
||||
(global-font-lock-mode t) ; show syntax highlighting, old
|
||||
(delete-selection-mode t) ; delete selection upon typing
|
||||
(show-paren-mode t) ; show the opposite paren
|
||||
|
||||
(defun buffer-major-mode (buffer-or-string)
|
||||
(with-current-buffer buffer-or-string major-mode))
|
||||
|
||||
;; Byte-compile elisp files on save
|
||||
(add-hook 'before-save-hook
|
||||
(lambda ()
|
||||
(if (not (eq (buffer-major-mode (current-buffer))
|
||||
'markdown-mode))
|
||||
(delete-trailing-whitespace))))
|
||||
(add-hook 'after-save-hook
|
||||
(lambda ()
|
||||
(let ((fname (buffer-file-name)))
|
||||
(let ((suffix (file-name-extension fname)))
|
||||
(if (string-equal suffix "el")
|
||||
(byte-compile-file fname))))))
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(fullscreen)))
|
|
@ -1,2 +0,0 @@
|
|||
(require 'autopair)
|
||||
(autopair-global-mode)
|
|
@ -1,9 +0,0 @@
|
|||
(add-hook 'c-mode-hook
|
||||
(lambda ()
|
||||
(local-set-key [f8] 'c-toggle-header-source)
|
||||
(local-set-key "\C-m"
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(c-indent-new-comment-line)
|
||||
(c-indent-line-or-region)))
|
||||
(local-set-key [C-return] 'newline)))
|
|
@ -1,6 +0,0 @@
|
|||
(autoload 'cmake-mode "cmake-mode"
|
||||
"A major-mode for editing CMake sources" t)
|
||||
(setq auto-mode-alist
|
||||
(append '(("CMakeLists\\.txt\\'" . cmake-mode)
|
||||
("\\.cmake\\'" . cmake-mode))
|
||||
auto-mode-alist))
|
|
@ -1,9 +0,0 @@
|
|||
(require 'column-marker)
|
||||
|
||||
(defun set-column-marker ()
|
||||
(column-marker-1 73)
|
||||
(column-marker-2 81))
|
||||
|
||||
(add-hook 'c-mode-hook 'set-column-marker)
|
||||
(add-hook 'emacs-lisp-mode-hook 'set-column-marker)
|
||||
(add-hook 'html-mode-hook 'set-column-marker)
|
|
@ -1,5 +0,0 @@
|
|||
(require 'git-commit)
|
||||
|
||||
(add-hook 'git-commit-mode-hook
|
||||
(lambda ()
|
||||
(auto-fill-mode)))
|
|
@ -1,4 +0,0 @@
|
|||
(add-hook 'html-mode-hook
|
||||
(lambda ()
|
||||
(local-set-key [f9] 'browse-to-current-file)
|
||||
(auto-fill-mode)))
|
|
@ -1,10 +0,0 @@
|
|||
(if window-system
|
||||
(progn
|
||||
(require 'tabbar)
|
||||
(require 'ide-skel)
|
||||
|
||||
(global-set-key [f10] 'ide-skel-toggle-left-view-window)
|
||||
(global-set-key [f11] 'ide-skel-toggle-bottom-view-window)
|
||||
(global-set-key [f12] 'ide-skel-toggle-right-view-window)
|
||||
(global-set-key [C-prior] 'tabbar-backward)
|
||||
(global-set-key [C-next] 'tabbar-forward)))
|
|
@ -1,6 +0,0 @@
|
|||
(autoload 'markdown-mode "markdown-mode"
|
||||
"Major mode for editing Markdown files" t)
|
||||
|
||||
(add-hook 'markdown-mode-hook (lambda ()
|
||||
(whitespace-mode)
|
||||
(auto-fill-mode)))
|
|
@ -1,38 +0,0 @@
|
|||
(require 'org-crypt)
|
||||
|
||||
(setq org-todo-keywords '((sequence "TODO(t)"
|
||||
"IN PROGRESS(p)"
|
||||
"WAITING(w@/!)"
|
||||
"|"
|
||||
"DONE(d!/!)"
|
||||
"CANCELLED(c@/!)")))
|
||||
(setq org-ditaa-jar-path "/usr/share/java/ditaa/ditaa-0_9.jar")
|
||||
(setq org-babel-load-languages '((ditaa . t)))
|
||||
(setq org-confirm-babel-evaluate nil)
|
||||
(setq org-tags-exclude-from-inheritance '("crypt"))
|
||||
(setq org-crypt-key "33E8CC1CC4")
|
||||
; GPG key used for encryption
|
||||
(setq org-use-fast-todo-selection t)
|
||||
(setq org-default-notes-file (concat org-directory "/notes.org"))
|
||||
(setq org-refile-targets '((org-agenda-files :maxlevel . 5)
|
||||
(nil :maxlevel . 5)))
|
||||
(setq org-outline-path-complete-in-steps t)
|
||||
|
||||
(setq org-todo-keyword-faces
|
||||
'(("TODO" :foreground "red" :weight bold)
|
||||
("IN PROGRESS" :foreground "yellow" :weight bold)
|
||||
("DONE" :foreground "forest green" :weight bold)
|
||||
("WAITING" :foreground "orange" :weight bold)
|
||||
("CANCELLED" :foreground "orangered" :weight bold)))
|
||||
|
||||
(global-set-key "\C-cl" 'org-store-link)
|
||||
(global-set-key "\C-cc" 'org-capture)
|
||||
(global-set-key "\C-ca" 'org-agenda)
|
||||
|
||||
;; Encrypt all entries before saving
|
||||
(org-crypt-use-before-save-magic)
|
||||
|
||||
(add-hook 'org-mode-hook
|
||||
(lambda ()
|
||||
(flyspell-mode 1)
|
||||
(auto-fill-mode 1)))
|
|
@ -1,3 +0,0 @@
|
|||
(add-hook 'php-mode-hook
|
||||
(lambda ()
|
||||
(setq php-warn-if-mumamo-off nil)))
|
|
@ -1,6 +0,0 @@
|
|||
(require 'rainbow-delimiters)
|
||||
|
||||
(add-hook 'c-mode-hook 'rainbow-delimiters-mode)
|
||||
(add-hook 'emacs-lisp-mode-hook 'rainbow-delimiters-mode)
|
||||
(add-hook 'javascript-mode-hook 'rainbow-delimiters-mode)
|
||||
(add-hook 'python-mode-hook 'rainbow-delimiters-mode)
|
|
@ -1,6 +0,0 @@
|
|||
(autoload 'rainbow-mode "rainbow-mode"
|
||||
"A Minor mode for showing colors inline" t)
|
||||
|
||||
(add-hook 'css-mode-hook
|
||||
(lambda ()
|
||||
(rainbow-mode)))
|
|
@ -1,4 +0,0 @@
|
|||
(require 'uniquify)
|
||||
|
||||
; reverse uniquify file names
|
||||
(setq uniquify-buffer-name-style 'reverse)
|
|
@ -1,15 +0,0 @@
|
|||
;; Test for frame fonts
|
||||
(defun setup-system-frame-colours (&rest frame)
|
||||
(let ((f (if (car frame)
|
||||
(car frame)
|
||||
(selected-frame))))
|
||||
(progn
|
||||
(set-frame-font "-*-tamsyn-medium-*-*-*-15-*-*-*-*-80-*-*"))))
|
||||
(require 'server)
|
||||
(defadvice server-create-window-system-frame
|
||||
(after set-system-frame-colours ())
|
||||
"Set custom frame colours when creating the first frame on a display"
|
||||
(message "Running after frame-initialize")
|
||||
(setup-system-frame-colours))
|
||||
(ad-activate 'server-create-window-system-frame)
|
||||
(add-hook 'after-make-frame-functions 'setup-system-frame-colours t)
|
|
@ -1,13 +0,0 @@
|
|||
(require 'org-publish)
|
||||
(setq org-publish-project-alist
|
||||
'(("lxcoding-docs"
|
||||
:base-directory "~/devel/lxcoding-docs/"
|
||||
:base-extension "org"
|
||||
:publishing-directory "~/lxcoding-docs-test/"
|
||||
:recursive t
|
||||
:publishing-function org-publish-org-to-html
|
||||
:headline-levels
|
||||
:auto-preamble t
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "sitemap.org"
|
||||
:sitemap-title "docs sitemap")))
|
|
@ -1,12 +0,0 @@
|
|||
(define-skeleton cmake-project-skeleton
|
||||
"A cmake project template file"
|
||||
"Name: "
|
||||
"cmake_minimum_required(VERSION 2.6)\n"
|
||||
"project(" str ")\n"
|
||||
"\n"
|
||||
"set(" str "_VERSION_MAJOR 0)\n"
|
||||
"set(" str "_VERSION_MINOR 0)\n"
|
||||
"set(" str "_VERSION_PATCH 0)\n"
|
||||
"\n"
|
||||
"set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})\n"
|
||||
"add_subdirectory(src)")
|
|
@ -1,22 +0,0 @@
|
|||
(eval-when-compile
|
||||
(require 'color-theme))
|
||||
|
||||
(defun color-theme-example ()
|
||||
"Example theme. Carbon copy of color-theme-gnome contributed by Jonadab."
|
||||
(interactive)
|
||||
(color-theme-install
|
||||
'(color-theme-example
|
||||
((foreground-color . "wheat")
|
||||
(background-color . "darkslategrey")
|
||||
(background-mode . dark))
|
||||
(default ((t (nil))))
|
||||
(region ((t (:foreground "cyan" :background "dark cyan"))))
|
||||
(underline ((t (:foreground "yellow" :underline t))))
|
||||
(modeline ((t (:foreground "dark cyan" :background "wheat"))))
|
||||
(modeline-buffer-id ((t (:foreground "dark cyan" :background "wheat"))))
|
||||
(modeline-mousable ((t (:foreground "dark cyan" :background "wheat"))))
|
||||
(modeline-mousable-minor-mode ((t (:foreground "dark cyan" :background "wheat"))))
|
||||
(italic ((t (:foreground "dark red" :italic t))))
|
||||
(bold-italic ((t (:foreground "dark red" :bold t :italic t))))
|
||||
(font-lock-comment-face ((t (:foreground "Firebrick"))))
|
||||
(bold ((t (:bold)))))))
|
File diff suppressed because it is too large
Load diff
419
emacs.el
Normal file
419
emacs.el
Normal file
|
@ -0,0 +1,419 @@
|
|||
;; -*- mode: Emacs-Lisp; -*-
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; LOAD-PATHS ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(add-to-list 'load-path "~/.emacs.d/elisp")
|
||||
(add-to-list 'load-path "~/.emacs.d/naquadah-theme")
|
||||
(add-to-list 'load-path "~/.emacs.d/elisp/markdown-mode")
|
||||
(add-to-list 'load-path "~/.emacs.d/elisp/git-commit-mode")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; REQUIRES ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(require 'naquadah-theme)
|
||||
(require 'autopair)
|
||||
(require 'column-marker)
|
||||
(require 'git-commit)
|
||||
(require 'org-crypt)
|
||||
(require 'rainbow-delimiters)
|
||||
(require 'uniquify)
|
||||
(require 'server)
|
||||
(require 'org-publish)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; AUTOLOADS ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(autoload 'vala-mode "vala-mode"
|
||||
"A Major mode for editing Vala files" t)
|
||||
(autoload 'csharp-mode "csharp-mode"
|
||||
"A Major mode for editing C# files" t)
|
||||
(autoload 'javascript-mode "javascript"
|
||||
"A Major mode for editing JavaScript files" t)
|
||||
(autoload 'sqlplus-mode "sqlplus"
|
||||
"A Major mode for communicating with Oracle" t)
|
||||
(autoload 'batch-mode "batch-mode"
|
||||
"A Major mode for editing Batch files" t)
|
||||
(autoload 'lua-mode "lua-mode"
|
||||
"A Major mode for editing Lua files" t)
|
||||
(autoload 'php-mode "php-mode-improved"
|
||||
"A Major mode for editing PHP files" t)
|
||||
(autoload 'graphviz-dot-mode "graphviz-dot-mode"
|
||||
"A Major mode for editing graphviz dot files" t)
|
||||
(autoload 'cmake-mode "cmake-mode"
|
||||
"A major-mode for editing CMake sources" t)
|
||||
(autoload 'markdown-mode "markdown-mode"
|
||||
"Major mode for editing Markdown files" t)
|
||||
(autoload 'rainbow-mode "rainbow-mode"
|
||||
"A Minor mode for showing colors inline" t)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; DEFUNS ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(defun what-face (pos)
|
||||
"Find out which face the current position uses"
|
||||
(interactive "d")
|
||||
(let ((face (or (get-char-property (point) 'read-face-name)
|
||||
(get-char-property (point) 'face))))
|
||||
(if face
|
||||
(message "Face: %s" face)
|
||||
(message "No face at %d" pos))))
|
||||
|
||||
(defun my-comp-finish-function (buf str)
|
||||
"Don't show compilation window if everything went ok"
|
||||
(if (string-match "exited abnormally" str)
|
||||
;; there were errors
|
||||
(message "compilation errors, press C-x ` to visit")
|
||||
;; no errors, make the compilation window go away in 0.5 seconds
|
||||
(run-at-time 0.5 nil 'delete-windows-on buf)
|
||||
(message "NO COMPILATION ERRORS!")))
|
||||
|
||||
(defun fullscreen ()
|
||||
"Fill the entire screen with emacs"
|
||||
(interactive)
|
||||
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
|
||||
'(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
|
||||
(x-send-client-message nil 0 nil "_NET_WM_STATE" 32
|
||||
'(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)))
|
||||
|
||||
(defun c-toggle-header-source ()
|
||||
"Toggle between a C source and header file"
|
||||
(interactive)
|
||||
(let ((ext (file-name-extension (buffer-file-name)))
|
||||
(noext (file-name-sans-extension (buffer-file-name))))
|
||||
(if (string= (substring ext 0 1) "c")
|
||||
(find-file (concat noext ".h"))
|
||||
(find-file (concat noext ".c")))))
|
||||
|
||||
(defun browse-to-current-file ()
|
||||
"Show current file in browser"
|
||||
(interactive)
|
||||
(browse-url buffer-file-name))
|
||||
|
||||
(defun comment-line ()
|
||||
"Toggle comment on a line"
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(insert "//")))
|
||||
|
||||
(defun add-php-keywords ()
|
||||
"Designed for c and c-style languages
|
||||
|
||||
Currently adds | & ! . + = - / % * , < > ? : ->"
|
||||
;; Add ! at the beginning of font lock
|
||||
(font-lock-add-keywords
|
||||
'php-mode
|
||||
'(("\\([!]\\|\\=>\\)" 1 font-lock-operator-face)))
|
||||
;; Add the rest at the end of font lock
|
||||
(font-lock-add-keywords
|
||||
'php-mode
|
||||
'(("\\(->\\|[|.+=&/%*,:?<>-]\\)" 1 font-lock-operator-face)
|
||||
("\\(;\\)" 1 font-lock-end-statement)) 1))
|
||||
|
||||
(defun add-html-keywords ()
|
||||
"Designed for html, show some smarty tags"
|
||||
(font-lock-add-keywords
|
||||
'html-mode
|
||||
'(("{\\(\\*.*\\*\\)}" 1 font-comment-face)
|
||||
("{\\/?\\(extends\\|block\\|foreach\\|if\\)"
|
||||
1 font-lock-builtin-face)
|
||||
("\\$\\(\\(?:\\sw\\|\\s_\\)+\\)\\(?:|\\(\\(?:\\sw\\|\\s_\\)+\\):\\)"
|
||||
(1 font-lock-variable-name-face)
|
||||
(2 font-lock-function-name-face))
|
||||
("\\$\\(\\(?:\\sw\\|\\s_\\)+\\)"
|
||||
1 font-lock-variable-name-face)
|
||||
("{\\(\\(?:\\sw\\|\\s_\\)+\\).*}"
|
||||
1 font-lock-function-name-face))))
|
||||
|
||||
(defun buffer-major-mode (buffer-or-string)
|
||||
"Find out which major-mode is currently used"
|
||||
(with-current-buffer buffer-or-string major-mode))
|
||||
|
||||
(defun set-column-marker ()
|
||||
"Default column markers"
|
||||
(column-marker-1 73)
|
||||
(column-marker-2 81))
|
||||
|
||||
(defun setup-system-frame-colours (&rest frame)
|
||||
(let ((f (if (car frame)
|
||||
(car frame)
|
||||
(selected-frame))))
|
||||
(progn
|
||||
(set-frame-font "-*-tamsyn-medium-*-*-*-15-*-*-*-*-80-*-*"))))
|
||||
|
||||
(defun show-init-sections ()
|
||||
(interactive)
|
||||
(occur ";;\s +.*\s +;;")
|
||||
(other-window 1))
|
||||
|
||||
(defun list-functions ()
|
||||
(interactive)
|
||||
(occur
|
||||
"\(?:\(?:private\|protected\|public\) \)?function \(?:\sw\)+(\sw*)"))
|
||||
|
||||
(defun insert-init-title (title width)
|
||||
(interactive "stitle: \nnwidth: ")
|
||||
(insert-char ?\; width)
|
||||
(insert "\n;;")
|
||||
(insert-char ?\s (floor (/ (- (- width 4.0) (length title)) 2)))
|
||||
(insert title)
|
||||
(insert-char ?\s (ceiling (/ (- (- width 4.0) (length title)) 2)))
|
||||
(insert ";;\n")
|
||||
(insert-char ?\; width))
|
||||
|
||||
(defun x-init ()
|
||||
"Start ide-skel and set some keys")
|
||||
|
||||
(defun cli-init ()
|
||||
"Add a space to the linum column"
|
||||
(setq linum-format "%d "))
|
||||
|
||||
(defun on-before-save ()
|
||||
(if (not (eq (buffer-major-mode (current-buffer)) 'markdown-mode))
|
||||
(delete-trailing-whitespace)))
|
||||
|
||||
(defun on-after-save ()
|
||||
(let ((fname (buffer-file-name)))
|
||||
(let ((suffix (file-name-extension fname)))
|
||||
(if (string-equal suffix "el")
|
||||
(byte-compile-file fname)))))
|
||||
|
||||
(defun on-c-mode ()
|
||||
(local-set-key [f8] 'c-toggle-header-source)
|
||||
(local-set-key [f9] 'compile)
|
||||
(local-set-key [C-m] 'newline-and-indent)
|
||||
(local-set-key [C-return] 'newline)
|
||||
(set-column-marker)
|
||||
(rainbow-delimiters-mode))
|
||||
|
||||
(defun on-emacs-lisp-mode ()
|
||||
(set-column-marker)
|
||||
(rainbow-delimiters-mode))
|
||||
|
||||
(defun on-html-mode ()
|
||||
(local-set-key [f9] 'browse-to-current-file)
|
||||
(auto-fill-mode)
|
||||
(set-column-marker))
|
||||
|
||||
(defun on-markdown-mode ()
|
||||
(whitespace-mode)
|
||||
(auto-fill-mode))
|
||||
|
||||
(defun on-org-mode ()
|
||||
(flyspell-mode 1)
|
||||
(auto-fill-mode 1))
|
||||
|
||||
(defun on-php-mode ()
|
||||
(defvar php-warn-if-mumamo-off nil)
|
||||
(setq case-fold-search t)
|
||||
(c-set-offset 'arglist-intro '+)
|
||||
(c-set-offset 'arglist-close '0)
|
||||
(column-marker-1 76)
|
||||
(column-marker-2 81)
|
||||
(local-set-key [f6] 'comment-line))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; VARIABLES ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(defvar font-lock-operator-face 'font-lock-operator-face)
|
||||
(defvar font-lock-end-statement 'font-lock-end-statement)
|
||||
|
||||
(defadvice server-create-window-system-frame
|
||||
(after set-system-frame-colours ())
|
||||
"Set custom frame colours when creating the first frame on a display"
|
||||
(message "Running after frame-initialize")
|
||||
(setup-system-frame-colours))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; FILE ASSOCIATIONS ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(add-to-list 'auto-mode-alist '("\\.vala$" . vala-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.vapi$" . vala-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.cs$" . csharp-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.bat$" . batch-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.lua$" . lua-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.php[345]?$" . php-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . javascript-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.m\\(ark\\)?do?wn$". markdown-mode))
|
||||
(add-to-list 'auto-mode-alist '("CMakeLists\\.txt$" . cmake-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.cmake$" . cmake-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.css$" . css-mode))
|
||||
(add-to-list 'auto-mode-alist '("mutt-cloud-" . message-mode))
|
||||
|
||||
(add-to-list 'file-coding-system-alist '("\\.vala$" . utf-8))
|
||||
(add-to-list 'file-coding-system-alist '("\\.vapi$" . utf-8))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; KEYBINDS ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(global-set-key "\C-m" 'newline-and-indent)
|
||||
(global-set-key (kbd "C-x n r") 'narrow-to-region)
|
||||
(global-set-key "\C-cl" 'org-store-link)
|
||||
(global-set-key "\C-cc" 'org-capture)
|
||||
(global-set-key "\C-ca" 'org-agenda)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; THEME SETTINGS ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(naquadah-theme-set-faces
|
||||
'naquadah
|
||||
|
||||
;; markdown-mode
|
||||
'(markdown-link-face (:inherit 'link))
|
||||
'(markdown-header-face-1 (:inherit 'org-level-1))
|
||||
'(markdown-header-face-2 (:inherit 'org-level-2))
|
||||
'(markdown-header-face-3 (:inherit 'org-level-3))
|
||||
'(markdown-header-face-4 (:inherit 'org-level-4))
|
||||
'(markdown-header-face-5 (:inherit 'org-level-5))
|
||||
'(markdown-header-face-6 (:inherit 'org-level-6)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; SETTINGS ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(setq-default indent-tabs-mode nil) ; spaces, no tabs
|
||||
|
||||
(setq
|
||||
inhibit-startup-message t
|
||||
require-final-newline t
|
||||
inhibit-default-init t
|
||||
scroll-conservatively 101 ; scroll only one line
|
||||
browse-url-browser-function 'browse-url-generic
|
||||
browse-url-generic-program "conkeror"
|
||||
whitespace-style '(face trailing)
|
||||
uniquify-buffer-name-style 'reverse
|
||||
org-confirm-babel-evaluate nil
|
||||
org-tags-exclude-from-inheritance '("crypt")
|
||||
org-crypt-key "33E8CC1CC4"
|
||||
org-use-fast-todo-selection t
|
||||
org-default-notes-file (concat org-directory "/notes.org")
|
||||
org-ditaa-jar-path "/usr/share/java/ditaa/ditaa-0_9.jar"
|
||||
jit-lock-defer-time 0.2
|
||||
|
||||
frame-title-format
|
||||
'(:eval
|
||||
(concat "emacs: " (buffer-name)))
|
||||
|
||||
backup-directory-alist ; backup file location
|
||||
`((".*" . ,temporary-file-directory))
|
||||
|
||||
auto-save-file-name-transforms ; autosave file location
|
||||
`((".*" ,temporary-file-directory t))
|
||||
|
||||
default-frame-alist ; default frame settings
|
||||
(append '((font . "DejaVu Sans Mono-10:antialias=true")))
|
||||
|
||||
org-todo-keywords
|
||||
'((sequence "TODO(t)"
|
||||
"IN PROGRESS(p)"
|
||||
"WAITING(w@/!)"
|
||||
"|"
|
||||
"DONE(d!/!)"
|
||||
"CANCELLED(c@/!)"))
|
||||
|
||||
org-babel-load-languages
|
||||
'((ditaa . t))
|
||||
|
||||
org-refile-targets
|
||||
'((org-agenda-files :maxlevel . 5)
|
||||
(nil :maxlevel . 5))
|
||||
org-outline-path-complete-in-steps t
|
||||
|
||||
org-todo-keyword-faces
|
||||
'(("TODO" :foreground "red" :weight bold)
|
||||
("IN PROGRESS" :foreground "yellow" :weight bold)
|
||||
("DONE" :foreground "forest green" :weight bold)
|
||||
("WAITING" :foreground "orange" :weight bold)
|
||||
("CANCELLED" :foreground "orangered" :weight bold))
|
||||
|
||||
org-publish-project-alist
|
||||
'(("lxcoding-docs"
|
||||
:base-directory "~/devel/lxcoding-docs/"
|
||||
:base-extension "org"
|
||||
:publishing-directory "~/lxcoding-docs-test/"
|
||||
:recursive t
|
||||
:publishing-function org-publish-org-to-html
|
||||
:headline-levels
|
||||
:auto-preamble t
|
||||
:auto-sitemap t
|
||||
:sitemap-filename "sitemap.org"
|
||||
:sitemap-title "docs sitemap")))
|
||||
|
||||
(if window-system (x-init) (cli-init))
|
||||
|
||||
(fset 'yes-or-no-p 'y-or-n-p) ; switch yes or no to y or n
|
||||
|
||||
(tool-bar-mode -1) ; no toolbar
|
||||
(menu-bar-mode -1) ; no menubar
|
||||
(scroll-bar-mode -1) ; no scrollbars
|
||||
(line-number-mode -1) ; don't show line number in splitter
|
||||
(global-linum-mode t) ; Show line numbers in gutter
|
||||
(column-number-mode t) ; show column number in splitter
|
||||
(global-font-lock-mode t) ; show syntax highlighting, old
|
||||
(delete-selection-mode t) ; delete selection upon typing
|
||||
(show-paren-mode t) ; show the opposite paren
|
||||
(autopair-global-mode) ; automatically add the other
|
||||
; delimiter
|
||||
|
||||
(add-to-list 'compilation-finish-functions 'my-comp-finish-function)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; HOOKS ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(add-hook 'before-save-hook 'on-before-save)
|
||||
(add-hook 'after-save-hook 'on-after-save)
|
||||
(add-hook 'c-mode-hook 'on-c-mode)
|
||||
(add-hook 'emacs-lisp-mode-hook 'on-emacs-lisp-mode)
|
||||
(add-hook 'html-mode-hook 'on-html-mode)
|
||||
(add-hook 'markdown-mode-hook 'on-markdown-mode)
|
||||
(add-hook 'org-mode-hook 'on-org-mode)
|
||||
(add-hook 'php-mode-hook 'on-php-mode)
|
||||
(add-hook 'git-commit-mode-hook 'auto-fill-mode)
|
||||
(add-hook 'emacs-startup-hook 'fullscreen)
|
||||
(add-hook 'css-mode-hook 'rainbow-mode)
|
||||
(add-hook 'javascript-mode-hook 'rainbow-delimiters-mode)
|
||||
(add-hook 'python-mode-hook 'rainbow-delimiters-mode)
|
||||
(add-hook 'after-make-frame-functions 'setup-system-frame-colours t)
|
||||
(add-hook 'lisp-mode-hook 'rainbow-delimiters-mode)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; SKELETONS ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(define-skeleton cmake-project-skeleton
|
||||
"A cmake project template file"
|
||||
"Name: "
|
||||
"cmake_minimum_required(VERSION 2.6)\n"
|
||||
"project(" str ")\n"
|
||||
"\n"
|
||||
"set(" str "_VERSION_MAJOR 0)\n"
|
||||
"set(" str "_VERSION_MINOR 0)\n"
|
||||
"set(" str "_VERSION_PATCH 0)\n"
|
||||
"\n"
|
||||
"set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR})\n"
|
||||
"add_subdirectory(src)")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; AUTORUN ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(org-crypt-use-before-save-magic)
|
||||
(ad-activate 'server-create-window-system-frame)
|
||||
(add-php-keywords)
|
||||
(add-html-keywords)
|
||||
(make-face 'font-lock-operator-face)
|
||||
(make-face 'font-lock-end-statement)
|
||||
(set-face-foreground 'font-lock-operator-face "#EDD400")
|
||||
(set-face-foreground 'font-lock-end-statement "#888A85")
|
||||
|
||||
(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.
|
||||
'(org-agenda-files (quote ("~/documents/org/main.org")))
|
||||
'(safe-local-variable-values (quote ((Mode . shell-script) (ispell-local-dictionary . nl)))))
|
||||
(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.
|
||||
)
|
||||
(put 'narrow-to-region 'disabled nil)
|
Loading…
Reference in a new issue