Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added emacs bits.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
  • Loading branch information...
commit 0f6d6cdb43c25ee0d5f27c0576fa34413f8e5360 1 parent f94f1cf
@trofi authored
View
38 .emacs
@@ -0,0 +1,38 @@
+(load-file "~/elisp/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.
+ '(c-echo-syntactic-information-p t)
+ '(c-strict-syntax-p t)
+ '(case-fold-search t)
+ '(current-language-environment "UTF-8")
+ '(default-input-method "cyrillic-jcuken")
+ '(desktop-enable t nil (desktop))
+ '(face-font-family-alternatives (quote (("terminus" "fixed") ("helv" "helvetica" "arial" "fixed"))))
+ '(global-font-lock-mode t nil (font-lock))
+ '(menu-bar-mode nil)
+ '(save-place t nil (saveplace))
+ '(scroll-bar-mode (quote right))
+ '(show-paren-mode t nil (paren))
+ '(tool-bar-mode nil nil (tool-bar))
+ '(transient-mark-mode t)
+ '(visible-bell t)
+ '(window-min-height 4)
+ '(window-min-width 40))
+(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.
+ '(default ((t (:stipple nil :background "black" :foreground "gray90" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 140 :width normal :family "xos4-terminus"))))
+ '(cursor ((t (:background "white"))))
+ '(show-paren-match ((((class color)) (:foreground "green" :background "darkgray" :family "terminus"))))
+ '(show-paren-mismatch ((((class color)) (:foreground "red" :background "darkgray" :family "terminus"))))
+ '(variable-pitch ((t (:family "terminus")))))
+
+(setq
+ x-select-enable-clipboard t
+ x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)
+ interprogram-paste-function 'x-cut-buffer-or-selection-value)
View
48 elisp/c-mode-config
@@ -0,0 +1,48 @@
+(font-lock-add-keywords 'c-mode '(("\\<FIXME:" 0 font-lock-warning-face t)))
+(font-lock-add-keywords 'c++-mode '(("\\<FIXME:" 0 font-lock-warning-face t)))
+
+(defconst my-c-style
+ '((c-tab-always-indent . t)
+ (c-comment-only-line-offset . 0)
+ (c-hanging-braces-alist . ((substatement-open after)
+ (brace-list-open)))
+ (c-hanging-colons-alist . ((member-init-intro before)
+ (inher-intro)
+ (case-label after)
+ (label after)
+ (access-label after)))
+ (c-cleanup-list . (scope-operator
+ empty-defun-braces
+ defun-close-semi))
+ (c-offsets-alist . ((arglist-close . c-lineup-arglist)
+ (c . c-lineup-dont-change)
+ (substatement-open . 0)
+ (inextern-lang . 0)
+ (case-label . 4)
+ (block-open . 0)
+ (defun-open . 0)
+ (inline-open . 0)
+ (knr-argdecl-intro . -)))
+ (c-echo-syntactic-information-p . t)
+ )
+ "My C Programming Style")
+
+;; offset customizations not in my-c-style
+(setq c-offsets-alist '((member-init-intro . ++)))
+
+;; Customizations for all modes in CC Mode.
+(defun my-c-mode-common-hook ()
+ ;; add my personal style and set it for the current buffer
+ (c-add-style "PERSONAL" my-c-style t)
+ ;; other customizations
+ (setq tab-width 4
+ ;; this will make sure spaces are used instead of tabs
+ indent-tabs-mode nil)
+ ;; we DONT :] like auto-newline and hungry-delete
+ ;;(c-toggle-auto-hungry-state 1)
+ ;; key bindings for all supported languages. We can put these in
+ ;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map,
+ ;; java-mode-map, idl-mode-map, and pike-mode-map inherit from it.
+ (define-key c-mode-base-map "\C-m" 'c-context-line-break)
+ )
+(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
View
2  elisp/codepages-config
@@ -0,0 +1,2 @@
+(codepage-setup "866")
+(codepage-setup "1251")
View
14 elisp/config
@@ -0,0 +1,14 @@
+;;;;(load "/usr/share/emacs/site-lisp/site-gentoo.el")
+(load "/usr/share/emacs/site-lisp/site-gentoo")
+
+(setq load-path (cons "~/elisp" load-path))
+;;;;(load-file "~/elisp/codepages-config")
+(load-file "~/elisp/variables-config")
+(load-file "~/elisp/keybind-config")
+;;;;(load-file "~/elisp/python-mode-config")
+(load-file "~/elisp/faces-config")
+(load-file "~/elisp/c-mode-config")
+(load-file "~/elisp/lisp-mode-config")
+(load-file "~/elisp/scroll_s.el")
+(load-file "~/elisp/gnus-config.el")
+(server-start)
View
21 elisp/faces-config
@@ -0,0 +1,21 @@
+(custom-set-faces
+ ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
+ ;; Your init file should contain only one such instance.
+ '(default ((t (:stipple nil
+ :background "black"
+ :foreground "gray90"
+ :inverse-video nil
+ :box nil
+ :strike-through nil
+ :overline nil
+ :underline nil
+ :slant normal
+ :weight normal
+ :height 140
+ :width normal
+ :family "xos4-terminus"))))
+ '(cursor ((t (:background "white"))))
+ '(show-paren-match-face ((((class color))
+ (:foreground "green" :background "darkgray" :family "terminus"))))
+ '(show-paren-mismatch-face ((((class color)) (:foreground "red" :background "darkgray" :family "terminus"))))
+ '(variable-pitch ((t (:family "terminus")))))
View
2  elisp/gnus-config.el
@@ -0,0 +1,2 @@
+(setq mail-sources
+ '((file :path "~/INBOX")))
View
68 elisp/keybind-config
@@ -0,0 +1,68 @@
+;;; -*- lisp -*-
+;;; man
+(global-set-key [(f1)] (lambda () (interactive) (manual-entry (current-word))))
+(global-set-key [(f4)] 'kill-this-buffer)
+
+;;; fast window hops
+(global-set-key (kbd "C-c <left>") 'windmove-left)
+(global-set-key (kbd "C-c <right>") 'windmove-right)
+(global-set-key (kbd "C-c <up>") 'windmove-up)
+(global-set-key (kbd "C-c <down>") 'windmove-down)
+
+;;;;;;;;;;;;;;;;;;;;;;;;
+;;; search progect dir
+(defvar *project-root-dir-indicator* "root-project-dir")
+
+;;; not too portable
+(defun find-root-project-dir ()
+ "Return path to root project directory"
+ (loop for curdir = default-directory then (concat curdir "../")
+ and
+ max = 10 then (- max 1)
+ while (> max 0)
+ when (file-exists-p (concat curdir *project-root-dir-indicator*))
+ return curdir))
+
+;;; compilation
+(defun my-save-and-compile (&rest params)
+ "Saves all dirty buffers and tries to compile all the proj"
+ (interactive "")
+ (save-buffer 0)
+ (compile
+ (let ((dir (find-root-project-dir)))
+ (concat "make"
+ (when dir (concat " -C "
+ dir
+ " "
+ (with-temp-buffer
+ (insert-file-contents (concat dir "/" *project-root-dir-indicator*))
+ (buffer-string))))
+ (when params (concat " " (car params)))))))
+(global-set-key [(f9)] 'my-save-and-compile)
+
+(defun my-save-and-run ()
+ (interactive "")
+ (my-save-and-compile "run"))
+(global-set-key [(f5)] 'my-save-and-run)
+
+(defun my-save-and-mk-TAGS ()
+ (interactive "")
+ (my-save-and-compile "TAGS"))
+(global-set-key [(f6)] 'my-save-and-mk-TAGS)
+
+(defun my-save-and-clean ()
+ (interactive "")
+ (my-save-and-compile "clean"))
+(global-set-key [(f7)] 'my-save-and-clean)
+
+;;; tags
+(defun my-visit-tags-table-in-current-dir ()
+ (interactive "")
+ (visit-tags-table (concat (find-root-project-dir) "/TAGS")))
+(global-set-key [(f8)] 'my-visit-tags-table-in-current-dir)
+
+;;; flawfinder
+(defun my-exec-flaw-finder-in-current-dir ()
+ (interactive "")
+ (compile (concat "flawfinder " (find-root-project-dir) "/")))
+(global-set-key [(f12)] 'my-exec-flaw-finder-in-current-dir)
View
6 elisp/lisp-mode-config
@@ -0,0 +1,6 @@
+(add-hook 'lisp-mode-hook (lambda () (slime-mode t)))
+(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t)))
+(setq inferior-lisp-program "/usr/bin/sbcl"
+ lisp-indent-function 'common-lisp-indent-function)
+
+(slime-setup) (setq slime-net-coding-system 'utf-8-unix)
View
43 elisp/python-mode-config
@@ -0,0 +1,43 @@
+(setq load-path (cons "~/elisp/python-mode-1.0" load-path))
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Python mode
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; Associate .py files with python mode
+ (setq auto-mode-alist
+ (cons `(".py$" . python-mode) auto-mode-alist))
+
+
+
+;; Use the `python' interpreter when executing code in python-mode.
+;; You might want to change this if you have a number of pythons on your
+;; path but want to use a specific version (e.g. python2.3)
+(setq interpreter-mode-alist
+ (cons `("python" . python-mode)
+ interpreter-mode-alist))
+
+
+
+;; These are various settings you may want to set
+;; - py-indent-offset - the number of spaces you are going to indent by
+;; - py-smart-indentation - this allows emacs to guess what your indentation
+;; should be. I set it to nil because I don't want it to do that. I religiously
+;; believe everything should be 4 spaces ;)
+;; - indent-tabs-mode - set to nil - tabs are evil. We indent with spaces
+;;
+(setq python-mode-hook
+ `(lambda () (progn
+ (set-variable `py-indent-offset 4)
+ (set-variable `py-smart-indentation nil)
+ (set-variable `indent-tabs-mode nil) )))
+
+
+
+;; If you start a shell up within python-mode using `py-shell' this is the
+;; interpreter you are going to be using
+(defconst py-python-command "python")
+
+
+
+;; Load the code in
+(autoload `python-mode "python-mode" "Python editing mode." t)
View
59 elisp/scroll_s.el
@@ -0,0 +1,59 @@
+;;
+;; __ Original author is
+;
+;; Hsueh-Li Lu. English name is Vincent.
+;
+;; __ Downloaded from:
+;
+;; <http://www.cs.utexas.edu/users/hllu/EmacsSmoothScrolling.html>
+;
+;; __ Feature of "Y constant cursor position" added by olecom.
+;;
+;; usage:
+;(global-set-key (kbd "<down>") 'next-one-line)
+;(global-set-key (kbd "<up>") 'previous-one-line)
+(global-set-key (kbd "C-<down>") 'next-one-line-cc)
+(global-set-key (kbd "C-<up>") 'previous-one-line-cc)
+
+(defun point-of-beginning-of-bottom-line ()
+ (save-excursion
+ (move-to-window-line -1)
+ (point)))
+
+(defun point-of-beginning-of-line ()
+ (save-excursion
+ (beginning-of-line)
+ (point)))
+
+(defun next-one-line () (interactive)
+ (if (= (point-of-beginning-of-bottom-line) (point-of-beginning-of-line))
+ (progn (scroll-up 1)
+ (next-line 1))
+ (next-line 1)))
+
+(defun next-one-line-cc () (interactive)
+ (if (= (point-of-beginning-of-bottom-line) (point-of-beginning-of-line))
+ (progn (scroll-up 1)
+ (next-line 1))
+ (next-line 1)
+ (scroll-up 1)))
+
+(defun point-of-beginning-of-top-line ()
+ (save-excursion
+ (move-to-window-line 0)
+ (point)))
+
+(defun previous-one-line () (interactive)
+ (if (= (point-of-beginning-of-top-line) (point-of-beginning-of-line))
+ (progn (scroll-down 1)
+ (previous-line 1))
+ (previous-line 1)))
+
+(defun previous-one-line-cc () (interactive)
+ (if (= (point-of-beginning-of-top-line) (point-of-beginning-of-line))
+ (progn (scroll-down 1)
+ (previous-line 1))
+ (previous-line 1)
+ (scroll-down 1)))
+
+(provide 'scroll_s)
View
25 elisp/variables-config
@@ -0,0 +1,25 @@
+(custom-set-variables
+ ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
+ ;; Your init file should contain only one such instance.
+ '(c-echo-syntactic-information-p t)
+ '(c-strict-syntax-p t)
+ '(case-fold-search t)
+ '(current-language-environment "UTF-8")
+ '(default-input-method "cyrillic-jcuken")
+ '(desktop-enable t nil (desktop))
+ '(face-font-family-alternatives (quote (("terminus" "fixed") ("helv" "helvetica" "arial" "fixed"))))
+ '(global-font-lock-mode t nil (font-lock))
+ '(menu-bar-mode nil)
+ '(save-place t nil (saveplace))
+ '(show-paren-mode t nil (paren))
+ '(scroll-bar-mode (quote right))
+ '(tool-bar-mode nil nil (tool-bar))
+ '(transient-mark-mode t)
+ '(visible-bell t)
+ '(window-min-height 4)
+ '(window-min-width 40))
+(setq compilation-window-height 8)
+(set-keyboard-coding-system 'utf-8)
+
+;;; colorful gomoku
+(add-hook 'gomoku-mode-hook 'turn-on-font-lock)
Please sign in to comment.
Something went wrong with that request. Please try again.