From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED!not-for-mail
From: =?utf-8?Q?H=C3=A9ctor?= Lahoz <hectorlahoz@gmail.com>
Newsgroups: gmane.emacs.help
Subject: strange behaviour in keyboard macro
Date: Sun, 30 Jul 2017 07:51:06 +0200
Message-ID: <20170730055106.GA2292@ordenador31>
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: blaine.gmane.org 1501393912 2042 195.159.176.226 (30 Jul 2017 05:51:52 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 30 Jul 2017 05:51:52 +0000 (UTC)
User-Agent: Mutt/1.5.23 (2014-03-12)
To: help-gnu-emacs@gnu.org
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jul 30 07:51:46 2017
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geh-help-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>)
	id 1dbh8k-0000AE-4Z
	for geh-help-gnu-emacs@m.gmane.org; Sun, 30 Jul 2017 07:51:46 +0200
Original-Received: from localhost ([::1]:54293 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>)
	id 1dbh8p-00067z-SR
	for geh-help-gnu-emacs@m.gmane.org; Sun, 30 Jul 2017 01:51:51 -0400
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53832)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <hectorlahoz@gmail.com>) id 1dbh8L-00067t-3N
	for help-gnu-emacs@gnu.org; Sun, 30 Jul 2017 01:51:21 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <hectorlahoz@gmail.com>) id 1dbh8G-0001pp-98
	for help-gnu-emacs@gnu.org; Sun, 30 Jul 2017 01:51:21 -0400
Original-Received: from mail-wr0-x233.google.com ([2a00:1450:400c:c0c::233]:36854)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <hectorlahoz@gmail.com>)
	id 1dbh8G-0001p3-1P
	for help-gnu-emacs@gnu.org; Sun, 30 Jul 2017 01:51:16 -0400
Original-Received: by mail-wr0-x233.google.com with SMTP id y43so167775409wrd.3
	for <help-gnu-emacs@gnu.org>; Sat, 29 Jul 2017 22:51:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
	h=date:from:to:subject:message-id:mail-followup-to:mime-version
	:content-disposition:user-agent;
	bh=df0r+O2XHmq5qA+72BoZcc8e/pJpAyOICamEljwuf/I=;
	b=dfFlCqBDzQS6yQXhD1cB0uFNS2hvVSaxvKOjuxSFAGCEKZ1u5BvsYZD6FWYej+GdM1
	yvWQs5YrHGtwsYHXLZx3qmMi8xgyqyzDf/+dKdDeT7/z8XgqF+wLBHVE6CcVBnNv5q48
	YGHTU14NDn6N7vroFJnACw16Q7oy+6GWZA1dbQ57AIoZlGBkXdOVMmgjWO0VpHr8gVla
	aKGteJA5aBxFTR95esJmmr07iPsrvVyzV6ZiK3FlA6lMvm4RvqOcQHXScYiHMc6wItl/
	lgNagxXnUXNhO7O5V577vhzI6mjvzpV7uPSOx7NCGu5SUC01/gEuKiFNPnbDdFcpl8pp
	znYw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=1e100.net; s=20161025;
	h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to
	:mime-version:content-disposition:user-agent;
	bh=df0r+O2XHmq5qA+72BoZcc8e/pJpAyOICamEljwuf/I=;
	b=tAcSXDLK8r0uwBwaZAOwtxCfRNv5mQhTfo0a6Pww2x9vx4k/WAQnlBcFqd++ph7VD5
	B7ZprFQaI8CUGhx85/rzf8n1rqPC6EasuDSeafyWi/b4aQSa1wAEaDKVZMYaVzkXJl4d
	i0hTKhc4TB54aYQewcmSxeqE+Wd4bbZ4jNqImk10T9l3vDyp3LlqM81hqIcQGQa3NrDt
	dCPvLeAxM5ZT8hSbmD8Y3HI6l18Fo+MuQ7fUL1QTEQ78ac5bc+UPU8LU6h0EOW2ui6Dd
	VcXlR0zMjuOvuPNPy6g01znqAwUv+MUP0TPBMVqLwq6uuyZzk3+stAXEz82t98DwIZKT
	POLw==
X-Gm-Message-State: AIVw110MaVz1I24h0fL/X/5MSy13TDL6GDeBCq681V0YG/GXno1reAe+
	uEUJBInoI8rr3ozj
X-Received: by 10.223.161.84 with SMTP id r20mr9977591wrr.91.1501393873068;
	Sat, 29 Jul 2017 22:51:13 -0700 (PDT)
Original-Received: from ordenador31 ([148.3.202.125]) by smtp.gmail.com with ESMTPSA id
	z37sm4830729wrc.56.2017.07.29.22.51.11 for <help-gnu-emacs@gnu.org>
	(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
	Sat, 29 Jul 2017 22:51:12 -0700 (PDT)
Mail-Followup-To: help-gnu-emacs@gnu.org
Content-Disposition: inline
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-Received-From: 2a00:1450:400c:c0c::233
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/help-gnu-emacs/>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: "help-gnu-emacs"
	<help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.help:113910
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/113910>

I saved a keyboard macro like this:

<<search-forward>>	;; search-forward
Priority:		;; self-insert-command * 9
SPC			;; self-insert-command
required		;; self-insert-command * 8
RET			;; newline
<<backward-paragraph>>	;; backward-paragraph
C-n			;; next-line
<<search-forward>>	;; search-forward
:			;; self-insert-command
SPC			;; self-insert-command
RET			;; newline

When I execute it sometimes it does what I mean and the cursor ends on the right line.
But sometimes it ends (erroneously) on the following line. For example (I added numbers
for reference):

1: Package: mypkg
2: xxxxxxxxxxxxxx
3:  xxxxxxxxxxxxxx
4: Priority: normal
5: 
6: Package: mypkg2
7: xxxxxxxxxxxxxx
8: Priority: required

backward-paragraph should set the cursor at line 5 (blank line) so
cursor should end up at line 6.

At first it seemed random. Then I tried to find a pattern and found
out that it has something to do with text scrolling. When I repeat the
macro starting at a distant point (like half the window size) I manage
to get alternating results, that is, with one execution it ends at
line 6 and with the next execution (reseting the start position) it
ends at line 7.

Emacs version 24.4.1. Fundamental mode.
Is this a bug? I think with emacs 23 it worked fine.