GNU bug report logs - #63626
[PATCH] Make forward and backward-to-word arg optional

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Zaz Brown <zazbrown@HIDDEN>; Keywords: patch; dated Sun, 21 May 2023 07:33:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 63626 <at> debbugs.gnu.org:


Received: (at 63626) by debbugs.gnu.org; 26 May 2023 11:23:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 26 07:23:46 2023
Received: from localhost ([127.0.0.1]:48975 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q2VXt-0008At-KV
	for submit <at> debbugs.gnu.org; Fri, 26 May 2023 07:23:45 -0400
Received: from eggs.gnu.org ([209.51.188.92]:47144)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1q2VXr-0008AX-2C
 for 63626 <at> debbugs.gnu.org; Fri, 26 May 2023 07:23:43 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1q2VXl-0002Pl-9U; Fri, 26 May 2023 07:23:37 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=xLE9R8nvM4Vv8q83GGuTGy+GDELIJl2yheY/9fYuLKM=; b=Gyi8END6eZ+S
 C6DNqjr1fWvxzgfkHe3KG2iXyddLJvFWirXHkLBbIGgJqv0TIuMW2GDjgpcXx4ZgElD6gJIM1JpED
 1ubPP21cQLkyI3qfNJufEAuPZfGRgxkRfm6x+2O7jg1sqmJqlRxiJIBalVRiUamhGAWEM3I0+l6mJ
 dpz4Sm06eqxDMcYZBPBhej65vRGqPcvhrQZxY1e5jvUwS4+6xdLfndJJeMj2QGZkw+/LwW3SODebY
 piCuqyBl7G4E4ANWlLWmW1l7JgUMVFhGVLGeOQTPPqdIPPqIIszwrQmDIy5zNH8Sa5nOOy+9zvtoi
 Tb1u7YmT+iHnt2J1+8AUOw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1q2VXk-0006mh-PC; Fri, 26 May 2023 07:23:37 -0400
Date: Fri, 26 May 2023 14:24:08 +0300
Message-Id: <83zg5rjpyf.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Zaz Brown <zazbrown@HIDDEN>
In-Reply-To: <CACTmS+hsinyhZh0EyHtNis5-ywSY27QiY+sV4TwO5iapjRhDcA@HIDDEN>
 (message from Zaz Brown on Sat, 20 May 2023 21:33:51 -0700)
Subject: Re: bug#63626: [PATCH] Make forward and backward-to-word arg optional
References: <CACTmS+hsinyhZh0EyHtNis5-ywSY27QiY+sV4TwO5iapjRhDcA@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 63626
Cc: dalanicolai@HIDDEN, 63626 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: dalanicolai@HIDDEN
> From: Zaz Brown <zazbrown@HIDDEN>
> Date: Sat, 20 May 2023 21:33:51 -0700
> 
> (forward-to-word) throws (wrong-number-of-arguments forward-to-word 0)
> in spite of the doc string stating:
> 
> > Move forward until encountering the beginning of a word.
> > With argument, do this that many times.
> 
> This behaviour is present in Spacemacs 28.2, and has been confirmed by
> Daniel Nicolai on Emacs 30. It's also evident in the latest source code.
> 
> The same issue exists for (backward-to-word). But running each command
> with M-x works with no argument.

Thank you for your report.

Please tell why you think we should allow non-interactive invocation
of these functions with no argument.  IOW, what exactly is wrong with
the current code, and in what situations you have found this to be a
problem?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#63626; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 May 2023 07:32:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 21 03:32:29 2023
Received: from localhost ([127.0.0.1]:59960 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1q0dYL-0000uM-3B
	for submit <at> debbugs.gnu.org; Sun, 21 May 2023 03:32:29 -0400
Received: from lists.gnu.org ([209.51.188.17]:44294)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <zazbrown@HIDDEN>) id 1q0alr-0003m9-1y
 for submit <at> debbugs.gnu.org; Sun, 21 May 2023 00:34:17 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <zazbrown@HIDDEN>)
 id 1q0aln-0005ej-Q8
 for bug-gnu-emacs@HIDDEN; Sun, 21 May 2023 00:34:13 -0400
Received: from relay4-d.mail.gandi.net ([2001:4b98:dc4:8::224])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <zazbrown@HIDDEN>)
 id 1q0alj-0007iC-SK
 for bug-gnu-emacs@HIDDEN; Sun, 21 May 2023 00:34:11 -0400
