From 91d3e89c924fb8a932599ccfcf18bc364878ac17 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 18 Nov 2009 13:52:06 +0100 Subject: updated copy/paste functions --- emacs | 57 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 21 deletions(-) (limited to 'emacs') diff --git a/emacs b/emacs index e5ad535..fc27b21 100644 --- a/emacs +++ b/emacs @@ -91,7 +91,7 @@ '(scalable-fonts-allowed t) '(scroll-bar-mode (quote right)) '(server-mode t) - '(show-trailing-whitespace nil) + '(show-trailing-whitespace t) '(speedbar-directory-button-trim-method (quote trim)) '(speedbar-frame-parameters (quote ((minibuffer) (width . 30) (height . 60) (border-width . 0) (menu-bar-lines . 0) (tool-bar-lines . 0) (unsplittable . t) (left-fringe . 0)))) '(speedbar-frame-plist (quote (minibuffer nil width 30 height 60 border-width 0 internal-border-width 0 unsplittable t default-toolbar-visible-p nil has-modeline-p nil menubar-visible-p nil default-gutter-visible-p nil))) @@ -139,7 +139,6 @@ '(whitespace-rescan-timer-time 0) '(windmove-wrap-around nil) '(x-gtk-whole-detached-tool-bar nil) - '(x-select-enable-clipboard t) '(x-stretch-cursor nil)) (custom-set-faces @@ -242,12 +241,12 @@ (setq inhibit-startup-message t) (setq require-final-newline t) (fset 'yes-or-no-p 'y-or-n-p) -(setq next-line-add-newlines nil) +(setq next-line-add-newlines nil) ; general settings (require 'paren) (show-paren-mode t) (global-font-lock-mode t t) -(setq font-lock-maximum-decoration t) +(setq font-lock-maximum-decoration t) (follow-mode t) (setq vc-follow-symlinks t) @@ -300,7 +299,6 @@ (global-set-key [C-tab] 'indent-region-with-tab) (global-set-key [C-S-iso-lefttab] 'unindent-region-with-tab) - ; byte-compile .emacs (defun autocompile nil "compile itself if ~/.emacs" @@ -332,22 +330,6 @@ ido-max-prospects 6 ido-confirm-unique-completion t) -; rectagle select -(require 'rect-mark) -(global-set-key (kbd "C-x r C-SPC") 'rm-set-mark) -(global-set-key (kbd "C-w") - '(lambda(b e) (interactive "r") - (if rm-mark-active - (rm-kill-region b e) (kill-region b e)))) -(global-set-key (kbd "M-w") - '(lambda(b e) (interactive "r") - (if rm-mark-active - (rm-kill-ring-save b e) (kill-ring-save b e)))) -(global-set-key (kbd "C-x C-x") - '(lambda(&optional p) (interactive "p") - (if rm-mark-active - (rm-exchange-point-and-mark p) (exchange-point-and-mark p)))) - ; servermode (to edit files with emacsclient) (server-start) @@ -368,3 +350,36 @@ ; html-php-multi-mode (require 'html-php) (setq auto-mode-alist (cons '("\\.php" . html-php-mode) auto-mode-alist)) + +;; copy/paste enhancements +; share clipboard with other X11-Apps +(setq x-select-enable-clipboard t) +(setq interprogram-paste-function 'x-cut-buffer-or-selection-value) + +; rectangle selection +(require 'rect-mark) +(global-set-key (kbd "C-x r SPC") 'rm-set-mark) +(global-set-key (kbd "C-S-y") 'yank-rectangle) + +(global-set-key (kbd "C-x C-x") + '(lambda(p) (interactive + (if rm-mark-active + (rm-exchange-point-and-mark p) (exchange-point-and-mark p))))) + +; if rectangle mark active, copy/cut/ rectangle and +; if not copy whole line when no region is active +(global-set-key (kbd "C-w") + '(lambda(b a) (interactive "r") + (if rm-mark-active + (rm-kill-region b a) + (if mark-active + (kill-region b a) + (kill-region (line-beginning-position) (line-beginning-position 2)))))) + +(global-set-key (kbd "M-w") + '(lambda(b a) (interactive "r") + (if rm-mark-active + (rm-kill-ring-save b a) + (if mark-active + (kill-ring-save b a) + (kill-ring-save (line-beginning-position) (line-beginning-position 2)))))) -- cgit v1.2.3