From: Gerd Moellmann Date: Tue, 11 Jan 2000 15:08:47 +0000 (+0000) Subject: (add-log-current-defun): Call X-Git-Tag: emacs-pretest-21.0.90~5391 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c1356086c3fc3f24c4d277c5532dac9dbfb7c8f4;p=emacs.git (add-log-current-defun): Call `add-log-current-defun-function'. Try matches at level 0 and level 1. Strip whitespace from defun found. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 59d96bb9cea..2c9180c3e9a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2000-01-09 Sun Jari Aalto + + * add-log.el (add-log-current-defun): Call + `add-log-current-defun-function'. Try matches at level 0 and + level 1. Strip whitespace from defun found. + 2000-01-10 John Wiegley * allout.el (isearch-done/outline-provisions): Added `edit' diff --git a/lisp/add-log.el b/lisp/add-log.el index 333089d5cff..30802c4155d 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el @@ -581,14 +581,17 @@ Texinfo (@node titles), Perl, and Fortran. Other modes are handled by a heuristic that looks in the 10K before point for uppercase headings starting in the first column or -identifiers followed by `:' or `=', see variable -`add-log-current-defun-header-regexp'. +identifiers followed by `:' or `=', see variables +`add-log-current-defun-header-regexp' and +`add-log-current-defun-function' Has a preference of looking backwards." (condition-case nil (save-excursion (let ((location (point))) - (cond ((memq major-mode add-log-lisp-like-modes) + (cond ((functionp add-log-current-defun-function) + (funcall add-log-current-defun-function)) + ((memq major-mode add-log-lisp-like-modes) ;; If we are now precisely at the beginning of a defun, ;; make sure beginning-of-defun finds that one ;; rather than the previous one. @@ -771,13 +774,22 @@ Has a preference of looking backwards." "main"))) (t ;; If all else fails, try heuristics - (let (case-fold-search) + (let (case-fold-search + result) (end-of-line) - (if (re-search-backward add-log-current-defun-header-regexp - (- (point) 10000) - t) - (buffer-substring (match-beginning 1) - (match-end 1)))))))) + (when (re-search-backward + add-log-current-defun-header-regexp + (- (point) 10000) + t) + (setq result (or (buffer-substring (match-beginning 1) + (match-end 1)) + (buffer-substring (match-beginning 0) + (match-end 0)))) + ;; Strip whitespace away + (when (string-match "\\([^ \t\n\r\f].*[^ \t\n\r\f]\\)" + result) + (setq result (match-string 1 result))) + result)))))) (error nil))) (defvar change-log-get-method-definition-md)