Hadith In Muslim (57f) That A Believer Is Not A Believer When He Commit Sins
So, from what I understood, this hadith is pointing to those who are persistent in such acts without repenting, or any feel of guilt or remorse. A kafir is someone who deliberately denies the truth. Deliberately denying the truth is a form of arrogance infront of God. So in this way, if a muslim persists in such grave sins without repenting, or trying to stop, are also falling in the category of arrogance. So such acts do not make a person non muslim but can put a person in the category of arrogance infront of God. This is what you mean by kafir in spirit, right?.