Skip to content

Instantly share code, notes, and snippets.

@nyuichi
Created July 21, 2012 04:44
Show Gist options
  • Save nyuichi/3154599 to your computer and use it in GitHub Desktop.
Save nyuichi/3154599 to your computer and use it in GitHub Desktop.
emacs
(global-set-key "\C-h" 'delete-backward-char)
;;; Misc
(tool-bar-mode 0)
(show-paren-mode 1)
(global-linum-mode 1)
(setq column-number-mode t)
(setq indent-tabs-mode nil)
(setq make-backup-files nil)
(setq auto-save-default t)
(setq inhibit-startup-message t)
;;; Scrolling
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1)))
(setq mouse-wheel-progressive-speed t)
(setq mouse-wheel-follow-mouse t)
(setq scroll-step 1)
(setq scroll-conservatively 10000)
(setq scroll-margin 0)
(setq scroll-preserve-screen-position t)
(global-set-key "\M-n" '(lambda () (interactive) (scroll-up 4)))
(global-set-key "\M-p" '(lambda () (interactive) (scroll-down 4)))
(let ((default-directory "~/.emacs.d/site-lisp"))
(add-to-list 'load-path "~/.emacs.d/site-lisp")
(normal-top-level-add-subdirs-to-load-path))
;;; Auto-install
(require 'auto-install)
;(auto-install-update-emacswiki-package-name t)
(setq auto-install-directory "~/.emacs.d/site-lisp")
;;; Anything
(require 'anything-startup)
(global-set-key (kbd "C-]") 'anything-for-files)
;;; Auto-complete
(require 'auto-complete-config)
(ac-config-default)
;; ParEdit
(require 'paredit)
(add-hook 'lisp-mode-hook 'enable-paredit-mode)
(add-hook 'emacs-lisp-mode-hook 'enable-paredit-mode)
(add-hook 'scheme-mode-hook 'enable-paredit-mode)
(add-hook 'slime-repl-mode-hook 'enable-paredit-mode)
;; Flymake
(require 'flymake)
(require 'popup)
(defun popup-flymake-display-error ()
(interactive)
(let* ((line-no (flymake-current-line-no))
(line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info
line-no)))
(count (length line-err-info-list)))
(while (> count 0)
(when line-err-info-list
(let* ((file (flymake-ler-file (nth (1- count)
line-err-info-list)))
(full-file (flymake-ler-full-file (nth (1- count)
line-err-info-list)))
(text (flymake-ler-text (nth (1- count)
line-err-info-list)))
(line (flymake-ler-line (nth (1- count)
line-err-info-list))))
(popup-tip (format "[%s] %s" line text))))
(setq count (1- count)))))
(global-set-key "\C-cd" 'popup-flymake-display-error)
;; Slime
(require 'slime)
(setq slime-net-coding-system 'utf-8-unix)
(slime-setup '(slime-repl slime-fancy slime-banner))
;; C/C++
(defun flymake-init (cc)
(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 cc (list "-Wall" "-Wextra" "-fsyntax-only" local-file))))
(defun flymake-cc-init () (flymake-init "g++"))
(defun flymake-c-init () (flymake-init "gcc"))
(push '("\\.h$" flymake-cc-init) flymake-allowed-file-name-masks)
(push '("\\.cc$" flymake-cc-init) flymake-allowed-file-name-masks)
(push '("\\.cpp$" flymake-cc-init) flymake-allowed-file-name-masks)
(push '("\\.c$" flymake-c-init) flymake-allowed-file-name-masks)
(add-hook 'c++-mode-hook '(lambda () (flymake-mode t)))
(add-hook 'c-mode-hook '(lambda () (flymake-mode t)))
;;; Lisp
;; (setq inferior-lisp-program "sbcl")
;; JSX
;; (add-to-list 'load-path (expand-file-name "~/.emacs.d/jsx-mode.el/"))
;; (add-to-list 'auto-mode-alist '("\\.jsx\\'" . jsx-mode))
;; (autoload 'jsx-mode "jsx-mode" "JSX mode" t)
;; ;; You can edit user-customizable variables by typing the following command.
;; ;; M-x customize-group [RET] jsx-mode
;; (custom-set-variables
;; '(jsx-indent-level 4)
;; '(jsx-use-flymake t)
;; '(jsx-syntax-check-mode "compile"))
;; (defun jsx-mode-init ()
;; (define-key jsx-mode-map (kbd "C-c d") 'jsx-display-popup-err-for-current-line)
;; (when (require 'auto-complete nil t)
;; (auto-complete-mode t)))
;; (add-hook 'jsx-mode-hook 'jsx-mode-init)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment