unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Juri Linkov <juri@jurta.org>
Cc: 6100@debbugs.gnu.org
Subject: bug#6100: c-beginning-of-defun doesn't push mark
Date: Thu, 6 May 2010 10:54:33 +0000	[thread overview]
Message-ID: <20100506105433.GA1366__40931.241963017$1273161149$gmane$org@muc.de> (raw)
In-Reply-To: <87k4rimcdr.fsf@mail.jurta.org>

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).






  parent reply	other threads:[~2010-05-06 10:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-04 16:01 bug#6100: c-beginning-of-defun doesn't push mark Juri Linkov
2010-05-05 13:16 ` Stefan Monnier
     [not found] ` <jwvk4ripk1d.fsf-monnier+emacs@gnu.org>
2010-05-05 18:28   ` Juri Linkov
2010-05-05 20:29     ` Stefan Monnier
2010-05-06 10:54     ` Alan Mackenzie [this message]
     [not found]     ` <20100506105433.GA1366@muc.de>
2010-05-11 19:22       ` Stefan Monnier
2010-05-12 11:21         ` Alan Mackenzie
2010-05-12 13:26 ` bug#6100: Fix Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20100506105433.GA1366__40931.241963017$1273161149$gmane$org@muc.de' \
    --to=acm@muc.de \
    --cc=6100@debbugs.gnu.org \
    --cc=juri@jurta.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).