Re: function for add-log-current-defun-function?

Eric Ludlam <[email protected]> Fri, 15 Apr 2016 08:01:45 -0400
Newsgroups gmane.emacs.semantic
Message-ID <[email protected]>
On 04/14/2016 04:07 PM, Stephen Leake wrote:
> Eric Ludlam <[email protected]> writes:
>
>> On 04/01/2016 04:40 PM, Stephen Leake wrote:
>>> Does semantic provide a function suitable for function for
>>> add-log-current-defun-function?
>>
>> Hi,
>>
>> The senator package has advice for `add-log-current-defun' that is
>> enabled if you also enable senator mode.
>
> I don't see that anywhere in senator.el or semantic/*.
>
> I searched for "add-log".
>
> I'm using Emacs emacs-25 branch (not quite current).
>
> Did the old cedet repository ever get merged into this?

The CEDET git repository is ahead of Emacs, but also Emacs has deleted a 
bunch of stuff from CEDET during the merge.  I've lost track of all the 
differences.

>> Alternately, you could just force it on however you like.
>>
>> I took a peak at add-log-current-defun and see that it is not
>> parameterized so there is a better way to do this.
>
> ?

not --> now


> That's what add-log-current-defun-function is for; it completely
> replaces the implementation of add-log-current-defun.

Yes, That was a typo - sorry.  When I used advice in senator, there was 
no override variable.

Here's the senator advice for add log which should be easy to adapt into 
add-log.

Eric

(defadvice add-log-current-defun (around senator activate)
   "Return name of function definition point is in, or nil."
   (if senator-minor-mode
       (let ((tag (semantic-current-tag))
             (name nil))
         (if (and tag (memq (semantic-tag-class tag)
                            senator-add-log-tags))
             (progn
               (setq name
		    (replace-regexp-in-string
		     "\\(?:(\\|)\\)" ""
		     (semantic-format-tag-canonical-name
		      tag (semantic-current-tag-parent))))
               (setq ad-return-value name))
           ad-do-it))
     ad-do-it))

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z