Timeline for Replace existent link in org-mode with org-stored link
Current License: CC BY-SA 4.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 15, 2020 at 15:41 | comment | added | Ajned | Excellent. Thank you! There is only one small detail (for whoever might use your solution). If for some reason the update is cancelled, for example via C-g the link disappears. Minor thing, but just thought worth mentioning. | |
| Nov 15, 2020 at 15:36 | vote | accept | Ajned | ||
| Nov 15, 2020 at 14:56 | comment | added | Zeta | @Ajned I'm not entirely sure why it's necessary in Emacs 26.3, but apparently remove-link-and-mark-description must take an argument in 26.3. &rest args makes sure that it works in both 26.3 and 27.1. | |
| Nov 15, 2020 at 14:54 | history | edited | Zeta | CC BY-SA 4.0 | added 27 characters in body |
| Nov 15, 2020 at 14:47 | comment | added | Zeta | I can reproduce the error with Emacs v26.3, Org mode v9.1. It works fine on Emacs 27.1. There might have been some changes with advice-add. I'll check the NEWS. | |
| Nov 15, 2020 at 14:45 | comment | added | Ajned | Indeed, I should have stated that right at the beginning. Emacs v26.3, Org mode v9.4. and the error is "Wrong number of arguments: (lambda nil "Removes the link at point and marks the description. The previous link gets stored into org-stored-links'." (cond ((org-in-regexp org-link-bracket-re 1) (let* ((link (match-string-no-properties 1)) (desc (if (match-end 2) (match-string-no-properties 2) link)) (deactivate-mark)) (setq org-stored-links (cons (list (org-link-unescape link) desc) org-stored-links)) (replace-match desc) (push-mark (match-beginning 0) t t))) (t nil))), 1"` | |
| Nov 15, 2020 at 14:37 | comment | added | Zeta | @Ajned Which emacs-version and org-version do you use? | |
| Nov 15, 2020 at 14:18 | comment | added | Ajned | I am surprised that this is not implemented by default. Your solution returned an error, so it might have to be slightly changed. I will give feedback as soon as possible. | |
| Nov 15, 2020 at 12:12 | history | answered | Zeta | CC BY-SA 4.0 |