From: Mario L. <ml...@ho...> - 2001-11-07 16:30:44
|
Hello. In erc cvs rev. 1.91, I tried to modularize erc a bit. I removed erc-fill-region calls from the core functions and added erc-fill-region to erc-insert-hook instead. Unfortunately, this results in a serious problem. erc-fill-region changes the region, e.g. the end position is probably something else after erc-fill-region was executed. So, we would need to have erc-fill-region at the end of erc-insert-hook. This already conflicts with one function smoke is writing, which also required to be the last one on this hook. So we need to find a nice solution for this. Here is what I can propose: 1. Write erc-run-hook-with-args in a way that if one of those hook functions returns a list which length is same as number of args, call the next hook with those values. 2. make new buffer-local variables named erc-insert-start and erc-insert-end. Those should be set wherever erc-insert-hook gets called, and those should be markers. erc-insert-hook would get called without any args then, and use the erc-insert-start and erc-insert-end markers to determine the region. If erc-fill-region inserted some text then, the markers would reflect that for the next function. 3. Wherever erc-insert-hook gets called, first, create a temp-buffer, insert text there, call the insert-hook, extract the resulting text, and insert it where appropriate. 4. Move erc-fill-region back into the core functions. I would like to avoid this solution obviously. So, all you lisp hackers, please please comment on this, and perhaps more solutions. I am somehow a lisp newbie and I am not sure which solution is most flexible for future use. Comments? -- CYa, Mario <ml...@de...> Homepage(s): http://delysid.org | http://piss.at/ |