Guillaume MULLER <guillaume.mul...@emse.fr> writes: > ... > - Switch back to (Doom)Emacs ("window"/desktop) > - Click inside the Emacs "window" to give it focus > [Here is the problem: sometimes I forgot that I already started the > org-insert-link] > - Call org-insert-link > - Paste the URL > - Validate the link creation > > Then the link is inserted where I clicked last (to give focus to the Emacs > "window").
By default, Emacs moves point to where you click. You can do the same thing if you deliberately C-x o from the minibuffer. See 9.3 Editing in the Minibuffer section of Emacs manual. I see nothing wrong on the Org side. > Of course, the problem lies in my mistake of calling twice the > org-insert-link method, but the behavior is very strange, and it took me some > time to identify why my links were inserted at random places in my text. > > However, wouldn't it be possible to prevent it from the beginning by > forbidding me to call org-insert-link twice, i.e. making it a > singleton/atomic function (I don't see a UseCase where this could be useful > to be able to call it inside itself, but maybe I'm wrong)? Check out 22.1 Mouse Commands for Editing section of Emacs manual. `x-mouse-click-focus-ignore-position' might be something you want to customize. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>