unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Thorsten Bonow <thorsten.bonow@withouthat.org>
To: help-gnu-emacs@gnu.org
Subject: Re: package: iPhone behavior insert . After a word and twice space
Date: Sun, 26 Nov 2017 21:27:59 +0100	[thread overview]
Message-ID: <87fu90aipc.fsf@withouthat.org> (raw)
In-Reply-To: mailman.4600.1511724569.27995.help-gnu-emacs@gnu.org

>>>>> Uwe Brauer <oub@mat.ucm.es> writes:

>>>> "Uwe" == Uwe Brauer <oub@mat.ucm.es> writes:
> https://emacs.stackexchange.com/questions/3941/when-typing-automatically-transform-spc-spc-into-period-spc-spc

> (defun freaky-space () (interactive) (cond ((looking-back "\\(?:^\\|\\.\\)
> +") (insert " ")) ((eq this-command last-command) (backward-delete-char 1)
> (insert ".  "))  (t (insert " "))))

> (define-key text-mode-map " " 'freaky-space)

> Not bad.

Nice.  But this solution only works in text modes.  I think it might be
confusing after getting used to and relying on it, e.g. if you don't have this
feature when writing a comment in some programming language.  And when your
sentence already has a dot, typing two spaces adds another one.

But I guess the last problem can be solved by modifying the regexp.
'paragraphs.el' (included in GNU Emacs) has `sentence-end', which returns the
regexp describing the end of a sentence.  Maybe start from there.

Toto



-- 
"It's amazing how I can feel sorry for you and hate you at the same
time. I'm sure there is a German word for it."  Lisa Simpson, season
22 episode 7: How Munched Is That Birdie in the Window?


  parent reply	other threads:[~2017-11-26 20:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-26 15:22 package: iPhone behavior insert . After a word and twice space Uwe Brauer
2017-11-26 19:29 ` Uwe Brauer
     [not found] ` <mailman.4600.1511724569.27995.help-gnu-emacs@gnu.org>
2017-11-26 20:27   ` Thorsten Bonow [this message]
2017-11-26 20:53     ` Uwe Brauer
2017-11-26 21:28     ` Hi-Angel
2017-11-26 23:21       ` Emanuel Berg
2017-11-27  4:56         ` Hi-Angel
2017-11-28 20:36           ` Emanuel Berg
2017-11-26 22:06 ` Emanuel Berg
     [not found] <mailman.4578.1511709783.27995.help-gnu-emacs@gnu.org>
2017-11-26 18:53 ` Thorsten Bonow
2017-11-26 20:57   ` Uwe Brauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fu90aipc.fsf@withouthat.org \
    --to=thorsten.bonow@withouthat.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).