From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.help Subject: Re: backward-delete-char-untabify-method Date: 08 Jun 2003 16:46:15 -0400 Organization: Yale University Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <5lbrx8e1rc.fsf@rum.cs.yale.edu> References: <20030608190540.21c4890c.devnull@example.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1055106260 23935 80.91.224.249 (8 Jun 2003 21:04:20 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 8 Jun 2003 21:04:20 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Sun Jun 08 23:04:19 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19P7Ks-0006Ds-00 for ; Sun, 08 Jun 2003 23:04:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19P7M8-0005cn-EF for gnu-help-gnu-emacs@m.gmane.org; Sun, 08 Jun 2003 17:05:36 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!canoe.uoregon.edu!news.wss.yale.edu!rum.cs.yale.edu!rum.cs.yale.edu Original-Newsgroups: gnu.emacs.help Original-Lines: 41 Original-NNTP-Posting-Host: rum.cs.yale.edu Original-X-Trace: news.wss.yale.edu 1055105183 18262 128.36.229.169 (8 Jun 2003 20:46:23 GMT) Original-X-Complaints-To: news@news.wss.yale.edu Original-NNTP-Posting-Date: Sun, 8 Jun 2003 20:46:23 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-Original-NNTP-Posting-Host: rum.cs.yale.edu X-Original-Trace: 8 Jun 2003 16:46:15 -0400, rum.cs.yale.edu Original-Xref: shelby.stanford.edu gnu.emacs.help:114299 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:10793 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:10793 > 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