Last active
December 13, 2015 22:49
-
-
Save gempesaw/4987646 to your computer and use it in GitHub Desktop.
patch-two-files-alongside
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 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