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.bugs Subject: bug#18847: 24.4; Inconsistent behaviour of M-h with negative arguments Date: Mon, 27 Oct 2014 00:27:20 +0100 Message-ID: <877fzmqunb.fsf@vsl28t2g.ww011> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1414366174 28267 80.91.229.3 (26 Oct 2014 23:29:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Oct 2014 23:29:34 +0000 (UTC) To: 18847@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 27 00:29:25 2014 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 1XiXFU-0000vX-1K for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Oct 2014 00:29:24 +0100 Original-Received: from localhost ([::1]:58628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiXFT-0003VE-MD for geb-bug-gnu-emacs@m.gmane.org; Sun, 26 Oct 2014 19:29:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42002) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiXFH-0003UY-Gv for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 19:29:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XiXF8-0005fT-Cj for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 19:29:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44164) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiXF8-0005fD-AK for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 19:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XiXF7-0000Mj-TO for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 19:29:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: dieter@duenenhof-wilhelm.de (H. Dieter Wilhelm) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Oct 2014 23:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18847 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14143660821318 (code B ref -1); Sun, 26 Oct 2014 23:29:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Oct 2014 23:28:02 +0000 Original-Received: from localhost ([127.0.0.1]:36262 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XiXE9-0000Kv-4k for submit@debbugs.gnu.org; Sun, 26 Oct 2014 19:28:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:39945) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XiXE6-0000Kg-CW for submit@debbugs.gnu.org; Sun, 26 Oct 2014 19:27:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XiXDr-0005G8-SE for submit@debbugs.gnu.org; Sun, 26 Oct 2014 19:27:52 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:53786) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiXDr-0005G4-PF for submit@debbugs.gnu.org; Sun, 26 Oct 2014 19:27:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiXDi-0002sQ-Mh for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 19:27:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XiXDZ-0005DA-LI for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 19:27:34 -0400 Original-Received: from mail-la0-x22c.google.com ([2a00:1450:4010:c03::22c]:53549) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XiXDZ-0005Cy-8U for bug-gnu-emacs@gnu.org; Sun, 26 Oct 2014 19:27:25 -0400 Original-Received: by mail-la0-f44.google.com with SMTP id hs14so4977222lab.17 for ; Sun, 26 Oct 2014 16:27:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version:content-type; bh=NuWTRd4eud/rih3X/CUM+LXxchvRISHKpZ4yFlx678w=; b=iCbXNhpBBihzsbsIgN9dCFJebebwRnORItLewI5//s4TbGgWU5970au7T0HyMnFJHB y1+K1bodj321K//N/QETb/y9jrGmqr5vPKhQpb7Ckuv1vf/O6+Spr7O8EVSpS5EFbLqV DQNUXpKinla0fKXeCPsH3nc/Y7GjZpVtTxgYn7MKhZwvVyHNyUGrWxQ4ynGIs+7Xw+7S YHERB+RSVhgr3r1Vj3uoaCzWNjboQKU8CuQLzfI/LGuQrfOQ5vHva3aYNlOLSVpUhTpk wPfSsN/1GHMNmDcs71S1fZXUKkAJt8VQmd4ivFL9PEhcfFH9cdUoTDZrZgDIa9wLueae fEDg== X-Received: by 10.112.93.231 with SMTP id cx7mr4999849lbb.89.1414366043574; Sun, 26 Oct 2014 16:27:23 -0700 (PDT) Original-Received: from vsl28t2g.ww011 (p57ACF456.dip0.t-ipconnect.de. [87.172.244.86]) by mx.google.com with ESMTPSA id qg4sm4343988lbb.36.2014.10.26.16.27.22 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 26 Oct 2014 16:27:22 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x 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:95131 Hello, please try M-- M-h M-h M-h. below some paragraphs. The behaviour is not in line with the other marking commands like M-@, ... Here's a suggestion and a matching patch: (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") (let ((numeric-arg (prefix-numeric-value arg))) (cond ((eobp) ; smart-aleck? (backward-paragraph (abs numeric-arg)) (push-mark nil t t) (forward-paragraph (abs numeric-arg))) ((and allow-extend ;we already called this function or have ;a (possibly empty) region (or (eq last-command this-command) (region-active-p))) (if arg (setq arg numeric-arg) (if (< (mark) (point)) (setq arg -1) (setq arg 1))) (set-mark (save-excursion (goto-char (mark)) (forward-paragraph arg) (point)))) ((zerop numeric-arg) (message "Will not mark zero paragraphs.")) (t (forward-paragraph numeric-arg) (push-mark nil t t) (backward-paragraph numeric-arg))))) Thank you for your troubles! 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-27 00:22:41.874845901 +0100 *************** *** 370,403 **** (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)))) (defun kill-paragraph (arg) "Kill forward to end of paragraph. --- 370,417 ---- (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") ! (let ((numeric-arg (prefix-numeric-value arg))) ! (cond ((eobp) ; smart-aleck? ! (backward-paragraph (abs numeric-arg)) ! (push-mark nil t t) ! (forward-paragraph (abs numeric-arg))) ! ((and allow-extend ;we already called this function or have ! ;a (possibly empty) region ! (or (eq last-command this-command) ! (region-active-p))) ! (if arg ! (setq arg numeric-arg) ! (if (< (mark) (point)) ! (setq arg -1) ! (setq arg 1))) ! (set-mark ! (save-excursion ! (goto-char (mark)) ! (forward-paragraph arg) ! (point)))) ! ((zerop numeric-arg) ! (message "Will not mark zero paragraphs.")) ! (t ! (forward-paragraph numeric-arg) ! (push-mark nil t t) ! (backward-paragraph numeric-arg))))) (defun kill-paragraph (arg) "Kill forward to end of paragraph. Diff finished. Mon Oct 27 00:22:49 2014 -- Best wishes H. Dieter Wilhelm Darmstadt, Germany