Emacs Dired rename with alternative tool

前提是你 提交于 2019-12-07 11:11:02

问题


In dired you can rename files just by editing the directory listing and then saving it.

Is it possible to use use an alternative method for renaming when using dired for renaming? I want to use "svn mv", "bzr mv" or "git mv" instead of just renaming, so that I can register the extra metadata in the source control system.


回答1:


Looking at the functions in dired-aux.el, it seems like the built-in rename-file is what is ultimately called by dired-rename-file (which is the function bound to 'R' in dired-mode).

What you could do is grab that function and replace the call to rename-file with a call to shell-command that runs the appropriate VCS command.

However, another (better/easier) option would be to use one of Emacs's VCS modes to rename your files in your revision control system directly -- have a look at magit or PSVN or MercurialMode, depending on your choice of poison...




回答2:


I don't think dired provides any hook for that. You may be stuck doing something like

! hg mv ? target


来源:https://stackoverflow.com/questions/1233344/emacs-dired-rename-with-alternative-tool

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!