From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Dan Jacobson Newsgroups: gmane.emacs.bugs Subject: Re: why not allow an argument to just-one-space? Date: Thu, 13 Jan 2005 07:29:48 +0800 Message-ID: <87mzvei5ub.fsf@jidanni.org> References: <87u1d9n60f.fsf@jidanni.org> <87brbzqvr8.fsf@jidanni.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1105738095 27649 80.91.229.6 (14 Jan 2005 21:28:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 14 Jan 2005 21:28:15 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 14 22:28:03 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CpYzD-0008Qe-00 for ; Fri, 14 Jan 2005 22:28:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CpZAv-0006pT-RT for geb-bug-gnu-emacs@m.gmane.org; Fri, 14 Jan 2005 16:40:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CpZA5-0006Qh-2s for bug-gnu-emacs@gnu.org; Fri, 14 Jan 2005 16:39:17 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CpZA1-0006OO-Hx for bug-gnu-emacs@gnu.org; Fri, 14 Jan 2005 16:39:13 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CpZA1-0006Na-0o for bug-gnu-emacs@gnu.org; Fri, 14 Jan 2005 16:39:13 -0500 Original-Received: from [204.74.68.40] (helo=frodo.hserus.net) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CpYv0-0000iV-Sk for bug-gnu-emacs@gnu.org; Fri, 14 Jan 2005 16:23:43 -0500 Original-Received: from tc218-187-77-169.2-4.dynamic.apol.com.tw ([218.187.77.169]:35735 helo=jidanni1) by frodo.hserus.net with esmtpsa (Cipher TLSv1:RC4-SHA:128) (Exim 4.43 #1) id 1CpYus-000CCZ-Li by authid with plain for ; Sat, 15 Jan 2005 02:53:35 +0530 Original-To: bug-gnu-emacs@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:10436 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:10436 OK >>>>> "rms" == Richard Stallman writes: rms> Does this do the job well? rms> (defun just-one-space (n) rms> "Delete all spaces and tabs around point, leaving one space (or N spaces)." rms> (interactive "*p") rms> (let ((orig-pos (point))) rms> (skip-chars-backward " \t") rms> (constrain-to-field nil orig-pos) rms> (dotimes (i n) rms> (if (= (following-char) ?\ ) rms> (forward-char 1) rms> (insert ?\ ))) rms> (delete-region rms> (point) rms> (progn rms> (skip-chars-forward " \t") rms> (constrain-to-field nil orig-pos t)))))