(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.
'(auto-compression-mode t nil (jka-compr))
'(case-fold-search t)
'(column-number-mode t)
'(current-language-environment "UTF-8")
'(default-input-method "rfc1345")
'(global-font-lock-mode t nil (font-lock))
'(size-indication-mode t)
'(transient-mark-mode t)
'(truncate-lines t))
(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.
'(linum ((t (:inherit (default default) :background "white" :foreground "black")))))
;;(top . 20) (left . 20)
;;(setq default-frame-alist
;; '((width . 100) (height . 80)
;; (font . "-adobe-courier-medium-r-normal--17-120-100-100-m-100-iso8859-1")))
(put 'dired-find-alternate-file 'disabled nil)
;; Add F12 to toggle line wrap
(setq line-number-mode t)
(setq column-number-mode t)
; turn off tool bar
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(add-hook 'window-configuration-change-hook
(lambda ()
(setq frame-title-format
(concat
invocation-name "@" system-name ": "
(replace-regexp-in-string
(concat "/home/" user-login-name) "~"
(or buffer-file-name "%b"))))))
(put 'upcase-region 'disabled nil)
;;(setq w32-enable-synthesized-fonts t)
;;(set-default-font "-outline-Verdana-normal-r-normal-normal-15-112-96-96-p-*-iso8859-1")
(put 'downcase-region 'disabled nil)
(setq-default ispell-program-name "aspell")
(setq-default indent-tabs-mode nil)
;; repeat last command
(global-set-key [(control z)] 'repeat)
;; repeat last command
(global-set-key [(control j)] 'join-line)
;; Enable backup files.
(setq make-backup-files t)
;; Enable versioning with default values (keep five last versions, I think!)
(setq version-control t)
;; Save all backup file in this directory.
(setq backup-directory-alist (quote ((".*" . "/app/skathirvel/emacs_backups/"))))
;; ===== Set the highlight current line minor mode =====
;; In every buffer, the line which contains the cursor will be fully
;; highlighted
;;(global-hl-line-mode t)
;; show line numbers of left hand side; needs linum.el where .emacs file is
;; I was wondering if there is way to change the color of the line numbers e.g change color/change backgroun
;;:Try M-x customize-face RET linum. Also try M-x global-linum-mode, or append (add-hook ‘find-file-hook (la
;;(add-to-list 'default-frame-alist '(font . "-adobe-courier-bold-r-normal--14-140-75-75-m-90-iso8859-1"))
;;Sets the tab size to four spaces
(setq-default tab-width 2)
(setq default-truncate-lines t)
(set-scroll-bar-mode 'right)
;; Open a file
(global-set-key [(control o)] 'find-file)
;; Close
(global-set-key [(control w)] 'kill-this-buffer)
;; goto-line
(global-set-key [(control l)] 'goto-line)
;; clear buffer
(global-set-key [f1] 'list-bookmarks)
;;close all buffers
;;(global-set-key [(control f1)] 'close-all-buffers)
;; Save
(global-set-key [f2] 'bookmark-set)
(global-set-key [(shift f2)] 'write-file )
(global-set-key [f3] 'query-replace-regexp)
(global-set-key [shift f3] 'isearch-backward)
;; search regex forward
(global-set-key [f4] 'isearch-forward-regexp)
;; search regex backward
(global-set-key [(shift f4)] 'isearch-backward-regexp)
;; Indent
;;(global-set-key [f4] 'indent-region)
(load-file "~/ibuffer.el")
(require 'ibuffer)
;; Term and shell
;; Toggle between two windows
(global-set-key [f5] 'ibuffer)
(global-set-key [f6] 'buffer-menu-other-window)
(global-set-key [f7] 'other-window)
(global-set-key [f8] 'delete-window)
(global-set-key [(shift f8)] 'delete-other-windows)
(global-set-key [f9] 'find-dired)
(global-set-key [(kbd "C-c-o")] 'occur)
;; frames (create and delete)
(global-set-key [f10] 'make-frame-command)
(global-set-key [(shift f10)] 'delete-frame)
(global-set-key [(meta f10)] 'other-frame)
(global-set-key [(shift f7)] 'switch-to-next-buffer)
(global-set-key [(alt f7)] 'toggle-source-header)
(global-set-key [delete] 'delete-char)
(global-set-key [(meta right)] 'forward-word)
(global-set-key [(meta left)] 'backward-word)
(global-set-key [(control home)] 'beginning-of-buffer)
(global-set-key [(control end)] 'end-of-buffer)
(global-set-key [f12] 'toggle-truncate-lines)
(global-set-key [f11] 'revert-buffer)
(global-set-key [(meta ?1)] 'cscope-find-global-definition)
(global-set-key [(meta ?2)] 'cscope-find-functions-calling-this-function)
(global-set-key [(meta ?3)] 'cscope-find-this-symbol)
(global-set-key [(meta ?4)] 'cscope-find-egrep-pattern)
;;(global-set-key [(control ?0)] 'bc-clear )
(defun eshellclear ()
"Clears the shell buffer ala Unix's clear or DOS' cls"
(interactive)
;; the shell prompts are read-only, so clear that for the duration
(let ((inhibit-read-only t))
;; simply delete the region
(delete-region (point-min) (point-max))))
;; To ease the edition of code. It allows me to indent (or unindent) several lines back and forth pressing t
;; (or the Shift and tab key)
;;(set-variable <91>my-tab-width 2)
(defun indent-block()
(interactive)
(shift-region 2)
(setq deactivate-mark nil))
(defun unindent-block()
(interactive)
(shift-region -2)
(setq deactivate-mark nil))
(defun shift-region(numcols)
; my trick to expand the region to the beginning and end of the area selected
; a convenient feature to which I was used, from the Dreamweaver editor
(if (< (point)(mark))
(if (not(bolp)) (progn (beginning-of-line)(exchange-point-and-mark) (end-of-line)
(progn (end-of-line)(exchange-point-and-mark)(beginning-of-line)))
(setq region-start (region-beginning))
(setq region-finish (region-end))
(save-excursion
(if (< (point) (mark)) (exchange-point-and-mark))
(let ((save-mark (mark)))
;; book mark keys
;;(global-set-key [(control ?1)] 'bookmark-bmenu-list )
;;(global-set-key [(control ?2)] 'af-bookmark-toggle )
;;(global-set-key [(control ?3)] 'bookmark-write )
;;(global-set-key [(control ?4)] 'bookmark-load )
;;(global-set-key [(meta ?,)] 'af-bookmark-cycle-forward )
;;(global-set-key [(meta ?.)] 'af-bookmark-cycle-reverse )
;;(global-set-key [(control ?0)] 'af-bookmark-clear-all )
;; book mark keys
;;(global-set-key [(control ?1)] 'bc-list )
;;(global-set-key [(control ?2)] 'bc-set )
;;(global-set-key [(control ?3)] 'bookmark-write )
;;(global-set-key [(control ?4)] 'bookmark-load )
;;(global-set-key [(meta ?.)] 'bc-local-next)
;;(global-set-key [(control meta ?.)] 'bc-next)
;;(global-set-key [(control meta ?,)] 'bc-previous)
(indent-rigidly region-start region-finish numcols))))
(defun indent-or-complete ()
"Indent region selected as a block; if no selection present either indent according to mode,
or expand the word preceding point. "
(interactive)
(if mark-active
(indent-block)
(if (looking-at "\\>")
(hippie-expand nil)
(insert "\t"))))
(defun my-unindent()
"Unindent line, or block if it's a region selected"
(interactive)
(if mark-active
(unindent-block)
(if(not(bolp))(delete-backward-char 2))))
(add-hook 'find-file-hooks (function (lambda ()
(define-key global-map [tab] 'indent-or-complete) ;; Now remember to force tab (C-q-tab) if you want to simp
(define-key global-map [(shift tab)] 'my-unindent)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-set-key [(control f5)] 'ebrowse-tree-mode)
(add-to-list 'auto-mode-alist '("BROWSE\\.*" . ebrowse-tree-mode))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Easy bookmarks management
;;
;; Author: Anthony Fairchild
;;
;;;; Keymaping examples
;; (global-set-key [(control f2)] 'af-bookmark-toggle )
;; (global-set-key [f2] 'af-bookmark-cycle-forward )
;; (global-set-key [(shift f2)] 'af-bookmark-cycle-reverse )
;; (global-set-key [(control shift f2)] 'af-bookmark-clear-all )
;; Include common lisp stuff
(require 'cl)
(require 'bookmark)
(defvar af-current-bookmark nil)
;;(defun af-bookmark-make-name ()
;; "makes a bookmark name from the buffer name and cursor position"
;; (concat (buffer-name (current-buffer))
;; " - " (number-to-string (point))))
;; (1+ (count-lines 1 (point)))
(defun af-bookmark-make-name ()
"makes a bookmark name from the buffer name and cursor position"
(concat (buffer-name (current-buffer))
" - " (number-to-string(1+ (count-lines 1 (point))))))
(defun af-bookmark-toggle ()
"remove a bookmark if it exists, create one if it doesnt exist"
(interactive)
(let ((bm-name (af-bookmark-make-name)))
(if (bookmark-get-bookmark bm-name)
(progn (bookmark-delete bm-name)
(message "bookmark removed"))
(progn (bookmark-set bm-name)
(setf af-current-bookmark bm-name)
(message "bookmark set")))))
(defun af-bookmark-cycle (i)
"Cycle through bookmarks by i. 'i' should be 1 or -1"
(if bookmark-alist
(progn (unless af-current-bookmark
(setf af-current-bookmark (first (first bookmark-alist))))
(let ((cur-bm (assoc af-current-bookmark bookmark-alist)))
(setf af-current-bookmark
(if cur-bm
(first (nth (mod (+ i (position cur-bm bookmark-alist))
(length bookmark-alist))
bookmark-alist))
(first (first bookmark-alist))))
(bookmark-jump af-current-bookmark)
;; Update the position and name of the bookmark. We
;; only need to do this when the bookmark has changed
;; position, but lets go ahead and do it all the time
;; anyway.
(bookmark-set-position af-current-bookmark (point))
(let ((new-name (af-bookmark-make-name)))
(bookmark-set-name af-current-bookmark new-name)
(setf af-current-bookmark new-name))))
(message "There are no bookmarks set!")))
(defun af-bookmark-cycle-forward ()
"find the next bookmark in the bookmark-alist"
(interactive)
(af-bookmark-cycle 1))
(defun af-bookmark-cycle-reverse ()
"find the next bookmark in the bookmark-alist"
(interactive)
(af-bookmark-cycle -1))
(defun af-bookmark-clear-all()
"clears all bookmarks"
(interactive)
(setf bookmark-alist nil))
;;If you put this in your .emacs, you can do M-x close-all-buffers. To bind it to a key (for example, C-c x
(defun close-all-buffers ()
(interactive)
(mapc 'kill-buffer (buffer-list)))
(defun sacha/increase-font-size ()
(interactive)
(set-face-attribute 'default
nil
:height
(ceiling (* 1.10
(face-attribute 'default :height)))))
(defun sacha/decrease-font-size ()
(interactive)
(set-face-attribute 'default
nil
:height
(floor (* 0.9
(face-attribute 'default :height)))))
(global-set-key (kbd "C-+") 'sacha/increase-font-size)
(global-set-key (kbd "C--") 'sacha/decrease-font-size)
(require 'dired-x)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Easy bookmarks management ends
;;:Append (global-linum-mode 1) to your .emacs.
;;(load-file "~/linum.el")
;;(require 'linum)
;;(global-linum-mode 1)
(load-file "~/xcscope.el")
(require 'xcscope)
(load-file "~/breadcrumb.el")
(require 'breadcrumb)
(defun date ()
(interactive)
(insert (format-time-string "%A, %B %e, %Y")))
;;(add-to-list 'load-path "/app/skathirvel/tramp-2.1.9/lisp/")
;;(require 'tramp)
;;(setq tramp-default-method "scp")
;;(setq shell-file-name "c:/cygwin/bin/bash.exe")
;;(load "linum.el")
;;(require 'linum)
;;(global-linum-mode 1)
;; (load-file "C:\\Program Files\\gnuserv\\gnuserv.el")
;; (require 'gnuserv)
;;
;; (require 'gnuserv)
;; (setq custom-file "/cygdrive/c/moje/_unix/.emacs-cygwin-mine")
;; (load custom-file)
;;(global-set-key [(control .)] 'enlarge-window-horizontally)
;;(global-set-key [(control ,)] 'shrink-window-horizontally )
;;(global-set-key [(control ?6)] 'enlarge-window )
;;(global-set-key [(control ?7)] 'shrink-window )
(defun copy-buffer-file-name-as-kill (choice)
"Copyies the buffer {name/mode}, file {name/full path/directory} to the kill-ring."
(interactive "cCopy (b) buffer name, (m) buffer major mode, (f) full buffer-file path, (d) buffer-file dir
(let ((new-kill-string)
(name (if (eq major-mode 'dired-mode)
(dired-get-filename)
(or (buffer-file-name) ""))))
(cond ((eq choice ?f)
(setq new-kill-string name))
((eq choice ?d)
(setq new-kill-string (file-name-directory name)))
((eq choice ?n)
(setq new-kill-string (file-name-nondirectory name)))
((eq choice ?b)
(setq new-kill-string (buffer-name)))
((eq choice ?m)
(setq new-kill-string (format "%s" major-mode)))
(t (message "Quit")))
(when new-kill-string
(message "%s copied" new-kill-string)
(kill-new new-kill-string))))
;; When moving to parent directory by `^ Dired by default creates a new buffer for each movement up. The fol
(add-hook 'dired-mode-hook
(lambda ()
(define-key dired-mode-map (kbd "^")
(lambda () (interactive) (find-alternate-file "..")))
; was dired-up-directory
))
(put 'erase-buffer 'disabled nil)
;;(load-file "~/dirtree.el")
(add-to-list 'load-path "/app/skathirvel/.emacs.d/")
;;(eval-after-load "tree-widget"
;; '(if (boundp 'tree-widget-themes-load-path)
;; (add-to-list 'tree-widget-themes-load-path "/app/skathirvel/.emacs.d/tree-widget")))
;;(autoload 'imenu-tree "imenu-tree" "Imenu tree" t)
;;(autoload 'tags-tree "tags-tree" "TAGS tree" t)
;;(autoload 'dirtree "dirtree" "Add directory to tree view" t)
;;(require 'sr-speedbar)
;; Customization examples:
;;
;; To ignore case by default:
;; (setq igrep-options "-i")
;; or:
(setq igrep-case-fold-search t)
;; To search subdirectories by default:
(setq igrep-find t)
;; To search files with the GNU (gzip) zgrep script:
;; (setq igrep-use-zgrep t)
;; or define new igrep commands (this works for zegrep and zfgrep as well):
;; (igrep-define zgrep); M-x zgrep
;; (igrep-find-define zgrep); M-x zgrep-find
;; To search "*.[ch]" files by default in C mode:
(put 'igrep-files-default 'c-mode
(lambda () "*.[ch]"))
;; To disable the default search regex and/or files pattern, except for
;; specific modes:
(setq igrep-regex-default 'ignore)
(setq igrep-files-default 'ignore)
;; To avoid exceeding some shells' limit on command argument length
;; (this only searches files in the current directory):
(setq igrep-find t
igrep-find-prune-clause "-type d \\! -name .")
;;(load-file "~/savehist-20+.el")
;;(savehist-mode 1)
;;(setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring))
;;(setq savehist-file "/app/skathirvel/2006/emacs.savehist.txt")
My emacs file
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment