Emacs/Windows İçin Emacs Dosyası

NOT: Bu .emacs dosyasi Ali Cehreli'nin bir donem kullandigi kisisel bir .emacs'tir. Yalnizca bir fikir vermesi amaciyla buraya koyulmustur.

Ornegin bas tarafindaki global-set-key cagrilariyla yapilan tus donusumleri, Ali'nin kullandigi Dvorak klavye duzeninde rahat olacagi dusunuldugu icin yapilmaktadir.

Bunlar, sizin klavye duzeninizde hic ise yaramayabilirler. :)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Emacs startup File
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Miscellaneous variables

(prefer-coding-system 'utf-8)

;; key bindings that work well with Dvorak keyboard
(global-set-key "\C-f" 'previous-line)
(global-set-key "\C-b" 'next-line)
(global-set-key "\C-t" 'backward-char)
(global-set-key "\C-n" 'forward-char)
(global-set-key "\M-t" 'backward-word)
(global-set-key "\M-n" 'forward-word)
(global-set-key "\M-u" 'upcase-prev-word)
(global-set-key "\M--" 'goto-line)
;(global-set-key "\M-c" 'end-of-buffer-other-window)
(global-set-key "\M-c" 'next-error)
(global-set-key [home] 'beginning-of-buffer)
(global-set-key [end] 'end-of-buffer)

(global-set-key [(control shift right)] 'compile)
(global-set-key [(control shift up)] 'previous-buffer)
(global-set-key [(control shift down)] 'next-buffer)

;; Scroll buffer without moving the cursor
(global-set-key "\M-f" '(lambda () (interactive) (scroll-down 1)))
(global-set-key "\M-b" '(lambda () (interactive) (scroll-up 1)))

;; Record the position of the cursor to register 't' and then find-tag
(global-set-key "\M-." '(lambda () (interactive) 
						  (point-to-register t) 
						  (find-tag (find-tag-default))))

;; Go to the next definition of a tag
;; This overrides 'forward-sentence'
(global-set-key "\M-p" '(lambda () (interactive) (find-tag nil t)))

;; Go to the last recorded position of the cursor in register 't'
(global-set-key "\C-p" '(lambda () (interactive) (register-to-point t)))

;; don't center when point moves out of view
(setq scroll-step 20)

;; Mode line setup
(setq display-time-24hr-format t)
(display-time)

(setq line-number-mode t)
(setq column-number-mode t)
(setq visible-bell t)
(setq inhibit-startup-message t)
(put 'narrow-to-region 'disabled nil)

; (defvar default-load-path load-path
;   "Standard places to look for lisp files.  See load-path.")
; (setq load-path (append (list
; 						 "/usr/local/share/emacs/site-lisp"
;                          "~/lisp"
; 						 "~/lisp/emacs-lisp"
; 						 "~/lisp/emulation"
; 						 "~/lisp/gnus"
; 						 "~/lisp/international"
; 						 "~/lisp/language"
; 						 "~/lisp/mail"
; 						 "~/lisp/play"
; 						 "~/lisp/progmodes"
; 						 "~/lisp/term"
; 						 "~/lisp/textmodes"
; 						 )
;                         default-load-path))

(setq auto-mode-alist
      '(("[-\\.]info$" . info-mode)
        ("\\.c\\'" . c++-mode)
        ("\\.cpp\\'" . c++-mode)
        ("\\.cxx\\'" . c++-mode)
        ("\\.h\\'" . c++-mode)
        ("\\.hpp\\'" . c++-mode)
        ("\\.tex\\'" . TeX-mode)
        ("\\.el\\'" . emacs-lisp-mode)
        ("\\.pl\\'" . perl-mode)
        ("\\.sty\\'" . LaTeX-mode)
        ("\\.bbl\\'" . LaTeX-mode)
        ("\\.bib\\'" . bibtex-mode)
        ("\\.texinfo\\'" . texinfo-mode)
        ("\\.texi\\'" . texinfo-mode)
        ("\\.awk\\'" . awk-mode)
        ("\\.tar\\'" . tar-mode)
        ("\\.y\\'" . c-mode)
        ("\\.lex\\'" . c-mode)
	("\\.m$"  . objc-mode)
	("\\.C$"     . c++-mode)
	("\\.cc$"    . c++-mode)
	("\\.hh$"    . c++-mode)
        ("[]>:/]\\..*emacs\\'" . emacs-lisp-mode)
	("Makefile"  . makefile-mode)
	("makefile"  . makefile-mode)
	("\\.mak\\'" . makefile-mode)
	("\\.scm\\'" . scheme-mode)
	("\\.py$" . python-mode)
    ("\\.diff" . diff-mode)
    ("\\.sgml" . sgml-mode)
    ("\\.xml" . xml-mode)
))

(setq interpreter-mode-alist
	  (cons '("python" . python-mode)
			interpreter-mode-alist))

;; Customize auto-save interval
(setq auto-save-interval 2000)
(setq auto-save-timeout 120)

;; Save last location in all files between sessions
(load "saveplace")
(setq-default save-place t)

;; The ID database functions
(autoload 'gid  "gid" "ID Database functions" t)

;; C Mode stuff
(autoload 'c++-mode  "cc-mode" "C++ Editing Mode" t)
(autoload 'c-mode    "cc-mode" "C Editing Mode" t)
(autoload 'python-mode "python-mode" "Python Editing Mode" t)

     (defconst my-c-style
       '((c-tab-always-indent        . nil)
         (c-comment-only-line-offset . 4)
         (c-hanging-braces-alist     . ((brace-list-open)))
         (c-hanging-colons-alist     . ((member-init-intro before)
                                        (inher-intro)
                                        (case-label after)
                                        (label after)
                                        (access-label after)))
         (c-cleanup-list             . (scope-operator
                                        empty-defun-braces
                                        defun-close-semi))
         (c-offsets-alist            . ((arglist-close . c-lineup-arglist)
					(inline-open       . 0)
                                        (substatement-open . 0)
                                        (comment-intro     . 0)
                                        (block-open        . 0)
                                        (knr-argdecl-intro . -)))
         (c-echo-syntactic-information-p . t)
         )
       "My C Programming Style")
     
     ;; Customizations for all of c-mode, c++-mode, and objc-mode
     (defun my-c-mode-common-hook ()
       ;; add my personal style and set it for the current buffer
       (c-add-style "PERSONAL" my-c-style t)
       ;; offset customizations not in my-c-style
       (c-set-offset 'member-init-intro '+)
       ;; other customizations
       (setq tab-width 4
             ;; this will make sure spaces are used instead of tabs
             indent-tabs-mode nil)
       ;; we like auto-newline and hungry-delete
       (c-toggle-auto-hungry-state 1)
       ;; keybindings for all supported languages.  We can put these in
       ;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map,
       ;; java-mode-map, and idl-mode-map inherit from it.
       (define-key c-mode-base-map "\C-m" 'newline-and-indent)
       )
     
     (add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
     
(set-default `indent-tabs-mode nil)

;;(setq-default case-fold-search nil)
(setq dabbrev-case-fold-search nil)

(mouse-avoidance-mode 'animate)

(show-paren-mode t)
(setq search-highlight t)

;; Compilation Stuff
;(global-set-key "\C-c\C-c" 'compile)
;(global-set-key "\C-c\C-g" 'grep)
;(setq grep-command "grep -n -i ")
(setq compile-command '("make -C " . 9))
(setq compilation-ask-about-save nil)
;(setq compilation-finish-function 'compilation-buffer-goto-end)
;(setq compilation-finish-function 'next-error)

(setq calendar-week-start-day 1)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dired

(setq dired-keep-marker-copy)

(setq dired-listing-switches "-alR")

(setq dired-auto-shell-command-alist
  (list
;; '("\\.[Tt][Aa][Rr]\\.*[Gg]*[Zz]$" "zcat * | tar tvf -")
   '("\\.shar.g*[Zz]$"  "zcat * | unshar")
   '("\\.ps$"           "gv * &")
   '("\\.ps[.gZz]*$"    "zxdvi")
   '("\\.dvi[.gZz]*$"   "zxdvi")
   '("\\.au$"           "play")
   '("\\.tar$"          "tar tvf")
   '("\\.u*e*$"         "uudecode")
   '("\\.gif$"          "xv * &")               ; view gif pictures
   '("\.tex$"           "latex")                
   '("\\.g*[Zz]$"       "gunzip")
   '("[Aa]rc"           "spark -tv")            ; Acorn Archimedes archive
   '("\\.shar$"         "unshar")               
   '("^![Rr][Uu][Nn][Ii][Mm]" "baslist -n")     ; Tokenised BASIC program
   '("\\.defaults$"     "xrdb")
   '("\\.gopher_menu$"  "mkcache")
   '("^a\\.out$"        "*")
   ))

(defun dired-mouse (event)
  "Visit a file clicked on in a Dired buffer.
If there is a filename on the current line, visit the file else
re-read the directory."
  (interactive "e")
  (let ((opoint (point)))
    (mouse-set-point event)
    (cond ((dired-move-to-filename)
           (sit-for 0)
           (dired-find-file))
          (t (dired-revert)
             (goto-char opoint)))))

;; A version of dired-mark-read-file-name which inserts the name of
;; the single current file as the intial minibuffer contents.

(defun my-dired-mark-read-file-name (prompt dir op-symbol arg files)
  (dired-mark-pop-up
   nil op-symbol files
   (function read-file-name)
   ;; Args for read-file-name:
   (format prompt (dired-mark-prompt arg files))
   dir nil nil                            ; completion dir, no default, needn't match
   (and (null (cdr files)) (car files)))) ; initial contents if single file

(defun upcase-prev-word ()
  (interactive)
  (upcase-word -1))

;(defun compilation-buffer-goto-end (buffer result)
;  (end-of-buffer-other-window 0))

(put 'upcase-region 'disabled nil)

(transient-mark-mode t)

;; Turn the menu bar off
(menu-bar-mode 1)

(add-to-list 'auto-mode-alist '("\\.e\\'" . eiffel-mode))
(autoload 'eiffel-mode "eiffel-mode" "Major mode for Eiffel programs" t)

(global-font-lock-mode t)
(setq font-lock-maximum-decoration '((c-mode . 3) (c++-mode . 3)))
(setq font-lock-maximum-size `((c-mode . 524288) (c++-mode . 524288)))
(setq font-lock-support-mode 'fast-lock-mode)
(add-hook 'c-mode-common-hook 'turn-on-font-lock)

; (setq Info-directory-list
;       '("/usr/local/info/"
; 		"/hw/cad/gnu/guile-doc/ref"
; 		"/cad/local/info/"
; 		))

;; Stop at the end of the file, not just add lines
(setq next-line-add-newlines nil)

;; (server-start)

;; (autoload 'sgml-mode "psgml" "Major mode to edit SGML files." t)
;; (autoload 'xml-mode "psgml" "Major mode to edit XML files." t)
;; (autoload 'html-mode "xxml" "Major mode to edit HTML files." t)
;; (autoload 'xxml-mode-routine "xxml")
;; (add-hook 'sgml-mode-hook 'xxml-mode-routine)

;; (setq sgml-indent-step 4)

(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(blink-cursor nil)
 '(blink-matching-paren nil)
 '(blink-matching-paren-distance 65536)
 '(blink-matching-paren-on-screen nil)
 '(browse-url-browser-function (quote browse-url-netscape) t)
 '(compilation-error-screen-columns t)
 '(compilation-scroll-output t)
 '(compilation-window-height nil)
 '(compile-auto-highlight t)
 '(compile-command "make -C ")
 '(cursor-in-non-selected-windows nil)
 '(default-frame-alist (quote ((menu-bar-lines . 10) (top . 4) (left . 270) (cursor-color . "yellow") (cursor-type . box) (foreground-color . "white") (background-color . "gray10") (vertical-scroll-bars . right) )))
 '(delete-selection-mode nil nil (delsel))
 '(fill-column 70)
 '(indent-tabs-mode nil)
 '(initial-frame-alist nil)
 '(minibuffer-auto-raise nil)
 '(printer-name "kavruk")
 '(scroll-bar-mode (quote right))
 '(show-paren-delay 0.25)
 '(show-paren-mode t nil (paren))
 '(show-paren-style (quote mixed))
 '(tab-width 4)
 '(tool-bar-mode nil nil (tool-bar)))
(custom-set-faces
  ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(default ((t (:stipple nil :background "gray10" :foreground "white" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 100 :width normal :family "etl-fixed"))))
 '(custom-group-tag-face ((((class color) (background light)) (:underline t :foreground "cyan"))))
 '(custom-state-face ((((class color) (background light)) (:foreground "greenyellow"))))
 '(custom-variable-tag-face ((((class color) (background light)) (:underline t :foreground "cyan"))))
 '(font-lock-builtin-face ((((class color) (background light)) (:foreground "pink"))))
 '(font-lock-comment-face ((t (:foreground "darkseagreen"))))
 '(font-lock-constant-face ((((class color) (background light)) (:foreground "orange"))))
 '(font-lock-function-name-face ((t (:foreground "turquoise"))))
 '(font-lock-keyword-face ((t (:foreground "bisque"))))
 '(font-lock-string-face ((t (:foreground "gold"))))
 '(font-lock-type-face ((t (:foreground "bisque"))))
 '(font-lock-variable-name-face ((t (:foreground "bisque"))))
 '(font-lock-warning-face ((t (:foreground "tomato"))))
 '(highlight ((((class color) (background light)) (:background "darkgreen"))))
 '(modeline ((t (:foreground "black" :background "gray80"))))
 '(region ((t (:background "gray50"))))
 '(secondary-selection ((((class color) (background light)) (:background "turquoise"))))
 '(show-paren-match-face ((((class color)) (:background "lightcyan4"))))
 '(vhdl-font-lock-prompt-face ((((class color) (background light)) (:bold t :foreground "aquamarine")))))

;; w3
;(require 'w3)

;; Doxymacs

; (require 'doxymacs)

; (setq doxygen-directory (format "%s/cent/sw/tablegen/doc/doxygen" (getenv "FE_WORK_AREA")))

; (setq doxymacs-doxygen-root
; 	  (format "%s/html" doxygen-directory))

; (setq doxymacs-doxygen-tags
; 	  (format "%s/YES" doxygen-directory))

; (add-hook 'c-mode-common-hook 'doxymacs-mode)

; (defun my-doxymacs-font-lock-hook ()
;   (if (or (eq major-mode 'c-mode) (eq major-mode 'c++-mode))
; 	  (doxymacs-font-lock)))
; (add-hook 'font-lock-mode-hook 'my-doxymacs-font-lock-hook)

; ;; OO-Browser

; (setq load-path (append '("/dw/home/acehreli/build/solaris/oo-browser/"
; 						  "/dw/home/acehreli/build/solaris/oo-browser/hypb/")
; 						load-path))

; (load "br-start")

; (global-set-key "\C-c\C-o" 'oo-browser)

(setq default-fill-column 60)
(setq fill-column 50)

(require 'quail)

(quail-define-package
 "turkish-repeat" "Latin-5" "TRR<" t
 "Turkish (Türkçe) input method with repeat modifiers.

This is for those who use Latin-5 (ISO-8859-9) for Turkish.

AA -> Â
CC -> Ç
GG -> Ğ
II  -> I
ii  -> ı
II -> İ
OO -> Ö
SS -> Ş
UU -> Ü
U^ -> Û

AA/ -> AÂ
etc.

" nil t nil nil nil nil nil nil nil nil t)

(quail-define-rules
 ("A^" ?Â)
 ("a^" ?â)
 ("CC" ?Ç)
 ("cc" ?ç)
 ("GG" ?Ğ)
 ("gg" ?ğ)
 ("II" ?İ)
 ("ii" ?ı)
 ("OO" ?Ö)
 ("oo" ?ö)
 ("SS" ?Ş)
 ("ss" ?ş)
 ("UU" ?Ü)
 ("uu" ?ü)
 ("U^" ?Û)
 ("u^" ?û)

;;  ("CCC" "CÇ")
;;  ("ccc" "cç")
;;  ("GGG" "GĞ")
;;  ("ggg" "gğ")
;;  ("III" "Iİ")
;;  ("iii" "iı")
;;  ("OOO" "OÖ")
;;  ("ooo" "oö")
;;  ("SSS" "SŞ")
;;  ("sss" "sş")
;;  ("UUU" "UÜ")
;;  ("uuu" "uü")

 ("A^^" ["A^"])
 ("a^^" ["a^"])
 ("CC/" ["CC"])
 ("cc/" ["cc"])
 ("GG/" ["GG"])
 ("gg/" ["gg"])
 ("II/" ["II"])
 ("ii/" ["ii"])
 ("OO/" ["OO"])
 ("oo/" ["oo"])
 ("SS/" ["SS"])
 ("ss/" ["ss"])
 ("UU/" ["UU"])
 ("uu/" ["uu"])
 ("U^^" ["U^"])
 ("u^^" ["u^"])
 )

;; Turkish keys for writing TeX documents
(defun turkish-env ()
  (interactive)
  (set-language-environment "turkish")
  (set-input-method "turkish-repeat"))

;; Emacs renk teması listesi
(require 'color-theme)
(setq my-color-themes (list 'color-theme-aalto-light 
                            'color-theme-aliceblue  
                            'color-theme-andreas                
                            'color-theme-arjen
                            'color-theme-bharadwaj            
                            'color-theme-billw       
                            'color-theme-blippblopp  
                            'color-theme-blue-eshell
                            'color-theme-blue-gnus        
                            'color-theme-blue-mood
                            'color-theme-calm-forest
                            'color-theme-charcoal-black
                            'color-theme-clarity
                            'color-theme-classic
                            'color-theme-comidia
                            'color-theme-dark-blue2          
                            'color-theme-dark-laptop
                            'color-theme-deep-blue
                            'color-theme-digital-ofs1
                            'color-theme-euphoria    
                            'color-theme-feng-shui
                            'color-theme-fischmeister          
                            'color-theme-gnome
                            'color-theme-gnome2  
                            'color-theme-goldenrod
                            'color-theme-gray1  
                            'color-theme-gray30
                            'color-theme-greiner 
                            'color-theme-gtk-ide
                            'color-theme-high-contrast
                            'color-theme-hober
                            'color-theme-infodoc               
                            'color-theme-jb-simple  
                            'color-theme-jedit-grey
                            'color-theme-jonadabian  
                            'color-theme-jonadabian-slate
                            'color-theme-jsc-dark
                            'color-theme-jsc-light
                            'color-theme-jsc-light2      
                            'color-theme-katester
                            'color-theme-kingsajz  
                            'color-theme-late-night
                            'color-theme-lawrence
                            'color-theme-ld-dark
                            'color-theme-lethe   
                            'color-theme-marine
                            'color-theme-marquardt    
                            'color-theme-matrix
                            'color-theme-midnight  
                            'color-theme-mistyday
                            'color-theme-montz  
                            'color-theme-oswald
                            'color-theme-parus  
                            'color-theme-pierson
                            'color-theme-pok-wob            
                            'color-theme-pok-wog
                            'color-theme-ramangalahy
                            'color-theme-raspopovic 
                            'color-theme-resolve
                            'color-theme-retro-green
                            'color-theme-retro-orange
                            'color-theme-robin-hood     
                            'color-theme-rotor
                            'color-theme-ryerson    
                            'color-theme-salmon-font-lock
                            'color-theme-scintilla   
                            'color-theme-shaman   
                            'color-theme-simple-1
                            'color-theme-sitaramv-nt
                            'color-theme-sitaramv-solaris
                            'color-theme-snow 
                            'color-theme-snowish
                            'color-theme-standard                  
                            'color-theme-subtle-blue  
                            'color-theme-subtle-hacker
                            'color-theme-taming-mr-arneson  
                            'color-theme-taylor
                            'color-theme-tty-dark   
                            'color-theme-vim-colors
                            'color-theme-whateveryouwant 
                            'color-theme-wheat
                            'color-theme-word-perfect
                            'color-theme-xemacs
                            'color-theme-xp 
      ))

;; Emacs renk temaları arasında dolaş
(defun my-theme-set-default () ; Set the first row
  (interactive)
  (setq theme-current my-color-themes)
  (funcall (car theme-current)))

(defun my-describe-theme () ; Show the current theme
  (interactive)
  (message "%s" (car theme-current)))

                                        ; Set the next theme (fixed by Chris Webber - tanks)
(defun my-theme-cycle ()		
  (interactive)
  (setq theme-current (cdr theme-current))
  (if (null theme-current)
      (setq theme-current my-color-themes))
  (funcall (car theme-current))
  (message "%S" (car theme-current)))

(setq theme-current my-color-themes)
(setq color-theme-is-global nil) ; Initialization
(my-theme-set-default)
(global-set-key [f12] 'my-theme-cycle)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Bu satirdan sonrasini iptal ediyoruz
;; (put 'menu-bar-mode 'disabled nil)

;; Wikipedia modu
;;(autoload 'wikipedia-mode "wikipedia-mode.el"
;;  "Major mode for editing documents in Wikipedia markup." t)

;;(add-to-list 'auto-mode-alist 
  ;; '("\\.wiki\\'" . wikipedia-mode))

;; Longlines
;; (autoload 'longlines-mode "longlines.el"
;;   "Minor mode for editing long lines." t)

;; ViewSource
;;(add-to-list 'auto-mode-alist
;;  '("en\\.wikipedia\\.org" . wikipedia-mode))