Received: (Authenticated sender: zazbrown@HIDDEN)
 by mail.gandi.net (Postfix) with ESMTPSA id 37406E0006
 for <bug-gnu-emacs@HIDDEN>; Sun, 21 May 2023 04:34:03 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zazbrown.com;
 s=gm1; t=1684643644;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type;
 bh=YFNJmEryfMImw1gccOFh8zSt2SBu0VFb6BDgkNXYvv0=;
 b=PjYx+mUi1HaMXdR1R5RgGGKuPJv4Ad/04p9qk6i9To+tPtrV7U7z+wABagqPr49be+rJm5
 Z8PKuptB88kv+l85qc99Kz82CfxDi3PdlVp1lkRhtkqg+MUnaoSKpgZW6fl02uX1CvqcH4
 s773J1QvbZEBnxT/1vkCyer54eYVmSzR92HFGGtIAdHhVA7/VyA8dxkeFDqiTv+ZZwAbbZ
 4pSSbe5m5HNOSFHzi3sluC+Zcg/n6SIX92ABxgp3uYHq8L9xm9nOOaQ6Z8BDOJmZiFNR+x
 JA7ZIEzyY0/HruK47qpEyrWUEwklLAv4sIDli/Emx7FSnDCUGnMPZNVt8vkCTw==
Received: by mail-pl1-f172.google.com with SMTP id
 d9443c01a7336-1ae4baa77b2so34329645ad.2
 for <bug-gnu-emacs@HIDDEN>; Sat, 20 May 2023 21:34:03 -0700 (PDT)
X-Gm-Message-State: AC+VfDxok5zv33ocZItIGmJZXowzlDjjOfrLghrwG7VC9nVpK5TxSoRE
 ghVkJV98zjJUbX4yp9JkBiJv7UkdMsnzzLoRUbU=
X-Google-Smtp-Source: ACHHUZ4gDTO+YxDyn9KObCtBPh2Xj9HM+NAHTDVV6Q7CvXAPSMCTMlSqkJHD82tD9fE8G71XWamLfkHQYu6AsUcnmtE=
X-Received: by 2002:a17:902:e889:b0:1a5:2993:8aa6 with SMTP id
 w9-20020a170902e88900b001a529938aa6mr8380397plg.63.1684643642281; Sat, 20 May
 2023 21:34:02 -0700 (PDT)
MIME-Version: 1.0
From: Zaz Brown <zazbrown@HIDDEN>
Date: Sat, 20 May 2023 21:33:51 -0700
X-Gmail-Original-Message-ID: <CACTmS+hsinyhZh0EyHtNis5-ywSY27QiY+sV4TwO5iapjRhDcA@HIDDEN>
Message-ID: <CACTmS+hsinyhZh0EyHtNis5-ywSY27QiY+sV4TwO5iapjRhDcA@HIDDEN>
Subject: [PATCH] Make forward and backward-to-word arg optional
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Received-SPF: softfail client-ip=2001:4b98:dc4:8::224;
 envelope-from=zazbrown@HIDDEN; helo=relay4-d.mail.gandi.net
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 21 May 2023 03:32:22 -0400
Cc: dalanicolai@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

(forward-to-word) throws (wrong-number-of-arguments forward-to-word 0)
in spite of the doc string stating:

> Move forward until encountering the beginning of a word.
> With argument, do this that many times.

This behaviour is present in Spacemacs 28.2, and has been confirmed by
Daniel Nicolai on Emacs 30. It's also evident in the latest source code.

The same issue exists for (backward-to-word). But running each command
with M-x works with no argument.

I'm new to Emacs, so please take this with a grain of salt.  Thank you!

---
 lisp/misc.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git master/lisp/misc.el arg-optional/lisp/misc.el
index ca013d5..f97240e 100644
--- a/lisp/misc.el
+++ b/lisp/misc.el
@@ -166,18 +166,20 @@ is an upper-case character."
     (upcase-region (point) (progn (forward-char arg) (point)))))

 ;;;###autoload
-(defun forward-to-word (arg)
+(defun forward-to-word (&optional arg)
   "Move forward until encountering the beginning of a word.
 With argument, do this that many times."
   (interactive "^p")
+  (unless arg (setq arg 1))
   (or (re-search-forward (if (> arg 0) "\\W\\b" "\\b\\W") nil t arg)
       (goto-char (if (> arg 0) (point-max) (point-min)))))

 ;;;###autoload
-(defun backward-to-word (arg)
+(defun backward-to-word (&optional arg)
   "Move backward until encountering the end of a word.
 With argument, do this that many times."
   (interactive "^p")
+  (unless arg (setq arg 1))
   (forward-to-word (- arg)))

 ;;;###autoload
--
2.40.1




Acknowledgement sent to Zaz Brown <zazbrown@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#63626; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 26 May 2023 11:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.