help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: package: iPhone behavior insert . After a word and twice space


From: Thorsten Bonow
Subject: Re: package: iPhone behavior insert . After a word and twice space
Date: Sun, 26 Nov 2017 21:27:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

>>>>> 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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]