unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Bruce Kroeze <bruce@zefamily.org>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: C-k and scolding
Date: Mon, 14 Apr 2003 14:04:30 -0700	[thread overview]
Message-ID: <200304141404.30501.bruce@zefamily.org> (raw)
In-Reply-To: <87u1dgjb6h.fsf@jidanni.org>

On Thursday 03 April 2003 12:04 pm, Dan Jacobson wrote:
> Take the case of a single C-k.  To do this the proper way in a
> read-only buffer etc. one needs to set a mark, go the end of line, and
> hit M-w. Much more trouble than just a C-k while accepting the
> sadomasochistic beep.
>
> So there should be a way, just as easy as one or more C-k's, to do
> what C-k does (as far as adding to the kill ring), without getting
> beeped, nor without changing the file.

Here you go, a couple small functions I wrote for this very purpose:

(defun copy-line (&optional where)
  "Copy the line containing point."
  (interactive "d")
  (save-excursion
    (beginning-of-line)
    (let ((beg (point)))
      (end-of-line)
      (copy-region-as-kill beg (point)))
    (end-of-line))
    (message "copied line"))

(defun copy-to-eol (&optional where)
  "Copy to the end of the line containing point."
  (interactive "d")
  (save-excursion
    (let ((beg (point)))
      (end-of-line)
      (copy-region-as-kill beg (point)))
    (end-of-line))
    (message "copied to eol"))

;; I bind 'em to "one-step" keys, your tastes are likely different.
(define-key global-map [(alt ?c)] 'copy-line)
(define-key global-map [(alt ?k)] 'copy-to-eol)

  parent reply	other threads:[~2003-04-14 21:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <73388857A695D31197EF00508B08F2980A00EEEC@ntmsg0131.corpmail.telstra.com.au>
     [not found] ` <87znn8tdn5.fsf@pfaff.Stanford.EDU>
2003-04-03 20:04   ` C-k and scolding Dan Jacobson
2003-04-04  0:18     ` Ben Pfaff
2003-04-14 21:04     ` Bruce Kroeze [this message]
2003-04-17  1:14       ` decriminalize C-k in read-only buffers! Dan Jacobson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200304141404.30501.bruce@zefamily.org \
    --to=bruce@zefamily.org \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).