capitalize-word and downcase-word are godsends. Like many other
commands, they've spoiled me to the point that I can no longer write
prose without Emacs. There's just one peeve that bothers me quite often.
Let's say I want to join the following two sentences, and point is at the “B”.
Languages are fleeting. But Emacs is forever.
You could do DEL DEL , M-l, but that's so long! When I
downcase the word “But”, it's perfectly obvious that I'll want to get rid of
that full stop, so why can't M-l do that for me?
(global-set-key"\M-c"'endless/capitalize)(global-set-key"\M-l"'endless/downcase)(global-set-key"\M-u"'endless/upcase)(defunendless/convert-punctuation(rgrp)"Look for regexp RG around point, and replace with RP.
Only applies to text-mode."(let((f"\\(%s\\)\\(%s\\)")(space"?:[[:blank:]\n\r]*"));; We obviously don't want to do this in prog-mode.(if(and(derived-mode-p'text-mode)(or(looking-at(formatfspacerg))(looking-back(formatfrgspace))))(replace-matchrpnilnilnil1))))(defunendless/capitalize()"Capitalize region or word.
Also converts commas to full stops, and kills
extraneous space at beginning of line."(interactive)(endless/convert-punctuation","".")(if(use-region-p)(call-interactively'capitalize-region);; A single space at the start of a line:(when(looking-at"^\\s-\\b");; get rid of it!(delete-char1))(call-interactively'subword-capitalize)))(defunendless/downcase()"Downcase region or word.
Also converts full stops to commas."(interactive)(endless/convert-punctuation"\\."",")(if(use-region-p)(call-interactively'downcase-region)(call-interactively'subword-downcase)))(defunendless/upcase()"Upcase region or word."(interactive)(if(use-region-p)(call-interactively'upcase-region)(call-interactively'subword-upcase)))
The snippet above will automatically convert between commas and full-stops when
you're (un)capitalizing prose. It comes up on every single writing session for
me.
Super Smart Capitalization
03 Nov 2014, by Artur Malabarba.capitalize-word
anddowncase-word
are godsends. Like many other commands, they've spoiled me to the point that I can no longer write prose without Emacs. There's just one peeve that bothers me quite often.Let's say I want to join the following two sentences, and point is at the “B”.
You could do DEL DEL , M-l, but that's so long! When I
downcase
the word “But”, it's perfectly obvious that I'll want to get rid of that full stop, so why can't M-l do that for me?The snippet above will automatically convert between commas and full-stops when you're (un)capitalizing prose. It comes up on every single writing session for me.
Now I can just hit M-l and get
Tags: writing, optimization, init.el, emacs,
Get in the habit of using sharp quote »
« Big things to expect from Emacs 25
Related Posts
A few paredit keys that take over the world in writing
An improvement to Emacs auto-correct in writing
Fixing DOuble CApitals as you type in writing
Content © 2019, All rights reserved. Icons under CC3.0.