From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Safer kill-line for org-mode Date: Mon, 28 Jan 2008 06:32:38 +0100 Message-ID: <24C402A1-D927-4C68-B9C1-26669325691B@science.uva.nl> References: <3c12eb8d0801271529w74635486r40fc839a3ef89399@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v915) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JJMbv-0000Vh-2r for emacs-orgmode@gnu.org; Mon, 28 Jan 2008 00:32:47 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JJMbt-0000VV-9A for emacs-orgmode@gnu.org; Mon, 28 Jan 2008 00:32:45 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JJMbt-0000VS-31 for emacs-orgmode@gnu.org; Mon, 28 Jan 2008 00:32:45 -0500 Received: from ug-out-1314.google.com ([66.249.92.174]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JJMbt-0001tx-8D for emacs-orgmode@gnu.org; Mon, 28 Jan 2008 00:32:45 -0500 Received: by ug-out-1314.google.com with SMTP id a2so966915ugf.48 for ; Sun, 27 Jan 2008 21:32:43 -0800 (PST) In-Reply-To: <3c12eb8d0801271529w74635486r40fc839a3ef89399@mail.gmail.com> 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: Piotr Zielinski Cc: emacs-orgmode@gnu.org Hi Piotr, I do like that a lot. An extension might be to even keep the tags in headlines. - Carsten On Jan 28, 2008, at 12:29 AM, 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 > 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