From: "Piotr Zielinski" <piotr.zielinski@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Safer kill-line for org-mode
Date: Sun, 27 Jan 2008 23:29:50 +0000 [thread overview]
Message-ID: <3c12eb8d0801271529w74635486r40fc839a3ef89399@mail.gmail.com> (raw)
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
next reply other threads:[~2008-01-27 23:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-27 23:29 Piotr Zielinski [this message]
2008-01-28 5:32 ` Safer kill-line for org-mode Carsten Dominik
2008-01-28 8:17 ` Detlef Steuer
2008-01-31 17:30 ` Carsten Dominik
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3c12eb8d0801271529w74635486r40fc839a3ef89399@mail.gmail.com \
--to=piotr.zielinski@gmail.com \
--cc=emacs-orgmode@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 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.