Created
December 22, 2008 14:37
-
-
Save yaotti/39003 to your computer and use it in GitHub Desktop.
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
;; reopen | |
;; http://www.bookshelf.jp/soft/meadow_24.html#SEC254 | |
(defun reopen-file () | |
(interactive) | |
(let ((file-name (buffer-file-name)) | |
(old-supersession-threat | |
(symbol-function 'ask-user-about-supersession-threat)) | |
(point (point))) | |
(when file-name | |
(fset 'ask-user-about-supersession-threat (lambda (fn))) | |
(unwind-protect | |
(progn | |
(erase-buffer) | |
(insert-file file-name) | |
(set-visited-file-modtime) | |
(goto-char point)) | |
(fset 'ask-user-about-supersession-threat | |
old-supersession-threat))))) | |
(define-key ctl-x-map "\C-r" 'reopen-file) | |
;; for VCS like GIT | |
;; git reset --hard ^HEADとかしたときに | |
(defun reopen-all-files () | |
(interactive) | |
(dolist (buf (buffer-list)) | |
(with-current-buffer buf | |
(reopen-file) | |
))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment