10

Q: What practical reasons are there not to set sentence-end-double-space to nil?

A recently-revived thread on recognizing sentences that don't end in two spaces inspired this question.

The Emacs manual node on sentences notes that the sentence commands assume that we use the American typist's convention of putting two spaces at the end of a sentence (as opposed to, say, the French convention of one space). Arguments for/against the two-space convention apparently gets pretty polemical (eg, this Slate piece).

I don't particularly care about looks insofar as I let LaTeX handle my type-setting, but the two-space convention is pounded into muscle memory. However, when I paste text into an Emacs buffer from other sources (webpages, etc.), it's almost always in the one-space convention. That's kind of annoying in a how-dare-they-differ-from-me sort of way, and I'm tempted to set sentence-end-double-space to nil to Deal With Reality. I never have, however, because I've always assumed that Something Will Break if I did so. I just don't have any firm basis for that assumption.

So: are there any practical consequences in terms of loss of functionality for setting sentence-end-double-space to nil? The only significant change I can think of is that the fill functions will change the two-space convention into the one-space convention.

2
  • 3
    Love this question, I completely understand what you feel...
    – mbork
    Oct 28, 2014 at 21:03
  • Even the Slate article that you cite argues that in monospaced type a double-space convention may help to identify the ending of sentences.
    – alexurba
    Oct 28, 2014 at 23:47

2 Answers 2

10

The only consequence I'm seeing, is the ability to recognize periods from abbreviations.

As stated by gnu.org:

If you want to use just one space between sentences, you can set the variable sentence-end-double-space to nil to make the sentence commands stop for single spaces. However, this has a drawback: there is no way to distinguish between periods that end sentences and those that indicate abbreviations.

For convenient and reliable editing, we therefore recommend you follow the two-space convention. The variable sentence-end-double-space also affects filling.

I've never used the two-space convention, I think, it depends on how/what you are editing.

3

This is not really an answer to the question as stated ("what do I lose if I set sentence-end-double-space to nil"), but rather something like the third way;-). (Also, it is a (partial) copy from a post I've just written on my blog; if this is inappropriate, someone please delete this, but I hope this might be helpful.)

So, basically, why do you want to lose anything by setting something against your liking? This is Emacs, after all!

(defvar sentence-end-double-space-threshold 2
  "How many occurrences of \".  \" per kilobyte should be enough
  to declare this file as using two spaces after sentences.")

(defun set-sentence-end-double-space ()
  "Set `sentence-end-double-space' according to how often the
  literal string \".  \" occurs in the current buffer."
  (make-local-variable 'sentence-end-double-space)
  (if (>= (* (count-matches "\\.  ") 1024)
      (* (buffer-size) sentence-end-double-space-threshold))
      (setq sentence-end-double-space t)
    (setq sentence-end-double-space nil)))

(add-hook 'find-file-hook 'set-sentence-end-double-space)     

Now when you open a file, Emacs decides (using the very conservative value of sentence-end-double-space-threshold, which you can setq to whatever you feel right) which style it is. (Obviously, this does not help in case of pasting from the browser or whatever. It could be done, advising yank and – if needed – replacing spaces in the yanked text as necessary, but hey, I only had 15 minutes for that!)

PS. Of course, it does not take into account periods at EOLs etc.; but again, the threshold is very low.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.