|
(global-set-key "\C-xg" 'goto-line)
(global-set-key [home] 'beginning-of-line)
(global-set-key [end] 'end-of-line)
(global-set-key [\C-home] 'beginning-of-buffer)
(global-set-key [\C-end] 'end-of-buffer)
(global-set-key [\S-tab] 'indent-region)
(global-set-key [?\C-/] 'void) (global-set-key [\C-backspace] 'backward-kill-word)
(global-set-key "\C-s" 'isearch-forward-regexp)
(global-set-key "\C-r" 'isearch-backward-regexp)
(global-set-key "\C-\M-s" 'tags-search)
(global-set-key "\C-x\C-n" 'find-file-other-frame) (global-set-key "\C-x\C-c" 'intelligent-close) (global-set-key "\C-x55" 'split-window-fork) (global-set-key "\M-n" 'scroll-n-lines-ahead) (global-set-key "\M-p" 'scroll-n-lines-behind) (global-set-key "\M-u" 'void) (global-set-key "\M-l" 'void) (global-set-key "\C-c\C-c" 'comment-region) (global-set-key [\C-tab] 'yic-next-buffer) (global-set-key [\C-\S-tab] 'yic-prev-buffer)
(setq-default abbrev-mode t)
(if (file-exists-p "~/.abbrev")
(read-abbrev-file "~/.abbrev"))
(setq save-abbrevs t)
(setq dabbrev-case-replace nil)
(setq scroll-step 1)
(global-font-lock-mode 1)
(setq font-lock-maximum-decoration t)
(custom-set-faces)
(show-paren-mode t)
(column-number-mode t)
(setq-default frame-title-format (list "%65b %f"))
(setq-default icon-title-format (list "%b"))
(display-time)
(fset 'yes-or-no-p 'y-or-n-p)
(setq next-line-add-newlines nil)
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(defun ascii-table ()
"Print the ascii table. Based on a defun by Alex Schroeder <asc@bsiag.com>"
(interactive)
(switch-to-buffer "*ASCII*")
(erase-buffer)
(insert (format "ASCII characters up to number %d.\n" 254))
(let ((i 0))
(while (< i 254)
(setq i (+ i 1))
(insert (format "%4d %c\n" i i))))
(beginning-of-buffer))
(defun insert-date ()
"Insert date at point."
(interactive)
(insert (format-time-string "%a %b %e, %Y %l:%M %p")))
(defun dos2unix ()
(interactive)
(goto-char (point-min))
(while (search-forward "\r" nil t) (replace-match "")))
(defun unix2dos ()
(interactive)
(goto-char (point-min))
(while (search-forward "\n" nil t) (replace-match "\r\n")))
(defun intelligent-close ()
"quit a frame the same way no matter what kind of frame you are on"
(interactive)
(if (eq (car (visible-frame-list)) (selected-frame))
(if (> (length (visible-frame-list)) 1)
(delete-frame (selected-frame))
(save-buffers-kill-emacs))
(delete-frame (selected-frame))))
(defun void ()
"this is a no-op"
(interactive))
(defun region-length ()
"length of a region"
(interactive)
(message (format "%d" (- (region-end) (region-beginning)))))
(defun split-window-fork ()
(concat
"spawns a new frame so that a 2-way split window in one frame becomes "
"2 top-level frames. Has the same action as ")
(interactive)
(progn
(let ((current_window (selected-window))
(other_window (next-window (selected-window)))
(current_buffer (window-buffer (selected-window)))
(other_buffer (window-buffer (next-window (selected-window)))))
(make-frame)
(select-window other_window)
(delete-other-windows))))
(defalias 'scroll-ahead 'scroll-up)
(defalias 'scroll-behind 'scroll-down)
(defun scroll-n-lines-ahead (&optional n)
"Scroll ahead N lines (1 by default)."
(interactive "P")
(progn
(scroll-ahead (prefix-numeric-value n))
(next-line 1)))
(defun scroll-n-lines-behind (&optional n)
"Scroll behind N lines (1 by default)."
(interactive "P")
(progn
(scroll-behind (prefix-numeric-value n))
(previous-line 1)))
(defun yic-ignore (str)
(or
(string-match "\\*Buffer List\\*" str)
(string-match "^TAGS" str)
(string-match "^\\*Messages\\*$" str)
(string-match "^\\*Completions\\*$" str)
(string-match "^ " str)
(memq str
(mapcar
(lambda (x)
(buffer-name
(window-buffer
(frame-selected-window x))))
(visible-frame-list)))
))
(defun yic-next (ls)
"Switch to next buffer in ls skipping unwanted ones."
(let* ((ptr ls)
bf bn go
)
(while (and ptr (null go))
(setq bf (car ptr) bn (buffer-name bf))
(if (null (yic-ignore bn)) (setq go bf)
(setq ptr (cdr ptr))
)
)
(if go
(switch-to-buffer go))))
(defun yic-prev-buffer ()
"Switch to previous buffer in current window."
(interactive)
(yic-next (reverse (buffer-list))))
(defun yic-next-buffer ()
"Switch to the other buffer (2nd in list-buffer) in current window."
(interactive)
(bury-buffer (current-buffer))
(yic-next (buffer-list)))
(defun get-my-tab-length () 3)
(defun iota
(n)
(if (= n 0) '()
(append (iota (- n 1)) (list n))))
(defun create-tab-list
(length)
(mapcar (lambda (n) (* (get-my-tab-length) n)) (iota length)))
(defun my-c-mode-hook ()
(local-set-key "\M-f" 'c-forward-into-nomenclature)
(local-set-key "\M-b" 'c-backward-into-nomenclature)
(setq tab-stop-list (create-tab-list 60))
(setq indent-tabs-mode t)
(setq tab-width (get-my-tab-length))
(setq c-basic-offset (get-my-tab-length))
(setq standard-indent (get-my-tab-length))
(setq c-style-variables-are-local-p nil)
(setq c-auto-newline nil)
(c-set-offset 'substatement-open 0)
(c-set-offset 'arglist-intro '+)
(c-set-offset 'arglist-cont-nonempty '+)
(c-set-offset 'case-label '+)
(local-set-key "\C-m" 'newline-and-indent)
(setq font-lock-support-mode 'lazy-lock-mode)
(setq lazy-lock-defer-contextually t)
(setq lazy-lock-defer-time 0)
(c-toggle-hungry-state 1)
(c-set-offset 'statement-case-open 0)
(setq c-electric-pound-behavior (quote (alignleft)))
(setq c-label-minimum-indentation 0)
)
(add-hook 'c++-mode-hook 'my-c-mode-hook)
(add-hook 'c-mode-hook 'my-c-mode-hook)
(if (or (eq system-type 'windows-nt)
(eq system-type 'ms-dos))
(progn
(setq initial-frame-alist
`((top . 0)
(left . ,(/ (car (cdr (cdr (current-time)))) 8000))))
)
)
(if (file-exists-p "~/.emacs_local")
(load-file "~/.emacs_local"))
|
|
|
All content copyright by the contributors. |
Website maintained with
Emacs ,
wsmake and
html-helper-mode |
Emacs community logo by Daniel Lundin |
Last updated on Sat Jan 22 14:49:24 2005
by Ingo Koch |
|
|
|
|