On Friday, May 27, 2016 at 10:38:00 PM UTC+3, Bram Moolenaar wrote: > Ramel Eshed wrote: > > > On Wednesday, May 25, 2016 at 11:49:48 PM UTC+3, Bram Moolenaar wrote: > > > Ramel Eshed wrote: > > > > > > > Is there any way to use a nomodifiable buffer as an output buffer for > > > > a job? If not, I think that it could be very useful. > > > > > > The idea of making a buffer nomodifiable is that it's read-only, the > > > contents is not supposed to change. That conflicts with writing to the > > > buffer. > > > > > > -- > > > hundred-and-one symptoms of being an internet addict: > > > 11. You find yourself typing "com" after every period when using a word > > > processor.com > > > > > > /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net > > > \\\ > > > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ > > > \\\ > > > \\\ an exciting new programming language -- http://www.Zimbu.org > > > /// > > > \\\ help me help AIDS victims -- http://ICCF-Holland.org > > > /// > > > > Hi Bram, > > > > It seems to me that in most cases plugins developers will want to > > protect the job's output buffer from being modified by the user. I > > know that in all the use cases I can think about now I want to set > > this buffer to be read-only or at least to be able to control when the > > user can modify it. A few examples might be: Live log file viewer, > > some sort of console, display search results (like I did in the plugin > > I mentioned in the other thread). > > Well, running a plugin is also triggered by the user, thus it's a subtle > difference. > > In most cases the user will know not to modify a buffer that is used by > a plugin. Just like you would not change a log file, etc. > > Perhaps you can guard modifications, and set/reset 'modifiable' at the > right moment. Directly redirecting to the buffer doesn't work then > though. > > -- > hundred-and-one symptoms of being an internet addict: > 23. You can't call your mother...she doesn't have a modem. > > /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ > /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ > \\\ an exciting new programming language -- http://www.Zimbu.org /// > \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
In every Vim plugin that I've used (which are not too many though) there was a protection on the general-purpose buffers (done by setting and resetting 'modifiable'). The concern, I guess, is not to prevent the user from changing the buffer deliberately rather then to protect from stupid mistakes. Here, when the buffer changed asynchronously it is even more dangerous. For example: what if the user by mistake will press 'p' while the buffer is being updated? -In other cases a simple undo will help but here it is likely that before the user will press 'u' there will be many new lines added by the job output so undo will delete them instead. Is it possible to add an option to the job that will let it override 'modifiable' just for the out_io? -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
