I must be hitting some combination of shortcut keys, because my Emacs keeps on switching all of its buffers to the minor mode 'fill'.

It's trivial to turn the mode off on each buffer individually, but I can't figure out how to do it globally in as simple a way as I seem to have turned it on globally.

What shortcut keys am I hitting, and how do I shortcut-key my way back?

I'm using:

GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2016-04-17 on lgw01-04, modified by Debian
  • 1
    The default Emacs auto-fill-mode is buffer-local, so any chance you've customized fill behavior or installed a related package? If you know the command you can use e.g. C-h w auto-fill-mode to see if it is bound to keys. If you just triggered some unexpected behavior use C-h l or M-x view-lossage to see what keys you typed. Once you figure that out you can consider removing or changing the key binding. – glucas May 3 '17 at 16:43
  • 1
    Check too that your value of default-major-mode is not a mode for which you've turned on auto-fill by default. – Drew May 3 '17 at 16:59
  • I don't think I've done any of that kind of customization on it. Is there some other mode which looks like Fill which isn't auto-fill-mode? I'm working mainly in Python and C++, so maybe it's something associated with one of those modes? – Autumnsault May 3 '17 at 17:11
  • If you figure out a repeatable recipe for triggering the problem, you can then use recursive bisection of your init file to establish which part of your configuration is responsible. – phils May 3 '17 at 22:17

When some key sequence triggers an unexpected command, use view-lossage (bound to C-h lby default) to see what keystrokes Emacs has recently received. This is most useful since Emacs 25 as it now shows the commands invoked by each key sequence -- in earlier releases you'll just see the raw keystrokes.

When an unexpected minor-mode has been enabled, use describe-mode (C-h m) to see what modes are enabled in the current buffer. For example you might see Auto-Fill in the list of enabled minor-modes and can read the corresponding help to see that auto-fill-mode is used to toggle this mode in the current buffer.

If you see a minor mode name in the mode line and aren't exactly sure where it comes from, try C-h v minor-mode-alist. That variable stores the map of mode functions to display strings.

Once you figure out what mode command you are accidentally hitting you can use where-is (C-h w) to find any key bindings associated with that command.

| improve this answer | |
  • So, I'm many keystrokes past triggering it at this point (and I'll try the view-lossage suggestion next time I start a new emacs and cause this), but when I do describe-mode, all I see is Abbrev. Fill doesn't show up at all, even though the mode string is (C++/lah Abbrev Fill). – Autumnsault May 4 '17 at 14:47
  • That's odd. Does M-x auto-fill-mode turn it off in the current buffer? You can also try C-h v minor-mode-alist and look to see what modes have "Fill" as their mode lighter. – glucas May 4 '17 at 15:38

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.