From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: dieter@duenenhof-wilhelm.de (H. Dieter Wilhelm) Newsgroups: gmane.emacs.devel Subject: Strange behaviour of M-h with negative arguments Date: Thu, 23 Oct 2014 07:40:37 +0200 Organization: The Church of Emacs Message-ID: <87h9yvgx7u.fsf@vsl28t2g.ww011> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1414042945 26970 80.91.229.3 (23 Oct 2014 05:42:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Oct 2014 05:42:25 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 23 07:42:18 2014 Return-path: Envelope-to: ged-emacs-devel@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 1XhBA8-0006J2-Uo for ged-emacs-devel@m.gmane.org; Thu, 23 Oct 2014 07:42:17 +0200 Original-Received: from localhost ([::1]:34708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhBA8-00009q-IF for ged-emacs-devel@m.gmane.org; Thu, 23 Oct 2014 01:42:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhB8s-0006q6-Op for emacs-devel@gnu.org; Thu, 23 Oct 2014 01:41:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XhB8k-0008Cy-M3 for emacs-devel@gnu.org; Thu, 23 Oct 2014 01:40:58 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:49873) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhB8k-0008Cr-Ai for emacs-devel@gnu.org; Thu, 23 Oct 2014 01:40:50 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XhB8i-0005nQ-PX for emacs-devel@gnu.org; Thu, 23 Oct 2014 07:40:48 +0200 Original-Received: from p4fd4e4ce.dip0.t-ipconnect.de ([79.212.228.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Oct 2014 07:40:48 +0200 Original-Received: from dieter by p4fd4e4ce.dip0.t-ipconnect.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Oct 2014 07:40:48 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 98 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: p4fd4e4ce.dip0.t-ipconnect.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:jltmbG+Wu2jR+Yuxoi8CwWua0Fs= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:175714 Archived-At: Hello (), please try from Emacs-24.4 to: M-- M-h M-h M-h. This is not in line with the other marking commands like M-@... Would somebody please have a look at the following? diff -c /usr/local/src/emacs-24.4/lisp/textmodes/paragraphs.el /usr/local/src/emacs/lisp/textmodes/paragraphs.el *** /usr/local/src/emacs-24.4/lisp/textmodes/paragraphs.el 2014-03-21 06:34:40.000000000 +0100 --- /usr/local/src/emacs/lisp/textmodes/paragraphs.el 2014-10-22 18:48:01.603492155 +0200 *************** *** 370,400 **** (forward-paragraph (- arg))) (defun mark-paragraph (&optional arg allow-extend) ! "Put point at beginning of this paragraph, mark at end. ! The paragraph marked is the one that contains point or follows point. ! With argument ARG, puts mark at end of a following paragraph, so that ! the number of paragraphs marked equals ARG. ! If ARG is negative, point is put at end of this paragraph, mark is put ! at beginning of this or a previous paragraph. ! Interactively (or if ALLOW-EXTEND is non-nil), if this command is ! repeated or (in Transient Mark mode) if the mark is active, ! it marks the next ARG paragraphs after the ones already marked." ! (interactive "p\np") ! (unless arg (setq arg 1)) ! (when (zerop arg) ! (error "Cannot mark zero paragraphs")) ! (cond ((and allow-extend ! (or (and (eq last-command this-command) (mark t)) (and transient-mark-mode mark-active))) (set-mark (save-excursion ! (goto-char (mark)) (forward-paragraph arg) (point)))) ! (t (forward-paragraph arg) (push-mark nil t t) (backward-paragraph arg)))) --- 370,411 ---- (forward-paragraph (- arg))) (defun mark-paragraph (&optional arg allow-extend) ! "Put mark at beginning of this paragraph, point at end. ! The paragraph marked is the one that contains point or follows ! point. ! With argument ARG, puts mark at the end of a following paragraph, ! so that the number of paragraphs marked equals ARG. ! If ARG is negative, point is put at the beginning of this ! paragraph, mark is put at the end of this or a previous ! paragraph. ! Interactively, if this command is repeated or (in Transient Mark ! mode) if the mark is active, it marks the next ARG paragraphs ! after the ones already marked. This means when activating the ! mark before using this command, the current paragraph is only ! marked from point." ! (interactive "P\np") ! (cond ((zerop (prefix-numeric-value arg)) ;argument is zero ! (message "Will not mark zero paragraphs.")) ;currently ERROR ! ((and allow-extend ;we already called this function ! (or (and (eq last-command this-command) (mark t) mark-active) (and transient-mark-mode mark-active))) + (if arg + (setq arg (prefix-numeric-value arg)) + (if (< (mark) (point)) + (setq arg -1) + (setq arg 1))) (set-mark (save-excursion ! (if mark-active (goto-char (mark))) (forward-paragraph arg) (point)))) ! (t ;we are in an empty line or a paragraph ! (if arg ! (setq arg (prefix-numeric-value arg)) ! (setq arg 1)) (forward-paragraph arg) (push-mark nil t t) (backward-paragraph arg)))) Diff finished. Thu Oct 23 07:28:33 2014 Thanks Dieter -- Best wishes H. Dieter Wilhelm Darmstadt, Germany