Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
___Johniel authored and ___Johniel committed Jul 27, 2013
0 parents commit 241689b
Show file tree
Hide file tree
Showing 197 changed files with 48,565 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
auto-save-list
*~
tramp
elpa
url
*.elc
history
skk
eshell/history
eshell/lastdir
.mc-lists.el
/site-lisp/k7
30 changes: 30 additions & 0 deletions appearance.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
;; appearance.el ---

(require 'util)

;; Font
(set-face-attribute 'default nil :height 120)

(add-to-list 'custom-theme-load-path "~/.emacs.d/theme")
(load-theme 'piecewise-linear t)
(enable-theme 'piecewise-linear)

(global-font-lock-mode 1)

(show-paren-mode 1)

(line-number-mode 1)

(column-number-mode 1)

(tool-bar-mode 0)

(scroll-bar-mode 0)

(transient-mark-mode 0)

(when window-system
(eval-safe
(global-hl-line-mode 1)
(global-yascroll-bar-mode 1)
))
143 changes: 143 additions & 0 deletions commands.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
;;; commands.el ---

;;
;; https://github.com/magnars/.emacs.d/blob/master/defuns/lisp-defuns.el
(defun eval-and-replace ()
"Replace the preceding sexp with its value."
(interactive)
(backward-kill-sexp)
(condition-case nil
(prin1 (eval (read (current-kill 0)))
(current-buffer))
(error (message "Invalid expression")
(insert (current-kill 0)))))


;;
;; http://qiita.com/items/e6978008253ba70c037c
(defun kill-word-or-kill-region ()
(interactive)
(if (or (not transient-mark-mode) (region-active-p))
(kill-region (region-beginning) (region-end))
(kill-word 1)))

;;
;; http://d.hatena.ne.jp/rubikitch/20100210/emacs
(defun other-window-or-split ()
(interactive)
(when (one-window-p)
(split-window-horizontally))
(other-window 1))

;;
;; http://d.hatena.ne.jp/supermassiveblackhole/20100625/1277436024
(defun swap-screen ()
"Swap two screen,leaving cursor at current window."
(interactive)
(let ((thiswin (selected-window))
(nextbuf (window-buffer (next-window))))
(set-window-buffer (next-window) (window-buffer))
(set-window-buffer thiswin nextbuf)))

(defun swap-screen-with-cursor ()
"Swap two screen,with cursor in same buffer."
(interactive)
(let ((thiswin (selected-window))
(thisbuf (window-buffer)))
(other-window 1)
(set-window-buffer thiswin (window-buffer))
(set-window-buffer (selected-window) thisbuf)))

;;
;; http://emacswiki.org/emacs/CopyingWholeLines
(defun copy-line (arg)
"Copy lines (as many as prefix argument) in the kill ring"
(interactive "p")
(kill-ring-save (line-beginning-position)
(line-beginning-position (+ 1 arg)))
(message "%d line%s copied" arg (if (= 1 arg) "" "s")))


;; delete-trailing-whitespace-except-current-line is added to hook
;; http://stackoverflow.com/questions/3533703/emacs-delete-trailing-whitespace-except-current-line
(defun delete-trailing-whitespace-except-current-line ()
(interactive)
(let ((begin (line-beginning-position))
(end (line-end-position)))
(save-excursion
(when (< (point-min) begin)
(save-restriction
(narrow-to-region (point-min) (1- begin))
(delete-trailing-whitespace)))
(when (> (point-max) end)
(save-restriction
(narrow-to-region (1+ end) (point-max))
(delete-trailing-whitespace))))))


;;
;; https://github.com/purcell/emacs.d/blob/master/init-editing-utils.el
(defun sort-lines-random (beg end)
"Sort lines in region randomly."
(interactive "r")
(save-excursion
(save-restriction
(narrow-to-region beg end)
(goto-char (point-min))
(let ;; To make `end-of-line' and etc. to ignore fields.
((inhibit-field-text-motion t))
(sort-subr nil 'forward-line 'end-of-line nil nil
(lambda (s1 s2) (eq (random 2) 0)))))))


;;
;; http://stackoverflow.com/questions/3669511/the-function-to-show-current-files-full-path-in-mini-buffer
(setq frame-title-format
(list (format "%s %%S: %%j " (system-name))
'(buffer-file-name "%f" (dired-directory dired-directory "%b"))))
(defun insert-file-path ()
(interactive)
(insert (buffer-file-name)))


;; Switching Between Two Recently Used Buffers
;; http://www.emacswiki.org/emacs/SwitchingBuffers
(defun resently-used-buffer ()
(interactive)
(other-buffer (current-buffer) 1))

;;
;; http://whattheemacsd.com/file-defuns.el-02.html
(defun delete-current-buffer-file ()
"Removes file connected to current buffer and kills buffer."
(interactive)
(let ((filename (buffer-file-name))
(buffer (current-buffer))
(name (buffer-name)))
(if (not (and filename (file-exists-p filename)))
(ido-kill-buffer)
(when (yes-or-no-p "Are you sure you want to remove this file? ")
(delete-file filename)
(kill-buffer buffer)
(message "File '%s' successfully removed" filename)))))

;; http://whattheemacsd.com/file-defuns.el-01.html
(defun rename-current-buffer-file ()
"Renames current buffer and file it is visiting."
(interactive)
(let ((name (buffer-name))
(filename (buffer-file-name)))
(if (not (and filename (file-exists-p filename)))
(error "Buffer '%s' is not visiting a file!" name)
(let ((new-name (read-file-name "New name: " filename)))
(if (get-buffer new-name)
(error "A buffer named '%s' already exists!" new-name)
(rename-file filename new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil)
(message "File '%s' successfully renamed to '%s'"
name (file-name-nondirectory new-name)))))))

;;;
(provide 'commands)
59 changes: 59 additions & 0 deletions conf/integrate-yas-ac.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
;;; integrate-yas-ac.el --- Integration for Auco-Complete and Yasnippet

(require 'auto-complete)
(require 'auto-complete-config)
(require 'dash)
(require 'util)
(require 'yasnippet)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Remove Yasnippet Keywords Into `ac-ignores' For Each Buffers
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun add-yas-keys-to-ac-ignores ()
(interactive)
(progn
(make-local-variable 'ac-ignores)
(->> (yas--get-snippet-tables)
(-map 'yas--table-hash)
(--map (loop for k being the hash-keys in it collect k))
(-flatten)
(--map (add-to-list 'ac-ignores it)))))

(defadvice yas--load-pending-jits (after my-ac-conf activate)
(add-yas-keys-to-ac-ignores))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Stup Auto-Complete While Expanding Yasnippet
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; https://gist.github.com/750077
;;; yasnippet and auto-complete

(defvar ac-yas-expand-autostart-backup nil "s")

(defun ac-yas-expand-start ()
""
(setq ac-yas-expand-autostart-backup ac-auto-start)
(setq ac-auto-start nil))

(defun ac-yas-expand-end ()
""
(setq ac-auto-start ac-yas-expand-autostart-backup))

(defun ac-yas-expand-install ()
(interactive)
(add-hook 'yas-before-expand-snippet-hook 'ac-yas-expand-start)
(add-hook 'yas-after-exit-snippet-hook 'ac-yas-expand-end))

(defun ac-yas-expand-uninstall ()
(interactive)
(remove-hook 'yas-before-expand-snippet-hook 'ac-yas-expand-start)
(remove-hook 'yas-after-exit-snippet-hook 'ac-yas-expand-end))

(ac-yas-expand-install)

;;;
(provide 'integrate-yas-ac)
24 changes: 24 additions & 0 deletions conf/setup-ace-jump-mode.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
;;; setup-ace-jump-mode.el ---

(require 'ace-jump-mode)

(setq ace-jump-mode-submode-list
'(ace-jump-word-mode
ace-jump-char-mode
ace-jump-line-mode))

;; https://github.com/magnars/.emacs.d/blob/master/setup-ace-jump-mode.el
(defun define-ace-jump-char-mode-for-all (c)
(global-set-key (read-kbd-macro (concat "C-M-g " (string c)))
`(lambda ()
(interactive)
(setq ace-jump-query-char ,c)
(setq ace-jump-current-mode 'ace-jump-word-mode)
(ace-jump-do (concat "\\b"
(regexp-quote (make-string 1 ,c)))))))

;; (loop for c from ?0 to ?9 do (define-ace-jump-char-mode-for-all c))
;; (loop for c from ?A to ?Z do (define-ace-jump-char-mode-for-all c))
;; (loop for c from ?a to ?z do (define-ace-jump-char-mode-for-all c))

(provide 'setup-ace-jump-mode)
46 changes: 46 additions & 0 deletions conf/setup-auctex.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
;;; setup-auctex.el ---

(require 'latex)
(require 'tex-site)
(require 'tex-mode)

(defvar tex-mode-list
'(tex-mode-hook
slitex-mode-hook
latex-mode-hook
bibtex-mode-hook
LaTeX-mode-hook))

;; http://d.hatena.ne.jp/ryoma_robo/20120503/1336012148

;; (setq tex-default-mode 'latex-mode)

;; (setq-default ispell-program-name "/usr/bin/aspell") ;; path to aspell
(setq flyspell-issu-welcome-flag nil)


;; DocView auto-revert-mode
(add-hook 'doc-view-mode-hook 'auto-revert-mode)
(setq doc-view-continuous t)

(dolist (mode tex-mode-list)
(add-hook mode 'flyspell-mode))

(add-to-list 'tex-compile-commands
'("platex %f"))

(require 'setup-flyspell)
(add-hook 'flyspell-mode-hook
'(lambda ()
(local-set-key (kbd "C-c n") 'flyspell-correct-word-popup-el)))

;; http://wikemacs.org/wiki/AUCTeX
(require 'font-latex)
(setq font-latex-fontify-script nil)
(setq font-latex-fontify-sectioning 'color)
; modify Beamer as well
(custom-set-faces
'(font-latex-slide-title-face ((t (:inherit font-lock-type-face)))))
(font-latex-update-sectioning-faces)

(provide 'setup-auctex)
35 changes: 35 additions & 0 deletions conf/setup-auto-complete.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
;; http://cx4a.org/software/auto-complete/manual.ja.html

(require 'auto-complete)
(require 'auto-complete-config)

(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete/dict")

(custom-set-variables '(ac-ignore-case nil))

(setq ac-use-comphist nil)
(setq ac-auto-start t)
(setq ac-delay 0.0)
(setq popup-use-optimized-column-computation nil)

(setq ac-use-menu-map t)
(define-key ac-menu-map (kbd "C-n") nil)
(define-key ac-menu-map (kbd "C-p") nil)

(define-key ac-completing-map "\r" nil)
(define-key ac-completing-map [return] nil)

(set-face-background 'ac-candidate-face "gray30")
(set-face-underline 'ac-candidate-face "gray50")
(set-face-background 'ac-selection-face "RoyalBlue4")

(defadvice ac-inline-show (around my-ac-conf activate)
"Call ac-inline-show, if the cursor is in end of line."
(if (eolp) ad-do-it nil))

(if (not (performance-saving-p))
(global-auto-complete-mode t))

(make-local-variable 'ac-auto-start)

(provide 'setup-auto-complete)
5 changes: 5 additions & 0 deletions conf/setup-auto-save-buffers.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(require 'auto-save-buffers)

(run-with-idle-timer 5 t 'auto-save-buffers)

(provide 'setup-auto-save-buffers)
Loading

0 comments on commit 241689b

Please sign in to comment.