Created
September 10, 2015 13:18
-
-
Save stakemori/ccf0e4cfae2fcfafbf0a to your computer and use it in GitHub Desktop.
#20440 reproducible code
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
(require 'cl-lib) | |
(defun my/test-revert-buffer () | |
(let ((file (make-temp-file "test-revert-buffer" nil ".py")) | |
(file-content1 "# -*- coding: utf-8 -*- | |
''' | |
Foo. | |
''' | |
") | |
(file-content2 "# -*- coding: utf-8 -*- | |
class Foo(object): | |
pass | |
")) | |
(write-region file-content1 nil file nil 'silent) | |
(find-file file) | |
;; The content of the current buffer is equal to file-content1. | |
(write-region file-content2 nil file nil 'silent) | |
(revert-buffer nil t) | |
;; Now the content of the current buffer should be equal to file-content2. | |
(cl-assert (string= (buffer-string) file-content2)))) | |
(defun my/add-to-after-change-functions () | |
(add-hook 'after-change-functions (lambda (x y z) (buffer-string)) nil t)) | |
(add-hook 'python-mode-hook #'my/add-to-after-change-functions) | |
(my/test-revert-buffer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment