Okay, to formalize this (and since I have some time now to type up an actual answer).
add_hidden_range() IDC function and the SDK function of the same name (
bytes.hpp) can be used for the purpose. (However, I am almost sure there was another function I used at the time.)
update_hidden_range() may also be of interest (see link above).
When I used this some years ago to write an IDC script (IDAPython didn't ship with IDA at the time), I used this to hide the code for some repetitive debug print and assertion functionality in some (checked) Windows binaries I was looking at. For this I used gray color and replaced the whole hidden range with an assembly-style comment (
; prefix). The comment would then contain pseudocode of the debug print or assertion it was hiding. This helped a lot in making the disassembly a lot cleaner for reading.
The biggest challenge other than finding the functionality and the IDC function exposing it initially, was to look for the opcodes surrounding the xref locations of the known functions calls and make sure I wasn't hiding some interspersed opcodes. So essentially I made sure that the script would verbosely output whenever it hit an instance where unexpected opcodes where interspersed with the expected opcodes, showing the EA, and could then double click on that in the log pane to review those (in my case rare) instances manually.
Other instances where this technique proved useful were well-known inlined functions (think
memcpy and friends). The patterns repeat and by hiding the opcodes and replacing them with meaningful pseudocode you can speed up reading your disassembly considerably (even without a decompiler plugin).