;; disable bell function
(setq ring-bell-function 'ignore)
;; disable toolbar
(tool-bar-mode -1)
;; disable scrollbar
(toggle-scroll-bar -1)
;; disable splash screen
(custom-set-variables '(inhibit-startup-screen t))
;; current buffer name in title bar
(setq frame-title-format "%b")
;; start emacs server
(server-start)
(defun djcb-opacity-modify (&optional dec)
"modify the transparency of the emacs frame; if DEC is t,
decrease the transparency, otherwise increase it in 10%-steps"
(let* ((alpha-or-nil (frame-parameter nil 'alpha)) ; nil before
setting
(oldalpha (if alpha-or-nil alpha-or-nil 100))
(newalpha (if dec (- oldalpha 10) (+ oldalpha 10))))
(when (and (>= newalpha frame-alpha-lower-limit) (<= newalpha 100))
(modify-frame-parameters nil (list (cons 'alpha newalpha))))))
;; C-8 will increase opacity (== decrease transparency)
;; C-9 will decrease opacity (== increase transparency
;; C-0 will returns the state to normal
(global-set-key (kbd "C-8")
'(lambda()(interactive)(djcb-opacity-modify)))
(global-set-key (kbd "C-9") '(lambda()(interactive)(djcb-opacity-modify
t)))
(global-set-key (kbd "C-0") '(lambda()(interactive)
(modify-frame-parameters nil `((alpha .
100)))))
(defun indent-or-expand (arg)
"Either indent according to mode, or expand the word preceding
point."
(interactive "*P")
(if (and
(or (bobp) (= ?w (char-syntax (char-before))))
(or (eobp) (not (= ?w (char-syntax (char-after))))))
(dabbrev-expand arg)
(indent-according-to-mode)))
(defun my-tab-fix ()
(local-set-key [tab] 'indent-or-expand))
;; add hooks for modes you want to use the tab completion for:
(add-hook 'c-mode-hook 'my-tab-fix)
(add-hook 'sh-mode-hook 'my-tab-fix)
(add-hook 'emacs-lisp-mode-hook 'my-tab-fix)
(add-hook 'clojure-mode-hook 'my-tab-fix)
(defun move-line-down ()
(interactive)
(let ((col (current-column)))
(save-excursion
(next-line)
(transpose-lines 1))
(next-line)
(move-to-column col)))
(defun move-line-up ()
(interactive)
(let ((col (current-column)))
(save-excursion
(next-line)
(transpose-lines -1))
(move-to-column col)))
(defun duplicate-line()
(interactive)
(move-beginning-of-line 1)
(kill-line)
(yank)
(newline)
(yank)
)
(setq x-select-enable-clipboard t)
;;enable deleting selected text with del or ctrl-d
(delete-selection-mode t)
(load-file "$EMACS_LIB/load-directory.el")
;(load-file "$EMACS_LIB/setup-clojure.el")
;(load-file "$EMACS_LIB/setup-ecb.el")
(mapcar 'load-directory
'("$EMACS_LIB/startup"))
(require 'ido)
(ido-mode t)
(set-cursor-color "white")
(switch-to-buffer "*scratch*")
(global-set-key (kbd "M-<down>") 'move-line-down)
(global-set-key (kbd "M-<up>") 'move-line-up)
(global-set-key (kbd "M-S-<down>") 'duplicate-line)
(message "Emacs is ready")