Function: forward-unix-word

forward-unix-word is a byte-compiled function defined in simple.el.gz.

Signature

(forward-unix-word N &optional DELIM)

Documentation

Move forward N Unix-words.

A Unix-word is whitespace-delimited. A negative N means go backwards to the beginning of Unix-words.

Unix-words differ from Emacs words in that they are always delimited by whitespace, regardless of the buffer's syntax table. This function emulates how C-w at the Unix terminal or shell identifies words.

Optional argument DELIM specifies what characters are considered whitespace. It is a string as might be passed to skip-chars-forward. The default is "\\s\\f\\n\\r\\t\\v". Do not prefix a ^ character.

Source Code

;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun forward-unix-word (n &optional delim)
  "Move forward N Unix-words.
A Unix-word is whitespace-delimited.
A negative N means go backwards to the beginning of Unix-words.

Unix-words differ from Emacs words in that they are always delimited by
whitespace, regardless of the buffer's syntax table.  This function
emulates how C-w at the Unix terminal or shell identifies words.

Optional argument DELIM specifies what characters are considered
whitespace.  It is a string as might be passed to `skip-chars-forward'.
The default is \"\\s\\f\\n\\r\\t\\v\".  Do not prefix a `^' character."
  (when (string-prefix-p "^" delim)
    (error "DELIM argument must not begin with `^'"))
  (unless (zerop n)
    ;; We do skip over newlines by default because `backward-word' does.
    (let* ((delim (or delim "\s\f\n\r\t\v"))
           (ndelim (format "^%s" delim))
           (start (point))
           (fun (if (> n 0)
                    #'skip-chars-forward
                  #'skip-chars-backward)))
      (dotimes (_ (abs n))
        (funcall fun delim)
        (funcall fun ndelim))
      (constrain-to-field nil start))))