Moving regions with `M-<up>` and `M-<down>` stopped working

What happened?

The M-<up> and M-<down> used to move the current line, or a selected region, up and down. Recently I noticed it doesn’t work anymore.

System information


Loading data dump...

You can check if those keybindings are allocated or unused using the function describe-key.

The functions that move text up and down are move-text-up and move-text-down. You can also check with describe-function if they are bound to some keybinding.

HTH

Thanks for coming back to me.

I’m getting M-<up> is undefined from describe-key, and describe-function can’t find anything matching move-text. Do you happen to know which package / module this should come from? While researching I saw there is an Emacs package called move-text that provides this functionality, but it was not included in Doom. Personally I don’t remember ever configuring anything related to this and I swear it used to “just work”.

I’ve run describe-function on move-text-down and returns that:

move-text-down is an autoloaded, interactive and natively compiled function defined in init.29.el.

In my configuration:

;; $DOOMDIR/packages.el
(package! move-text)

The file is under ~/.doom/.local/straight/build-29.4/move-text and I can confirm it’s the package you mention.

Did you recently update anything that could have affected that package? Did you try rebuilding the bytecode cache of Doom packages or of your config?

1 Like

Yes, it’s those recent changes: refactor!(default): drag-stuff: make non-evil only · doomemacs/doomemacs@816db4a · GitHub

Oh, interesting. I didn’t notice this breaking changes because I use the standard Emacs keybindings.

Thanks for the tip.

Ok. So the idea is to kill and yank? My muscle memory will have to adjust :smiley:

well you can re-add (package! drag-stuff) to packages.el and config

(use-package! drag-stuff
   :defer t
   :init
  (map! "<M-up>"    #'drag-stuff-up
        "<M-down>"  #'drag-stuff-down))

somewhere in config.el — but it would be against the bigger idea I guess…