I was wondering the same thing: M-C-a and M-C-e move over classes (and
functions in C), and I was looking for something to move over methods.  I'm
surprised there isn't anything in cc-mode for this.

Thanks David!

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On
Behalf Of David Ponce
Sent: Wednesday, April 12, 2000 1:28 PM
To: Lance Johnston; [EMAIL PROTECTED]
Subject: Re: Previous/Next Method?


Lance Johnston wrote:
>
> Does JDE provide a "move the cursor to previous/next method" type of
> function? I've looked around some, but can't seem to find anything.
>

Hello,

I use the following commands, based on font-lock-mode, to move the
cursor to previous/next method:

(defun next-function-name-face ()
  "Point to next `font-lock-function-name-face' text."
  (interactive)
  (let ((pos (point)))
    (if (eq (get-text-property pos 'face) 'font-lock-function-name-face)
      (setq pos (or (next-property-change pos) (point-max))))
    (setq pos (text-property-any pos (point-max) 'face
'font-lock-function-name-face))
    (if pos
        (goto-char pos)
      (progn
        (goto-char (point-max))
        (message "End of buffer")))))

(defun prev-function-name-face ()
  "Point to previous `font-lock-function-name-face' text."
  (interactive)
  (let ((pos (point)))
    (if (eq (get-text-property pos 'face) 'font-lock-function-name-face)
      (setq pos (or (previous-property-change pos) (point-min))))
    (setq pos (previous-property-change pos))
    (while (and pos (not (eq (get-text-property pos 'face)
'font-lock-function-name-face)))
      (setq pos (previous-property-change pos)))
    (if pos
        (progn
          (setq pos (previous-property-change pos))
          (goto-char (or (and pos (1+ pos)) (point-min))))
      (progn
        (goto-char (point-min))
        (message "Beginning of buffer")))))

(global-set-key [A-next]  'next-function-name-face)
(global-set-key [A-prior] 'prev-function-name-face)

These commands works well too in elisp mode, and probably others ones
that use font-lock-mode :-)

Hope this will help.
Sincerely,

David

Reply via email to