From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Bruce Kroeze Newsgroups: gmane.emacs.bugs Subject: Re: C-k and scolding Date: Mon, 14 Apr 2003 14:04:30 -0700 Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <200304141404.30501.bruce@zefamily.org> References: <73388857A695D31197EF00508B08F2980A00EEEC@ntmsg0131.corpmail.telstra.com.au> <87znn8tdn5.fsf@pfaff.Stanford.EDU> <87u1dgjb6h.fsf@jidanni.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1050355466 13891 80.91.224.249 (14 Apr 2003 21:24:26 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 14 Apr 2003 21:24:26 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 14 23:24:24 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 195BQo-0003aG-00 for ; Mon, 14 Apr 2003 23:24:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 195BQV-0002aj-05 for gnu-bug-gnu-emacs@m.gmane.org; Mon, 14 Apr 2003 17:23:43 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 195BPl-0001fQ-00 for bug-gnu-emacs@gnu.org; Mon, 14 Apr 2003 17:22:57 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 195BOq-0000ed-00 for bug-gnu-emacs@gnu.org; Mon, 14 Apr 2003 17:22:00 -0400 Original-Received: from marshall.modwest.com ([216.129.251.30] helo=mail.modwest.com) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 195BOm-0000Y8-00 for bug-gnu-emacs@gnu.org; Mon, 14 Apr 2003 17:21:56 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.modwest.com (Postfix) with ESMTP id 1275A40F67E1; Mon, 14 Apr 2003 15:21:50 -0600 (MDT) Original-Received: from mail.modwest.com ([127.0.0.1]) by localhost 16843-07; Mon, 14 Apr 2003 15:21:49 -0000 (MDT) Original-Received: from wind.zehome (12-213-122-98.client.attbi.com [12.213.122.98]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mail.modwest.com (Postfix) with ESMTP id 8E8DD40F58DA; Mon, 14 Apr 2003 15:21:49 -0600 (MDT) Original-To: Dan Jacobson User-Agent: KMail/1.5.1 In-Reply-To: <87u1dgjb6h.fsf@jidanni.org> Content-Disposition: inline X-Virus-Scanned: by amavisd-new amavisd-new-20020630 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:4790 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:4790 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)