Hello,

On Fri 06 Sep 2024 at 11:36am +01, Sean Whitton wrote:

> diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
> index 37cfe264157..b576df82382 100644
> --- a/doc/lispref/positions.texi
> +++ b/doc/lispref/positions.texi
> @@ -275,6 +275,19 @@ Word Motion
>  syntax tables.
>  @end defun
>
> +@deffn Command forward-unix-word &optional arg delim
> +This function is like @code{forward-word}, except that words are always
> +delimited by whitespace, regardless of the buffer's syntax table.  This
> +emulates how @kbd{C-w} at the Unix terminal or shell identifies words.
> +See the @code{unix-word-rubout} command in @xref{(readline)Commands For
> +Killing}.
> +
> +Lisp programs can pass the @var{delim} argument to specify the notion of
> +whitespace.  This argument is a string listing the characters considered
> +whitespace, as might be passed to @code{skip-chars-forward}.  The
> +default is @code{[:space:]\n}.  Do not prefix a `^' character.
> +@end deffn

The `^' should use @code{}.

> diff --git a/lisp/simple.el b/lisp/simple.el
> index 2453a129d0a..f34eef9ac25 100644
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -8892,6 +8892,36 @@ current-word
>        ;; If we found something nonempty, return it as a string.
>        (unless (= start end)
>       (buffer-substring-no-properties start end)))))
> +
> +(defun forward-unix-word (&optional arg delim)
> +  "Move forward to the end of the next whitespace-delimited word.

ARG is not optional, only DELIM, in fact.  I will fix this.

I thought I should also explain this DELIM thing.  In addition to
Philip's usage and unix-word-rubout, I would like to add
unix-filename-rubout, which I think is generally useful -- it's also in
(info "(readline)Commands For Killing").  DELIM is needed for that.
It also makes the function more generally useful to Lisp programmers --
you might want to drop \n, for example.

-- 
Sean Whitton



Reply via email to