From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Asher Gordon Newsgroups: gmane.emacs.bugs Subject: bug#40169: Fix gomoku-plot-square Date: Sat, 21 Mar 2020 19:22:58 -0400 Message-ID: <87pnd58f8t.fsf_-_@posteo.net> References: <87d095ipza.fsf@posteo.net> <875zexfrs5.fsf_-_@posteo.net> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="51103"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) To: 40169@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Mar 22 00:24:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jFnTR-000DAi-1M for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 22 Mar 2020 00:24:13 +0100 Original-Received: from localhost ([::1]:41738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFnTP-00008v-Mk for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 21 Mar 2020 19:24:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36836) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jFnTH-00008p-Rp for bug-gnu-emacs@gnu.org; Sat, 21 Mar 2020 19:24:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jFnTG-0004R9-Hr for bug-gnu-emacs@gnu.org; Sat, 21 Mar 2020 19:24:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42469) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jFnTG-0004QU-3t for bug-gnu-emacs@gnu.org; Sat, 21 Mar 2020 19:24:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jFnTG-0006Ii-0B for bug-gnu-emacs@gnu.org; Sat, 21 Mar 2020 19:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Asher Gordon Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Mar 2020 23:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40169 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 40169-submit@debbugs.gnu.org id=B40169.158483299924156 (code B ref 40169); Sat, 21 Mar 2020 23:24:01 +0000 Original-Received: (at 40169) by debbugs.gnu.org; 21 Mar 2020 23:23:19 +0000 Original-Received: from localhost ([127.0.0.1]:48442 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFnSY-0006HW-Kc for submit@debbugs.gnu.org; Sat, 21 Mar 2020 19:23:18 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:46967) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jFnSV-0006HF-KO for 40169@debbugs.gnu.org; Sat, 21 Mar 2020 19:23:17 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 029302400E6 for <40169@debbugs.gnu.org>; Sun, 22 Mar 2020 00:23:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1584832989; bh=pJYwvjd6mv8+T3wlEWvEkX1mBEgH6pAdiFD+4sLqRmg=; h=From:To:Subject:Date:From; b=rMK+7gcFQpU55/rjrI8U91KHxzCIV7A3Jm7rIA87yeqWbE8p0QLpJ5kcpG31peHbC lUMlsmgPEjsfGlHa7nWI2Agb/Rj8BMJF+OAiNo58y1AvSRI3cdm5VKI5SHIdx1qP7Z QW0zlfGDpkMePqMDkUjnQXo81gIVdntyiMp8a0MKeFgUwopHN1pMeVuF4UuTLLs24j 7HXjL/DdbSYesWha7af73DxLsHSYBSxAOn2170cbEgLgJlENI8iLjkQBp6fl/t+NhO 2582v3JR8zpXT06j+Os+UQQwOKmHlxE02DBYJ1ydu1Fo53vxdsEdXFftoHd72Pjw77 JTHr4H3Im4b7g== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 48lGsR16kzz9rxW for <40169@debbugs.gnu.org>; Sun, 22 Mar 2020 00:23:06 +0100 (CET) In-Reply-To: <875zexfrs5.fsf_-_@posteo.net> (Asher Gordon's message of "Sat, 21 Mar 2020 15:10:18 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:177609 Archived-At: --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, It turns out that `backward-char' in `gomoku-plot-square' should not be replaced. I have attached a patch (gomoku-plot-square.patch) to fix that. For your convenience, I've also attached another patch (gomoku.patch) which combines the previous two patches and this one (with `combinediff' from `patchutils'). I tested it to make sure it applies cleanly. Asher =2D-=20 Only fools are quoted. -- Anonymous -------- I prefer to send and receive mail encrypted. Please send me your public key, and if you do not have my public key, please let me know. Thanks. GPG fingerprint: 38F3 975C D173 4037 B397 8095 D4C9 C4FC 5460 8E68 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=gomoku-plot-square.patch Content-Transfer-Encoding: quoted-printable Content-Description: Fix `gomoku-plot-square' =2D-- gomoku.el~ 2020-03-21 15:06:52.145727337 -0400 +++ gomoku.el 2020-03-21 19:13:36.284656730 -0400 @@ -1000,7 +1000,7 @@ (1- (point)) (point) '(mouse-face highlight help-echo "mouse-2: play at this square"))) (delete-char 1) =2D (gomoku-move-left)) + (backward-char 1)) (sit-for 0)) ; Display NOW =20 (defun gomoku-init-display (n m) --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=gomoku.patch Content-Transfer-Encoding: quoted-printable Content-Description: Combination of all three patches diff -u gomoku.el gomoku.el =2D-- gomoku.el 2020-03-21 15:06:52.145727337 -0400 +++ gomoku.el 2020-03-21 19:13:36.284656730 -0400 @@ -110,8 +110,8 @@ (define-key map "u" 'gomoku-move-ne) ; u (define-key map "b" 'gomoku-move-sw) ; b (define-key map "n" 'gomoku-move-se) ; n =2D (define-key map "h" 'backward-char) ; h =2D (define-key map "l" 'forward-char) ; l + (define-key map "h" 'gomoku-move-left) ; h + (define-key map "l" 'gomoku-move-right) ; l (define-key map "j" 'gomoku-move-down) ; j (define-key map "k" 'gomoku-move-up) ; k =20 @@ -119,11 +119,13 @@ (define-key map [kp-9] 'gomoku-move-ne) (define-key map [kp-1] 'gomoku-move-sw) (define-key map [kp-3] 'gomoku-move-se) =2D (define-key map [kp-4] 'backward-char) =2D (define-key map [kp-6] 'forward-char) + (define-key map [kp-4] 'gomoku-move-left) + (define-key map [kp-6] 'gomoku-move-right) (define-key map [kp-2] 'gomoku-move-down) (define-key map [kp-8] 'gomoku-move-up) =20 + (define-key map "\C-b" 'gomoku-move-left) ; C-b + (define-key map "\C-f" 'gomoku-move-right) ; C-f (define-key map "\C-n" 'gomoku-move-down) ; C-n (define-key map "\C-p" 'gomoku-move-up) ; C-p =20 @@ -146,6 +148,10 @@ (define-key map [mouse-2] 'gomoku-mouse-play) (define-key map [drag-mouse-2] 'gomoku-mouse-play) =20 + (define-key map [remap backward-char] 'gomoku-move-left) + (define-key map [remap left-char] 'gomoku-move-left) + (define-key map [remap forward-char] 'gomoku-move-right) + (define-key map [remap right-char] 'gomoku-move-right) (define-key map [remap previous-line] 'gomoku-move-up) (define-key map [remap next-line] 'gomoku-move-down) (define-key map [remap move-beginning-of-line] 'gomoku-beginning-of-li= ne) @@ -954,6 +960,11 @@ ;; 2 instead of 1 because WINDOW-HEIGHT includes the mode line ! gomoku-square-height))) =20 +(defun gomoku-point-x () + "Return the board column where point is." + (1+ (/ (- (current-column) gomoku-x-offset) + gomoku-square-width))) + (defun gomoku-point-y () "Return the board row where point is." (1+ (/ (- (count-lines (point-min) (point)) @@ -1103,7 +1114,7 @@ (setq square1 (+ square1 depl)) (cond ((=3D dy 0) ; Horizontal =2D (forward-char 1) + (gomoku-move-right) (insert-char ?- (1- gomoku-square-width) t) (delete-region (point) (progn (skip-chars-forward " \t") @@ -1143,13 +1154,28 @@ (skip-chars-forward gomoku--intangible-chars) (when (eobp) (skip-chars-backward gomoku--intangible-chars) =2D (forward-char -1))) + (gomoku-move-left))) (skip-chars-backward gomoku--intangible-chars) (if (bobp) (skip-chars-forward gomoku--intangible-chars) =2D (forward-char -1)))) + (gomoku-move-left)))) (setq gomoku--last-pos (point))) =20 +;; forward-char and backward-char don't always move the right number +;; of characters. Also, these functions check if you're on the edge of +;; the screen. +(defun gomoku-move-right () + "Move point right one column on the Gomoku board." + (interactive) + (when (< (gomoku-point-x) gomoku-board-width) + (forward-char gomoku-square-width))) + +(defun gomoku-move-left () + "Move point left one column on the Gomoku board." + (interactive) + (when (> (gomoku-point-x) 1) + (backward-char gomoku-square-width))) + ;; previous-line and next-line don't work right with intangible newlines (defun gomoku-move-down () "Move point down one row on the Gomoku board." @@ -1171,25 +1197,25 @@ "Move point North East on the Gomoku board." (interactive) (gomoku-move-up) =2D (forward-char)) + (gomoku-move-right)) =20 (defun gomoku-move-se () "Move point South East on the Gomoku board." (interactive) (gomoku-move-down) =2D (forward-char)) + (gomoku-move-right)) =20 (defun gomoku-move-nw () "Move point North West on the Gomoku board." (interactive) (gomoku-move-up) =2D (backward-char)) + (gomoku-move-left)) =20 (defun gomoku-move-sw () "Move point South West on the Gomoku board." (interactive) (gomoku-move-down) =2D (backward-char)) + (gomoku-move-left)) =20 (defun gomoku-beginning-of-line () "Move point to first square on the Gomoku board row." --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQQ485dc0XNAN7OXgJXUycT8VGCOaAUCXnah0gAKCRDUycT8VGCO aNbuAP45+hUe+Z2+v4VlCyojr7sMdbve4fypuQdTIzrb9iCciAD/XWEUWFTu3h1U Urk9Pz7dyyGPrULrCijUQKFTRt1vHwo= =IqG6 -----END PGP SIGNATURE----- --==-=-=--