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 08:37:44 +0100 Organization: The Church of Emacs Message-ID: <8738aaq7xz.fsf@vsl28t2g.ww011> References: <877fzmqunb.fsf@vsl28t2g.ww011> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1414401689 3249 80.91.229.3 (27 Oct 2014 09:21:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 27 Oct 2014 09:21:29 +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 10:21:22 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 1XigUM-00034r-5r for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Oct 2014 10:21:22 +0100 Original-Received: from localhost ([::1]:60205 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XigUL-0001Ej-LH for geb-bug-gnu-emacs@m.gmane.org; Mon, 27 Oct 2014 05:21:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XigU9-0000zi-Vh for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 05:21:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XigU3-0005LL-5Z for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 05:21:09 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44265) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XigU3-0005LH-2N for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 05:21:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XigU1-0007Nd-RF for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 05:21:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <877fzmqunb.fsf@vsl28t2g.ww011> Resent-From: dieter@duenenhof-wilhelm.de (H. Dieter Wilhelm) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Oct 2014 09:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 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.141440164228331 (code B ref -1); Mon, 27 Oct 2014 09:21:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Oct 2014 09:20:42 +0000 Original-Received: from localhost ([127.0.0.1]:36363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XigTc-0007Mh-M9 for submit@debbugs.gnu.org; Mon, 27 Oct 2014 05:20:41 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:55095) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XigTZ-0007MP-0o for submit@debbugs.gnu.org; Mon, 27 Oct 2014 05:20:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XigTM-0005FN-Ub for submit@debbugs.gnu.org; Mon, 27 Oct 2014 05:20:27 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:38703) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XigTM-0005FG-S3 for submit@debbugs.gnu.org; Mon, 27 Oct 2014 05:20:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56714) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XigTG-0008MB-TG for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 05:20:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XigTA-0005C4-Tz for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 05:20:14 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:57847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XigTA-0005Au-Jt for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 05:20:08 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XifX1-0003yY-BR for bug-gnu-emacs@gnu.org; Mon, 27 Oct 2014 09:20:03 +0100 Original-Received: from p57acd226.dip0.t-ipconnect.de ([87.172.210.38]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 27 Oct 2014 09:20:03 +0100 Original-Received: from dieter by p57acd226.dip0.t-ipconnect.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 27 Oct 2014 09:20:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 291 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: p57acd226.dip0.t-ipconnect.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:Iw53S0/620lZew01ZDTPBctBmyw= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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:95146 dieter@duenenhof-wilhelm.de (H. Dieter Wilhelm) writes: > 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: I'm sorry, I overlooked a special case: (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 this or 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 region already marked. This also means when activating the mark immediately 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 (or (region-active-p) (and (eq last-command this-command) mark-active))) (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))))) 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 08:31:27.457755345 +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,416 ---- (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 this or 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 region already marked. This also means when activating ! the mark immediately 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 ! (or (region-active-p) ! (and (eq last-command this-command) mark-active))) ! (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 08:31:56 2014 > (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