1

I use org-mode, with auto-capitalize-mode turned on.

But sometimes, within org-mode, I want to type out some lisp, highlight it, and execute it.

I might type something like

(setq org-cycle-emulate-tab)

Auto-capitalize automatically capitalizes setq to Setq.

I don't feel like switching modes to emacs-lisp-mode or disabling auto-capitalize-mode. I just want it to recognize that I never want the word setq capitalized.

How can I disable autocapitalization for certain specific words?

tinlyx
  • 1,276
  • 1
  • 12
  • 27
incandescentman
  • 4,111
  • 16
  • 53
  • Is it possible you have modified the library so that the default behavior no longer exists: http://stackoverflow.com/a/26590746/2112489 – lawlist Oct 27 '15 at 17:28
  • I think that modification is a list of words for which the NEXT word should not be capitalized, e.g. the word AFTER "e.g." should never be capitalized. But I want a list of words that should THEMSELVES never be capitalized. – incandescentman Oct 27 '15 at 17:47
  • 1
    Lines 61 to 63 of the comments in the source code -- https://github.com/yuutayamada/auto-capitalize-el/blob/master/auto-capitalize.el -- state: "**To prevent a word from ever being capitalized or upcased (e.g. "http"), simply add it (in lowercase) to the `auto-capitalize-words' list.**" – lawlist Oct 27 '15 at 18:04
  • So like this? `(setq auto-capitalize-words '("I" "setq"))` – incandescentman Oct 27 '15 at 18:19
  • Yes, that is my understanding based on a brief look at the source-code; however, I've never actually used that library -- so give it a try and see what happens. If it doesn't work, consider temporarily removing your other customizations of that particular library to see if a conflict exists. The comments in the source-code also discuss making exceptions in a particular context (if that feature interests you) and there is a guide of how to accomplish that goal. – lawlist Oct 27 '15 at 18:31
  • It works. The other modification you refer to was to auto-capitalize-predicate, not auto-capitalize-words, which I had not customized. – incandescentman Oct 27 '15 at 18:45
  • 1
    I answered with eval-expression ( M-: ) but the OP said " another reason I often type setq in an org-mode environment is to change my config. I keep my Emacs config in org-mode files, inside source code blocks. I can do C-c ' to enter the source code block, but sometimes I just want to quickly type in a setting without entering the block." – Brian C. Oct 28 '15 at 17:29

1 Answers1

2

The doc-string for the variable auto-capitalize-words states as follows: "If non-nil, a list of proper nouns or acronyms. If 'auto-capitalize' mode is on, these words will be automatically capitalized or upcased as listed (mixed case is allowable as well), even in the middle of a sentence. A lowercase word will not have its casemodified." [Admittedly, the comments in the source-code, infra, are more concise than the doc-string itself.]

Lines 61 to 63 of the source-code -- https://github.com/yuutayamada/auto-capitalize-el/blob/master/auto-capitalize.el -- contain comments that state: "To prevent a word from ever being capitalized or upcased (e.g. "http"), simply add it (in lowercase) to the 'auto-capitalize-words' list."

The original poster has confirmed (in the comments underneath the original question) that the following setting resolves his issue:

(setq auto-capitalize-words '("I" "setq"))
lawlist
  • 18,826
  • 5
  • 37
  • 118
  • This works for lowercase words like `setq` but it doesn't respect mixed-case words like `iPhone`. How do I add the word "iPhone" to `auto-capitalize-words` so that auto-capitalize-mode respects its case? – incandescentman Oct 27 '15 at 20:13