* Re: package: iPhone behavior insert . After a word and twice space
[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
0 siblings, 1 reply; 11+ messages in thread
From: Thorsten Bonow @ 2017-11-26 18:53 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> Uwe Brauer <oub@mat.ucm.es> writes:
> Mi iphone has the nice feature that if I press space quickly twice after a
> word it inserts a . Since it is considered as a end of sentence.
> Does anybody now about a Emacs package providing this functionality?
Hi,
one solution would be "key chord" from EmacsWiki[1]. Quick and dirty:
(require 'key-chord "/usr/local/share/emacs/site-lisp/key-chord.el")
(key-chord-mode 1)
(defun my-insert-dot ()
"Insert \".\" at point, moving point forward"
(interactive)
(insert "."))
(key-chord-define-global (kbd "SPC SPC") 'my-insert-dot)
There is a discussion on the page about a 'small hack to define a key-chord
starting with space'.
The Vi emulation package for GNU Emacs 'Viper' has 'timeout macros' that make
binding a key pressed twice to a macro possible. My guess is that the Vim
emulation package "Evil"[2] must offer something similar.
I'm using 'viper' but only 'key-chord' for combinations of key-strokes. Works
for me.
Hope this helps.
Toto
Footnotes:
[1] https://www.emacswiki.org/emacs/KeyChord
[2] https://github.com/emacs-evil/evil
--
"A Korean newspaper wrote that Aachen University is the MIT of Europe."
Burkhard Rauhut / "Anything that's the something of something isn't
really the anything of anything." Lisa Simpson
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: package: iPhone behavior insert . After a word and twice space
2017-11-26 18:53 ` package: iPhone behavior insert . After a word and twice space Thorsten Bonow
@ 2017-11-26 20:57 ` Uwe Brauer
0 siblings, 0 replies; 11+ messages in thread
From: Uwe Brauer @ 2017-11-26 20:57 UTC (permalink / raw)
To: help-gnu-emacs
>>> "Thorsten" == Thorsten Bonow <thorsten.bonow@withouthat.org> writes:
>>>>>> Uwe Brauer <oub@mat.ucm.es> writes:
>> Mi iphone has the nice feature that if I press space quickly twice after a
>> word it inserts a . Since it is considered as a end of sentence.
>> Does anybody now about a Emacs package providing this functionality?
> Hi,
> one solution would be "key chord" from EmacsWiki[1]. Quick and dirty:
> (require 'key-chord "/usr/local/share/emacs/site-lisp/key-chord.el")
> (key-chord-mode 1)
> (defun my-insert-dot ()
> "Insert \".\" at point, moving point forward"
> (interactive)
> (insert "."))
> (key-chord-define-global (kbd "SPC SPC") 'my-insert-dot)
Thanks just checked, for me this is slower and less comfortable but
maybe more stable than the other solution I posted. I will play around
with both.
^ permalink raw reply [flat|nested] 11+ messages in thread
* package: iPhone behavior insert . After a word and twice space
@ 2017-11-26 15:22 Uwe Brauer
2017-11-26 19:29 ` Uwe Brauer
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Uwe Brauer @ 2017-11-26 15:22 UTC (permalink / raw)
To: help-gnu-emacs
Hi
Mi iphone has the nice feature that if I press space quickly twice
after a word it inserts a . Since it is considered as a end of
sentence.
Does anybody now about a Emacs package providing this
functionality?
Thanks
Uwe Brauer
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: package: iPhone behavior insert . After a word and twice space
2017-11-26 15:22 Uwe Brauer
@ 2017-11-26 19:29 ` Uwe Brauer
[not found] ` <mailman.4600.1511724569.27995.help-gnu-emacs@gnu.org>
2017-11-26 22:06 ` Emanuel Berg
2 siblings, 0 replies; 11+ messages in thread
From: Uwe Brauer @ 2017-11-26 19:29 UTC (permalink / raw)
To: help-gnu-emacs
>>> "Uwe" == Uwe Brauer <oub@mat.ucm.es> writes:
> Hi
> Mi iphone has the nice feature that if I press space quickly
> twice after a word it inserts a . Since it is considered as a
> end of sentence.
> Does anybody now about a Emacs package providing this
> functionality?
I found this:
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.
^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <mailman.4600.1511724569.27995.help-gnu-emacs@gnu.org>]
* Re: package: iPhone behavior insert . After a word and twice space
[not found] ` <mailman.4600.1511724569.27995.help-gnu-emacs@gnu.org>
@ 2017-11-26 20:27 ` Thorsten Bonow
2017-11-26 20:53 ` Uwe Brauer
2017-11-26 21:28 ` Hi-Angel
0 siblings, 2 replies; 11+ messages in thread
From: Thorsten Bonow @ 2017-11-26 20:27 UTC (permalink / raw)
To: help-gnu-emacs
>>>>> 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?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: package: iPhone behavior insert . After a word and twice space
2017-11-26 20:27 ` Thorsten Bonow
@ 2017-11-26 20:53 ` Uwe Brauer
2017-11-26 21:28 ` Hi-Angel
1 sibling, 0 replies; 11+ messages in thread
From: Uwe Brauer @ 2017-11-26 20:53 UTC (permalink / raw)
To: help-gnu-emacs
>>> "Thorsten" == Thorsten Bonow <thorsten.bonow@withouthat.org>
>>> writes:
>>>>>> 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.
Well I just bound it globally and it worked, I wrote a trivial function
which toogle on and of this key setting and it works even in lisp mode.
> 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.
Right first I check your other solution
> Toto
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: package: iPhone behavior insert . After a word and twice space
2017-11-26 20:27 ` Thorsten Bonow
2017-11-26 20:53 ` Uwe Brauer
@ 2017-11-26 21:28 ` Hi-Angel
2017-11-26 23:21 ` Emanuel Berg
1 sibling, 1 reply; 11+ messages in thread
From: Hi-Angel @ 2017-11-26 21:28 UTC (permalink / raw)
To: Thorsten Bonow; +Cc: help-gnu-emacs
On 26 November 2017 at 23:27, Thorsten Bonow
<thorsten.bonow@withouthat.org> wrote:
>>>>>> 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.
Yeah, I think the proper solution would be to make it working rather
in an IM, e.g. ibus or fcitx, or whatever. This way it would work not
only in Emacs, but for every application in the system. I don't have
any tips for how to do it though.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: package: iPhone behavior insert . After a word and twice space
2017-11-26 21:28 ` Hi-Angel
@ 2017-11-26 23:21 ` Emanuel Berg
2017-11-27 4:56 ` Hi-Angel
0 siblings, 1 reply; 11+ messages in thread
From: Emanuel Berg @ 2017-11-26 23:21 UTC (permalink / raw)
To: help-gnu-emacs
Hi-Angel wrote:
> Yeah, I think the proper solution would be to
> make it working rather in an IM, e.g. ibus or
> fcitx, or whatever.
Not necessarily! To implement this in Emacs
only is as much a proper solution.
First, it happens that people move their work
to Emacs one application at a time until they
basically use Emacs all day long. This is
natural since they become more comfortable and
discover mor and more of it.
Second, it isn't wrong to implement the same
behavior at different places. Sometimes it
isn't possible to do it system-wide and
sometimes, even tho it is possible in theory,
doing it at two places is much simpler and
a quick, well-known fix.
An example is precisely the keys. I know how to
set them up in Emacs, the Linux VTs (ttys or
the console), and in X, and way back, tho
I have forgot how I did it, I managed to get
Emacs-like cursor movement in zsh.
But how do I set them up at one place so they
act the same way everywhere? And is that
even desirable?
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: package: iPhone behavior insert . After a word and twice space
2017-11-26 23:21 ` Emanuel Berg
@ 2017-11-27 4:56 ` Hi-Angel
2017-11-28 20:36 ` Emanuel Berg
0 siblings, 1 reply; 11+ messages in thread
From: Hi-Angel @ 2017-11-27 4:56 UTC (permalink / raw)
To: help-gnu-emacs
On 27 November 2017 at 02:21, Emanuel Berg <moasen@zoho.com> wrote:
> Hi-Angel wrote:
>
>> Yeah, I think the proper solution would be to
>> make it working rather in an IM, e.g. ibus or
>> fcitx, or whatever.
>
> Not necessarily! To implement this in Emacs
> only is as much a proper solution.
>
> First, it happens that people move their work
> to Emacs one application at a time until they
> basically use Emacs all day long. This is
> natural since they become more comfortable and
> discover mor and more of it.
You're right. But not everyone can move everything to Emacs. There are
specialized
applications; and sometimes it's just not worth the effort. E.g. I am
using a mail
client application — I do not spend much time there, whereas proper
Emacs-solution
would require lots of time to make sure of proper html-rendering. Claws-mail
e.g. can't — and it is a pure mail-client app. For typing mails I
usually just use
external editor.
> An example is precisely the keys. I know how to
> set them up in Emacs, the Linux VTs (ttys or
> the console), and in X, and way back, tho
> I have forgot how I did it, I managed to get
> Emacs-like cursor movement in zsh.
Yeah, in fact readline library is using those keys. Just install
oh-my-zsh — they have
them configured by default.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: package: iPhone behavior insert . After a word and twice space
2017-11-27 4:56 ` Hi-Angel
@ 2017-11-28 20:36 ` Emanuel Berg
0 siblings, 0 replies; 11+ messages in thread
From: Emanuel Berg @ 2017-11-28 20:36 UTC (permalink / raw)
To: help-gnu-emacs
Hi-Angel wrote:
> You're right. But not everyone can move
> everything to Emacs. There are specialized
> applications; and sometimes it's just not
> worth the effort. E.g. I am using a mail
> client application — I do not spend much time
> there, whereas proper Emacs-solution would
> require lots of time to make sure of proper
> html-rendering.
I'm confident Gnus can do it. It even has
a setting so you can pick and choose what
renderer (or browser) you'd want for the job.
But HTML and mail is a bad combination anyway.
Here is what I do:
(setq gnus-inhibit-images t)
(setq mm-discouraged-alternatives '("text/html" "text/richtext"))
(setq mm-text-html-renderer #'w3m)
Perhaps the second line is all you/I need...?
And even more broadly, mail (and news) is
something Emacs has better than anyone else so
it is a poor example why people shouldn't move
their activities to Emacs...
> Yeah, in fact readline library is using those
> keys. Just install oh-my-zsh — they have them
> configured by default.
I don't need to - I already have it :)
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: package: iPhone behavior insert . After a word and twice space
2017-11-26 15:22 Uwe Brauer
2017-11-26 19:29 ` Uwe Brauer
[not found] ` <mailman.4600.1511724569.27995.help-gnu-emacs@gnu.org>
@ 2017-11-26 22:06 ` Emanuel Berg
2 siblings, 0 replies; 11+ messages in thread
From: Emanuel Berg @ 2017-11-26 22:06 UTC (permalink / raw)
To: help-gnu-emacs
Uwe Brauer wrote:
> Mi iphone has the nice feature [...] Does
> anybody now about a Emacs package providing
> this functionality?
Now the cooked pork is fried...
--
underground experts united
http://user.it.uu.se/~embe8573
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-11-28 20:36 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.4578.1511709783.27995.help-gnu-emacs@gnu.org>
2017-11-26 18:53 ` package: iPhone behavior insert . After a word and twice space Thorsten Bonow
2017-11-26 20:57 ` Uwe Brauer
2017-11-26 15:22 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
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
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).