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

Eric Ludlam <[email protected]> Wed, 13 Apr 2016 20:27:42 -0400
Newsgroups gmane.emacs.semantic
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------070505030601060104000604
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit

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.

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.  I'd be open to a 
patch for it.  For example, integration with completion-at-point 
functions is in semantic.el.

For your entertainment, I've included a function I use, but never 
polished enough to make part of CEDET.  It depends on the senator advice 
for add-log-current-defun.  Maybe it will spawn some good ideas.

Eric

--------------070505030601060104000604
Content-Type: text/x-emacs-lisp;
 name="myvc.el"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="myvc.el"

;; Useful VC commands for eric

(defun vc-add-log-entries ()
  "Populate the current log with change log entry points.
A change log entry point starts with \"(symbolname):\" for each symbol
which appears in a difference."
  (interactive)
  ;; Find the difference for our buffer.
  (let ((diff-functions nil))
    (if (catch 'diff-process
	  (save-excursion
	    (save-window-excursion
	      (if (get-buffer "*vc-diff*")
		  (set-buffer "*vc-diff*")
		(vc-diff nil))
	      ;; In the DIFF buffer.
	      (if (get-buffer-process (current-buffer))
		  ;; We have a process, run something when it's over.
		  (throw 'diff-process 'process)
		;; We have a diff buffer, collect the info.
		)
	      (require 'add-log)
	      (save-excursion
		(goto-char (point-min))
		(diff-hunk-next 1)
		(while (not (eobp))
		  (re-search-forward "^[-+!]\\s-")
		  (beginning-of-line)
		  (if (looking-at "! ")
		      ;; We need to find the match in the
		      ;; opposite side of the entry
		      (progn
			(re-search-forward "^--- [0-9]")
			(re-search-forward "^! ")))
		  (save-excursion
		    (let* ((b (diff-find-source-location))
			   (buff (car b))
			   (pos (car (car (cdr (cdr b)))))
			   (src (car (cdr (cdr (cdr b)))))
			   (fn nil))
		      (set-buffer buff)
		      (goto-char (+ pos (cdr src)))
		      (forward-line (car (cdr b)))
		      (end-of-line)
		      (setq fn (add-log-current-defun))
		      (if (not (equal (car diff-functions) fn))
			  (setq diff-functions (cons fn diff-functions)))))
		  (condition-case nil
		      (diff-hunk-next 1)
		    (error (goto-char (point-max))))
		  ))))
	  ;; We've collected all the entries, now pop back out, and add
	  ;; these functions to the vc log buffer.
	  (setq diff-functions (nreverse diff-functions))
	  (while diff-functions
	    (when (stringp (car diff-functions))
	      (insert "(" (car diff-functions) "): \n"))
	    (setq diff-functions (cdr diff-functions)))
	  nil)
	;; We have a catch, show the diff buffer.
	(progn
	  (pop-to-buffer "*vc-diff*")
	  (error "Try again when the diff is done")
	  ))))

(provide 'myvc)

--------------070505030601060104000604
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
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
--------------070505030601060104000604
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
cedet-semantic mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cedet-semantic

--------------070505030601060104000604--