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: Juri Linkov
Subject: bug#6100: c-beginning-of-defun doesn't push mark
Date: Tue, 04 May 2010 19:01:45 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu)

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/







reply via email to

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