From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: weber Newsgroups: gmane.emacs.help Subject: Re: insert text after a char depending on next char Date: 20 Apr 2007 15:11:03 -0700 Organization: http://groups.google.com Message-ID: <1177107063.893618.116400@o5g2000hsb.googlegroups.com> References: <1177092344.828314.308710@b58g2000hsg.googlegroups.com> <1177095349.796214.182690@d57g2000hsg.googlegroups.com> <1177105532.679291.45760@o5g2000hsb.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1177108627 30541 80.91.229.12 (20 Apr 2007 22:37:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 20 Apr 2007 22:37:07 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 21 00:37:01 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Hf1iu-0006Dq-Tk for geh-help-gnu-emacs@m.gmane.org; Sat, 21 Apr 2007 00:37:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Hf1o1-0004el-5c for geh-help-gnu-emacs@m.gmane.org; Fri, 20 Apr 2007 18:42:17 -0400 Original-Path: shelby.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!out01b.usenetserver.com!news.usenetserver.com!in02.usenetserver.com!news.usenetserver.com!postnews.google.com!o5g2000hsb.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 55 Original-NNTP-Posting-Host: 189.6.212.239 Original-X-Trace: posting.google.com 1177107064 28450 127.0.0.1 (20 Apr 2007 22:11:04 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 20 Apr 2007 22:11:04 +0000 (UTC) In-Reply-To: <1177105532.679291.45760@o5g2000hsb.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1) Gecko/20060601 Firefox/2.0 (Ubuntu-edgy),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: o5g2000hsb.googlegroups.com; posting-host=189.6.212.239; posting-account=pG57fA0AAADtQ-4h1MyvjXjZpSNZC0zj Original-Xref: shelby.stanford.edu gnu.emacs.help:147329 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:42933 Archived-At: On Apr 20, 6:45 pm, james wrote: > On Apr 20, 1:55 pm, weber wrote: > > > > > On 20 abr, 15:05, james wrote: > > > > On Apr 20, 9:17 am, Sebastian Meisel wrote: > > > > > Hallo, > > > > > is the following possible in emacs, and if it is how can it be done: > > > > > I want emacs to insert "\," after a dot ("."), when no space is following: > > > > > I type: "Hallo World. Hallo World." -> emacs shall not insert anything, > > > > because a space is following. > > > > I type: "Hallo World.Hallo World." -> emacs shall insert "\," after the > > > > dot resulting in: "Hallo World.\,Hallo World.". > > > > > Thanks for any hints. > > > > > Sebastian Meisel > > > > Something like this: > > > > (defun qwerty() > > > (interactive) > > > (cond ((looking-at " ") (insert ".")) > > > (t (insert ".\\,")))) > > > > (local-set-key (kbd ".") 'qwerty) > > > > Seems like the sort of thing you'd want to add more conditions to > > > At first I thought about something like that too, but you got to > > realize that when he types the '.' he still has not completed the rest > > of the sentence... > > So it seems that the correct would be: after any keypress, look back: > > if there is ". " then nothing, is there is ".H" then insert \, after > > the dot... > > > Cheers, > > weber > > (defun qwerty() > (interactive) > (insert ".") > (let ((c (read-event))) > (cond > ((eq 32 c) (insert " ")) > (t (insert (concat "\\," (make-string 1 c))))))) Cool! I had never seen that!