Thread: [CEDET-devel] Consider to include some handy functions for definition navigation.
Brought to you by:
zappo
From: kostafey <kos...@gm...> - 2013-12-13 13:24:21
|
Hello, I'm making a function for simplify navigation to the definitions of some entities (e.g. classes or functions). It is based on the CEDET, but not only. e.g. you can bind: (global-set-key (kbd "<C-down-mouse-1>") 'find-definition-jump-mouse) or bind find-definition-jump-at-point to some key, if you dislike to use mouse :). and then click Ctrl-mouse (like in ordinary IDE) to the class or function and it will do it's best to find entity definition and jump to it (via elisp own, CEDET or tags navigation measures). Can it be included to the CEDET (after necessary adapt, of course) in the some form? What can you advice? here is a draft: (defun buffer-mode (buffer-or-string) "Returns the major mode associated with a buffer." (with-current-buffer buffer-or-string major-mode)) (defun strip-text-properties (txt) (set-text-properties 0 (length txt) nil txt) txt) (defun jump-default-tag () (let ((default (funcall (or find-tag-default-function (get major-mode 'find-tag-default-function) 'find-tag-default)))) (if default (find-tag default)))) (defun find-definition-jump-at-point (point) "Jump to the entity definition." (interactive "d") (push-mark) (let ((mode (buffer-mode (current-buffer)))) (cond ((equal 'emacs-lisp-mode mode) (let ((symb (read (strip-text-properties (thing-at-point 'symbol))))) (when symb (cond ((functionp symb) (find-function symb)) (t (find-variable symb)))))) (t ; other modes (if (semantic-active-p) (condition-case nil (semantic-ia-fast-jump point) (error (jump-default-tag))) (jump-default-tag)))))) (defun find-definition-jump-mouse (start-event) "Jump to the entity definition by mouse click." (interactive "e") (mouse-drag-region start-event) (find-definition-jump-at-point (point))) |
From: David E. <de...@ra...> - 2013-12-17 20:48:53
|
'kostafey' writes: > I'm making a function for simplify navigation to the definitions of some > entities (e.g. classes or functions). It is based on the CEDET, but not only. > > e.g. you can bind: > > (global-set-key (kbd "<C-down-mouse-1>") 'find-definition-jump-mouse) > > or bind find-definition-jump-at-point to some key, if you dislike to use mouse > :). > > and then click Ctrl-mouse (like in ordinary IDE) to the class or function and > it will do it's best to find entity definition and jump to it (via elisp own, > CEDET or tags navigation measures). > > Can it be included to the CEDET (after necessary adapt, of course) in the some > form? Since those functions would support different packages apart from CEDET, I don't think putting them into CEDET would be a good idea. Those should rather be handled in a different package, like 'company' or 'auto-complete' do it for providing in-buffer completions. -David |
From: kostafey <kos...@gm...> - 2013-12-18 07:14:33
|
It seems, that there is no proper project to include, and I need a new one. Thank you for answer. 2013/12/18 David Engster <de...@ra...> > 'kostafey' writes: > > I'm making a function for simplify navigation to the definitions of some > > entities (e.g. classes or functions). It is based on the CEDET, but not > only. > > > > e.g. you can bind: > > > > (global-set-key (kbd "<C-down-mouse-1>") 'find-definition-jump-mouse) > > > > or bind find-definition-jump-at-point to some key, if you dislike to use > mouse > > :). > > > > and then click Ctrl-mouse (like in ordinary IDE) to the class or > function and > > it will do it's best to find entity definition and jump to it (via elisp > own, > > CEDET or tags navigation measures). > > > > Can it be included to the CEDET (after necessary adapt, of course) in > the some > > form? > > Since those functions would support different packages apart from CEDET, > I don't think putting them into CEDET would be a good idea. Those should > rather be handled in a different package, like 'company' or > 'auto-complete' do it for providing in-buffer completions. > > -David > |