When responding to the other thread with an idea about using a CMOS gate as a linear amplifier, I remembered an experiment I conducted awhile ago using a couple of gates to make a comparator.
https://www.eevblog.com/forum/index.php?topic=2550.msg34540#msg34540I was impressed that it actually worked. Fair enough, the performance wasn't great and the common mode range of the inputs is a volt or so from either rail but it's not bad considering I'm usign an IC not designed to do this. It's probably worth doing if you have a spare couple of logic gates on an IC and don't want to use another for a comparator and is certainly fine for a thermostat using a thermistor or a light sensitive switch with a CdS cell.
R1 = R5
R2 = R3
Hysteresis = Vdd*R1/R4
I used the CD4011 but there's no reason why it couldn't be the CD4001 or even a 74HC04.
R1 or R2 could also be replace with a potential divider to the powersupply rails, in which case it should be treated as the value of the potential divider resistors in parallel. You can't just replace them with a pot as the output impedance will vary with the pot setting so keep R1 or R2 as is and use a much lower value pot, say 1M and 1k respectively.