Vous êtes sur la page 1sur 6

(garbage-collect)

;;(set-frame-parameter (selected-frame) 'alpha '(<active> [<inactive>]))


;(add-to-list 'default-frame-alist '(alpha 80 50))
;; (eval-when-compile (require 'cl))
;; (defun toggle-transparency ()
;; (interactive)
;; (if (/=
;; (cadr (frame-parameter nil 'alpha))
;; 100)
;; (set-frame-parameter nil 'alpha '(100 100))
;; (set-frame-parameter nil 'alpha '(80 50))))
;; (global-set-key (kbd "C-c t") 'toggle-transparency)
; show parenthesis
(show-paren-mode)
; hide bars
(menu-bar-mode -1)
(tool-bar-mode -1)
; set font, monaco, download from http://www.webdevkungfu.com/textmate-envy-aka-
monaco-font-for-windows/
; note that for Mac OS X, the default font is just monaco, so please comment out
the following line
(set-default-font "-outline-Monaco-normal-normal-normal-mono-14-*-*-*-c-*-iso885
9-1")
; show column numbers
(column-number-mode)
; overriding M-w and C-w key so that if no region selected, copy the current lin
e
(defadvice kill-ring-save (before slickcopy activate compile)
"When called interactively with no active region, copy a single line instead."
(interactive
(if mark-active (list (region-beginning) (region-end))
(list (line-beginning-position)
(line-beginning-position 2)))))
(defadvice kill-region (before slickcut activate compile)
"When called interactively with no active region, kill a single line instead."
(interactive
(if mark-active (list (region-beginning) (region-end))
(list (line-beginning-position)
(line-beginning-position 2)))))
; file associations, associate files with .module and .install to php mode
(setq auto-mode-alist (cons '("\\.module$" . php-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.install$" . php-mode) auto-mode-alist))
; goto matching brackets
(defun goto-match-paren (arg)
"Go to the matching parenthesis if on parenthesis AND last command is a movemen
t command, otherwise insert %.
vi style of % jumping to matching brace."
(interactive "p")
(message "%s" last-command)
(if (not (memq last-command '(
set-mark
cua-set-mark
goto-match-paren
down-list
up-list
end-of-defun
beginning-of-defun
backward-sexp
forward-sexp
backward-up-list
forward-paragraph
backward-paragraph
end-of-buffer
beginning-of-buffer
backward-word
forward-word
mwheel-scroll
backward-word
forward-word
mouse-start-secondary
mouse-yank-secondary
mouse-secondary-save-then-kill
move-end-of-line
move-beginning-of-line
backward-char
forward-char
scroll-up
scroll-down
scroll-left
scroll-right
mouse-set-point
next-buffer
previous-buffer
)
))
(self-insert-command (or arg 1))
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char))
((looking-at "\\s\)") (forward-char) (backward-list 1))
(t (self-insert-command (or arg 1))))))
(add-hook 'c-mode-common-hook (lambda ()
(local-set-key (kbd "%") 'goto-match-paren)))
; end of matching brackets
; load autopair, used to automatically insert the matching bracket, quotes a
nd double quotes
(load "~/.emacs.d/autopair.el")
(require 'autopair)
(autopair-global-mode)
; set C-a back to begin of line
(global-set-key (kbd "C-a") 'move-beginning-of-line)
; set cursor to a vertical bar
(setq-default cursor-type 'bar)
; set tab and indentation width to 4
(setq-default tab-width 4)
(setq-default c-basic-offset 4)
; offset settings for drupal, so that the array indentation is in accord with Dr
upal Style
(c-set-offset 'arglist-intro '+) ; for FAPI arrays and DBTNG
(c-set-offset 'arglist-cont-nonempty 'c-lineup-math) ; for DBTNG fields and valu
es
(defconst my-php-style
'((c-offsets-alist . (
(arglist-close . c-lineup-close-paren) ; correct arglist closing pa
renthesis
)))
"My PHP Programming style"
)
(c-add-style "my-php-style" my-php-style)
; load AUCTex
(load "~/.emacs.d/auctex/auctex.el")
(require 'tex-site)
(global-set-key (kbd "C-j") 'newline)
(global-set-key (kbd "RET") 'newline-and-indent)
(global-set-key (kbd "C-`") 'set-mark-command)
; psvn settings
(load "~/.emacs.d/psvn.el")
(require 'psvn)
(add-hook 'asm-mode-hook '(lambda ()
(local-set-key (kbd "RET") 'newline)))
(setq auto-mode-alist (cons '("\\.asm$" . asm-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.ASM$" . asm-mode) auto-mode-alist))
; flymake, on-the-fly syntax check
(load "~/.emacs.d/flymake.el")
(add-hook 'c-mode-common-hook (lambda ()
(flymake-mode 1)))
(add-hook 'php-mode-hook '(lambda ()
(local-set-key (kbd "C-x e") 'flymake-display-err-me
nu-for-current-line)
(c-set-style "my-php-style")))
(load "~/.emacs.d/linum")
;(setq linum-format "%d ")
(global-linum-mode 1)

(add-to-list 'load-path (expand-file-name "~/.emacs.d/"))


(add-to-list 'load-path (expand-file-name "~/.emacs.d/auto-install"))
(require 'auto-install)
;(setq auto-install-directory "~/.emacs.d/auto-install/")
(add-to-list 'load-path (expand-file-name "~/.emacs.d/php-mode"))
(load "~/.emacs.d/php-mode/php-mode.el")
(require 'php-mode)
; color theme, a plugin to change the color settings of the editor
(add-to-list 'load-path "~/.emacs.d/color-theme/")
(require 'color-theme)
(eval-after-load "color-theme"
'(progn
(color-theme-initialize)
; the next line set the color theme to use
(color-theme-xemacs)))
; set aspell connector, need aspell to be installed on the system
(eval-after-load "ispell"
(progn
(setq-default ispell-local-dictionary "british"
ispell-silently-savep t)))
(setq-default ispell-program-name "C:\\Aspell\\bin\\aspell.exe") ; set aspell as
checker
(require 'ispell)
; load flyspell, a on-the-fly spell checking plugin, requires aspell to function
(setq ispell-extra-args '("--sug-mode=ultra"))
(setq ispell-process-directory (expand-file-name "~/"))
(load "~/.emacs.d/flyspell.el")
(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
(autoload 'flyspell-delay-command "flyspell" "Delay on command." t) (autoload 't
ex-mode-flyspell-verify "flyspell" "" t)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'flyspell-mode-hook '(lambda ()
(local-set-key (kbd "C-x a") 'ispell-word)))
; set smooth scrolling
;; scroll one line at a time (less "jumpy" than defaults)
(setq mouse-wheel-scroll-amount '(2 ((shift) . 2))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
(setq scroll-step 2) ;; keyboard scroll one line at a time
; setup autocomplete, a plugin to automatically complete the input
(add-to-list 'load-path "~/.emacs.d/auto-complete")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete/ac-dict")
(ac-config-default)
; copy word shortcuts
(defun get-point (symbol &optional arg)
"get the point"
(funcall symbol arg)
(point)
)
(defun copy-thing (begin-of-thing end-of-thing &optional arg)
"copy thing between beg & end into kill ring"
(let ((beg (get-point begin-of-thing 1))
(end (get-point end-of-thing arg)))
(copy-region-as-kill beg end))
)
(defun paste-to-mark(&optional arg)
"paste things to mark, or to the prompt in shell-mode"
(let ((pasteMe
(lambda()
(if (string= "shell-mode" major-mode)
(progn (goto-char (mark)) (yank) )))))
(if arg
(if (= arg 1)
nil
(funcall pasteMe))
(funcall pasteMe))
))
(defun copy-word (&optional arg)
"copy words at the point into kill-ring"
(interactive "P")
(setq cur_point (point))
(forward-word)
(copy-thing 'backward-word 'forward-word arg)
(paste-to-mark arg)
(goto-char cur_point)
)
(defun reverse-mark-word (&optional arg allow-extend)
"Set mark ARG words backwards away from point.
The place mark goes is the same place \\[forward-word] would
move to with the same argument.
Interactively, if this command is repeated
or (in Transient Mark mode) if the mark is active,
it marks the next ARG words after the ones already marked."
(interactive "P\np")
(cond ((and allow-extend
(or (and (eq last-command this-command) (mark t))
(region-active-p)))
(setq arg (if arg (prefix-numeric-value arg)
(if (< (mark) (point)) -1 1)))
(set-mark
(save-excursion
(goto-char (mark))
(backward-word arg)
(point))))
(t
(push-mark
(save-excursion
(backward-word (prefix-numeric-value arg))
(point))
nil t))))
(global-set-key (kbd "C-;") 'mark-word)
(global-set-key (kbd "C-:") 'reverse-mark-word)
; select text in quote
(defun select-text-in-quote ()
"Select text between the nearest left and right delimiters.
"
(interactive)
(let (b1 b2)
(skip-chars-backward "^<>({[\"¡®")
(setq b1 (point))
(skip-chars-forward "^<>)¡±}]\"¡‾")
(setq b2 (point))
(set-mark b1)
)
)
(global-set-key (kbd "M-*") 'select-text-in-quote)
; select bigger blocks
;; by Nikolaj Schumacher, 2008-10-20. Released under GPL.
(defun semnav-up (arg)
(interactive "p")
(when (nth 3 (syntax-ppss))
(if (> arg 0)
(progn
(skip-syntax-forward "^\"")
(goto-char (1+ (point)))
(decf arg))
(skip-syntax-backward "^\"")
(goto-char (1- (point)))
(incf arg)))
(up-list arg))
;; by Nikolaj Schumacher, 2008-10-20. Released under GPL.
(defun extend-selection (arg &optional incremental)
"Select the current word.
Subsequent calls expands the selection to larger semantic unit."
(interactive (list (prefix-numeric-value current-prefix-arg)
(or (and transient-mark-mode mark-active)
(eq last-command this-command))))
(if incremental
(progn
(semnav-up (- arg))
(forward-sexp)
(mark-sexp -1))
(if (> arg 1)
(extend-selection (1- arg) t)
(if (looking-at "\\=\\(\\s_\\|\\sw\\)*\\_>")
(goto-char (match-end 0))
(unless (memq (char-before) '(?\) ?\"))
(forward-sexp)))
(mark-sexp -1))))
(global-set-key (kbd "M-8") 'extend-selection)
; darkroom-mode for windows fullscreen, this is for Windows only, please google
emacs darkroom-mode for the detailed installation instructions
(add-to-list 'load-path "~/.emacs.d/darkroom-mode")
(require 'darkroom-mode)
(global-set-key (kbd "C-x q") 'darkroom-mode)

Vous aimerez peut-être aussi