Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save marker and use it in callback for insert #127

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Miciah
Copy link
Contributor

@Miciah Miciah commented May 21, 2021

Delete unused callback function

Follow-up to commit 666d0cd.

  • 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.

Follow-up to commit 666d0cd.

* 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.
@Miciah
Copy link
Contributor Author

Miciah commented May 27, 2021

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 Miciah force-pushed the save-marker-and-use-it-in-callback-for-insert branch from 2b5701f to 8c66bd5 Compare May 27, 2021 04:46
* 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.
@Miciah Miciah force-pushed the save-marker-and-use-it-in-callback-for-insert branch from 8c66bd5 to efbba76 Compare May 27, 2021 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

org-cliplink function inserts result after the current position of the cursor
1 participant