git mergetool
に使えるツールとして、デフォルトで"emerge"
というのが用意されており、Emacs使いはこれを使えばEmergeでマージが行えるわけだが、難点もある。ひとつは、新たなEmacsインスタンスを起動してしまうということだ。起動に無駄な時間が掛かるし、マージにあたって既存のセッションで開いているファイルをその場で参照できないのは不便だろう。もっとも、これはemacsclient
を使うようにして、Emergeの呼び出し方を少し直せば済む。もうひとつは、EmergeではなくよりモダンなEdiffを使いたいということだが、これは思ったほど簡単ではないのでわざわざこうして記事を書くことになった。
というのも、Emergeにはemerge-files-with-ancestor-command
という便利なものがあり、「マージが終わったらマージ結果を保存して即終了」ということが一発で出来てしまうのだが、Ediffの方にはそういうものがない。こいつはマージを終了してもろくに片付けもせず、全部ほったらかしという行儀の悪さだ。
そういうわけで、まずはEdiffのediff-merge-{files,buffers}
が終わったら起動前のウィンドウ設定を復元するようにしてみる。これは比較的簡単。[2013-01-23改訂:フックにappendフラグを指定]
1 2 3 4 5 6 7 8 9 10 11 |
(eval-after-load "ediff" '(progn ; save and restore window configuration (defvar my-ediff-saved-window-configuration nil "Saved window configuration for ediff") (defun my-ediff-save-window-configuration () (setq my-ediff-saved-window-configuration (current-window-configuration))) (add-hook 'ediff-before-setup-hook 'my-ediff-save-window-configuration) (defun my-ediff-restore-window-configuration () (set-window-configuration my-ediff-saved-window-configuration)) (add-hook 'ediff-suspend-hook 'my-ediff-restore-window-configuration t) (add-hook 'ediff-quit-hook 'my-ediff-restore-window-configuration t))) |
次に、Ediffが新たに開いたファイルのバッファをマージ終了時に自動的に閉じる、および、マージ終了時に自動的にセーブしつつEmacsフレームを閉じる「バッチ版ediff-merge-files-with-ancestor
」を加える。[2013-01-23改訂:ediff-filesに影響を与えるなどおかしかったので大幅修正; 続きはGitHubで]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
(eval-after-load "ediff" '(progn ; batch mode (for use from git mergetool etc.) (ediff-defvar-local my-ediff-batch-mode-p nil "True if in batch mode") (ediff-defvar-local my-ediff-close-on-quit nil "True if the buffer should be closed on quit.") (defun my-ediff-batch-mode (&optional mode) (ediff-with-current-buffer ediff-buffer-A (case mode (set (setq my-ediff-batch-mode-p t)) (unset (prog1 my-ediff-batch-mode-p (setq my-ediff-batch-mode-p nil))) (t my-ediff-batch-mode-p)))) (defadvice ediff-find-file (around mark-newly-opened-buffers (file-var buffer-name &optional last-dir hooks-var) activate) (let* ((file (symbol-value file-var)) (existing-p (and find-file-existing-other-name (find-buffer-visiting file)))) ad-do-it (or existing-p (ediff-with-current-buffer (symbol-value buffer-name) (setq my-ediff-close-on-quit t))))) (defun my-ediff-save-merge () (if (my-ediff-batch-mode) (let ((file ediff-merge-store-file)) (if file (ediff-with-current-buffer ediff-buffer-C (set-visited-file-name file t) (save-buffer)))) (ediff-maybe-save-and-delete-merge))) (remove-hook 'ediff-quit-merge-hook 'ediff-maybe-save-and-delete-merge) (add-hook 'ediff-quit-merge-hook 'my-ediff-save-merge) (defadvice ediff-cleanup-mess (around support-batch-mode () activate) (let ((batch-p (my-ediff-batch-mode 'unset)) (buffers (list ediff-buffer-A ediff-buffer-B ediff-ancestor-buffer)) (buffer-C ediff-buffer-C)) ad-do-it (dolist (buffer buffers) (ediff-with-current-buffer buffer (and my-ediff-close-on-quit (kill-buffer)))) (when batch-p (ediff-kill-buffer-carefully buffer-C) (delete-frame)))) (defun ediff-merge-files-with-ancestor-in-batch-mode (file-A file-B file-ancestor &optional startup-hooks merge-buffer-file) (ediff-merge-files-with-ancestor file-A file-B file-ancestor (cons (function (lambda () (my-ediff-batch-mode 'set))) startup-hooks) merge-buffer-file)))) (autoload 'ediff-merge-files-with-ancestor-in-batch-mode "ediff") |
これで、~/.gitconfig
にこんな風に書けばgit mergetool
で瞬時にEdiffが起動し、マージが済んだらq, yで即コマンドラインに帰ってくる。既存Emacsセッションにゴミバッファも残らない。
1 2 3 4 |
[merge] tool = ediff [mergetool "ediff"] cmd = emacsclient -a \"\" -t -e \"(ediff-merge-files-with-ancestor-in-batch-mode \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$BASE\\\" nil \\\"$MERGED\\\")\" |
あとは、たとえばラッパースクリプトを用意して、「<<<<<<<
」などの行が残っていたらマージ失敗とするとか、好きに改良すると良い。
порно
xnxx
Your talent is equal to your own inspiration. Giustino’s artwork is tasteful, and the written content is properly arranged. Despite this, you feel uneasy about the prospect of embarking on something that might cause you discomfort. I concede that you will be able to address this problem quickly.
Real Estate I really like reading through a post that can make men and women think. Also, thank you for allowing me to comment!
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
dodb buzz I very delighted to find this internet site on bing, just what I was searching for as well saved to fav
Fran Candelera This was beautiful Admin. Thank you for your reflections.
Blue Techker I am truly thankful to the owner of this web site who has shared this fantastic piece of writing at at this place.
child porn
Newtoki You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
Самый лучший сайт для подростков с порно. restaurantetrivio.com услуги специальные очень качественные порно видео. Партнер pornhub.com
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
gluco6 reviews : https://gluco6reviews.usaloves.com/
Baddiehub naturally like your web site however you need to take a look at the spelling on several of your posts. A number of them are rife with spelling problems and I find it very bothersome to tell the truth on the other hand I will surely come again again.
Blue Techker I am truly thankful to the owner of this web site who has shared this fantastic piece of writing at at this place.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://www.binance.com/join?ref=P9L9FQKY
BWER leads the way in weighbridge technology in Iraq, delivering customized weighing solutions that are accurate, efficient, and ideal for heavy-duty use in any environment.
Noodlemagazine Good post! We will be linking to this particularly great post on our site. Keep up the great writing
Noodlemagazine I do not even understand how I ended up here, but I assumed this publish used to be great
For the modern world, a consultation with a wide asset entails the process of introducing and modernizing the timely implementation of the super -task. And the elements of the political process urge us to new achievements, which, in turn, should be described as detailed as possible.
Great! Thank you so much for sharing this. Visit my websitee: free stresser
Only replicated from foreign sources, modern studies are only the method of political participation and are devoted to a socio-democratic anathema. Camping conspiracies do not allow the situations in which representatives of modern social reserves only add fractional disagreements and are indicated as applicants for the role of key factors.
Given the current international situation, the introduction of modern methods to a large extent determines the importance of the phased and consistent development of society. There is a controversial point of view that reads approximately the following: ties diagrams can be limited exclusively by the way of thinking.
Our business is not as unambiguous as it might seem: constant information and propaganda support for our activities, as well as a fresh look at the usual things-certainly opens up new horizons for clustering efforts. In particular, the introduction of modern methods plays an important role in the formation of positions occupied by participants in relation to the tasks.
It is difficult to say why representatives of modern social reserves to this day remain the lot of liberals, who are eager to be objectively examined by the relevant authorities. Likewise, a deep level of immersion creates the need to include a number of extraordinary measures in the production plan, taking into account the complex of relevant conditions of activation.
First of all, the framework of personnel training entails the process of implementation and modernization of both self -sufficient and outwardly dependent conceptual decisions. On the other hand, the cohesion of the team of professionals provides ample opportunities for the distribution of internal reserves and resources.
Definitely, thorough studies of competitors are mixed with unique data to the degree of perfect unrecognizability, which is why their status of uselessness increases. Definitely, the actions of opposition representatives only add fractional disagreements and are blocked within their own rational restrictions.
A variety of and rich experience tells us that increasing the level of civil consciousness is a qualitatively new step in the withdrawal of current assets. Banal, but irrefutable conclusions, as well as interactive prototypes are nothing more than the quintessence of the victory of marketing over the mind and should be declared violating universal human ethics and morality.
There is something to think about: replicated from foreign sources, modern studies form a global economic network and at the same time – subjected to a whole series of independent studies. On the other hand, the further development of various forms of activity requires an analysis of the priority of the mind over emotions.
But the conviction of some opponents unequivocally defines each participant as capable of making his own decisions regarding thoughtful reasoning. The significance of these problems is so obvious that the semantic analysis of external counteraction entails the process of introducing and modernizing the rethinking of foreign economic policies.
As is commonly believed, independent states to this day remain the destiny of liberals, who are eager to be equally left to themselves. In their desire to improve the quality of life, they forget that socio-economic development unambiguously records the need for new principles for the formation of a material, technical and personnel base.
Taking into account the success indicators, the innovation path we have chosen creates the prerequisites for clustering efforts. It should be noted that the conviction of some opponents allows us to assess the value of the withdrawal of current assets.
Given the current international situation, the strengthening and development of the internal structure largely determines the importance of the priority of the mind over emotions. But entrepreneurs on the Internet, initiated exclusively synthetically, are limited exclusively by the way of thinking.
Here is a vivid example of modern trends – semantic analysis of external counteraction allows you to complete important tasks to develop a rethinking of foreign economic policies. In our desire to improve user experience, we miss that the conclusions made on the basis of Internet analytics call us to new achievements, which, in turn, should be verified in a timely manner.
In their desire to improve the quality of life, they forget that the current structure of the organization allows you to complete important tasks to develop the progress of the professional community. Preliminary conclusions are disappointing: the introduction of modern methods unambiguously defines each participant as capable of making his own decisions regarding the relevant conditions of activation.