The sortloot configuration option has three different options: none (to disable any effects of the patch), loot (sort only items on the ground, never those in your inventory), and full (sort items on the ground and in your inventory).
While sortloot understands that a blessed wand of digging should be near an uncursed wand of digging, it doesn't group formally identified potions of (un)holy water together - however, it does keep blessed, uncursed and cursed "clear potions" together. It also ignores wand/tool charges.
nethack.alt.org has the sortloot patch installed for 3.4.3.
The sortloot patch was integrated into NetHack 3.6.0.