From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Ludwig, Mark" Newsgroups: gmane.emacs.help Subject: Electric punctuation replacement for editing (correcting grammar) Date: Tue, 13 Dec 2011 19:32:31 +0000 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1323804774 16412 80.91.229.12 (13 Dec 2011 19:32:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 13 Dec 2011 19:32:54 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Dec 13 20:32:51 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RaY5q-0000EY-P9 for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Dec 2011 20:32:50 +0100 Original-Received: from localhost ([::1]:55115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaY5q-0000qq-CN for geh-help-gnu-emacs@m.gmane.org; Tue, 13 Dec 2011 14:32:50 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:52694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaY5m-0000ql-1C for help-gnu-emacs@gnu.org; Tue, 13 Dec 2011 14:32:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RaY5l-0001KL-5d for help-gnu-emacs@gnu.org; Tue, 13 Dec 2011 14:32:45 -0500 Original-Received: from usslmhub002.ugs.com ([134.244.32.85]:3626 helo=ugs.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RaY5l-0001KE-0h for help-gnu-emacs@gnu.org; Tue, 13 Dec 2011 14:32:45 -0500 Original-Received: from USSLMMBX002.net.plm.eds.com (161.134.138.62) by USSLMHUB002.net.plm.eds.com (134.244.32.85) with Microsoft SMTP Server (TLS) id 14.1.323.3; Tue, 13 Dec 2011 13:32:32 -0600 Original-Received: from USSLMMBX003.net.plm.eds.com ([169.254.2.137]) by USSLMMBX002.net.plm.eds.com ([169.254.1.72]) with mapi id 14.01.0323.003; Tue, 13 Dec 2011 13:32:32 -0600 Thread-Topic: Electric punctuation replacement for editing (correcting grammar) Thread-Index: Acy5zdkB6z6qtbOPTZi1fdiYog4kbQ== Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [146.122.220.128] X-detected-operating-system: by eggs.gnu.org: Windows 2000 SP2+, XP SP1+ (seldom 98) X-Received-From: 134.244.32.85 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:83191 Archived-At: Has anyone else tried to develop a text mode sub-mode with "electric" punct= uation replacement? I use this when fixing the grammar in text. What I ha= ve handles replacement from either "direction." For example, consider the = following sentence (with a comma splice): The big horse, tired after running for so long, paused by a creek to ta= ke a drink, that was where I caught up with him. By "direction" what I mean is that I might be going through the text one se= ntence at a time (with M-e), and only after skipping a sentence, I might no= tice that I need to back up to fix something. Then I use M-b to get to the= front of a word, and type the correction. To handle that, what I have wor= ks (in the above example) when point is on the comma (",") after "drink" or= the space following it, or the "t" starting "that" that follows. In any o= f those three positions, I can type semi-colon (";") to correct the grammar= (for example), and the comma (",") gets replaced. Point is left on the "t= " starting "that." If I type period (".") instead of semi-colon, the spaci= ng increases to make a proper English sentence end. (I have to type M-c to= change the case of "that" in that case.) Changing the spacing was relatively straight-forward. More challenging is = handling parentheses, because my current approach is to use the "sentence" = infrastructure (e.g., sentence-end) to figure out the spacing. I don't kno= w how to handle situations like: I thought so (I was not sure, but suspected. This should be: I thought so (I was not sure), but suspected. I want to be able to type the closing parenthesis (")") just as I might typ= e semi-colon (";") in the above example, and have it correctly place the pa= renthesis before the comma. It also doesn't handle ending a sentence with "...." properly, because I ha= ve logic to handle ellipsis ("...") in the middle of a sentence (by normali= zing to a single space before and after the ellipsis). I'd appreciate any pointers if anyone else has done anything like this. Thanks, Mark