Commit 00a2b823 authored by Stefan Monnier's avatar Stefan Monnier

Make registers and delete-selection-mode work on rectangles.

* lisp/register.el (describe-register-1): Don't modify the register's value.
(copy-to-register): Obey region-extract-function.
* lisp/delsel.el (delete-active-region): Obey region-extract-function.
parent a92fa5f1
2013-12-08 Stefan Monnier <monnier@iro.umontreal.ca>
Make registers and delete-selection-mode work on rectangles.
* register.el (describe-register-1): Don't modify the register's value.
(copy-to-register): Obey region-extract-function.
* delsel.el (delete-active-region): Obey region-extract-function.
2013-12-08 Leo Liu <sdl.web@gmail.com> 2013-12-08 Leo Liu <sdl.web@gmail.com>
* progmodes/flymake.el (flymake, flymake-error-bitmap) * progmodes/flymake.el (flymake, flymake-error-bitmap)
...@@ -29,8 +36,7 @@ ...@@ -29,8 +36,7 @@
2013-12-07 Lars Magne Ingebrigtsen <larsi@gnus.org> 2013-12-07 Lars Magne Ingebrigtsen <larsi@gnus.org>
* net/shr.el (shr-tag-img): Don't bug out on <img src=""> * net/shr.el (shr-tag-img): Don't bug out on <img src=""> data.
data.
2013-12-06 Michael Albinus <michael.albinus@gmx.de> 2013-12-06 Michael Albinus <michael.albinus@gmx.de>
...@@ -42,8 +48,8 @@ ...@@ -42,8 +48,8 @@
2013-12-06 Dmitry Gutov <dgutov@yandex.ru> 2013-12-06 Dmitry Gutov <dgutov@yandex.ru>
* progmodes/ruby-mode.el (ruby-syntax-propertize-function): Touch * progmodes/ruby-mode.el (ruby-syntax-propertize-function):
up the last change. Touch up the last change.
2013-12-06 Leo Liu <sdl.web@gmail.com> 2013-12-06 Leo Liu <sdl.web@gmail.com>
...@@ -73,8 +79,8 @@ ...@@ -73,8 +79,8 @@
2013-12-06 Dmitry Gutov <dgutov@yandex.ru> 2013-12-06 Dmitry Gutov <dgutov@yandex.ru>
* progmodes/octave.el (inferior-octave-completion-table): Turn * progmodes/octave.el (inferior-octave-completion-table):
back into function, use `completion-table-with-cache' Turn back into function, use `completion-table-with-cache'
(Bug#11906). Update all references. (Bug#11906). Update all references.
* minibuffer.el (completion-table-with-cache): New function. * minibuffer.el (completion-table-with-cache): New function.
......
...@@ -78,8 +78,8 @@ any selection." ...@@ -78,8 +78,8 @@ any selection."
"Delete the active region. "Delete the active region.
If KILLP in not-nil, the active region is killed instead of deleted." If KILLP in not-nil, the active region is killed instead of deleted."
(if killp (if killp
(kill-region (point) (mark)) (kill-region (point) (mark) t)
(delete-region (point) (mark))) (funcall region-extract-function 'delete-only))
t) t)
(defun delete-selection-helper (type) (defun delete-selection-helper (type)
...@@ -197,9 +197,9 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer." ...@@ -197,9 +197,9 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
(define-key minibuffer-local-completion-map "\C-g" 'abort-recursive-edit) (define-key minibuffer-local-completion-map "\C-g" 'abort-recursive-edit)
(define-key minibuffer-local-must-match-map "\C-g" 'abort-recursive-edit) (define-key minibuffer-local-must-match-map "\C-g" 'abort-recursive-edit)
(define-key minibuffer-local-isearch-map "\C-g" 'abort-recursive-edit) (define-key minibuffer-local-isearch-map "\C-g" 'abort-recursive-edit)
(dolist (sym '(self-insert-command self-insert-iso yank clipboard-yank (dolist (sym '(self-insert-command yank clipboard-yank
insert-register delete-backward-char backward-delete-char-untabify insert-register
delete-char newline-and-indent newline open-line)) newline-and-indent newline open-line))
(put sym 'delete-selection nil)) (put sym 'delete-selection nil))
;; continue standard unloading ;; continue standard unloading
nil) nil)
......
...@@ -364,6 +364,7 @@ The Lisp value REGISTER is a character." ...@@ -364,6 +364,7 @@ The Lisp value REGISTER is a character."
(princ (car val)))) (princ (car val))))
((stringp val) ((stringp val)
(setq val (copy-sequence val))
(if (eq yank-excluded-properties t) (if (eq yank-excluded-properties t)
(set-text-properties 0 (length val) nil val) (set-text-properties 0 (length val) nil val)
(remove-list-of-text-properties 0 (length val) (remove-list-of-text-properties 0 (length val)
...@@ -417,19 +418,24 @@ Interactively, second arg is non-nil if prefix arg is supplied." ...@@ -417,19 +418,24 @@ Interactively, second arg is non-nil if prefix arg is supplied."
(error "Register does not contain text")))) (error "Register does not contain text"))))
(if (not arg) (exchange-point-and-mark))) (if (not arg) (exchange-point-and-mark)))
(defun copy-to-register (register start end &optional delete-flag) (defun copy-to-register (register start end &optional delete-flag region)
"Copy region into register REGISTER. "Copy region into register REGISTER.
With prefix arg, delete as well. With prefix arg, delete as well.
Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. Called from program, takes four args: REGISTER, START, END and DELETE-FLAG.
START and END are buffer positions indicating what to copy." START and END are buffer positions indicating what to copy.
The optional argument REGION if non-nil, indicates that we're not just copying
some text between START and END, but we're copying the region."
(interactive (list (register-read-with-preview "Copy to register: ") (interactive (list (register-read-with-preview "Copy to register: ")
(region-beginning) (region-beginning)
(region-end) (region-end)
current-prefix-arg)) current-prefix-arg
(set-register register (filter-buffer-substring start end)) t))
(set-register register (if region
(funcall region-extract-function delete-flag)
(prog1 (filter-buffer-substring start end)
(if delete-flag (delete-region start end)))))
(setq deactivate-mark t) (setq deactivate-mark t)
(cond (delete-flag (cond (delete-flag)
(delete-region start end))
((called-interactively-p 'interactive) ((called-interactively-p 'interactive)
(indicate-copied-region)))) (indicate-copied-region))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment