I use org-mode to write an executable paper, combining text and code. I make use of abbrev-mode to insert text more efficiently (e.g. type 'bc' to insert 'because') and to correct spelling errors. Is there any way to switch off abbrev-mode in the source blocks to prevent it expanding my variables?

I did run into this post, but don't see how to use that for my problem. Any help would be appreciated.

1 Answer 1


One way might be like this, where expansion only occurs conditionally. Put this statement in an init file, or in an org-mode hook function and you should not get expansion in src-blocks.

(setq abbrev-expand-function (lambda ()
                   (unless (org-in-src-block-p)

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.