Elisp函数返回标记而不是正确的值

Pau*_*han 4 lisp emacs elisp

我正在编写一个例程来测试点是否在实际的最后一行.

(defun end-of-line-p ()
  "T if there is only \w* between point and end of line" 
  (interactive)
  (save-excursion
    (set-mark-command nil)      ;mark where we are
    (move-end-of-line nil)      ;move to the end of the line
    (let ((str (buffer-substring (mark) (point))))    ;; does any non-ws text exist in the region? return false
      (if (string-match-p "\W*" str)
      t
    nil))))
Run Code Online (Sandbox Code Playgroud)

问题是,在运行它时,我在迷你缓冲窗口中看到"标记集",而不是T或nil.

hua*_*uan 8

(looking-at-p "\\s-*$")