[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: backward-delete-char-untabify-method
From: |
Stefan Monnier |
Subject: |
Re: backward-delete-char-untabify-method |
Date: |
08 Jun 2003 16:46:15 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
> line 1
> line 2
> line 3
> A
> when the cursor is at `A', if i press BACKSPACE, the cursor will go to
> the beginning of the line, but i would prefer it to go to the same
> indentation as "line 3", another BACKSPACE bringing me to "line 2" and
> requiring a third to bring me to the beginning of the line. i.e. I would
> prefer a `delete back one level of indentation' option.
Sounds like a cool idea.
> could somebody please tell me if is this possible?
Is that a troll ?
> and how to set it up (or where to look)?
I think you'll have to make it from scratch (and a few other ingredients).
(defun sam-backspace ()
"Delete space backward to prev level of indentation."
(interactive)
(if (or (bolp) (save-excursion (skip-chars-backward " \t") (not (bolp))))
;; If we're not inside indentation, behave as usual.
(call-interactively 'backward-delete-char-untabify)
;; We're inside indentation.
(let* ((col (current-column))
(destcol
(save-excursion
;; Skip previous lines that are more indented than us.
(while (and (not (bobp))
(zerop (forward-line -1))
(skip-chars-forward " \t")
(>= (current-column) col)))
(current-column))))
(delete-region (point) (progn (move-to-column destcol) (point))))))
-- Stefan
- backward-delete-char-untabify-method, Sam Halliday, 2003/06/08
- Re: backward-delete-char-untabify-method, Kai Großjohann, 2003/06/08
- Re: backward-delete-char-untabify-method,
Stefan Monnier <=
- Re: backward-delete-char-untabify-method, Sam Halliday, 2003/06/08
- Re: backward-delete-char-untabify-method, Sam Halliday, 2003/06/08
- Re: backward-delete-char-untabify-method, Stefan Monnier, 2003/06/08
- Re: backward-delete-char-untabify-method, Sam Halliday, 2003/06/08
- Re: backward-delete-char-untabify-method, Kai Großjohann, 2003/06/09
- Re: backward-delete-char-untabify-method, Sam Halliday, 2003/06/09
- Re: backward-delete-char-untabify-method, Kai Großjohann, 2003/06/09