diff --git a/.emacs.d/main.el b/.emacs.d/main.el index e37e5cbf..079da62c 100644 --- a/.emacs.d/main.el +++ b/.emacs.d/main.el @@ -16,6 +16,11 @@ (add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook) +;;============================================================================== + +;; Toggle line numbers. +(global-set-key (kbd "C-") 'linum-mode) + ;; Copy/Paste to/from clipboard. ;; (define-key my-keys-minor-mode-map (kbd "M-p") (kbd "C-u M-! xclip -o")) (define-key my-keys-minor-mode-map (kbd "C-") (kbd "M-| xsel -p -i")) @@ -23,7 +28,7 @@ (define-key my-keys-minor-mode-map (kbd "C-") (kbd "C-u M-! xsel -o -b")) ;; Compilation -(define-key my-keys-minor-mode-map (kbd "") 'compile) +(define-key my-keys-minor-mode-map (kbd "C-") 'compile) ;; (define-key my-keys-minor-mode-map (kbd "") 'next-error) ;; Window resize @@ -36,7 +41,6 @@ (define-key my-keys-minor-mode-map (kbd "M-a") 'beginning-of-defun) (define-key my-keys-minor-mode-map (kbd "M-e") 'end-of-defun) - ;; Modern scrolling (global-set-key [next] (lambda () (interactive) @@ -48,6 +52,9 @@ (condition-case nil (scroll-down) (beginning-of-buffer (goto-char (point-min)))))) +;(global-set-key (kbd "C-") 'dabbrev-expand) +;(define-key minibuffer-local-map (kbd "C-") 'dabbrev-expand) + ;;============================================================================== ;; General ;;============================================================================== @@ -63,7 +70,6 @@ ;; Line numbers (autoload 'linum-mode "linum" "toggle line numbers on/off" t) -(global-set-key (kbd "C-") 'linum-mode) ;; (setq linum-format "%-4d ") (setq linum-format "%d ") (global-linum-mode 1) ;; FIXME: This may generate warnings. Bug? diff --git a/.emacs.d/modes.el b/.emacs.d/modes.el index d849577c..699975da 100644 --- a/.emacs.d/modes.el +++ b/.emacs.d/modes.el @@ -2,12 +2,6 @@ ;; MODE OPTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;============================================================================== -;; Completion -;;============================================================================== -;(global-set-key (kbd "C-") 'dabbrev-expand) -;(define-key minibuffer-local-map (kbd "C-") 'dabbrev-expand) - ;;============================================================================== ;; Automode (Mode recognition) ;;============================================================================== @@ -179,3 +173,37 @@ ;; (set-face-bold-p 'font-latex-sedate-face t) ;; ) ;; (add-hook 'TeX-mode-hook 'my-tex-font-hook) + +;;============================================================================== +;; HTML +;;============================================================================== + +(add-hook 'html-mode-hook + (lambda () + (turn-off-auto-fill) + (toggle-truncate-lines) +)) + +;;============================================================================== +;; C-mode +;;============================================================================== +(add-hook 'c-mode-hook 'my-c-mode-hook) +(add-hook 'c++-mode-hook 'my-c-mode-hook) +(add-hook 'cpp-mode-hook 'my-c-mode-hook) + +(require 'compile) +(add-hook 'c-mode-hook + (lambda () + (unless (file-exists-p "Makefile") + (set (make-local-variable 'compile-command) + ;; emulate make's .c.o implicit pattern rule, but with + ;; different defaults for the CC, CPPFLAGS, and CFLAGS + ;; variables: + ;; $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $< + (let ((file (file-name-nondirectory buffer-file-name))) + (format "%s -c -o %s.o %s %s %s" + (or (getenv "CC") "gcc") + (file-name-sans-extension file) + (or (getenv "CPPFLAGS") "-DDEBUG=9") + (or (getenv "CFLAGS") "-ansi -pedantic -Wall -Wextra -Wshadow -lm -g3 -O0") + file)))))) diff --git a/.emacs.d/plugins.el b/.emacs.d/plugins.el index f7fe12e3..73e83fc0 100644 --- a/.emacs.d/plugins.el +++ b/.emacs.d/plugins.el @@ -2,39 +2,6 @@ ;; PLUGINS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;============================================================================== -;; smart-compile -;;============================================================================== - -;; (add-to-list 'load-path "~/.emacs.d/plugins/smart-compile") -;; (require 'smart-compile) - -(defun my-c-mode-hook () - ;; (local-set-key (kbd "") (kbd "C-x C-s M-x smart-compile C-j C-j")) - (local-set-key (kbd "") 'compile) - ) - -(add-hook 'c-mode-hook 'my-c-mode-hook) -(add-hook 'c++-mode-hook 'my-c-mode-hook) -(add-hook 'cpp-mode-hook 'my-c-mode-hook) - -(require 'compile) -(add-hook 'c-mode-hook - (lambda () - (unless (file-exists-p "Makefile") - (set (make-local-variable 'compile-command) - ;; emulate make's .c.o implicit pattern rule, but with - ;; different defaults for the CC, CPPFLAGS, and CFLAGS - ;; variables: - ;; $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $< - (let ((file (file-name-nondirectory buffer-file-name))) - (format "%s -c -o %s.o %s %s %s" - (or (getenv "CC") "gcc") - (file-name-sans-extension file) - (or (getenv "CPPFLAGS") "-DDEBUG=9") - (or (getenv "CFLAGS") "-ansi -pedantic -Wall -Wextra -Wshadow -lm -g3 -O0") - file)))))) - ;;============================================================================== ;; Yasnippet ;;============================================================================== @@ -89,18 +56,6 @@ (define-key mediawiki-mode-map (kbd "C-c o") 'mediawiki-browse) )) - -;;============================================================================== -;; HTML -;;============================================================================== - -(add-hook 'html-mode-hook - (lambda () - (turn-off-auto-fill) - (toggle-truncate-lines) -)) - - ;;============================================================================== ;; DoxyMacs ;;==============================================================================