From mboxrd@z Thu Jan 1 00:00:00 1970 From: Detlef Steuer Subject: Re: Safer kill-line for org-mode Date: Mon, 28 Jan 2008 09:17:07 +0100 Message-ID: <20080128091707.7728f6b3@renner> References: <3c12eb8d0801271529w74635486r40fc839a3ef89399@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJPMb-0006d7-Oi for emacs-orgmode@gnu.org; Mon, 28 Jan 2008 03:29:09 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJPMa-0006cT-IB for emacs-orgmode@gnu.org; Mon, 28 Jan 2008 03:29:09 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJPMa-0006c6-Ad for emacs-orgmode@gnu.org; Mon, 28 Jan 2008 03:29:08 -0500 Received: from mx20.gnu.org ([199.232.41.8]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JJPMZ-0005Cv-Ek for emacs-orgmode@gnu.org; Mon, 28 Jan 2008 03:29:07 -0500 Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJPBA-00054u-5b for emacs-orgmode@gnu.org; Mon, 28 Jan 2008 03:17:20 -0500 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1JJPB5-0001UZ-9t for emacs-orgmode@gnu.org; Mon, 28 Jan 2008 08:17:15 +0000 Received: from gaia.unibw-hamburg.de ([139.11.181.103]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Jan 2008 08:17:15 +0000 Received: from steuer by gaia.unibw-hamburg.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Jan 2008 08:17:15 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org On Sun, 27 Jan 2008 23:29:50 +0000 "Piotr Zielinski" wrote: > Hi, > > Read this to avoid losing your work. > > Standard kill-line deletes all text from the point to the end of the > _visible_ line. It happened to me a few times that I pressed C-k to > delete a few final words of a headline, but instead the whole > (invisible) subtree was deleted. This kind of mistake is costly Yeah. Felt the pain this weekend! Looks like a great addition. Thx Detlef > because it may go unnoticed for weeks, when you start wondering what > happened to a sizeable part of your org file and have to go through > rather old backups. Below is what I believe to be a safer version of > kill-line: it deletes text only to the end of the real line, unless > used at the beginning of the line, in which case it behaves as the > standard kill-line. I haven't tested much yet, but it seems to be > working ok. > > (defun kill-line-safe () > (interactive) > (if (bolp) > (kill-line) > (kill-region (point) (point-at-eol)))) > > (define-key global-map "\C-k" 'kill-line-safe) > > Piotr > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode >