bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6100: c-beginning-of-defun doesn't push mark


From: Alan Mackenzie
Subject: bug#6100: c-beginning-of-defun doesn't push mark
Date: Thu, 6 May 2010 10:54:33 +0000
User-agent: Mutt/1.5.9i

Hi, Juri,

On Wed, May 05, 2010 at 09:28:32PM +0300, Juri Linkov wrote:
> >> There is one annoying difference between `beginning-of-defun'
> >> and `c-beginning-of-defun':

> >> `beginning-of-defun' and `end-of-defun' pushes the mark for the
> >> old point location to the mark ring with this code:

> >>   (or (not (eq this-command 'beginning-of-defun))
> >>       (eq last-command 'beginning-of-defun)
> >>       (and transient-mark-mode mark-active)
> >>       (push-mark))

> >> but `c-beginning-of-defun' doesn't do that.

> >> This patch add the same code to `c-beginning-of-defun' and 
> >> `c-end-of-defun':

> > Of course, I'd argue that the right fix is to use `beginning-of-defun'.

> Do you mean cc-mode should use `beginning-of-defun-function'?

This would be OK.  Unfortunately, end-of-defun-function isn't called
cleanly.  With a C-M-e, {beginning,end}-of-defun-function are often
called 4 times.  c-end-of-defun, however, already does the Right Thing on
its own.

c-{beginning,end}-of-defun have a heavy overhead in determining the type
of starting position (inside the brace block, inside the function header,
etc.) and in locating a top-level brace (at the start) and the start of
the header (at the end).  This overhead dominates the speed of the
functions, which work essentially as fast regardless of how big ARG is.

The speed of c-{beginning,end}-of-defun have presented problems from time
to time.  Quadrupling CC Mode's end-of-defun's runtime doesn't seem a
good idea.  I want to keep the handling of c-{beginning,end}-of-defun
symmetrical for ease of maintenance.

I would favour your patch to these defuns which pushes the marks.

> Juri Linkov

-- 
Alan Mackenzie (Nuremberg, Germany).






reply via email to

[Prev in Thread] Current Thread [Next in Thread]