Emacs(第21版后)包括一个从文件delete trailing whitespace的功能。如何在Magit暂存区域(从delete-trailing-whitespace)中使magit-status可用,以便可以从单个块或整个文件中删除尾随空格?

最佳答案

这是肖恩的片段,针对Magit v2进行了调整:

(defun my-magit-delete-trailing-whitespace-from-file ()
  "Remove whitespace from the current file."
  (interactive)
  (save-excursion
    (magit-diff-visit-file-worktree (magit-file-at-point))
    (delete-trailing-whitespace)
    (save-buffer)
    (kill-buffer))
  (magit-refresh))

关于emacs - 如何从Magit的大块中删除尾随空格?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20127377/

10-12 20:51