Created
November 3, 2023 15:07
-
-
Save knollet/16927be87e51e07ef2ce964be9d02603 to your computer and use it in GitHub Desktop.
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
(defun buffer-minus (subtrahend) | |
"This function takes the name of a buffer, | |
and removes every line in the current buffer present in the given one. | |
The lines are removed with `delete-matching-lines' which uses the given string as a regex | |
but it is good enough..." | |
(interactive "*b") | |
(let ((sub-list | |
(with-current-buffer subtrahend | |
(string-split (buffer-string) "\n" t "[\t ]+")))) | |
(mapc (lambda (x) | |
(goto-char (point-min)) | |
(delete-matching-lines x)) | |
sub-list))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment