0

What is the key sequence for deleting from the current position to the beginning of the buffer?

I ask not because I want to use the sequence but to prevent it from happening. I always do this by mistake, often when I'm working too fast, and I don't realize it until later. It happens only maybe four times per year, but sometimes, if I don't realize it soon enough, it can be devastating.

I could disable the function or sequence if I only knew what it was.

Maybe I'll have to turn on some sort of keystroke log to find out exactly how I make this mistake?

I've noticed that the problem occurs when I'm in text-mode. I'm using EMACS 24.3.1 on Windows 10, in case that's relevant.

1
  • 5
    Try <f1> l (or M-x view-lossage) to see latest keystrokes
    – npostavs
    Mar 2, 2016 at 17:17

1 Answer 1

3

It is possible that that you're calling kill-region which is bound to C-w. This is what one would consider the cut command in other applications. If the region is not active it will kill from your point to where the last mark was, which could possibly be the beginning of the buffer.

The command view-lossage (bound to C-h l or <f1> l) displays the last 300 input keystrokes.

7
  • Thanks Jules. Well, C-w (kill-region) is bread-and-butter so I won't be disabling that, but I didn't know that its default behavior was as you described when a mark is not active. Case closed.
    – tom
    Mar 2, 2016 at 18:17
  • Glad to help. If this answer solved your problem feel free to mark it as accepted to let others know that this case is closed. Thanks!
    – Jules
    Mar 2, 2016 at 18:21
  • 3
    @tom You can use (defadvice kill-region (around only-active-region activate) (if (use-region-p) ad-do-it (message "Region not active"))) to avoid this behavior. With this advice region is killed only if it is active and non-empty.
    – Tobias
    Mar 2, 2016 at 20:26
  • God, even better. I'll give it a try.
    – tom
    Mar 3, 2016 at 18:22
  • Well, that works, but it also disables kill-line, C-k. If I find a way to fix that I'll post it.
    – tom
    Mar 4, 2016 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.