unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* copy-rectangle-to-kill-ring
@ 2007-01-04 18:40 Wilmar Igl
  2007-01-05 17:35 ` copy-rectangle-to-kill-ring Kevin Rodgers
  2007-01-10  8:38 ` copy-rectangle-to-kill-ring Kevin Rodgers
  0 siblings, 2 replies; 4+ messages in thread
From: Wilmar Igl @ 2007-01-04 18:40 UTC (permalink / raw)


Dear Emacs developers,

sorry, I don't want to  be a nuisance. However, I'd like to suggest to
include a function to copy a rectangle into the kill ring which is not 
available at the moment (only copy-rectangle-to-register).

Thanks for your effort.

Yours,

Wilmar Igl

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: copy-rectangle-to-kill-ring
  2007-01-04 18:40 copy-rectangle-to-kill-ring Wilmar Igl
@ 2007-01-05 17:35 ` Kevin Rodgers
  2007-01-10  8:38 ` copy-rectangle-to-kill-ring Kevin Rodgers
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2007-01-05 17:35 UTC (permalink / raw)


Wilmar Igl wrote:
> sorry, I don't want to  be a nuisance. However, I'd like to suggest to
> include a function to copy a rectangle into the kill ring which is not 
> available at the moment (only copy-rectangle-to-register).

C-x r k
C-x u
...
C-x r y

,----[ C-h f kill-rectangle RET ]
| kill-rectangle is an interactive compiled Lisp function in `rect.el'.
| It is bound to C-x r k.
| (kill-rectangle start end &optional fill)
|
| Delete the region-rectangle and save it as the last killed one.
|
| When called from a program the rectangle's corners are start and end.
| You might prefer to use `delete-extract-rectangle' from a program.
|
| With a prefix (or a fill) argument, also fill lines where nothing has 
to be
| deleted.
|
| If the buffer is read-only, Emacs will beep and refrain from deleting
| the rectangle, but put it in the kill ring anyway.  This means that
| you can use this command to copy text from a read-only buffer.
| (If the variable `kill-read-only-ok' is non-nil, then this won't
| even beep.)
|
| [back]
`----

,----[ C-h k C-x u ]
| C-x u runs the command advertised-undo
|   which is an alias for `undo' in `simple.el'.
| It is bound to C-x u.
| (advertised-undo &optional arg)
|
| Undo some previous changes.
| Repeat this command to undo more changes.
| A numeric argument serves as a repeat count.
|
| In Transient Mark mode when the mark is active, only undo changes within
| the current region.  Similarly, when not in Transient Mark mode, just C-u
| as an argument limits undo to changes within the current region.
|
| [back]
`----

,----[ C-h f yank-rectangle RET ]
| yank-rectangle is an interactive compiled Lisp function in `rect.el'.
| It is bound to C-x r y.
| (yank-rectangle)
|
| Yank the last killed rectangle with upper left corner at point.
|
| [back]
`----

-- 
Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: copy-rectangle-to-kill-ring
  2007-01-04 18:40 copy-rectangle-to-kill-ring Wilmar Igl
  2007-01-05 17:35 ` copy-rectangle-to-kill-ring Kevin Rodgers
@ 2007-01-10  8:38 ` Kevin Rodgers
  2007-01-11  6:14   ` copy-rectangle-to-kill-ring Kevin Rodgers
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2007-01-10  8:38 UTC (permalink / raw)


Wilmar Igl wrote:
> sorry, I don't want to  be a nuisance. However, I'd like to suggest to
> include a function to copy a rectangle into the kill ring which is not 
> available at the moment (only copy-rectangle-to-register).

Do you mean "copy a rectangle so that `C-x r y' can insert it"?  Or do
you mean "copy a rectangle so that `C-y' can insert it"?

If the former, this should do the job:

(defun copy-rectangle-as-kill (beg end)
   "Copy rectangular region into `killed-rectangle', but don't delete it.
The rectangle can then be yanked via \\[yank-rectangle]."
   (interactive "r")
   (setq killed-rectangle (extract-rectangle beg end)))

-- 
Kevin Rodgers
Denver, Colorado, USA

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: copy-rectangle-to-kill-ring
  2007-01-10  8:38 ` copy-rectangle-to-kill-ring Kevin Rodgers
@ 2007-01-11  6:14   ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2007-01-11  6:14 UTC (permalink / raw)


Kevin Rodgers wrote:
> Wilmar Igl wrote:
>> sorry, I don't want to  be a nuisance. However, I'd like to suggest to
>> include a function to copy a rectangle into the kill ring which is not 
>> available at the moment (only copy-rectangle-to-register).
> 
> Do you mean "copy a rectangle so that `C-x r y' can insert it"?  Or do
> you mean "copy a rectangle so that `C-y' can insert it"?
> 
> If the former, this should do the job:
> 
> (defun copy-rectangle-as-kill (beg end)
>   "Copy rectangular region into `killed-rectangle', but don't delete it.
> The rectangle can then be yanked via \\[yank-rectangle]."
>   (interactive "r")
>   (setq killed-rectangle (extract-rectangle beg end)))

Or if the latter, how about:

(defun copy-rectangle-as-kill-region (beg end)
   "Copy rectangular region into the kill ring, but don't delete it.
The text can then be yanked via \\[yank]."
   ;; Based on copy-region-as-kill, but with no filtering:
   (interactive "r")
   (let ((text (mapconcat 'identity (extract-rectangle beg end) "\n")))
     (if (eq last-command 'kill-region)
	(kill-append text (< end beg))
       (kill-new text)))
   (if transient-mark-mode
       (setq deactivate-mark t))
   nil)

-- 
Kevin Rodgers
Denver, Colorado, USA

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-01-11  6:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-04 18:40 copy-rectangle-to-kill-ring Wilmar Igl
2007-01-05 17:35 ` copy-rectangle-to-kill-ring Kevin Rodgers
2007-01-10  8:38 ` copy-rectangle-to-kill-ring Kevin Rodgers
2007-01-11  6:14   ` copy-rectangle-to-kill-ring Kevin Rodgers

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).