Skip to content

Instantly share code, notes, and snippets.

@gempesaw
Last active December 13, 2015 22:49
Show Gist options
  • Select an option

  • Save gempesaw/4987646 to your computer and use it in GitHub Desktop.

Select an option

Save gempesaw/4987646 to your computer and use it in GitHub Desktop.
patch-two-files-alongside
;; https://plus.google.com/u/0/105641731374531810537/posts/YDz3n6BWmea
(defun my-stitch-two-files-alongside (left-file right-file)
"Patch two files together side by side"
(interactive "fRequest file: \nfResponse file: ")
(pop-to-buffer (generate-new-buffer "merged-req-rsp-files"))
(let ((left-strings (file-string-list left-file))
(right-strings (file-string-list right-file)))
(while left-strings
(insert (car left-strings) " -> " (car right-strings))
(newline)
(setq left-strings (cdr left-strings))
(setq right-strings (cdr right-strings)))))
(defun file-string-list (file)
"Read the contents of a file and return as a string."
(with-temp-buffer
(insert-file-contents file)
(split-string (buffer-string) "\n")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment