GNU bug report logs - #6100
c-beginning-of-defun doesn't push mark

Previous Next

Packages: cc-mode, emacs;

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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Alan Mackenzie <acm <at> muc.de>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#6100: closed (c-beginning-of-defun doesn't push mark)
Date: Wed, 12 May 2010 13:18:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 12 May 2010 13:26:03 +0000
with message-id <20100512132603.GB1280 <at> muc.de>
and subject line Fix
has caused the GNU bug report #6100,
regarding c-beginning-of-defun doesn't push mark
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
6100: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6100
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Juri Linkov <juri <at> jurta.org>
To: bug-gnu-emacs <at> gnu.org
Subject: c-beginning-of-defun doesn't push mark
Date: Tue, 04 May 2010 19:01:45 +0300
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/



[Message part 3 (message/rfc822, inline)]
From: Alan Mackenzie <acm <at> muc.de>
To: 6100-done <at> debbugs.gnu.org
Subject: Fix
Date: Wed, 12 May 2010 13:26:03 +0000
c-{beginning,end}-of-function now push the mark like beginning-of-defun
does.

-- 
Alan Mackenzie (Nuremberg, Germany).


This bug report was last modified 15 years and 64 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.