1
0
mirror of https://github.com/m00natic/vlfi.git synced 2024-10-05 18:30:51 +01:00

Fix whole file reload in read-only buffer on vlf-mode exit.

This commit is contained in:
Andrey Kotlarski 2014-12-13 18:37:31 +02:00
parent d1a6800b5b
commit 1c961f45b2

10
vlf.el
View File

@ -140,14 +140,16 @@ values are: `write', `ediff', `occur', `search', `goto-line'."
(if (consp buffer-undo-list) (if (consp buffer-undo-list)
(setq buffer-undo-list nil)) (setq buffer-undo-list nil))
(vlf-with-undo-disabled (vlf-with-undo-disabled
(insert-file-contents-literally buffer-file-name (let ((inhibit-read-only t))
t nil nil t) (insert-file-contents-literally buffer-file-name
(hexlify-buffer)) t nil nil t)
(hexlify-buffer)))
(set-buffer-modified-p nil) (set-buffer-modified-p nil)
(goto-char (point-min)) (goto-char (point-min))
(forward-line line) (forward-line line)
(forward-char pos)) (forward-char pos))
(let ((pos (+ vlf-start-pos (position-bytes (point))))) (let ((pos (+ vlf-start-pos (position-bytes (point))))
(inhibit-read-only t))
(vlf-with-undo-disabled (vlf-with-undo-disabled
(insert-file-contents buffer-file-name t nil nil t)) (insert-file-contents buffer-file-name t nil nil t))
(goto-char (byte-to-position pos))))) (goto-char (byte-to-position pos)))))