org-cliplink icon indicating copy to clipboard operation
org-cliplink copied to clipboard

Save marker and use it in callback for insert

Open Miciah opened this issue 4 years ago • 1 comments

Delete unused callback function

Follow-up to commit 666d0cdf0cc6ea120c83b190396d76f0ac32605a.

  • org-cliplink.el (org-cliplink-insert-org-mode-link-callback): Delete function.
  • test/org-cliplink-test.el (org-cliplink-insert-org-mode-link-callback-test): Delete test.

Save marker and use it in callback for insert

  • org-cliplink.el (org-cliplink-insert-transformed-title): Save point as a marker, and use it in the callback so that it inserts the link at the position at which the org-cliplink command was executed.

@rexim, I believe this fixes #22 and obviates #55.

Miciah avatar May 21 '21 02:05 Miciah

save-excursion works nicely if point has moved since org-cliplink was called, but if point hasn't moved, then the text is inserted after point. Conditionally using save-excursion resolves this issue, but maybe there's a more elegant way?

Miciah avatar May 27 '21 04:05 Miciah