mv-shell

One of the most useful parts of Emacs is its built-in shell packages. Emacs actually has three(at least) ways to have a shell in an emacs buffer: shell-mode, ansi-term, and eshell. Each of these has their own problems, but the ability to have a shell where all my movement and editing commands are defined is more useful than the additional functionality provided by a real shell.

However, one of the benefits of using Emacs is having the ability to fix most things that bother you. One of these was moving opened files in shell-mode. If you have a buffer visiting a file and then move the file, the buffer is still visiting the old location. This means that the next time you save the file, instead of saving to the new location, the file will be re-created in the old location. This happened one too many times, and so I wrote mv-shell, a minor-mode that tracks ‘mv’ commands.

mv-shell works fairly simply; whenever input is sent to a comint buffer, of which shell-mode is a type, it will check for a ‘mv’ command. If one exists, it pulls out the file or directory names and checks which buffers you have open will be moved by the command. If they are, it will also move the buffer.

Installation is fairly easy; just put mv-shell.el somewhere in your load-path and add the following to your .emacs file:

(require 'mv-shell)
(mv-shell-mode 1)

As always, feel free to send me any questions/complaints at flat0103@gmail.com

One Response to “mv-shell”

  1. mcradle says:

    the link to the source is wrong, I guess it should say ‘https://github.com/nflath/mv-shell’.

    Cheers

Leave a Reply