[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hungry-delete

From: Andreas Röhler
Subject: Re: hungry-delete
Date: Mon, 04 Apr 2011 20:54:45 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; de; rv: Gecko/20110303 Thunderbird/3.1.9

Am 04.04.2011 20:20, schrieb Sam Steingold:
* Andreas Röhler<address@hidden>  [2011-04-04 19:19:52 +0200]:


"I really love the hungry-delete feature of Emacs'
c-mode. It would be great to have hungry-delete for
python-mode as well."

DEL (translated from<backspace>) runs the command
backward-delete-char-untabify, which is an interactive compiled Lisp
function in `simple.el'.

It is bound to DEL.

(backward-delete-char-untabify ARG&optional KILLP)

Delete characters backward, changing tabs into spaces.
The exact behavior depends on `backward-delete-char-untabify-method'.
Delete ARG chars, and kill (save in kill ring) if KILLP is non-nil.
Interactively, ARG is the prefix arg (default 1)
and KILLP is t if a prefix arg was specified.

backward-delete-char-untabify-method is a variable defined in `simple.el'.
Its value is all
Original value was untabify

The method for untabifying when deleting backward.
Can be `untabify' -- turn a tab to many spaces, then delete one space;
        `hungry' -- delete all whitespace, both tabs and spaces;
        `all' -- delete all whitespace, including tabs, spaces and newlines;
        nil -- just delete one character.

You can customize this variable.

This variable was introduced, or its default value was changed, in
version 20.3 of Emacs.


thanks for the hint.
However don't think customizing DEL does it.
In most cases you will use DEL as `untabify'.

"Hungry" eates a lot - that's is fine, but not as taking the common DEL.

Therefore think a seperate key for hungry-delete is needed.

However, seems it must not be copied from the scratch.
What about such a thing:

(defun hunry-delete  (&optional killp)
  "Delete characters backward, changing tabs into spaces.

Kill (save in kill ring) if KILLP is non-nil.
  (interactive "P")
  (let ((backward-delete-char-untabify-method 'all))
    (backward-delete-char-untabify 1 killp)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]