From: Zaz Brown <zazbrown@zazbrown.com>
To: 63626@debbugs.gnu.org
Cc: dalanicolai@gmail.com
Subject: bug#63626: [PATCH] Make forward and backward-to-word arg optional
Date: Sat, 20 May 2023 21:33:51 -0700 [thread overview]
Message-ID: <CACTmS+hsinyhZh0EyHtNis5-ywSY27QiY+sV4TwO5iapjRhDcA@mail.gmail.com> (raw)
(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
next reply other threads:[~2023-05-21 4:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-21 4:33 Zaz Brown [this message]
2023-05-26 11:24 ` bug#63626: [PATCH] Make forward and backward-to-word arg optional Eli Zaretskii
[not found] ` <CACTmS+g93z7ns6AD9v-a+-TRVkVuTLt5RGi5YVTGUA8J1BM3dw@mail.gmail.com>
2023-05-27 7:02 ` Eli Zaretskii
2023-05-27 18:39 ` Zaz Brown
2023-05-28 5:16 ` Eli Zaretskii
2023-05-29 15:24 ` dalanicolai
2023-05-29 16:46 ` Juri Linkov
2023-05-31 13:15 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CACTmS+hsinyhZh0EyHtNis5-ywSY27QiY+sV4TwO5iapjRhDcA@mail.gmail.com \
--to=zazbrown@zazbrown.com \
--cc=63626@debbugs.gnu.org \
--cc=dalanicolai@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).