From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#10899: 24.0.93; c-forward-conditional should not move the mark Date: Tue, 28 Feb 2012 12:30:46 +0200 Organization: JURTA Message-ID: <87399v2qsp.fsf@mail.jurta.org> References: <83haycdnqt.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1330426078 16618 80.91.229.3 (28 Feb 2012 10:47:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 28 Feb 2012 10:47:58 +0000 (UTC) Cc: 10899@debbugs.gnu.org To: Dani Moncayo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 28 11:47:57 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S2Kb4-0006jr-Sx for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Feb 2012 11:47:55 +0100 Original-Received: from localhost ([::1]:54827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2Kb4-0007iL-Ak for geb-bug-gnu-emacs@m.gmane.org; Tue, 28 Feb 2012 05:47:54 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:40607) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2Kav-0007fo-J3 for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 05:47:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S2Kak-0008QA-GH for bug-gnu-emacs@gnu.org; Tue, 28 Feb 2012 05:47:45 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S2KaX-0008Ok-MI; Tue, 28 Feb 2012 05:47:21 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1S2Kd8-0003WC-9x; Tue, 28 Feb 2012 05:50:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Tue, 28 Feb 2012 10:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10899 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 10899-submit@debbugs.gnu.org id=B10899.133042618513487 (code B ref 10899); Tue, 28 Feb 2012 10:50:02 +0000 Original-Received: (at 10899) by debbugs.gnu.org; 28 Feb 2012 10:49:45 +0000 Original-Received: from localhost ([127.0.0.1]:60800 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2Kcq-0003VH-Vy for submit@debbugs.gnu.org; Tue, 28 Feb 2012 05:49:45 -0500 Original-Received: from ps18281.dreamhost.com ([69.163.218.105]:44740 helo=ps18281.dreamhostps.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S2KcV-0003Uh-Kg for 10899@debbugs.gnu.org; Tue, 28 Feb 2012 05:49:33 -0500 Original-Received: from localhost (ps18281.dreamhostps.com [69.163.218.105]) by ps18281.dreamhostps.com (Postfix) with ESMTP id 88A6C451C1C9; Tue, 28 Feb 2012 02:44:30 -0800 (PST) In-Reply-To: (Dani Moncayo's message of "Tue, 28 Feb 2012 08:42:43 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (x86_64-pc-linux-gnu) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:57353 Archived-At: > Summarizing: > a. `c-forward-conditional' and `c-backward-conditional' should not set > the mark, because each one has an inverse movement command. > b. Even if you disagree, those commands should not set the mark when > it is active. All similar movement commands like `c-beginning-of-defun' and `c-end-of-defun' take precautions against the behavior you found. They do this by using the following condition before leaving mark behind: (and transient-mark-mode mark-active) The patch below fixes the remaining movement commands to do the same, except `c-mark-function' that needs to be rewritten to follow the logic of `mark-defun' for setting the mark. === modified file 'lisp/progmodes/cc-cmds.el' --- lisp/progmodes/cc-cmds.el 2012-01-25 17:54:01 +0000 +++ lisp/progmodes/cc-cmds.el 2012-02-28 10:27:49 +0000 @@ -2910,7 +2910,8 @@ (defun c-up-conditional (count) forward." (interactive "p") (let ((new-point (c-scan-conditionals (- count) -1))) - (push-mark) + (or (and transient-mark-mode mark-active) + (push-mark)) (goto-char new-point)) (c-keep-region-active)) @@ -2920,7 +2921,8 @@ (defun c-up-conditional-with-else (count directives." (interactive "p") (let ((new-point (c-scan-conditionals (- count) -1 t))) - (push-mark) + (or (and transient-mark-mode mark-active) + (push-mark)) (goto-char new-point)) (c-keep-region-active)) @@ -2934,7 +2936,8 @@ (defun c-down-conditional (count) backward." (interactive "p") (let ((new-point (c-scan-conditionals count 1))) - (push-mark) + (or (and transient-mark-mode mark-active) + (push-mark)) (goto-char new-point)) (c-keep-region-active)) @@ -2944,7 +2947,8 @@ (defun c-down-conditional-with-else (cou directives." (interactive "p") (let ((new-point (c-scan-conditionals count 1 t))) - (push-mark) + (or (and transient-mark-mode mark-active) + (push-mark)) (goto-char new-point)) (c-keep-region-active)) @@ -2959,7 +2963,8 @@ (defun c-backward-conditional (count &op to call `c-scan-conditionals' directly instead." (interactive "p") (let ((new-point (c-scan-conditionals (- count) target-depth with-else))) - (push-mark) + (or (and transient-mark-mode mark-active) + (push-mark)) (goto-char new-point)) (c-keep-region-active)) @@ -2980,7 +2985,8 @@ (defun c-forward-conditional (count &opt to call `c-scan-conditionals' directly instead." (interactive "p") (let ((new-point (c-scan-conditionals count target-depth with-else))) - (push-mark) + (or (and transient-mark-mode mark-active) + (push-mark)) (goto-char new-point))) (defun c-scan-conditionals (count &optional target-depth with-else)