* Re: insert text after a char depending on next char [not found] <mailman.2312.1177079016.7795.help-gnu-emacs@gnu.org> @ 2007-04-20 18:05 ` james 2007-04-20 18:55 ` weber 0 siblings, 1 reply; 7+ messages in thread From: james @ 2007-04-20 18:05 UTC (permalink / raw) To: help-gnu-emacs On Apr 20, 9:17 am, Sebastian Meisel <sebastianmei...@web.de> 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: insert text after a char depending on next char 2007-04-20 18:05 ` insert text after a char depending on next char james @ 2007-04-20 18:55 ` weber 2007-04-20 21:45 ` james 0 siblings, 1 reply; 7+ messages in thread From: weber @ 2007-04-20 18:55 UTC (permalink / raw) To: help-gnu-emacs On 20 abr, 15:05, james <james.kings...@gmail.com> wrote: > On Apr 20, 9:17 am, Sebastian Meisel <sebastianmei...@web.de> 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: insert text after a char depending on next char 2007-04-20 18:55 ` weber @ 2007-04-20 21:45 ` james 2007-04-20 22:11 ` weber 2007-04-21 9:43 ` Sebastian Meisel 0 siblings, 2 replies; 7+ messages in thread From: james @ 2007-04-20 21:45 UTC (permalink / raw) To: help-gnu-emacs On Apr 20, 1:55 pm, weber <hug...@gmail.com> wrote: > On 20 abr, 15:05, james <james.kings...@gmail.com> wrote: > > > > > On Apr 20, 9:17 am, Sebastian Meisel <sebastianmei...@web.de> 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))))))) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: insert text after a char depending on next char 2007-04-20 21:45 ` james @ 2007-04-20 22:11 ` weber 2007-04-21 9:43 ` Sebastian Meisel 1 sibling, 0 replies; 7+ messages in thread From: weber @ 2007-04-20 22:11 UTC (permalink / raw) To: help-gnu-emacs On Apr 20, 6:45 pm, james <james.kings...@gmail.com> wrote: > On Apr 20, 1:55 pm, weber <hug...@gmail.com> wrote: > > > > > On 20 abr, 15:05, james <james.kings...@gmail.com> wrote: > > > > On Apr 20, 9:17 am, Sebastian Meisel <sebastianmei...@web.de> 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! ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: insert text after a char depending on next char 2007-04-20 21:45 ` james 2007-04-20 22:11 ` weber @ 2007-04-21 9:43 ` Sebastian Meisel 1 sibling, 0 replies; 7+ messages in thread From: Sebastian Meisel @ 2007-04-21 9:43 UTC (permalink / raw) To: Emacs Mailing List james schrieb: > On Apr 20, 1:55 pm, weber <hug...@gmail.com> wrote: > >> On 20 abr, 15:05, james <james.kings...@gmail.com> wrote: >> >> >> >> >>> On Apr 20, 9:17 am, Sebastian Meisel <sebastianmei...@web.de> 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))))))) > > There is one last thing I'm missing to make it perfect (which that solution is close to): Is there a way to handle M- and C- events so they are evaluated not by the function, but with there standard binding? ^ permalink raw reply [flat|nested] 7+ messages in thread
* insert text after a char depending on next char @ 2007-04-20 14:17 Sebastian Meisel 2007-04-20 19:01 ` Peter Dyballa 0 siblings, 1 reply; 7+ messages in thread From: Sebastian Meisel @ 2007-04-20 14:17 UTC (permalink / raw) To: help-gnu-emacs 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: insert text after a char depending on next char 2007-04-20 14:17 Sebastian Meisel @ 2007-04-20 19:01 ` Peter Dyballa 0 siblings, 0 replies; 7+ messages in thread From: Peter Dyballa @ 2007-04-20 19:01 UTC (permalink / raw) To: Sebastian Meisel; +Cc: help-gnu-emacs Am 20.04.2007 um 16:17 schrieb Sebastian Meisel: > I want emacs to insert "\," after a dot ("."), when no space is > following: M-x replace-regexp RET \.\([^ ]\) RET .\\,\1 RET -- Mit friedvollen Grüßen Pete Time is an illusion. Lunchtime, doubly so. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-04-21 9:43 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <mailman.2312.1177079016.7795.help-gnu-emacs@gnu.org> 2007-04-20 18:05 ` insert text after a char depending on next char james 2007-04-20 18:55 ` weber 2007-04-20 21:45 ` james 2007-04-20 22:11 ` weber 2007-04-21 9:43 ` Sebastian Meisel 2007-04-20 14:17 Sebastian Meisel 2007-04-20 19:01 ` Peter Dyballa
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.