This file contains 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
;;;###autoload | |
(defun before-compile-hook (&rest _) | |
"Saves the current buffer if it is associated with a file." | |
(interactive) | |
(when buffer-file-name | |
(save-buffer))) | |
(provide 'before-compile-hook) |
This file contains 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
from itertools import takewhile | |
from typing import Iterable, Sequence, TypeVar | |
T = TypeVar("T") | |
def common_prefix(seqs: Iterable[Sequence[T]]) -> Iterable[T]: | |
"Returns the common prefix of a sequence of sequences." | |
return (c[0] for c in takewhile(lambda x: all(x[0] == y for y in x), zip(*seqs))) |