all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* copy-line (& default keychord)
@ 2012-07-05 19:08 Enda
  2012-07-24 16:06 ` copy-line Enda
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Enda @ 2012-07-05 19:08 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

What happened to copy-line in Emacs (which would copy the line). In Vi, copying a line is yy, what is the shortest way of copying a line in Emacs (without writing a lisp function in .emacs)? Should there be a default keychord for copying a line?


Best wishes,

Enda

[-- Attachment #2: Type: text/html, Size: 527 bytes --]

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

* copy-line
  2012-07-05 19:08 copy-line (& default keychord) Enda
@ 2012-07-24 16:06 ` Enda
  2012-07-24 17:44   ` copy-line Bastien
  2012-07-25 18:47   ` copy-line Guido Van Hoecke
       [not found] ` <mailman.5498.1343146029.855.help-gnu-emacs@gnu.org>
  2012-07-25 18:01 ` copy-line (& default keychord) Andreas Röhler
  2 siblings, 2 replies; 10+ messages in thread
From: Enda @ 2012-07-24 16:06 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

[-- Attachment #1: Type: text/plain, Size: 264 bytes --]

Usedn't there be a copy-line in Emacs (which would copy the line). In Vi, copying a line is yy, what is the shortest way of copying a line in Emacs (without writing a lisp function in .emacs)? Should there be a default keystroke for copying a line?




- Enda

[-- Attachment #2: Type: text/html, Size: 1052 bytes --]

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

* Re: copy-line
  2012-07-24 16:06 ` copy-line Enda
@ 2012-07-24 17:44   ` Bastien
  2012-07-25 18:47   ` copy-line Guido Van Hoecke
  1 sibling, 0 replies; 10+ messages in thread
From: Bastien @ 2012-07-24 17:44 UTC (permalink / raw)
  To: Enda; +Cc: help-gnu-emacs@gnu.org

Enda <enda_k2@yahoo.com> writes:

> Usedn't there be a copy-line in Emacs (which would copy the line). In
> Vi, copying a line is yy, what is the shortest way of copying a line
> in Emacs (without writing a lisp function in .emacs)? Should there be
> a default keystroke for copying a line?

What about one of these two?

(defun kill-line-save (&optional arg)
  "Save the rest of the line as if killed, but don't kill it."
  (interactive "P")
  (let ((buffer-read-only t))
    (kill-line arg)
    (message "Line(s) copied to the kill ring")))

(defun copy-line (&optional arg)
  "Copy the current line."
  (interactive "P")
  (copy-region-as-kill
   (point-at-bol)
   (+ (if kill-whole-line 1 0) (point-at-eol arg))))

-- 
 Bastien



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

* Re: copy-line
       [not found] ` <mailman.5498.1343146029.855.help-gnu-emacs@gnu.org>
@ 2012-07-25 12:31   ` rfflrccrd
  2012-07-25 13:41     ` copy-line Dan Espen
  2012-07-25 13:50     ` copy-line Raffaele Ricciardi
  0 siblings, 2 replies; 10+ messages in thread
From: rfflrccrd @ 2012-07-25 12:31 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: help-gnu-emacs@gnu.org, Enda

Comparing Vi/Vim to other editors is not fair ;-)

Vanilla Emacs has no way to copy text that has not been marked.  Thus, to copy a line, you have to mark it first.  The complete sequence is:

C-a C-Space C-e M-w

In alternative, you can kill a line and yank it back at once:

C-S-Backspace C-k

Unlike Vi, the line will be copied/killed without its new line.  I don't know whether such behaviour is customizable.

Cheers.


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

* Re: copy-line
  2012-07-25 12:31   ` copy-line rfflrccrd
@ 2012-07-25 13:41     ` Dan Espen
  2012-07-25 15:02       ` copy-line Raffaele Ricciardi
  2012-07-25 13:50     ` copy-line Raffaele Ricciardi
  1 sibling, 1 reply; 10+ messages in thread
From: Dan Espen @ 2012-07-25 13:41 UTC (permalink / raw)
  To: help-gnu-emacs

rfflrccrd@gmail.com writes:

> Comparing Vi/Vim to other editors is not fair ;-)
>
> Vanilla Emacs has no way to copy text that has not been marked.  Thus, to copy a line, you have to mark it first.  The complete sequence is:
>
> C-a C-Space C-e M-w
>
> In alternative, you can kill a line and yank it back at once:
>
> C-S-Backspace C-k
>
> Unlike Vi, the line will be copied/killed without its new line.  I don't know whether such behaviour is customizable.

It certainly is customizable:

(define-key global-map [(kp-add)] '(lambda () (interactive)
				     (beginning-of-line)
				     (if (eobp) (error "End of buffer"))
				     (let ((beg (point)))
				       (forward-line 1)
				       (kill-region beg (point))))); KeyPad + Key

Kill a line, yank it back:

C-KP+ C-y


-- 
Dan Espen


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

* Re: copy-line
  2012-07-25 12:31   ` copy-line rfflrccrd
  2012-07-25 13:41     ` copy-line Dan Espen
@ 2012-07-25 13:50     ` Raffaele Ricciardi
  1 sibling, 0 replies; 10+ messages in thread
From: Raffaele Ricciardi @ 2012-07-25 13:50 UTC (permalink / raw)
  To: help-gnu-emacs

On 07/25/2012 01:31 PM, rfflrccrd@gmail.com wrote:
> In alternative, you can kill a line and yank it back at once:
>
> C-S-Backspace C-k

Errata corrige:

C-S-Backspace C-k C-y



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

* Re: copy-line
  2012-07-25 13:41     ` copy-line Dan Espen
@ 2012-07-25 15:02       ` Raffaele Ricciardi
  2012-07-25 15:06         ` copy-line Raffaele Ricciardi
  0 siblings, 1 reply; 10+ messages in thread
From: Raffaele Ricciardi @ 2012-07-25 15:02 UTC (permalink / raw)
  To: help-gnu-emacs

's requirement is that for its was that you shouldn't ha.On 07/25/2012 
02:41 PM, Dan Espen wrote:> rfflrccrd@gmail.com writes:
 >
 >> Comparing Vi/Vim to other editors is not fair ;-)
 >>
 >> Vanilla Emacs has no way to copy text that has not been marked. 
Thus, to copy a line, you have to mark it first.  The complete sequence is:
 >>
 >> C-a C-Space C-e M-w
 >>
 >> In alternative, you can kill a line and yank it back at once:
 >>
 >> C-S-Backspace C-k
 >>
 >> Unlike Vi, the line will be copied/killed without its new line.  I 
don't know whether such behaviour is customizable.
 >
 > It certainly is customizable:
 >
 > (define-key global-map [(kp-add)] '(lambda () (interactive)
 > 				     (beginning-of-line)
 > 				     (if (eobp) (error "End of buffer"))
 > 				     (let ((beg (point)))
 > 				       (forward-line 1)
 > 				       (kill-region beg (point))))); KeyPad + Key
 >
 > Kill a line, yank it back:
 >
 > C-KP+ C-y
 >
 >

I meant: I don't know whether it is customizable via Customize, as the 
original poster asked for its .emacs to be left untouched.  Thank you 
for the tip, though :-)


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

* Re: copy-line
  2012-07-25 15:02       ` copy-line Raffaele Ricciardi
@ 2012-07-25 15:06         ` Raffaele Ricciardi
  0 siblings, 0 replies; 10+ messages in thread
From: Raffaele Ricciardi @ 2012-07-25 15:06 UTC (permalink / raw)
  To: help-gnu-emacs

there is nothing to be customizedOn 07/25/2012 04:02 PM, Raffaele 
Ricciardi wrote:> I meant: I don't know whether it is customizable via 
Customize, as the
 > original poster asked for its .emacs to be left untouched.  Thank you
 > for the tip, though :-)

Well, no customization is needed: to copy the whole line, including the 
newline:

C-a C-SPC C-n M-w

Cheers.



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

* Re: copy-line (& default keychord)
  2012-07-05 19:08 copy-line (& default keychord) Enda
  2012-07-24 16:06 ` copy-line Enda
       [not found] ` <mailman.5498.1343146029.855.help-gnu-emacs@gnu.org>
@ 2012-07-25 18:01 ` Andreas Röhler
  2 siblings, 0 replies; 10+ messages in thread
From: Andreas Röhler @ 2012-07-25 18:01 UTC (permalink / raw)
  To: help-gnu-emacs

Am 05.07.2012 21:08, schrieb Enda:
> What happened to copy-line in Emacs (which would copy the line). In Vi, copying a line is yy, what is the shortest way of copying a line in Emacs (without writing a lisp function in .emacs)? Should there be a default keychord for copying a line?
>
>
> Best wishes,
>
> Enda
>

you may try

https://launchpad.net/s-x-emacs-werkstatt/trunk/1.3/+download/S-X-Emacs-Werkstatt-1.3.tar.gz

it comes with ar-line-atpt, which should do what you want.

Also it delivers some hundred related commands, reducing the need for customizations/creations somehow

Andreas



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

* Re: copy-line
  2012-07-24 16:06 ` copy-line Enda
  2012-07-24 17:44   ` copy-line Bastien
@ 2012-07-25 18:47   ` Guido Van Hoecke
  1 sibling, 0 replies; 10+ messages in thread
From: Guido Van Hoecke @ 2012-07-25 18:47 UTC (permalink / raw)
  To: Enda; +Cc: help-gnu-emacs@gnu.org

On 24 July 2012 18:06, Enda <enda_k2@yahoo.com> wrote:
> Usedn't there be a copy-line in Emacs (which would copy the line). In Vi,
> copying a line is yy, what is the shortest way of copying a line in Emacs
> (without writing a lisp function in .emacs)? Should there be a default
> keystroke for copying a line?
>

You may want to look at
http://www.northbound-train.com/emacs/whole-line-or-region.el

Copies or kills with one keystroke, the default one :)

I found this via http://emacswiki.org/emacs/CopyingWholeLines
where you can find other suggestions.

I prefer the whole-line-or-region apprach.

HTH,


Guido

--
Good government never depends upon laws, but upon the personal qualities of
those who govern.  The machinery of government is always subordinate to the
will of those who administer that machinery.  The most important element of
government, therefore, is the method of choosing leaders.
		-- Frank Herbert, "Children of Dune"

http://vanhoecke.org ... and go2 places!



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

end of thread, other threads:[~2012-07-25 18:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-05 19:08 copy-line (& default keychord) Enda
2012-07-24 16:06 ` copy-line Enda
2012-07-24 17:44   ` copy-line Bastien
2012-07-25 18:47   ` copy-line Guido Van Hoecke
     [not found] ` <mailman.5498.1343146029.855.help-gnu-emacs@gnu.org>
2012-07-25 12:31   ` copy-line rfflrccrd
2012-07-25 13:41     ` copy-line Dan Espen
2012-07-25 15:02       ` copy-line Raffaele Ricciardi
2012-07-25 15:06         ` copy-line Raffaele Ricciardi
2012-07-25 13:50     ` copy-line Raffaele Ricciardi
2012-07-25 18:01 ` copy-line (& default keychord) Andreas Röhler

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.