$\def\Hom{\operatorname{Hom}}\def\N{\mathcal{N}}\def\P{\mathcal{P}}$ I don't understand the last step of this proof of the isomorphism $f_*\mathcal{H}om_X(f^*\mathcal{N},\mathcal{P}) \cong \mathcal{H}om_Y(\mathcal{N},f_*\mathcal{P})$ (where $f:X\to Y$ is a morphism of ringed spaces, $\mathcal{N}\in\operatorname{Mod}(\mathcal{O}_Y)$ and $\mathcal{P}\in\operatorname{Mod}(\mathcal{O}_X)$). There they claim that the maps on sections, which is given by the adjunction $f^*\dashv f_*$, commute with restrictions due to naturality of the bijection between hom-sets.
What we have to show is that if $V\subset U$ is open, then the following diagram commutes: $$ \require{AMScd} \begin{CD} \Hom_{f^{-1}(U)}\left(f^*\N|_{f^{-1}(U)},\P|_{f^{-1}(U)}\right)@>{\cong}>>\Hom_U\left(\N|_U, f_*\P|_U\right)\\ @V{\text{rest}}VV@VV{\text{rest}}V\\ \Hom_{f^{-1}(V)}\left(f^*\N|_{f^{-1}(V)},\P|_{f^{-1}(V)}\right)@>{\cong}>>\Hom_V\left(\N|_V, f_*\P|_V\right) \end{CD} $$ but why so? I know the horizontal maps are natural in $\N$ and in $\P$. That's how the adjunction $f^*\dashv f_*$ is stated. But is seems to me that what we need here is the adjunction to be “natural in $U$,” which is something different.
We can see the adjunction as the pair of functors satisfying the triangle identities, like $f_* \mathcal{F} \to f_* f^* f_* \mathcal{F} \to f_* \mathcal{F}$ is identity for $\mathcal{F}$ for every sheaf $\mathcal{F}$ on $X$. This amounts to a natural family of maps $f_* \mathcal{F}(U) \to f_* f^* f_* \mathcal{F}(U) \to f_* \mathcal{F}(U),$ so the same identity hold for restrictions of $\mathcal{F}$ on subsets of $Y$. Thus, we have the same unit and counit and the pair of triangle identities for the pair $(f^*,f_*)$ when regarded as functors between $\operatorname{Mod}(\mathcal{O}_V)$ and $\operatorname{Mod}(\mathcal{O}_{f^{-1}V})$. Moreover, these units and counits for different $V$ restrict to each other as they are natural transformations. Since passing along an adjunction amounts to applying one of the adjoint functors and (pre-)post-composing with the (co-)unit, these passages are also "natural".