1

I am trying to stop emacs from expanding abbrevs after I press the return key. If I press return, I simply want to create a new line without expanding any abbrev at point.

I am relatively new at elisp. I’m assuming the answer involves pre-abbrev-expand-hook, but I haven’t found an answer in my research.

Drew
  • 75,699
  • 9
  • 109
  • 225
Faulkner77
  • 21
  • 1
  • 1
  • 5
  • 1
    Does this answer your question? [Prevent abbrev-mode from expanding on underscore](https://emacs.stackexchange.com/questions/630/prevent-abbrev-mode-from-expanding-on-underscore) – Tyler May 20 '21 at 14:28
  • @Tyler yes, I linked to that thread in the marked Answer below. Let me know if I should clarify further. – Faulkner77 May 22 '21 at 05:53
  • That's fine, no need to do anything further @Faulkner77. This question will probably end up getting closed, since it already has an answer in the linked post. That doesn't mean there's anything wrong here, just that we want to keep the site streamlined, with a single question/answer post for each issue. – Tyler May 23 '21 at 17:09

1 Answers1

1

It seems this has been addressed after all in similar post here that I found after the fact. The solution I settled on was as follows:

(defun my-self-insert-no-abbrev-RET ()
  (interactive)
  (let ((abbrev-mode nil))
    (newline nil t)))

(global-set-key (kbd "RET") #'my-self-insert-no-abbrev-RET)
Faulkner77
  • 21
  • 1
  • 1
  • 5