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

evil-org-select-inner-element: added support for links #105

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions evil-org.el
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,27 @@ If a prefix argument is given, links are opened in incognito mode."
;; Special case on block types (thanks Nicolas Goaziou)
(list (org-with-point-at post-affiliated (line-beginning-position 2))
(org-with-point-at end (line-beginning-position (- post-blank)))))
((memq type '(link))
(let*
((link-type (org-element-property :type element))
(link-type-len (length link-type))
(link-path (org-element-property :path element))
(inner-begin
(save-excursion
(goto-char begin)
(re-search-forward "\\w" end)
(point)))
(path-begin
(cond
((member link-type '("fuzzy"))
(- inner-begin 1))
((member link-type '("http" "https" "ftp"))
(setq link-path (concat link-type ":" link-path))
(- inner-begin 1))
(t (+ inner-begin link-type-len))))
(link-path-len (length link-path))
(path-end (+ path-begin link-path-len)))
(list path-begin path-end)))
((memq type '(verbatim code))
(list (1+ begin) (- end post-blank 1)))
('otherwise
Expand Down