diff options
author | Richard M. Stallman <rms@gnu.org> | 1995-05-08 00:45:17 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1995-05-08 00:45:17 +0000 |
commit | 59c1a7de824207a5e4db6a945417d87fa18e9ef7 (patch) | |
tree | 619ebb7d468b92ee8f71daa1d6036cb70f3eae38 /lisp/add-log.el | |
parent | 002c4306f09aa9a4a81903325c1fa072a0b25ebe (diff) | |
download | emacs-59c1a7de824207a5e4db6a945417d87fa18e9ef7.tar.gz |
(get-method-definition, get-method-definition-1): New functions.
(add-log-current-defun): Use them to handle objc-mode.
Diffstat (limited to 'lisp/add-log.el')
-rw-r--r-- | lisp/add-log.el | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el index b51d43b4158..6305de92392 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el @@ -349,6 +349,8 @@ Has a preference of looking backwards." (skip-chars-forward " \t") (buffer-substring (point) (progn (forward-sexp 1) (point)))) + ((and (eq major-mode 'objc-mode) + (get-method-definition))) ((memq major-mode '(c-mode c++-mode c++-c-mode)) (beginning-of-line) ;; See if we are in the beginning part of a function, @@ -471,6 +473,31 @@ Has a preference of looking backwards." (match-end 1)))))))) (error nil))) +;; Subroutine used within get-method-definition. +;; Add the last match in the buffer to the end of `md', +;; followed by the string END; move to the end of that match. +(defun get-method-definition-1 (end) + (setq md (concat md + (buffer-substring (match-beginning 1) (match-end 1)) + end)) + (goto-char (match-end 0))) + +;; For objective C, return the method name if we are in a method. +(defun get-method-definition () + (let ((md "[")) + (save-excursion + (if (re-search-backward "^@implementation \\(.*\\)$" nil t) + (get-method-definition-1 " "))) + (save-excursion + (cond + ((re-search-backward "^\\([-+]\\)[ \t\n\f\r]*\\(([^)]*)\\)?" nil t) + (get-method-definition-1 "") + (while (not (looking-at "[{;]")) + (looking-at + "\\([^ ;{:\t\n\f\r]*:?\\)\\(([^)]*)\\)?[^ ;{:\t\n\f\r]*[ \t\n\f\r]*") + (get-method-definition-1 "")) + (concat md "]")))))) + (provide 'add-log) |