GNU bug report logs -
#6100
c-beginning-of-defun doesn't push mark
Previous Next
Reported by: Juri Linkov <juri <at> jurta.org>
Date: Tue, 4 May 2010 16:24:01 UTC
Severity: minor
Tags: patch
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6100 in the body.
You can then email your comments to 6100 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
:
bug#6100
; Package
emacs
.
(Tue, 04 May 2010 16:24:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> jurta.org>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 04 May 2010 16:24:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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':
=== modified file 'lisp/progmodes/cc-cmds.el'
--- lisp/progmodes/cc-cmds.el 2010-04-19 15:07:52 +0000
+++ lisp/progmodes/cc-cmds.el 2010-05-04 16:01:05 +0000
@@ -1501,6 +1501,11 @@ (defun c-beginning-of-defun (&optional a
(interactive "p")
(or arg (setq arg 1))
+ (or (not (eq this-command 'c-beginning-of-defun))
+ (eq last-command 'c-beginning-of-defun)
+ (and transient-mark-mode mark-active)
+ (push-mark))
+
(c-save-buffer-state
(beginning-of-defun-function end-of-defun-function
(start (point))
@@ -1604,6 +1609,11 @@ (defun c-end-of-defun (&optional arg)
(interactive "p")
(or arg (setq arg 1))
+ (or (not (eq this-command 'c-end-of-defun))
+ (eq last-command 'c-end-of-defun)
+ (and transient-mark-mode mark-active)
+ (push-mark))
+
(c-save-buffer-state
(beginning-of-defun-function end-of-defun-function
(start (point))
--
Juri Linkov
http://www.jurta.org/emacs/
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:
bug#6100
; Package
emacs,cc-mode
.
(Wed, 05 May 2010 13:17:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 6100 <at> debbugs.gnu.org (full text, mbox):
> 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'.
Stefan
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:
bug#6100
; Package
emacs,cc-mode
.
(Wed, 05 May 2010 18:29:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 6100 <at> debbugs.gnu.org (full text, mbox):
>> 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'?
--
Juri Linkov
http://www.jurta.org/emacs/
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:
bug#6100
; Package
emacs,cc-mode
.
(Wed, 05 May 2010 20:30:03 GMT)
Full text and
rfc822 format available.
Message #14 received at 6100 <at> debbugs.gnu.org (full text, mbox):
> Do you mean cc-mode should use `beginning-of-defun-function'?
AFAIK it already does, so just using the beginning-of-defun command
should DTRT.
Stefan
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:
bug#6100
; Package
emacs,cc-mode
.
(Thu, 06 May 2010 10:47:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 6100 <at> debbugs.gnu.org (full text, mbox):
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).
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:
bug#6100
; Package
emacs,cc-mode
.
(Tue, 11 May 2010 19:23:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 6100 <at> debbugs.gnu.org (full text, mbox):
> 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.
IIUC the speed of those operations has been a problem when called many
times within a single command (i.e. the cumulative time became
a problem), so it shouldn't be a problem for interactive use where doing
it 4 times rather than 1 shouldn't be noticeable.
IOW, the problem was algorithmic, but running the same code 4 times
makes no difference algorithmically.
> I would favour your patch to these defuns which pushes the marks.
It's your code, so it's your choice.
Stefan
Information forwarded
to
owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:
bug#6100
; Package
emacs,cc-mode
.
(Wed, 12 May 2010 11:13:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 6100 <at> debbugs.gnu.org (full text, mbox):
Hi, Stefan and Juri,
On Tue, May 11, 2010 at 03:22:10PM -0400, Stefan Monnier wrote:
> > I would favour your patch to these defuns which pushes the marks.
> It's your code, so it's your choice.
I've commited Juri's patch. The mark will now be pushed when
appropriate in c-{beginning,end}-of-function.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
Reply sent
to
Alan Mackenzie <acm <at> muc.de>
:
You have taken responsibility.
(Wed, 12 May 2010 13:18:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Juri Linkov <juri <at> jurta.org>
:
bug acknowledged by developer.
(Wed, 12 May 2010 13:18:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 6100-done <at> debbugs.gnu.org (full text, mbox):
c-{beginning,end}-of-function now push the mark like beginning-of-defun
does.
--
Alan Mackenzie (Nuremberg, Germany).
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 10 Jun 2010 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 15 years and 63 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.