mirror of
https://github.com/m00natic/vlfi.git
synced 2025-02-24 05:48:06 +00:00
Intercept buffer saving with vlfi-write.
This commit is contained in:
parent
f3132c0970
commit
5405a30de4
4
vlfi.el
4
vlfi.el
@ -393,6 +393,7 @@ successful. Return nil if nothing found."
|
|||||||
"Major mode for editing large file chunks."
|
"Major mode for editing large file chunks."
|
||||||
(setq buffer-read-only nil)
|
(setq buffer-read-only nil)
|
||||||
(buffer-enable-undo)
|
(buffer-enable-undo)
|
||||||
|
(add-hook 'write-contents-functions 'vlfi-write)
|
||||||
(message (substitute-command-keys
|
(message (substitute-command-keys
|
||||||
"Editing: Type \\[vlfi-write] to write chunk \
|
"Editing: Type \\[vlfi-write] to write chunk \
|
||||||
or \\[vlfi-discard-edit] to discard changes.")))
|
or \\[vlfi-discard-edit] to discard changes.")))
|
||||||
@ -405,7 +406,8 @@ or \\[vlfi-discard-edit] to discard changes.")))
|
|||||||
End of chunk will be garbled. Continue? "))
|
End of chunk will be garbled. Continue? "))
|
||||||
(write-region nil nil buffer-file-name vlfi-start-pos)
|
(write-region nil nil buffer-file-name vlfi-start-pos)
|
||||||
(vlfi-move-to-chunk vlfi-start-pos vlfi-end-pos)
|
(vlfi-move-to-chunk vlfi-start-pos vlfi-end-pos)
|
||||||
(vlfi-mode)))
|
(vlfi-mode))
|
||||||
|
t)
|
||||||
|
|
||||||
(defun vlfi-discard-edit ()
|
(defun vlfi-discard-edit ()
|
||||||
"Discard edit and refresh chunk from file."
|
"Discard edit and refresh chunk from file."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user