[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 5f6aa5a174c 1/2: Make forward and backward-to-word arg optional
From: |
Eli Zaretskii |
Subject: |
master 5f6aa5a174c 1/2: Make forward and backward-to-word arg optional |
Date: |
Wed, 31 May 2023 09:13:57 -0400 (EDT) |
branch: master
commit 5f6aa5a174cf0ad53b54fa4b043408dbd85531ac
Author: Zaz Brown <zazbrown@zazbrown.com>
Commit: Eli Zaretskii <eliz@gnu.org>
Make forward and backward-to-word arg optional
* lisp/misc.el (forward-to-word, backward-to-word): Make the
argument optional. (Bug#63626)
Copyright-paperwork-exempt: yes
---
lisp/misc.el | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lisp/misc.el b/lisp/misc.el
index ca013d5f72f..f97240ed94f 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