|
(global-set-key [C-next] 'scroll-other-window)
(global-set-key [C-prior] 'scroll-other-window-down)
(global-set-key "\C-z" 'shell)
(global-set-key [S-iso-lefttab] 'dabbrev-completion)
(global-unset-key [?\C-\040])
(global-set-key [?\C-\040] 'dabbrev-completion)
(global-set-key [f1] 'help)
(global-set-key [S-f1] 'man)
(global-set-key [f2] 'save-buffer)
(global-set-key [f3] 'find-file)
(global-set-key [f4] 'kill-buffer)
(global-set-key [f5] 'compile)
(global-set-key [f6] 'first-error)
(global-set-key [f7] 'previous-error)
(global-set-key [f8] 'next-error)
(global-set-key [f9] 'new-frame)
(global-set-key [S-f9] 'delete-frame)
(global-set-key [f10] 'split-window-vertically)
(global-set-key [S-f10] 'delete-other-windows)
(global-set-key [f11] 'undo)
(global-set-key [f12] 'other-window)
(global-set-key [S-f12] 'delete-window)
(setq user-mail-address "sdodd@undergrad.math.uwaterloo.ca")(setq sendmail-program "/usr/sbin/sendmail")
(setq tex-dvi-view-command "xdvi")
(setq compile-command "make")
(setq transient-mark-mode '1)
(add-hook 'dired-mode-hook
'(lambda()
(define-key dired-mode-map [delete] 'dired-flag-file-deletion)
(define-key dired-mode-map [return] 'dired-find-file-other-window)
(define-key dired-mode-map [C-down-mouse-1] 'dired-mouse-find-file-other-window)))
(setq gnus-select-method '(nnspool ""))
(setq nnspool-inews-switches '("-h"))
(setq load-path (append load-path '("/usr/share/emacs/site-lisp/vm")))
(autoload 'vm "vm" "Start VM on your primary inbox." t)
(autoload 'vm-other-frame "vm" "Like `vm' but starts in another frame." t)
(autoload 'vm-visit-folder "vm" "Start VM on an arbitrary folder." t)
(autoload 'vm-visit-virtual-folder "vm" "Visit a VM virtual folder." t)
(autoload 'vm-mode "vm" "Run VM major mode on a buffer" t)
(autoload 'vm-mail "vm" "Send a mail message using VM." t)
(autoload 'vm-submit-bug-report "vm" "Send a bug report about VM." t)
(setq mouse-yank-at-point 't)
(global-set-key [vertical-scroll-bar down-mouse-1] 'scroll-bar-drag)
(add-hook 'completion-list-mode-hook
'(lambda() (define-key completion-list-mode-map [down-mouse-1]
'mouse-choose-completion)))
(add-hook 'Info-mode-hook
'(lambda() (define-key Info-mode-map [down-mouse-1]
'Info-mouse-follow-nearest-node)))
(add-hook 'buffer-menu-mode-hook
'(lambda() (define-key Buffer-menu-mode-map [down-mouse-1]
'Buffer-menu-mouse-select)))
(require 'custom)
(require 'cl)
(defconst mwheel-running-xemacs (string-match "XEmacs" (emacs-version)))
(defcustom mwheel-scroll-amount '(10 . 1)
"Amount to scroll windows by when spinning the mouse wheel.
This is actually a cons cell, where the first item is the amount to scroll
on a normal wheel event, and the second is the amount to scroll when the
wheel is moved with the shift key depressed.
This should be the number of lines to scroll, or `nil' for near
full screen.
A near full screen is `next-screen-context-lines' less than a full screen."
:group 'mouse
:type '(cons
(choice :tag "Normal"
(const :tag "Full screen" :value nil)
(integer :tag "Specific # of lines"))
(choice :tag "Shifted"
(const :tag "Full screen" :value nil)
(integer :tag "Specific # of lines"))))
(defcustom mwheel-follow-mouse 1
"Whether the mouse wheel should scroll the window that the mouse is over.
This can be slightly disconcerting, but some people may prefer it."
:group 'mouse
:type 'boolean)
(if (not (fboundp 'event-button))
(defun mwheel-event-button (event)
(let ((x (symbol-name (event-basic-type event))))
(if (not (string-match "^mouse-\\([0-9]+\\)" x))
(error "Not a button event: %S" event))
(string-to-int (substring x (match-beginning 1) (match-end 1)))))
(fset 'mwheel-event-button 'event-button))
(if (not (fboundp 'event-window))
(defun mwheel-event-window (event)
(posn-window (event-start event)))
(fset 'mwheel-event-window 'event-window))
(defun mwheel-scroll (event)
(interactive "e")
(let ((curwin (if mwheel-follow-mouse
(prog1
(selected-window)
(select-window (mwheel-event-window event)))))
(amt (if (memq 'shift (event-modifiers event))
(cdr mwheel-scroll-amount)
(car mwheel-scroll-amount))))
(case (mwheel-event-button event)
(4 (scroll-down amt))
(5 (scroll-up amt))
(otherwise (error "Bad binding in mwheel-scroll")))
(if curwin (select-window curwin))))
(defun mwheel-undo (event)
(interactive "e")
(let ((curwin (if mwheel-follow-mouse
(prog1
(selected-window)
(select-window (mwheel-event-window event)))))
)
(case (mwheel-event-button event)
(4 (undo))
(5 (undo))
(otherwise (error "Bad binding in mwheel-scroll")))
(if curwin (select-window curwin))))
(define-key global-map
(if mwheel-running-xemacs 'button4 [mouse-4]) 'mwheel-scroll)
(define-key global-map
(if mwheel-running-xemacs 'button5 [mouse-5]) 'mwheel-scroll)
(define-key global-map
(if mwheel-running-xemacs [(shift button4)] [S-mouse-4]) 'mwheel-scroll)
(define-key global-map
(if mwheel-running-xemacs [(shift button5)] [S-mouse-5]) 'mwheel-scroll)
(define-key global-map
(if mwheel-running-xemacs [(control button4)] [C-mouse-4]) 'mwheel-undo)
(define-key global-map
(if mwheel-running-xemacs [(control button5)] [C-mouse-5]) 'mwheel-undo)
(provide 'mwheel)
(defun s-self-insert-command ()
(interactive)
(if mark-active (kill-region (point) (mark)) ())
(self-insert-command 1))
(defun s-shift-forward-char ()
(interactive)
(if (not mark-active) (set-mark-command nil) ())
(forward-char))
(defun s-forward-char ()
(interactive)
(if mark-active (set-mark nil) ())
(forward-char))
(defun s-shift-backward-char ()
(interactive)
(if (not mark-active) (set-mark-command nil) ())
(backward-char))
(defun s-backward-char ()
(interactive)
(if mark-active (set-mark nil) ())
(backward-char))
(defun s-shift-previous-line1 ()
(interactive)
(if (not mark-active) (set-mark-command nil) ())
(previous-line 1))
(defun s-previous-line1 ()
(interactive)
(if mark-active (set-mark nil) ())
(previous-line 1))
(defun s-shift-next-line1 ()
(interactive)
(if (not mark-active) (set-mark-command nil) ())
(next-line 1))
(defun s-next-line1 ()
(interactive)
(if mark-active (set-mark nil) ())
(next-line 1))
(defun s-shift-end-of-line ()
(interactive)
(if (not mark-active) (set-mark-command nil) ())
(end-of-line))
(defun s-shift-ctrl-end-of-buffer ()
(interactive)
(if (not mark-active) (set-mark-command nil) (message "hi"))
(goto-char (point-max)))
(defun s-end-of-line ()
(interactive)
(if mark-active (set-mark nil) ())
(end-of-line))
(defun s-shift-beginning-of-line ()
(interactive)
(if (not mark-active) (set-mark-command nil) ())
(beginning-of-line))
(defun s-shift-ctrl-beginning-of-buffer ()
(interactive)
(if (not mark-active) (set-mark-command nil) ())
(goto-char (point-min)))
(defun s-beginning-of-line ()
(interactive)
(if mark-active (set-mark nil) ())
(beginning-of-line))
(defun s-shift-scroll-up ()
(interactive)
(if (not mark-active) (set-mark-command nil) ())
(if (condition-case nil
(scroll-up)
(error 't)) (goto-char (point-max)) ()))
(defun s-scroll-up ()
(interactive)
(if mark-active (set-mark nil) ())
(if (condition-case nil
(scroll-up)
(error 't)) (goto-char (point-max)) ()))
(defun s-shift-scroll-down ()
(interactive)
(if (not mark-active) (set-mark-command nil) ())
(if (condition-case nil
(scroll-down)
(error 't)) (goto-char (point-min)) ()))
(defun s-scroll-down ()
(interactive)
(if mark-active (set-mark nil) ())
(if (condition-case nil
(scroll-down)
(error 't)) (goto-char (point-min)) ()))
(defun s-shift-delete ()
(interactive)
(if mark-active (kill-region (point) (mark)) (kill-line))
(setq s-prev-selection nil))
(defun s-ctrl-delete ()
(interactive)
(if mark-active (copy-region-as-kill (point) (mark)) ())
(setq s-prev-selection nil))
(defun s-delete ()
(interactive)
(if mark-active (progn
(delete-region (point) (mark))
(if s-prev-selection
(x-set-selection 'PRIMARY s-prev-selection) ())
(setq s-prev-selection nil))
(delete-char 1)))
(defun s-mouse-drag-region (event)
(interactive "e")
(condition-case nil
(setq s-prev-selection (x-get-selection))
(error 't))
(mouse-drag-region event))
(defun s-mouse-yank-at-click ()
(interactive)
(if mark-active (progn (delete-region (point) (mark))
(if s-prev-selection
(x-set-selection 'PRIMARY s-prev-selection) ()))
())
(mouse-yank-at-click nil nil))
(setq s-prev-selection nil)
(substitute-key-definition 'self-insert-command 's-self-insert-command
global-map)
(substitute-key-definition 'mouse-yank-at-click 's-mouse-yank-at-click
global-map)
(define-key global-map [S-right] 's-shift-forward-char)
(define-key global-map [right] 's-forward-char)
(define-key global-map [S-left] 's-shift-backward-char)
(define-key global-map [up] 's-backward-char)
(define-key global-map [S-up] 's-shift-previous-line1)
(define-key global-map [up] 's-previous-line1)
(define-key global-map [S-down] 's-shift-next-line1)
(define-key global-map [down] 's-next-line1)
(define-key global-map [end] 's-end-of-line)
(define-key global-map [S-end] 's-shift-end-of-line)
(define-key global-map [C-end] 'end-of-buffer)
(define-key global-map [C-S-end] 's-shift-ctrl-end-of-buffer)
(define-key global-map [home] 's-beginning-of-line)
(define-key global-map [S-home] 's-shift-beginning-of-line)
(define-key global-map [C-home] 'beginning-of-buffer)
(define-key global-map [C-S-home] 's-shift-ctrl-beginning-of-buffer)
(define-key global-map [next] 's-scroll-up)
(define-key global-map [S-next] 's-shift-scroll-up)
(define-key global-map [prior] 's-scroll-down)
(define-key global-map [S-prior] 's-shift-scroll-down)
(define-key global-map [down-mouse-1] 's-mouse-drag-region)
(define-key global-map [S-delete] 's-shift-delete)
(define-key global-map [C-S-delete] 's-shift-delete)
(define-key global-map [delete] 's-delete)
(define-key global-map [C-delete] 's-ctrl-delete)
(define-key global-map [S-insert] 's-mouse-yank-at-click)
(defun s-minibuffer-complete ()
"A shell around minibuffer-complete which removes the name of the current buffer from the buffer completion list. The default behaviour doesn't make sense since there is no reason to ask to switch to the buffer you are already in!"
(interactive)
(if s-remove-first-completion
(progn (setq s-remove-first-completion nil)
(if (consp minibuffer-completion-table)
(setq minibuffer-completion-table
(cdr minibuffer-completion-table)) ()))
())
(minibuffer-complete))
(defun s-minibuffer-complete-word ()
"A shell around minibuffer-complete-word which removes the name of the current buffer from the buffer completion list. The default behaviour doesn't make sense since there is no reason to ask to switch to the buffer you are already in!"
(interactive)
(if s-remove-first-completion
(progn (setq s-remove-first-completion nil)
(if (consp minibuffer-completion-table)
(setq minibuffer-completion-table
(cdr minibuffer-completion-table)) ()))
())
(minibuffer-complete-word)
)
(defun s-minibuffer-complete-and-exit ()
"A shell around minibuffer-complete-and-exit which removes the name of the current buffer from the buffer completion list. The default behaviour doesn't make sense since there is no reason to ask to switch to the buffer you are already in!"
(interactive)
(if s-remove-first-completion
(progn (setq s-remove-first-completion nil)
(if (consp minibuffer-completion-table)
(setq minibuffer-completion-table
(cdr minibuffer-completion-table)) ()))
())
(minibuffer-complete-and-exit))
(defun s-switch-to-buffer ()
"A shell around switch-to-buffer which removes the name of the current buffer from the buffer completion list. The default behaviour doesn't make sense since there is no reason to ask to switch to the buffer you are already in!"
(interactive)
(setq s-remove-first-completion 't)
(switch-to-buffer (read-buffer "Switch to buffer: " (other-buffer))))
(setq s-remove-first-completion 'nil)
(define-key minibuffer-local-completion-map "\040" 's-minibuffer-word)
(define-key minibuffer-local-completion-map "\t" 's-minibuffer-complete)
(define-key minibuffer-local-must-match-map [return] 's-minibuffer-complete-and-exit)
(global-set-key "\C-xb" 's-switch-to-buffer)
|
|
|
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 |
|
|
|
|