redguardtoo/mastering-emacs-in-one-year-guide

能否在 org mode 的 source block 里面直接跳转到对应 函数/变量的 define

Closed this issue · 2 comments

#+BEGIN_SRC go -r
xxx
xxx
#+END_SRC


#+BEGIN_SRC php -r
xxx
xxx
#+END_SRC

我想在不同语言的 org-mode 的 source 调用不同的命令

(add-hook 'php-mode-hook
          '(lambda ()
             (define-key php-mode-map  (kbd "M-.") 'ac-php-find-symbol-at-point)   ;goto define
             (define-key php-mode-map  (kbd "M-*") 'ac-php-location-stack-back   ) ;go back
             ))

(add-hook 'go-mode-hook
          '(lambda ()
             (define-key go-mode-map  (kbd "M-.") 'godef-jump)      ;goto define
             (define-key go-mode-map  (kbd "M-*") 'pop-tag-mark) ;go back
             ))

sure, you need know the corresponding major mode of code snippet, see https://github.com/redguardtoo/evil-nerd-commenter/blob/92bee71aa6fbb36299a4e69e710da786f3694637/evil-nerd-commenter.el#L322

The you can turn on that major mode (temoporarily?), and jump.

ok, thank you