Emacs - Things I should have known #2

Posted on September 16, 2025

Run eval-expression

I don’t know about you, but my usula process of evaluating Emacs Lisp expressions has always been to jump to scratch buffer, type or paste the elisp expression and C-e or C-j.

This worked fine—until I needed to set a variable that works on a per-buffer basis.

While working on my newly created Auto Paste package, I used package-install-file to install it from a local file 1. I kept getting this warning:

Warning (package): Package lacks a terminating comment

—even though the terminating comment was clearly present. It turned out that emacs-lisp-mode was automatically adding a newline on save, which broke the required format.

To stop Emacs from doing that, I needed to evaluate:

;; No extra line for me please
(setq mode-require-final-newline nil)

But this sets the variable only for the current buffer. So running it in the scratch buffer didn’t help.

Enter : M-:

M-: was the solution - I could have saved myself a lot of buffer hopping had I know about this at the start of my emacs journey. It opens the minibuffer to evaluate a Lisp expression in the current buffer—exactly what I needed. Typing the above expression there disabled the automatic newline insertion on save, and the warning disappeared.