org/org: new command +org/remove-link, bound to C-c C-S-l
This commit is contained in:
parent
0b5a833638
commit
3b9e67746d
2 changed files with 16 additions and 0 deletions
|
@ -282,3 +282,18 @@ with `org-cycle'). Also:
|
|||
(let ((window-beg (window-start)))
|
||||
(org-cycle)
|
||||
(set-window-start nil window-beg))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +org/remove-link ()
|
||||
"Unlink the text at point."
|
||||
(interactive)
|
||||
(unless (org-in-regexp org-bracket-link-regexp 1)
|
||||
(user-error "No link at point"))
|
||||
(save-excursion
|
||||
(let ((remove (list (match-beginning 0) (match-end 0)))
|
||||
(description (if (match-end 3)
|
||||
(org-match-string-no-properties 3)
|
||||
(org-match-string-no-properties 1))))
|
||||
(apply #'delete-region remove)
|
||||
(insert description))))
|
||||
|
||||
|
|
|
@ -148,6 +148,7 @@
|
|||
between the two."
|
||||
(map! (:map org-mode-map
|
||||
"RET" #'org-return-indent
|
||||
"C-c C-S-l" #'+org/remove-link
|
||||
:n "j" "gj"
|
||||
:n "k" "gk")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue