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?

  • Is it possible you have modified the library so that the default behavior no longer exists: 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 -- github.com/yuutayamada/auto-capitalize-el/blob/master/… -- 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
  • 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 <kbd>C-c '</kbd> 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

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"))
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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