From: Ramakrishnan Muthukrishnan Date: Thu, 10 Oct 2013 12:55:09 +0000 (+0530) Subject: refactoring old cruft X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/bcase?a=commitdiff_plain;h=9fcc49d2714c38c06eb99dad75bdd0f8b81c1309;p=.emacs.d.git refactoring old cruft --- diff --git a/emacs/my-generic-stuff.el b/emacs/my-generic-stuff.el index e6b5bee..e989e6f 100644 --- a/emacs/my-generic-stuff.el +++ b/emacs/my-generic-stuff.el @@ -42,3 +42,43 @@ ;; font lock (global-font-lock-mode t) + +;; which-function mode +(setq-default indent-tabs-mode nil) +(add-hook 'emacs-lisp-mode-hook + (lambda () (which-function-mode t))) + +;; iswitch +(iswitchb-mode 1) + +;; smooth scroll +(setq scroll-conservatively 1) +(put 'upcase-region 'disabled nil) +(put 'downcase-region 'disabled nil) + +;; cut and paste with the rest of ecosystem in X +(setq x-select-enable-clipboard t) + +;; remove toolbar +(if (> emacs-major-version 20) + (tool-bar-mode -1)) + +;; completions enhancements +(icomplete-mode t) + +;; Interactively Do Things mode +(require 'ido) +(ido-mode t) +(setq ido-enable-flex-matching t) +(setq ido-enable-last-directory-history nil) + +;; browse kill ring +(when (require 'browse-kill-ring nil 'noerror) + (browse-kill-ring-default-keybindings)) + +;;; displays "\" at the end of lines that wrap +(setq longlines-show-hard-newlines t) + +;; cursor +(setq-default cursor-type '(bar . 2)) +(set-cursor-color "#ff0000") diff --git a/init.el b/init.el index a14feaf..1e40e81 100644 --- a/init.el +++ b/init.el @@ -5,40 +5,21 @@ ;(load-theme 'zenburn t) (require 'package) +(add-to-list 'package-archives + '("marmalade" . + "http://marmalade-repo.org/packages/")) (package-initialize) -(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t) (load "my-c-mode.el") (load "my-generic-stuff.el") (load "my-search.el") (load "my-erc.el") -(load "my-org-mode.el") -(load "my-slime.el") -(load "my-twitter.el") -(load "my-python.el") -(load "my-haskell.el") -(load "my-swank-js.el") - -;; setup font -(if (>= emacs-major-version 23) - (setq default-frame-alist '((font . "Inconsolata-14"))) - (set-default-font - "-Misc-Fixed-Medium-R-Normal--15-140-75-75-C-90-ISO8859-1")) - -(setq-default indent-tabs-mode nil) -(add-hook 'emacs-lisp-mode-hook - (lambda () (which-function-mode t))) - -;; iswitch -(iswitchb-mode 1) - -;; smooth scroll -(setq scroll-conservatively 1) -(put 'upcase-region 'disabled nil) -(put 'downcase-region 'disabled nil) - -;; cscope -(require 'xcscope) +;; (load "my-org-mode.el") +;; (load "my-slime.el") +;; (load "my-twitter.el") +;; (load "my-python.el") +;; (load "my-haskell.el") +;; (load "my-swank-js.el") (defun match-paren (arg) "Go to the matching paren if on a paren; otherwise insert %." @@ -47,53 +28,9 @@ ((looking-at "\\s\)") (forward-char 1) (backward-list 1)) (t (self-insert-command (or arg 1))))) -;; emacs window size according to screen resolution -;; from stackoverflow.com -;; - -(defun set-frame-size-according-to-resolution () - (interactive) - (if window-system - (progn - ;; use 120 char wide window for largeish displays - ;; and smaller 80 column windows for smaller displays - ;; pick whatever numbers make sense for you - (if (> (x-display-pixel-width) 1280) - (add-to-list 'default-frame-alist (cons 'width 80)) - (add-to-list 'default-frame-alist (cons 'width 78))) - ;; for the height, subtract a couple hundred pixels - ;; from the screen height (for panels, menubars and - ;; whatnot), then divide by the height of a char to - ;; get the height we want - (add-to-list 'default-frame-alist - (cons 'height (/ (- (x-display-pixel-height) 0) (frame-char-height))))))) - -(set-frame-size-according-to-resolution) - -;; tramp -(require 'tramp) - (setq tramp-default-method "ssh") - -;; cut and paste with the rest of ecosystem in X -(setq x-select-enable-clipboard t) - -;; remove toolbar -(if (> emacs-major-version 20) - (tool-bar-mode -1)) - -;; clojure mode -(add-to-list 'load-path "~/.emacs.d/vendor/clojure-mode") -(require 'clojure-mode) - ;; highlight parentheses mode (require 'highlight-parentheses) -;; rainbow effect -;; http://stackoverflow.com/questions/2413047/how-do-i-get-rainbow-parentheses-in-emacs -;; (setq hl-paren-colors -;; '(;"#8f8f8f" ; this comes from Zenburn -;; ; and I guess I'll try to make the far-outer parens look like this -;; "orange1" "yellow1" "greenyellow" "green1" -;; "springgreen1" "cyan1" "slateblue1" "magenta1" "purple")) ;; paredit (autoload 'paredit-mode "paredit" @@ -107,190 +44,16 @@ (add-hook hook #'(lambda () (highlight-parentheses-mode t) (paredit-mode +1)))) -;; clojure-test-mode -(autoload 'clojure-test-mode "clojure-test-mode" "Clojure test mode" t) -(autoload 'clojure-test-maybe-enable "clojure-test-mode" "" t) -(add-hook 'clojure-mode-hook 'clojure-test-maybe-enable) ;; flyspell (autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t) -;;; fullscreen mode -(defun switch-full-screen () - (interactive) - (shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen")) - -(global-set-key [f10] 'switch-full-screen) - -;; gist integration -(require 'gist) - -;; browse url -(setq browse-url-browser-function 'browse-url-firefox -; browse-url-generic-program "/usr/bin/iceweasel" - browse-url-new-window-flag t - browse-url-firefox-new-window-is-tab t) -(define-key global-map "\C-co" 'browse-url-at-point) - -;; nxml for editing xml files -(setq auto-mode-alist - (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode) - auto-mode-alist)) - -;; completions enhancements -(icomplete-mode t) - -;; Interactively Do Things mode -(require 'ido) - -(ido-mode t) -(setq ido-enable-flex-matching t) -(setq ido-enable-last-directory-history nil) - -;; browse kill ring -(when (require 'browse-kill-ring nil 'noerror) - (browse-kill-ring-default-keybindings)) - -;; rainbox mode for CSS color highlighting -(require 'rainbow-mode) - -(add-to-list 'auto-mode-alist '("\\.rkt$" . scheme-mode)) - -;; scheme auto complete -(require 'scheme-complete) -(autoload 'scheme-smart-complete "scheme-complete" nil t) -(eval-after-load 'scheme - '(progn (define-key scheme-mode-map "\t" 'scheme-complete-or-indent))) - -;; autocomplete -(add-to-list 'load-path "~/.emacs.d/vendor/popup/") -(add-to-list 'load-path "~/.emacs.d/vendor/auto-complete/") -(require 'auto-complete) - -(set-default 'ac-sources - '(ac-source-abbrev - ac-source-dictionary - ac-source-yasnippet - ac-source-words-in-buffer - ac-source-words-in-same-mode-buffers - ac-source-semantic)) - -(dolist (m '(c-mode c++-mode java-mode)) - (add-to-list 'ac-modes m)) - -(global-auto-complete-mode t) - -;; slime autocomplete -(add-to-list 'load-path "~/.emacs.d/vendor/ac-slime/") - -(require 'ac-slime) -(set-default 'ac-sources 'ac-source-slime-simple) -(add-hook 'slime-mode-hook 'set-up-slime-ac) -(add-hook 'slime-repl-mode-hook 'set-up-slime-ac) - -;; scheme/quack -;(require 'quack) -;(setq scheme-program-name "racket") -;(setq quack-default-program "racket -il racket/base") -;(setq quack-switch-to-scheme-method 'other-window) -;(setq quack-newline-behavior 'indent-newline-indent) - -(defun racket-enter! () - (interactive) - (comint-send-string (scheme-proc) - (format "(enter! (file \"%s\") #:verbose)\n" buffer-file-name)) - (switch-to-scheme t)) -(local-set-key "\C-c\C-v" 'racket-enter!) - -;; company-mode -(add-to-list 'load-path "~/.emacs.d/vendor/company-mode") -(autoload 'company-mode "company" nil t) - ;; handle trailing whitespaces ;(add-hook 'before-save-hook 'delete-trailing-whitespace) ;; update copyright years before saving. ;(add-hook 'before-save-hook 'copyright-update) -;; la carte mode (access menu from keyboard) -(require 'lacarte) - -;;; Based on code by Rudi Schlatte. -;;; Needs this library: -;;; http://www.emacswiki.org/cgi-bin/wiki/XmlRpc -(require 'xml-rpc) - -(defvar lisppaste-nick "vu3rdd") -(defvar lisppaste-channel "None") -(defvar lisppaste-colorize-as "Scheme") -(defvar lisppaste-prev-title "") - -(defun lisppaste-region (region-begin region-end - &optional channel username title annotate) - (interactive "r") - (let* ((content (buffer-substring region-begin region-end)) - (channel (or channel - (read-from-minibuffer "Channel: " lisppaste-channel))) - (username (or username (read-from-minibuffer "Nick: " lisppaste-nick))) - (title (or title (read-from-minibuffer "Title: " lisppaste-prev-title))) - (annotate (or annotate (string-to-number (read-from-minibuffer "Annotate? ")))) - (colorize-as (if (zerop annotate) (read-from-minibuffer "Colorize as (empty for default): " lisppaste-colorize-as)))) - (setf lisppaste-prev-title title) - (let* ((ret (xml-rpc-method-call "http://common-lisp.net:8185/RPC2" 'newpaste - channel username title content (or colorize-as annotate))) - (url-beg (search "http://" ret)) - (url-end (and url-beg (search " " ret :start2 url-beg))) - (url (and url-end (substring ret url-beg url-end)))) - (print ret) - (and url (browse-url url)) - (or url ret)))) - -;;; displays "\" at the end of lines that wrap -(setq longlines-show-hard-newlines t) - -;; javascript mode -(autoload 'js2-mode "js2-mode" nil t) -(add-to-list 'auto-mode-alist '("\\.js$" . js2-mode)) - -;; geiser for Scheme programming -;(load-file "~/src/geiser/elisp/geiser.el") - -;; geiser racket -;(setq geiser-guile-binary "racket") -;(setq geiser-active-implementations '(racket)) - -;; flymake -(require 'flymake) -(defun flymake-racket-init () - (let* ((temp-file (flymake-init-create-temp-buffer-copy - 'flymake-create-temp-inplace)) - (local-file (file-relative-name - temp-file - (file-name-directory buffer-file-name)))) - (list "racket" (list "-qf" local-file)))) - -(push '("\\.rkt\\'" flymake-racket-init) - flymake-allowed-file-name-masks) - - -;; ghc-mod -(autoload 'ghc-init "ghc" nil t) -(add-hook 'haskell-mode-hook - (lambda () - (ghc-init) - (require 'auto-complete-config) - (auto-complete-mode t) - (add-to-list 'ac-sources 'ac-source-ghc-mod))) -;; haskell-mode hooks -(add-hook 'haskell-mode-hook 'capitalized-words-mode) -(add-hook 'haskell-mode-hook 'turn-on-haskell-decl-scan) - -;; sml -(autoload 'sml-mode "sml-mode" "Major mode for editing SML." t) -(autoload 'run-sml "sml-proc" "Run an inferior SML process." t) - -(require 'gnus-art) - ;; sending email (setq message-send-mail-function 'message-send-mail-with-sendmail mail-specify-envelope-from t ; Settings to work with msmtp @@ -302,76 +65,6 @@ (setq message-kill-buffer-on-exit t) ; kill buffer after sending mail) - -;; cursor -(setq-default cursor-type '(bar . 2)) -(set-cursor-color "#ff0000") - -;; color theme - -;; wombat color theme -;(set-background-color "Black") -(set-background-color "#242424") -;(set-foreground-color "White") -(set-foreground-color "#f6f3e8") -(set-cursor-color "Red") -;(set-cursor-color "#656565") -(set-mouse-color "LightSkyBlue") -(setq font-lock-maximum-decoration t) -(set-face-foreground 'font-lock-comment-face "#99968b") -(set-face-italic-p 'font-lock-comment-face t) -(set-face-foreground 'font-lock-doc-face "#99968b") -(set-face-italic-p 'font-lock-doc-face t) -(set-face-foreground 'font-lock-constant-face "#e5786d") -(set-face-foreground 'font-lock-string-face "#95e454") -(set-face-italic-p 'font-lock-string-face t) -(set-face-foreground 'font-lock-variable-name-face "#cae682") -(set-face-foreground 'font-lock-function-name-face "#cae682") -(set-face-foreground 'font-lock-type-face "#cae682") -(set-face-foreground 'font-lock-builtin-face "#8ac6f2") -(set-face-foreground 'font-lock-keyword-face "#8ac6f2") -(set-face-foreground 'font-lock-preprocessor-face "#e5786d") -(set-face-foreground 'font-lock-negation-char-face "#e7f6da") -(set-face-foreground 'link "#8ac6f2") -(set-face-bold-p 'link t) -(set-face-underline-p 'link t) -(show-paren-mode t) -(set-face-foreground 'show-paren-match-face "#f6f3e8") -(set-face-background 'show-paren-match-face "#857b6f") -(set-face-bold-p 'show-paren-match t) -(set-face-foreground 'region "#f6f3e8") -(set-face-background 'region "#444444") -(set-face-foreground 'lazy-highlight "black") -(set-face-background 'lazy-highlight "yellow") - -;; color theme from Lau Jenson -(defun color-theme-dark-bliss () - "" - (interactive) - (color-theme-install - '(color-theme-dark-bliss - ((foreground-color . "#eeeeee") - (background-color . "#001122") - (background-mode . dark) - (cursor-color . "#ccffcc")) - (bold ((t (:bold t)))) - (bold-italic ((t (:italic t :bold t)))) - (default ((t (nil)))) - - (font-lock-builtin-face ((t (:foreground "#f0f0aa")))) - (font-lock-comment-face ((t (:italic t :foreground "#aaccaa")))) - (font-lock-delimiter-face ((t (:foreground "#aaccaa")))) - (font-lock-constant-face ((t (:bold t :foreground "#ffaa88")))) - (font-lock-doc-string-face ((t (:foreground "#eeccaa")))) - (font-lock-doc-face ((t (:foreground "#eeccaa")))) - (font-lock-reference-face ((t (:foreground "#aa99cc")))) - (font-lock-function-name-face ((t (:foreground "#ffbb66")))) - (font-lock-keyword-face ((t (:foreground "#ccffaa")))) - (font-lock-preprocessor-face ((t (:foreground "#aaffee")))) - (font-lock-string-face ((t (:foreground "#bbbbff"))))))) - -;; (color-theme-dark-bliss) - ;; notmuch (setq gnus-inhibit-images nil) (add-to-list 'load-path "~/.emacs.d/emacs/notmuch") @@ -419,3 +112,6 @@ (add-hook hook (lambda () (flyspell-mode 1)))) (dolist (hook '(change-log-mode-hook log-edit-mode-hook)) (add-hook hook (lambda () (flyspell-mode -1)))) + +;; new wonderful theme monokai +(load-theme 'monokai t)