Используя ediff как мерзавец mergetool

function setSelectValue (id, val) {
    document.getElementById(id).value = val;
}
setSelectValue('leaveCode', 14);
49
задан peSHIr 10 January 2011 в 03:18
поделиться

2 ответа

I use a a more complicated command. As far as I remember I got it from this thread http://kerneltrap.org/mailarchive/git/2007/6/28/250230 (probably the same as what you are referring to).

[mergetool.ediff]
    cmd = emacs --eval \"\
(progn\
  (defun ediff-write-merge-buffer ()\
    (let ((file ediff-merge-store-file))\
      (set-buffer ediff-buffer-C)\
      (write-region (point-min) (point-max) file)\
      (message \\\"Merge buffer saved in: %s\\\" file)\
      (set-buffer-modified-p nil)\
      (sit-for 1)))\
  (setq ediff-quit-hook 'kill-emacs\
        ediff-quit-merge-hook 'ediff-write-merge-buffer)\
  (ediff-merge-files-with-ancestor \\\"$LOCAL\\\" \\\"$REMOTE\\\"\
                                   \\\"$BASE\\\" nil \\\"$MERGED\\\"))\"

Note that I have split this across several lines to increase readability and escaped the newline with \ so git config considers it as a single line.

I usually use emacsclient to edit e.g. commit messages. The above mergetool configuration unfortunately does not use emacsclient, and when I tried to get it to work with emacsclient I ran in to various problems including the fact that emacsclient returned right away.

But you just reminded me of that issue, so I might work on fixing that problem soon. However if someone else already found a solution that would be great of course ;-)

30
ответ дан 7 November 2019 в 11:48
поделиться

Помимо проблемы с git vs bzr, которую я указал в своем комментарии выше, я смог подтвердить, что вам нужно избегать скобок, как в

 cmd = emacs --eval "\\(ediff-merge-files-with-ancestor \"$LOCAL\" \"$REMOTE\" \"$BASE\" nil \"$MERGED\"\\)"

. Обратите внимание на двойные символы обратной косой черты. Я как бы понимаю, что они нужны (а не один) для прохождения как цитирования sh / bash, так и механизмов цитирования запуска emacs. Я оставлю это кому-то, кто лучше разбирается в Emacs и цитировании оболочки, чтобы он объяснил кровавые подробности.

-pmr

6
ответ дан 7 November 2019 в 11:48
поделиться
Другие вопросы по тегам:

Похожие вопросы: