How to set priority in priority encoder?
I'm assuming inputs are active high.  If not, you may invert them or select different gates below.

Start by generating a set of 4 signals N1-N3 indicating whether the highest single priority input is inactive, or both of the top two, or all of the top three.  Think "nor" gates.

From that, determine for each input whether is is active while all higher-priority inputs are inactive.  Think "and" gates.

If you want a binary-coded output, identify for each bit position whether there are any inputs whose code should have a "1" in that position, which are active at the same time as all higher-priority inputs are inactive.  Think "or" gates.

If you need to be able to e.g. have a priority-reversing input, that should be handled with logic placed before the first set of "nor" gates.  Instead of feeding "nor" gates direct from the priority-encoder inputs, generate a set of signals that means e.g. "input #3 is active, and it should have priority over #2".  Feed the "nor" gate associated with each input with all the signals that would indicate that a higher-priority input is active.

This approach may not always yield the minimum possible amount of circuitry, but it is straightforwardly adaptable to a wide range of requirements, and does not impose any particular relationship between priority and output encoding.