Improve KeySpecifier, errors, IptKeySpecifier impl, etc.
After shaving various yaks.
Assigning review to @gabi-250 since this is mostly her area and she requested the change.
Update: this is now rebased on top of !1784 (merged) and contains rather more stuff too.
The branch is on top of !1804 (merged) and !1803 (merged)
Fixes #1148 (closed) Fixes #1116 (closed)
Edited by Ian Jackson