function for add-log-current-defun-function?
Stephen Leake <[email protected]> Fri, 01 Apr 2016 15:40:32 -0500
| Newsgroups | gmane.emacs.semantic |
|---|---|
| Message-ID | <[email protected]> |
Does semantic provide a function suitable for function for
add-log-current-defun-function?
The default java-mode does a bad job for this, so I'd like to use
semantic to make a better one.
I came up with:
(defun senator-current-defun ()
"Return name of current defun (a string).
Useful for add-log-current-defun-function."
(save-excursion
(let* ((senator-highlight-found nil)
;; Step at beginning of next tag with class specified in
;; `senator-step-at-tag-classes'.
(senator-step-at-start-end-tag-classes t)
(tag (senator-previous-tag)))
(when tag
(semantic-tag-name tag)))))
That works fairly well. One complaint is it returns member variables
instead of the class; given
public class AuthorSearchFragment extends Fragment
{
final static String ARG_ID = "id";
int iD = Database.nullId; // selects which author to display.
If point is on Database, I'd like senator-current-defun to return
"AuthorSearchFragment", not "iD". I can filter the tag class for
"function" rather than "variable", but the class name is _not_
tagged (senator-previous-tag doesn't stop on the class).
--
-- Stephe
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140