Better goto-definition when the function is verbatim
This commit is contained in:
parent
d27db0a84d
commit
f46d6080af
1 changed files with 12 additions and 9 deletions
|
@ -65,24 +65,27 @@ I love packages that add functionality but I don’t have to learn anything. How
|
||||||
(defun ha-org-code-block-jump (str pos)
|
(defun ha-org-code-block-jump (str pos)
|
||||||
"Go to a literate org file containing a symbol, STR.
|
"Go to a literate org file containing a symbol, STR.
|
||||||
The POS is ignored."
|
The POS is ignored."
|
||||||
|
;; Sometimes I wrap a function name in `=' characters, and these should be removed:
|
||||||
|
(when (string-match (rx "=" (group (one-or-more any)) "=") str)
|
||||||
|
(setq str (match-string 1 str)))
|
||||||
(ignore-errors
|
(ignore-errors
|
||||||
(let* ((default-directory (projectile-project-root))
|
(let* ((default-directory (projectile-project-root))
|
||||||
(command (format "rg --json '\\(def[^ ]+ %s ' *.org" str))
|
(command (format "rg --json '\\(def[^ ]+ %s ' *.org" str))
|
||||||
(results (thread-last command
|
(results (thread-last command
|
||||||
shell-command-to-list
|
shell-command-to-list
|
||||||
second
|
second
|
||||||
json-parse-string))
|
json-parse-string))
|
||||||
(file (thread-last results
|
(file (thread-last results
|
||||||
(gethash "data")
|
(gethash "data")
|
||||||
(gethash "path")
|
(gethash "path")
|
||||||
(gethash "text")))
|
(gethash "text")))
|
||||||
(line (thread-last results
|
(line (thread-last results
|
||||||
(gethash "data")
|
(gethash "data")
|
||||||
(gethash "line_number"))))
|
(gethash "line_number"))))
|
||||||
(find-file file)
|
(find-file file)
|
||||||
(goto-line line))))
|
(goto-line line))))
|
||||||
|
|
||||||
(add-to-list 'evil-goto-definition-functions ' ha-org-code-block-jump)
|
(add-to-list 'evil-goto-definition-functions 'ha-org-code-block-jump)
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
** Clever Parenthesis
|
** Clever Parenthesis
|
||||||
We need to make sure we keep the [[https://github.com/Fuco1/smartparens][smartparens]] project always in /strict mode/, because who wants to worry about paren-matching:
|
We need to make sure we keep the [[https://github.com/Fuco1/smartparens][smartparens]] project always in /strict mode/, because who wants to worry about paren-matching:
|
||||||
|
|
Loading…
Reference in a new issue