{"id":52,"date":"2010-03-01T21:41:03","date_gmt":"2010-03-02T01:41:03","guid":{"rendered":"http:\/\/www.joshmatthews.net\/blog\/?p=52"},"modified":"2010-03-01T21:41:03","modified_gmt":"2010-03-02T01:41:03","slug":"faster-mercurial-patch-queue-merging-with-emacs","status":"publish","type":"post","link":"https:\/\/www.joshmatthews.net\/blog\/2010\/03\/faster-mercurial-patch-queue-merging-with-emacs\/","title":{"rendered":"Faster mercurial patch queue merging with emacs"},"content":{"rendered":"<p>As a follow-up to <a href=\"http:\/\/www.joshmatthews.net\/blog\/2010\/01\/dealing-with-mercurial-patch-queue-rejects-in-emacs\/\">my previous post<\/a> about merging mq reject in emacs, I thought I&#8217;d share some improvements to the process that I&#8217;ve made since then.<\/p>\n<pre lang=\"lisp\">(defun switch-hg-reject ()\r\n  (interactive)\r\n  (let ((other-file\r\n\t (if (string= (substring (buffer-file-name) -4 nil) \".rej\")\r\n\t     (substring (buffer-file-name) 0 -4)\r\n\t   (concat (buffer-file-name) \".rej\"))))\r\n    (if (file-exists-p other-file)\r\n\t(save-selected-window\r\n\t  (switch-to-buffer-other-window (find-file-noselect other-file)))\r\n      (message \"No alternate reject file found\"))))\r\n\r\n(defun kill-hg-reject ()\r\n  (interactive)\r\n  (let ((reject-file (concat (buffer-file-name) \".rej\")))\r\n    (kill-buffer\r\n     (find-buffer-visiting reject-file))))\r\n\r\n(global-set-key (kbd \"C-c r\") 'switch-hg-reject)\r\n(global-set-key (kbd \"C-x r\") 'kill-hg-reject)<\/pre>\n<p>It turns out that swapping back and forth between the reject and the original in a single window felt was quite inefficient.  With these changes, the reject opens up in another window (think emacs terminology here) on <code>C-c r<\/code>, and I can kill it later with <code>C-x r<\/code>.  This also works better with other modules like uniquify &#8211; the code from the previous post would fail when trying to access rejects associated with buffers name &#8220;Makefile.in|ipc&#8221;.  No longer must you suffer the indignity of process!  Merging can, and should, be fun!  BEHOLD MY WORKS AND DESPAIR.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As a follow-up to my previous post about merging mq reject in emacs, I thought I&#8217;d share some improvements to the process that I&#8217;ve made since then. (defun switch-hg-reject () (interactive) (let ((other-file (if (string= (substring (buffer-file-name) -4 nil) &#8220;.rej&#8221;) &hellip; <a href=\"https:\/\/www.joshmatthews.net\/blog\/2010\/03\/faster-mercurial-patch-queue-merging-with-emacs\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,17,15],"tags":[],"class_list":["post-52","post","type-post","status-publish","format-standard","hentry","category-code","category-emacs","category-mozilla"],"_links":{"self":[{"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/posts\/52","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/comments?post=52"}],"version-history":[{"count":1,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/posts\/52\/revisions"}],"predecessor-version":[{"id":62,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/posts\/52\/revisions\/62"}],"wp:attachment":[{"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/media?parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/categories?post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/tags?post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}