Emacs: re-arranged configuration content.

master
Ambrevar 2012-10-12 15:32:18 +02:00
parent 15fced7b1f
commit 52daab1872
3 changed files with 43 additions and 54 deletions

View File

@ -16,6 +16,11 @@
(add-hook 'minibuffer-setup-hook 'my-minibuffer-setup-hook)
;;==============================================================================
;; Toggle line numbers.
(global-set-key (kbd "C-<f5>") 'linum-mode)
;; Copy/Paste to/from clipboard.
;; (define-key my-keys-minor-mode-map (kbd "M-p") (kbd "C-u M-! xclip <SPC> -o"))
(define-key my-keys-minor-mode-map (kbd "C-<f6>") (kbd "M-| xsel <SPC> -p <SPC> -i"))
@ -23,7 +28,7 @@
(define-key my-keys-minor-mode-map (kbd "C-<f8>") (kbd "C-u M-! xsel <SPC> -o -b"))
;; Compilation
(define-key my-keys-minor-mode-map (kbd "<f10>") 'compile)
(define-key my-keys-minor-mode-map (kbd "C-<f9>") 'compile)
;; (define-key my-keys-minor-mode-map (kbd "<f12>") '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-<tab>") 'dabbrev-expand)
;(define-key minibuffer-local-map (kbd "C-<tab>") 'dabbrev-expand)
;;==============================================================================
;; General
;;==============================================================================
@ -63,7 +70,6 @@
;; Line numbers
(autoload 'linum-mode "linum" "toggle line numbers on/off" t)
(global-set-key (kbd "C-<f5>") 'linum-mode)
;; (setq linum-format "%-4d ")
(setq linum-format "%d ")
(global-linum-mode 1) ;; FIXME: This may generate warnings. Bug?

View File

@ -2,12 +2,6 @@
;; MODE OPTIONS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;==============================================================================
;; Completion
;;==============================================================================
;(global-set-key (kbd "C-<tab>") 'dabbrev-expand)
;(define-key minibuffer-local-map (kbd "C-<tab>") '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))))))

View File

@ -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 "<f9>") (kbd "C-x C-s M-x smart-compile C-j C-j"))
(local-set-key (kbd "<f9>") '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
;;==============================================================================