User:Kungi/GNU Emacs Config: Difference between revisions

From NoName e.V.
Jump to navigation Jump to search
No edit summary
m (KungisEmacsConfig moved to User:Kungi/GNU Emacs Config: Namen sollten sinnvoll sein.)
 
(No difference)

Latest revision as of 18:23, 25 January 2008

;;;; General Configuration should be independent of Emacs
;;;; ----------------------------------------------------

;;; I should use psvn mode from http://www.xsteve.at/prg/emacs/psvn.el
;; XXX: Does not work for some reason
;; (require 'psvn)

;; highlight the line the cursor is in ( in aquamacs it's green )
(global-hl-line-mode 1)

;; Elisp directory
(add-to-list 'load-path "~/.elisp/")

;; Get some nice line numbering
;; setnu.el can be found at:
;;   http://www.wonderworks.com/download/setnu.el
(require 'setnu)

;; No emcas backup files
(setq make-backup-files nil
      backup-inhxibited t)

;; Completion
(load-library "completion")
(initialize-completions)

;; Highlight 80th character (by Kai Großjohann)
(font-lock-add-keywords 'c-mode
			'(("................................................................................\\(.\\)"
			   1 font-lock-warning-face prepend)))

;; yes/no = y/n
(fset 'yes-or-no-p 'y-or-n-p)

;; Replace highlighted/marked areas
(delete-selection-mode t)

;;; Aquamacs specific options
(when (or (featurep 'aquaemacs) (boundp 'aquamacs-version))
  ;; I really hate the Aquaemacs toolbar
  (tool-bar-mode 0)
  (line-number-mode 1)
  (column-number-mode 1)

  ;; Let the Apple Key be the Meta key
  (setq mac-command-modifier 'meta)

  ;; Let the option key be no special key
  (setq mac-option-modifier nil)

  ;; Set position of emacs
  (setq initial-frame-alist '((background-color . "white") (left . 230) (width . 145) (height . 47)))

  ;; Do exacly as defined above -- don't try to be intelligent
  (smart-frame-positioning-mode nil)

  ;; let aquamacs open a new buffer in one the same frame
  (one-buffer-one-frame-mode 0)
)

; TEX Editing
; -----------
;; Stuff that AUCTeX needs
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)

;; Activate REFTeX
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
(add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode

(global-set-key [(control .)] 'TeX-complete-symbol)

; Lisp Editing
; ------------
;; Stuff required for slime
(setq inferior-lisp-program "sbcl")
(add-to-list 'load-path "~/.elisp/slime/")
(require 'slime)
(slime-setup)

;; Some neaty tricks :-)
;;; ibuffer mode which make all operations on buffers possible
(setq ibuffer-shrink-to-minimum-size t)
(setq ibuffer-always-show-last-buffer nil)
(setq ibuffer-sorting-mode 'recency)
(setq ibuffer-use-header-line t)
(global-set-key [(f12)] 'ibuffer)

;; Functions taken from http://www.xsteve.at/prg/emacs/xsteve-functions.el
;; All occurances of kungi were made by replacing xsteve with kungi :-)
;;; taken from vhdl-mode
(defun kungi-remove-trailing-spaces ()
  "Remove trailing spaces in the whole buffer."
  (interactive)
  (save-match-data
    (save-excursion
      (let ((remove-count 0))
        (goto-char (point-min))
        (while (re-search-forward "[ \t]+$" (point-max) t)
          (setq remove-count (+ remove-count 1))
          (replace-match "" nil nil))
        (message (format "%d Trailing spaces removed from buffer." remove-count))))))

(defun kungi-remove-control-M ()
  "Remove ^M at end of line in the whole buffer."
  (interactive)
  (save-match-data
    (save-excursion
      (let ((remove-count 0))
	(goto-char (point-min))
	(while (re-search-forward " $" (point-max) t)
	  (setq remove-count (+ remove-count 1))
	  (replace-match "" nil nil))
	(message (format "%d ^M removed from buffer." remove-count))))))