Last active
October 8, 2015 22:17
-
-
Save gennad/3396504 to your computer and use it in GitHub Desktop.
latest .emacs
This file contains hidden or 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
| (setq org-directory "~/org/") | |
| (setq next-line-add-newlines nil) | |
| (load-file "~/.emacs.d/emacs-for-python/epy-init.el") | |
| (setq flymake-gui-warnings-enabled nil) | |
| ;; To require | |
| ;;(add-to-list 'load-path "~/.emacs.d/http") | |
| ;;(require 'http-post-curl) | |
| ;;(require 'http-twiddle) | |
| ;;(load-file "/home/gennad/.emacs.d/http-post-curl.el") | |
| ;;(load-file "/home/gennad/.emacs.d/http-post-curl.el") | |
| ;;(load-file "/home/gennad/.emacs.d/http-get.el") | |
| ;;(require 'http-post-curl) | |
| (blink-cursor-mode (- (*) (*) (*))) | |
| (add-to-list 'load-path "~/.emacs.d/nav/") | |
| (require 'nav) | |
| ;;(require 'git-emacs) | |
| (add-hook 'before-save-hook 'delete-trailing-whitespace) | |
| (defun my-other-delete-trailing-blank-lines () | |
| "Deletes all blank lines at the end of the file, even the last one" | |
| (interactive) | |
| (save-excursion | |
| (save-restriction | |
| (widen) | |
| (goto-char (point-max)) | |
| (delete-blank-lines) | |
| (let ((trailnewlines (abs (skip-chars-backward "\n\t")))) | |
| (if (> trailnewlines 0) | |
| (progn | |
| (delete-char trailnewlines))))))) | |
| ;Add magit | |
| (add-to-list 'load-path "~/.emacs.d/magit") | |
| (require 'magit) | |
| (require 'org-install) | |
| (add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) | |
| (define-key global-map "\C-cl" 'org-store-link) | |
| (define-key global-map "\C-ca" 'org-agenda) | |
| (setq org-log-done t) | |
| ;; etags | |
| (defun create-tags (dir-name) | |
| "Create tags file." | |
| (interactive "DDirectory: ") | |
| (eshell-command | |
| (format "find %s -type f -name \"*.py\" | etags -" dir-name))) | |
| ;;(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/emacs-color-theme-solarixed") | |
| ;;(load-theme 'solarized-light t) | |
| ;(require 'color-theme) | |
| ;(color-theme-initialize) | |
| ;;(color-theme-snowish) | |
| ;(color-theme-scintilla) | |
| (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. | |
| '(desktop-enable t nil (desktop)) | |
| '(desktop-save-mode t nil (desktop)) | |
| '(org-agenda-files (quote ("~/org/1.org"))) | |
| '(save-place t nil (saveplace)) | |
| '(ediff-split-window-function (quote split-window-horizontally)) | |
| ) | |
| (desktop-save-mode 1) | |
| (add-to-list 'load-path "~/.emacs.d/") | |
| ;;(require 'iy-go-to-char) | |
| (require 'go-to-char) | |
| (global-set-key (kbd "C-c f") 'go-to-char-forward) | |
| (global-set-key (kbd "C-c F") 'go-to-char-backward) | |
| ;; (global-set-key (kbd "C-c f") 'iy-go-to-char) | |
| ;; (global-set-key (kbd "C-c F") 'iy-go-to-char-backward) | |
| ;; (global-set-key (kbd "C-c ;") 'iy-go-to-char-continue) | |
| ;; (global-set-key (kbd "C-c ,") 'iy-go-to-char-continue-backward) | |
| (epy-setup-checker "/usr/local/bin/pyflakes %f") | |
| (tool-bar-mode -1) | |
| ;; Set to the location of your Org files on your local system | |
| ;(setq org-directory "~/org") | |
| ;; Set to the name of the file where new notes will be stored | |
| (require 'org) | |
| (setq org-mobile-inbox-for-pull "~/org/flagged.org") | |
| ;; Set to <your Dropbox root directory>/MobileOrg. | |
| (setq org-mobile-directory "~/Dropbox/MobileOrg") | |
| (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. | |
| ) | |
| (setq rsense-home "~/.emacs.d/rsense") | |
| (add-to-list 'load-path (concat rsense-home "/etc")) | |
| ;(require 'rsense) | |
| (require 'tramp) | |
| (setq tramp-default-method "scp") | |
| (require 'whitespace) | |
| (setq whitespace-style '(face empty tabs lines-tail trailing)) | |
| (global-whitespace-mode t) | |
| (column-number-mode 1) | |
| (eval-after-load "vc-hooks" | |
| '(define-key vc-prefix-map "=" 'ediff-revision)) | |
| (defun ediff-current-buffer-revision () | |
| "Run Ediff to diff current buffer's file against VC depot. | |
| Uses `vc.el' or `rcs.el' depending on `ediff-version-control-package'." | |
| (interactive) | |
| (let ((file (or (buffer-file-name) | |
| (error "Current buffer is not visiting a file")))) | |
| (if (and (buffer-modified-p) | |
| (y-or-n-p (message "Buffer %s is modified. Save buffer? " | |
| (buffer-name)))) | |
| (save-buffer (current-buffer))) | |
| (ediff-load-version-control) | |
| (funcall | |
| (intern (format "ediff-%S-internal" ediff-version-control-package)) | |
| "" "" nil))) | |
| (global-set-key [f6] 'compile) | |
| (setq compilation-ask-about-save nil) | |
| ;;(set-face-attribute 'default nil :height 125x) | |
| ;(set-face-attribute 'default nil :height 145 :weight 'normal) | |
| (set-face-attribute 'default nil :height 145 :weight 'normal) | |
| (set-default-font "Inconsolata-17") | |
| (defun toggle-window-split () | |
| (interactive) | |
| (if (= (count-windows) 2) | |
| (let* ((this-win-buffer (window-buffer)) | |
| (next-win-buffer (window-buffer (next-window))) | |
| (this-win-edges (window-edges (selected-window))) | |
| (next-win-edges (window-edges (next-window))) | |
| (this-win-2nd (not (and (<= (car this-win-edges) | |
| (car next-win-edges)) | |
| (<= (cadr this-win-edges) | |
| (cadr next-win-edges))))) | |
| (splitter | |
| (if (= (car this-win-edges) | |
| (car (window-edges (next-window)))) | |
| 'split-window-horizontally | |
| 'split-window-vertically))) | |
| (delete-other-windows) | |
| (let ((first-win (selected-window))) | |
| (funcall splitter) | |
| (if this-win-2nd (other-window 1)) | |
| (set-window-buffer (selected-window) this-win-buffer) | |
| (set-window-buffer (next-window) next-win-buffer) | |
| (select-window first-win) | |
| (if this-win-2nd (other-window 1)))))) | |
| (define-key ctl-x-4-map "t" 'toggle-window-split) | |
| (add-to-list 'load-path "~/.emacs.d/pydoc-info/") | |
| (require 'pydoc-info) | |
| (epy-setup-ipython) | |
| ;;(global-hl-line-mode t) ;; To enable | |
| ;;(set-face-background 'hl-line "black") ;; change with the color that you like | |
| ;; for a list of colors: http://raebear.net/comp/emacscolors.html | |
| (require 'highlight-indentation) | |
| (add-hook 'python-mode-hook 'highlight-indentation) | |
| ;; Auto refresh buffers | |
| (global-auto-revert-mode t) | |
| (setq-default indent-tabs-mode nil) | |
| (defun my-isearch-word-at-point () | |
| (interactive) | |
| (call-interactively 'isearch-forward-regexp)) | |
| (defun my-isearch-yank-word-hook () | |
| (when (equal this-command 'my-isearch-word-at-point) | |
| (let ((string (concat "\\<" | |
| (buffer-substring-no-properties | |
| (progn (skip-syntax-backward "w_") (point)) | |
| (progn (skip-syntax-forward "w_") (point))) | |
| "\\>"))) | |
| (if (and isearch-case-fold-search | |
| (eq 'not-yanks search-upper-case)) | |
| (setq string (downcase string))) | |
| (setq isearch-string string | |
| isearch-message | |
| (concat isearch-message | |
| (mapconcat 'isearch-text-char-description | |
| string "")) | |
| isearch-yank-flag t) | |
| (isearch-search-and-update)))) | |
| (add-hook 'isearch-mode-hook 'my-isearch-yank-word-hook) | |
| (when (fboundp 'winner-mode) | |
| (winner-mode 1)) | |
| (require 'magit) | |
| (autoload 'mo-git-blame-file "mo-git-blame" nil t) | |
| (autoload 'mo-git-blame-current "mo-git-blame" nil t) | |
| (require 'python-pep8) | |
| ; Cmd as meta key. Also, need to set caps lock as C system-wide. | |
| (setq mac-option-key-is-meta nil) | |
| (setq mac-command-key-is-meta t) | |
| (setq mac-command-modifier 'meta) | |
| (setq mac-option-modifier nil) | |
| ; Shell - M-x eshell | |
| ; M-y to yank in isearch | |
| ; Dot mode C-. | |
| (require 'dot-mode) | |
| (add-hook 'find-file-hooks 'dot-mode-on) | |
| ; C-M-f go to bracket closing or string end. | |
| ;; (defun my-horizontal-recenter () | |
| ;; "make the point horizontally centered in the window" | |
| ;; (interactive) | |
| ;; (let ((mid (/ (window-width) 2)) | |
| ;; (line-len (save-excursion (end-of-line) (current-column))) | |
| ;; (cur (current-column))) | |
| ;; (if (< mid cur) | |
| ;; (set-window-hscroll (selected-window) | |
| ;; (- cur mid))))) | |
| ;; (global-set-key (kbd "C-M-l") 'my-horizontal-recenter) | |
| ; Registers: C-x r s <reg> - save and C-x r i <reg> to insert | |
| (require 'list-register) | |
| (global-set-key (kbd "C-x r v") 'list-register) | |
| ;; C-x r <SPC> R -- C-x r j R -- save buffer/position in register R, and jump back to it | |
| ;; C-x r w R -- C-x r j R -- save window configuration in register R, and jump back to it | |
| ; M-r reposition cursor | |
| ; C-M-a -- go to beginning of the fuction | |
| ; C-m-e -- go to end of the function | |
| ; Back C-x o | |
| (defun back-window () | |
| (interactive) | |
| (other-window -1)) | |
| (global-set-key (kbd "C-x O") 'back-window) | |
| (setq calendar-week-start-day 1) | |
| (global-set-key (kbd "C-c <tab>") 'imenu) | |
| (setq python-imenu-make-tree nil) | |
| (setq python-imenu-include-defun-type nil) | |
| (require 'auto-highlight-symbol) | |
| (global-auto-highlight-symbol-mode t) | |
| (require 'etags) ;; provides `find-tag-default' in Emacs 21. | |
| (defun isearch-yank-regexp (regexp) | |
| "Pull REGEXP into search regexp." | |
| (let ((isearch-regexp nil)) ;; Dynamic binding of global. | |
| (isearch-yank-string regexp)) | |
| (isearch-search-and-update)) | |
| (defun isearch-yank-symbol (&optional partialp) | |
| "Put symbol at current point into search string. | |
| If PARTIALP is non-nil, find all partial matches." | |
| (interactive "P") | |
| (let* ((sym (find-tag-default)) | |
| ;; Use call of `re-search-forward' by `find-tag-default' to | |
| ;; retrieve the end point of the symbol. | |
| (sym-end (match-end 0)) | |
| (sym-start (- sym-end (length sym)))) | |
| (if (null sym) | |
| (message "No symbol at point") | |
| (goto-char sym-start) | |
| ;; For consistent behavior, restart Isearch from starting point | |
| ;; (or end point if using `isearch-backward') of symbol. | |
| (isearch-search) | |
| (if partialp | |
| (isearch-yank-string sym) | |
| (isearch-yank-regexp | |
| (concat "\\_<" (regexp-quote sym) "\\_>")))))) | |
| (defun isearch-current-symbol (&optional partialp) | |
| "Incremental search forward with symbol under point. | |
| Prefixed with \\[universal-argument] will find all partial | |
| matches." | |
| (interactive "P") | |
| (let ((start (point))) | |
| (isearch-forward-regexp nil 1) | |
| (isearch-yank-symbol partialp))) | |
| (defun isearch-backward-current-symbol (&optional partialp) | |
| "Incremental search backward with symbol under point. | |
| Prefixed with \\[universal-argument] will find all partial | |
| matches." | |
| (interactive "P") | |
| (let ((start (point))) | |
| (isearch-backward-regexp nil 1) | |
| (isearch-yank-symbol partialp))) | |
| ; (global-set-key [f3] 'isearch-current-symbol) | |
| ; (global-set-key [(control f3)] 'isearch-backward-current-symbol) | |
| (global-set-key (kbd "C-x *") 'isearch-current-symbol) | |
| (global-set-key (kbd "C-*") 'isearch-backward-current-symbol) | |
| ;; Subsequent hitting of the keys will increment to the next | |
| ;; match--duplicating `C-s' and `C-r', respectively. | |
| (define-key isearch-mode-map [(control f3)] 'isearch-repeat-backward) | |
| ; Do we need it? | |
| ;; I-search with initial contents | |
| (defvar isearch-initial-string nil) | |
| (defun isearch-set-initial-string () | |
| (remove-hook 'isearch-mode-hook 'isearch-set-initial-string) | |
| (setq isearch-string isearch-initial-string) | |
| (isearch-search-and-update)) | |
| (defun isearch-forward-at-point (&optional regexp-p no-recursive-edit) | |
| "Interactive search forward for the symbol at point." | |
| (interactive "P\np") | |
| (if regexp-p (isearch-forward regexp-p no-recursive-edit) | |
| (let* ((end (progn (skip-syntax-forward "w_") (point))) | |
| (begin (progn (skip-syntax-backward "w_") (point)))) | |
| (if (eq begin end) | |
| (isearch-forward regexp-p no-recursive-edit) | |
| (setq isearch-initial-string (buffer-substring begin end)) | |
| (add-hook 'isearch-mode-hook 'isearch-set-initial-string) | |
| (isearch-forward regexp-p no-recursive-edit))))) | |
| (define-key isearch-mode-map [f3] 'isearch-forward-at-point) | |
| (require 'goto-last-change) | |
| (global-set-key "\C-x\C-\\" 'goto-last-change) | |
| ; Repeat last command C-x z. z to repeat again. | |
| (require 'xml-rpc) | |
| (require 'weblogger) | |
| ; tags-search - search name in project | |
| ; Search a file in project | |
| (add-to-list 'load-path "~/.emacs.d/eproject") | |
| (require 'eproject) | |
| (require 'eproject-extras) | |
| ; C-c t -- google translate | |
| (require 'google-translate) | |
| (global-set-key "\C-ct" 'google-translate-query-translate) | |
| (setq google-translate-default-target-language "ru") | |
| (setq google-translate-default-source-language "en") | |
| ; Nosemacs | |
| (require 'nose) | |
| ; 3 buffers on screen | |
| (defun disabled-key () | |
| "Disables keys" | |
| (interactive) | |
| (print "Key is disabled !") | |
| ) | |
| ;; All arrow keys are disabled | |
| (global-set-key (kbd "<up>") 'disabled-key) | |
| (global-set-key (kbd "<down>") 'disabled-key) | |
| (global-set-key (kbd "<left>") 'disabled-key) | |
| (global-set-key (kbd "<right>") 'disabled-key) | |
| ; Copy word under the cursor | |
| (defun get-point (symbol &optional arg) | |
| "get the point" | |
| (funcall symbol arg) | |
| (point) | |
| ) | |
| ; Copy word under the cursor | |
| (defun copy-thing (begin-of-thing end-of-thing &optional arg) | |
| "copy thing between beg & end into kill ring" | |
| (save-excursion | |
| (let ((beg (get-point begin-of-thing 1)) | |
| (end (get-point end-of-thing arg))) | |
| (copy-region-as-kill beg end))) | |
| ) | |
| (defun copy-word (&optional arg) | |
| "Copy words at point into kill-ring" | |
| (interactive "P") | |
| (copy-thing 'backward-sexp 'forward-sexp arg) | |
| ;;(paste-to-mark arg) | |
| ) | |
| (global-set-key (kbd "C-c w") 'copy-word) | |
| ; C-h for backspace, C-w for backspace word, C-? for help | |
| (global-set-key (kbd "C-?") 'help-command) | |
| (global-set-key (kbd "M-?") 'mark-paragraph) | |
| (global-set-key (kbd "C-h") 'delete-backward-char) | |
| (global-set-key (kbd "C-w") 'backward-kill-word) | |
| (global-set-key (kbd "C-;") 'universal-argument) | |
| (global-set-key (kbd "M-h") 'kill-region) | |
| (global-set-key [backspace] 'disabled-key) | |
| (global-set-key [M-backspace] 'disabled-key) | |
| (global-set-key [return] 'disabled-key) | |
| ;;(global-set-key [return] 'disabled-key) | |
| ;;(local-set-key (kbd "RET") (key-binding (kbd "M-j") | |
| ;; (setq ipython-command "/usr/local/bin/ipython") | |
| ;; (require 'ipython) | |
| (require 'buffer-move) | |
| ;; Diff buffer with saved file: | |
| ;;diff-buffer-with-file | |
| ;;ediff-current-file | |
| ; C-n, C-p for autocomplete | |
| (yas/global-mode 1) | |
| (require 'auto-complete-config) | |
| (ac-config-default) | |
| (setq ac-use-menu-map t) | |
| (define-key ac-menu-map "\C-n" 'ac-next) | |
| (define-key ac-menu-map "\C-p" 'ac-previous) | |
| (define-key ac-menu-map "\C-o" 'ac-complete) | |
| ;;(add-to-list 'load-path "~/.emacs.d/plugins/yasnippet") | |
| ;;(require 'yasnippet) | |
| ;;(global-set-key (kbd "C-i") 'yas/expand) | |
| ;;(setq yas/also-auto-indent-first-line t) | |
| ;;(add-to-list 'load-path "~/.emacs.d/plugins/autocomplete/") | |
| ;;(add-to-list 'ac-dictionary-directories "~/.emacs.d/plugins/autocomplete/ac-dict") | |
| (defun undo-line () | |
| "Like C-u in bash" | |
| (interactive) | |
| (move-beginning-of-line 1) | |
| (kill-line) | |
| ) | |
| (global-set-key (kbd "C-u") 'undo-line) | |
| (add-to-list 'load-path "/usr/local/Cellar/emacs/24.2/Emacs.app/Contents/share/emacs/site-lisp/w3m") | |
| (require 'w3m-load) | |
| (setq w3m-use-cookies t) | |
| ; M-w to copy line, C-w to delete (without C-a) | |
| (require 'whole-line-or-region) | |
| (whole-line-or-region-mode 1) | |
| ; Rebind C-o to enter. M-o opens next line. | |
| (global-set-key (kbd "C-o") 'newline-and-indent) ;was newline | |
| (setq auto-save-interval 100) | |
| ; Auto save directory | |
| (setq backup-directory-alist | |
| `((".*" . ,temporary-file-directory))) | |
| (setq auto-save-file-name-transforms | |
| `((".*" ,temporary-file-directory t))) | |
| ; Smex | |
| (require 'smex) ; Not needed if you use package.el | |
| (smex-initialize) ; Can be omitted. This might cause a (minimal) delay | |
| ; when Smex is auto-initialized on its first run. | |
| (global-set-key (kbd "M-x") 'smex) | |
| (global-set-key (kbd "M-X") 'smex-major-mode-commands) | |
| ;; This is your old M-x. | |
| (global-set-key (kbd "C-c C-c M-x") 'execute-extended-command) | |
| ; Switch between 2 buffers | |
| (defun switch-to-previous-buffer () | |
| (interactive) | |
| (switch-to-buffer (other-buffer (current-buffer) 1))) | |
| (global-set-key (kbd "M-p") 'switch-to-previous-buffer) | |
| (global-set-key (kbd "M-n") 'other-window) | |
| ;; (add-to-list 'load-path "~/.emacs.d/org-caldav") | |
| ;; (require org-caldav) | |
| ;; (setq org-caldav-url "https://www.google.com/calendar/dav") | |
| ;; (setq org-caldav-calendar-id "") | |
| ;; - Set `org-caldav-files' to the list of org files you would like to | |
| ;; sync. For everything else, you can use the org-icalendar-* | |
| ;; variables, since org-caldav uses that package to generate the | |
| ;; events. | |
| ;; | |
| ;; - Set `org-caldav-inbox' to an org filename where new entries from | |
| ;; the calendar should be stored. | |
| ;; | |
| ;; Call `org-caldav-sync' to start the sync. The URL package will ask | |
| ;; you for username/password for accessing the calendar. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment