|
From: | Alexis |
Subject: | Re: function to copy org buffer substring with link description only |
Date: | Tue, 08 Dec 2015 17:54:24 +1100 |
Paul <mafeuser@gmail.com> writes:
(buffer-substring-no-properties (point) (mark)) on some part of an org buffer that contains a link returns the following example:"while [[(some-link)][description]] does not"Do You know a ready to use function that would return the following?:"while description does not"
i'm not aware of any existing function that does this, so here's a function that's at least a start:
#+BEGIN_SRC emacs-lisp(defun org-delinkify-region (start end) "Replace all Org-style links within the region with only the link description text, and return the result." (interactive "r") (let ((text (buffer-substring-no-properties start end))) (with-temp-buffer (insert text) (goto-char (point-min)) (while (re-search-forward "\\[\\[[^\\]+?]\\[\\(.+?\\)]\\]" (point-max) t) (replace-match (match-string 1))) (buffer-substring (point-min) (point-max)))))
#+END_SRC
Hope that helps! Alexis.
[Prev in Thread] | Current Thread | [Next in Thread] |