-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Configuration is now done with packages. kemacs * lisp->vendor * many-many more
- Loading branch information
krick
committed
Mar 31, 2009
1 parent
6a1521b
commit cd6de7c
Showing
1,663 changed files
with
164,941 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,49 @@ | ||
;; Setup variable for directory with dot-files | ||
;; Used in customization packages later | ||
(defconst dotfiles-dir (file-name-directory | ||
(or (buffer-file-name) load-file-name))) | ||
|
||
(add-to-list 'load-path dotfiles-dir) | ||
(add-to-list 'load-path (concat dotfiles-dir "vendor/")) | ||
|
||
;; Add directory recursievly to the load path | ||
(if (fboundp 'normal-top-level-add-subdirs-to-load-path) | ||
(let* ((my-lisp-dir "~/.emacs.d/lisp/") | ||
(default-directory my-lisp-dir)) | ||
(setq load-path (cons my-lisp-dir load-path)) | ||
(normal-top-level-add-subdirs-to-load-path))) | ||
;; (if (fboundp 'normal-top-level-add-subdirs-to-load-path) | ||
;; (let* ((my-lisp-dir (concat dotfiles-dir "vendor/")) | ||
;; (default-directory my-lisp-dir)) | ||
;; (setq load-path (cons my-lisp-dir load-path)) | ||
;; (normal-top-level-add-subdirs-to-load-path))) | ||
|
||
;; Load additional config files | ||
(defconst emacs-config-dir "~/.emacs.d/" "") | ||
(defun load-cfg-files (filelist) | ||
(dolist (file filelist) | ||
(load (expand-file-name | ||
(concat emacs-config-dir file))) | ||
(message "Loaded config file: %s" file) | ||
)) | ||
;; Load my customization packages | ||
(require 'kemacs-defuns) | ||
(require 'kemacs-russification) | ||
(require 'kemacs-gui) | ||
(require 'kemacs-navigation) | ||
(require 'kemacs-development) | ||
(require 'kemacs-webdev) | ||
(require 'kemacs-org) | ||
(require 'kemacs-bindings) | ||
(require 'kemacs-utils) | ||
(require 'kemacs-misc) | ||
(require 'kemacs-registers) | ||
(require 'kemacs-test) | ||
|
||
(load-cfg-files '( | ||
"cfg_defuns" | ||
"cfg_rusification" | ||
"cfg_gui" | ||
"cfg_navigation" | ||
"cfg_development" | ||
"cfg_webdev" | ||
"cfg_orgmode" | ||
"cfg_bindings" | ||
"cfg_utils" | ||
"cfg_test" | ||
)) | ||
(setq user-mail-address "antipin.konstantin@googlemail.com" | ||
user-full-name "Konstantin Antipin" | ||
) | ||
|
||
; Global settings done via emacs-config | ||
;; Global settings done via emacs-config | ||
(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. | ||
'(ido-enabled nil t) | ||
'(ido-everywhere t) | ||
'(nxhtml-skip-welcome t) | ||
'(org-agenda-files (quote ("~/gtd/org/notes.org"))) | ||
'(php-mode-force-pear t)) | ||
'(php-mode-force-pear t) | ||
(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. | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
;;; kemacs-bindings.el --- kEmacs bindings | ||
;; | ||
;; Part of kEmacs | ||
|
||
(require 'kemacs-defuns) | ||
|
||
;; bind changing layout of keyboard | ||
(global-set-key [(control ?')] 'user-toggle-input-method) | ||
|
||
;; convenient command. kill all buffers except current. | ||
(global-set-key "\C-c\C-u" 'kill-other-buffers) | ||
|
||
;; scroll up-down bindings. (check out cfg_navigation.el) | ||
(global-set-key [(control shift n)] 'scroll-one-line-up) | ||
(global-set-key [(control shift p)] 'scroll-one-line-down) | ||
|
||
;; Evaluate current lisp buffer | ||
(global-set-key (kbd "C-c v") 'eval-buffer) | ||
|
||
;; Self-written function that toggles fullscreen | ||
(global-set-key [(meta return)] 'toggle-fullscreen) | ||
|
||
;; Bound C-h to backspace. | ||
(global-set-key "\C-xh" 'help-command) | ||
;; rebind help | ||
(global-set-key "\C-h" 'delete-backward-char) | ||
;; Expected bahavior of M-backspace | ||
(global-set-key [(control meta h)] 'backward-kill-word) | ||
|
||
;; The default C-x b is too slow. Use C-; instead | ||
(global-set-key [(control ?\;)] 'ido-switch-buffer) | ||
|
||
;; Turn on the menu bar for exploring new modes | ||
(global-set-key (kbd "C-<f1>") 'menu-bar-mode) | ||
|
||
;; A better buffer list | ||
(global-set-key (kbd "C-x C-b") 'ibuffer) | ||
|
||
(global-set-key (kbd "C-x f") 'anything-for-files) | ||
;;(global-set-key (kbd "C-x f") 'recentf-ido-find-file) | ||
|
||
(provide 'kemacs-bindings) | ||
;;; kemacs-bindings.el ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
;;; kemacs-defuns.el --- Custom functions | ||
;; | ||
;; Part of kEmacs | ||
|
||
;; http://rlazo.supersized.org/archives/82-Insert-a-path-into-the-current-buffer.html | ||
(defun insert-path (file) | ||
"insert file" | ||
(interactive "FPath: ") | ||
(insert (expand-file-name file))) | ||
|
||
;; full screen toggle using command+[RET] | ||
(defun toggle-fullscreen () | ||
(interactive) | ||
(set-frame-parameter nil 'fullscreen (if (frame-parameter nil 'fullscreen) | ||
nil | ||
'fullboth))) | ||
|
||
(defun iwb () | ||
"indent whole buffer" | ||
(interactive) | ||
(delete-trailing-whitespace) | ||
(indent-region (point-min) (point-max) nil) | ||
(untabify (point-min) (point-max))) | ||
|
||
;; http://davidavraamides.net/files/mode-aware-google-help-in-emacs.html | ||
(defun search-site-url (keyword &optional site inurl lucky) | ||
"Do a Google search for KEYWORD. Restrict to SITE and INURL, if specified. | ||
Jump to best match (I Feel Lucky) if LUCKY set. | ||
" | ||
(concat "http://www.google.com/" | ||
(format "search?q=%s" (url-hexify-string keyword)) | ||
(if site (format "+site:%s" (url-hexify-string site))) | ||
(if inurl (format "+inurl:%s" (url-hexify-string inurl))) | ||
(if lucky "&btnI"))) | ||
|
||
(defun ask-google (start end) | ||
"Open browser, request google with string. | ||
if there is active region - use it | ||
if not - use current 'thing'(command/word/etc). | ||
" | ||
(interactive "r") | ||
(browse-url | ||
(search-site-url (if (eq mark-active nil) | ||
(thing-at-point 'symbol) | ||
(buffer-substring start end) | ||
)))) | ||
|
||
(defun get-file-basename (file-name) | ||
"Substitute basename from file-name. | ||
" | ||
(substring file-name 0 (- (length file-name) | ||
(length (file-name-extension file-name)) | ||
1) | ||
)) | ||
|
||
(defun get-buffer-name (&optional strip-extension) | ||
"Return current buffer name. | ||
If buffer is associated with the file - get filename only, without path. | ||
If not - just buffer name. | ||
If strip-extension is not nil - remove file extension. | ||
" | ||
(let ((name (if (buffer-file-name) | ||
(file-name-nondirectory (buffer-file-name)) | ||
(buffer-name)))) | ||
(if (not (eq strip-extension nil)) | ||
(get-file-basename name) | ||
name | ||
) | ||
)) | ||
|
||
(defun insert-date (prefix) | ||
"Insert the current date. With prefix-argument, use ISO format. With | ||
two prefix arguments, write out the day and month name." | ||
(interactive "P") | ||
(let ((format (cond | ||
((not prefix) "%d/%m/%Y") | ||
((equal prefix '(4)) "%Y-%m-%d") | ||
((equal prefix '(16)) "%d %B %Y, %A"))) | ||
;; (system-time-locale "ru_RU") | ||
) | ||
(insert (format-time-string format)))) | ||
|
||
(provide 'kemacs-defuns) | ||
;;; kemacs-defuns.el ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
;;; kemacs-development.el --- Configuration for better coding | ||
;; | ||
;; Part of kEmacs | ||
|
||
(require 'kemacs-defuns) | ||
|
||
;;; Development | ||
|
||
;;will make "Ctrl-k" kills an entire line if the cursor is | ||
;;at the beginning of line -- very useful. | ||
(setq kill-whole-line t) | ||
;; will delete "hungrily" in C mode! Use it to see what it does -- very useful. | ||
(setq c-hungry-delete-key t) | ||
;; will let emacs put in a "carriage-return" for you automatically after | ||
;;left curly braces, right curly braces, and semi-colons in "C mode" -- very useful. | ||
(setq c-auto-newline 0) | ||
|
||
;;compilation window shall scroll down | ||
(setq compilation-scroll-output 1) | ||
|
||
;; insert doxygen-style comments before function | ||
(fset 'insert-function-comment | ||
[?\C-a ?\C-j ?\C-p tab ?/ ?* ?* ?\M-j ?\M-j ?@ ?r ?e ?t ?u ?r ?n ? ?v ?o ?i ?d ? ?\M-j backspace ?/ ?\C-p ?\C-p ? ]) | ||
(global-set-key (kbd "\e:") 'insert-function-comment) | ||
|
||
|
||
|
||
;; Styling indentation and other | ||
(setq c-default-style | ||
'((java-mode . "java") (other . "cc-mode"))) | ||
|
||
(defun php-mode-hook () | ||
(setq tab-width 4 | ||
c-basic-offset 4 | ||
c-hanging-comment-ender-p nil | ||
indent-tabs-mode | ||
)) | ||
|
||
;; enjoy automatic indentation of yanked text in the listed programming modes | ||
;; Great stuff! | ||
(let ((yank-indent-modes '( | ||
emacs-lisp-mode scheme-mode lisp-mode | ||
c-mode c++-mode objc-mode latex-mode | ||
plain-tex-mode php-mode yaml-mode | ||
lisp-interaction-mode | ||
))) | ||
(defadvice yank (after indent-region activate) | ||
(if (member major-mode yank-indent-modes) | ||
(let ((mark-even-if-inactive t)) | ||
(indent-region (region-beginning) (region-end) nil)))) | ||
|
||
(defadvice yank-pop (after indent-region activate) | ||
(if (member major-mode yank-indent-modes) | ||
(let ((mark-even-if-inactive t)) | ||
(indent-region (region-beginning) (region-end) nil))))) | ||
|
||
;; super stuff for autocomplete | ||
(add-to-list 'load-path (concat dotfiles-dir "vendor/yasnippet/")) | ||
|
||
(require 'yasnippet) | ||
(yas/initialize) | ||
(setq yas-dir (concat dotfiles-dir "vendor/yasnippet")) | ||
(yas/load-directory (concat yas-dir "/snippets")) | ||
;; Trick to have my own changes to the snippets. | ||
;; Everything in my-snippet directory overwrites default one. | ||
(setq yas/root-directory (concat yas-dir "/my-snippets")) | ||
;; (message yas-dir) | ||
(yas/load-directory yas/root-directory) | ||
|
||
|
||
;;compilation window shall scroll down | ||
(setq compilation-scroll-output 1) | ||
|
||
;; show parenthesis (corresponding brackets) | ||
(show-paren-mode t) | ||
|
||
;;; Lisp | ||
;; Evaluate current lisp buffer | ||
(define-key lisp-mode-shared-map (kbd "C-c v") 'eval-buffer) | ||
|
||
(add-to-list 'auto-mode-alist '(".stumpwmrc" . lisp-mode)) | ||
(add-to-list 'auto-mode-alist '("\\.el[c]" . emacs-lisp-mode)) | ||
|
||
;;; setup automatic header updates | ||
(require 'header2) | ||
(defsubst header-usage () | ||
"Insert \"Usage: \" line." | ||
(insert (concat (section-comment-start) "Usage: \n"))) | ||
|
||
(defsubst header-installation () | ||
"Insert \"Installation: \" line." | ||
(insert (concat (section-comment-start) "Installation: \n"))) | ||
|
||
(defsubst header-lisp-installation () | ||
"Insert info, that I usually put in my emacs lisp file" | ||
(insert header-prefix-string "1. Put " (get-buffer-name) " to some directory.\n" | ||
header-prefix-string " (for example ~/.emacs.d/vendor).\n" | ||
header-prefix-string "2. In your .emacs add this directry to the load-path like this:\n" | ||
header-prefix-string " (add-to-list 'load-path (expand-file-name \"~/.emacs.d/vendor\"))\n" | ||
header-prefix-string "3. Add the following code to your .emacs file:\n" | ||
header-prefix-string " (require '" (get-buffer-name 1) ")\n")) | ||
|
||
(setq make-header-hook '( | ||
;;header-mode-line | ||
header-title | ||
header-blank | ||
;;header-file-name | ||
;;header-description | ||
;;header-status | ||
header-author | ||
;;header-maintainer | ||
;;header-copyright | ||
header-creation-date | ||
;;header-rcs-id | ||
header-version | ||
;;header-sccs | ||
header-modification-date | ||
header-modification-author | ||
header-update-count | ||
header-url | ||
header-keywords | ||
;;header-compatibility | ||
header-blank | ||
header-lib-requires | ||
header-end-line | ||
header-commentary | ||
header-blank | ||
header-blank | ||
header-blank | ||
header-end-line | ||
header-installation | ||
header-blank | ||
header-lisp-installation | ||
header-blank | ||
header-end-line | ||
header-usage | ||
header-blank | ||
header-blank | ||
header-end-line | ||
header-history | ||
header-blank | ||
header-blank | ||
;; header-rcs-log | ||
header-end-line | ||
header-free-software | ||
header-code | ||
header-eof | ||
)) | ||
|
||
|
||
(provide 'kemacs-development) | ||
;;; kemacs-development.el ends here |
Oops, something went wrong.