如何打开由backup-each-save.el创建的备份文件,其内容与dired-jump一样?

时间:2019-01-01 07:00:55

标签: emacs backup

通知:在回答此问题之前,请先查看我的答案,因为我首先回答了该问题。但是欢迎其他方式或任何建议。

如何打开backup-each-save.eldired中由dired-jump创建的最新备份文件,例如 1. Get the backup directory of the file connected to current opening file buffer. 2. Open the backup directory. 3. In the dired buffer, go to end of the buffer. 4. Search backward for the basename of opening file.

1 个答案:

答案 0 :(得分:0)

这是算法及其代码。

算法:

(defun backup-each-save-dired-jump ()
  (interactive)
  (let* (
         (filename (buffer-file-name))
         (containing-dir (file-name-directory filename))
         (basename (file-name-nondirectory filename))
         (backup-container
          (format "%s/%s"
                  backup-each-save-mirror-location
                  containing-dir))
         )
    (when (file-exists-p backup-container)
      (find-file backup-container)
      (goto-char (point-max))
      (search-backward basename)
      )))

代码:

d3