skeeto / impatient-mode

Impatient html mode. See your changes in the browser as you type
215 stars 19 forks source link

Implemented an option for delayed updating of buffers. #4

Closed ghost closed 6 years ago

ghost commented 6 years ago

When editing documents it is not always useful for the file to be updated in browser every keystroke, and can often lead to loading broken code into the browser, especially when editing linked JavaScript and CSS files.

I have implemented functionality which delays the update until activity ceases for 1 second. This allows you to type in a complete style rule or tag without having the browser load broken code.

I have introduced the buffer local variable imp--edit-timer which stores the timer, and the global variable impatient-mode-delayed-update which controls whether updates are instantaneous or delayed.

Also I have separated some code from imp--on-change and put it in a new function, imp--update-pages.