我正在编写一个例程来测试点是否在实际的行尾。
(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))))
问题是,在运行它时,我在迷你缓冲区窗口中看到“标记集”,而不是 T 或 nil。
最佳答案
(looking-at-p "\\s-*$")
关于emacs - Elisp 函数返回标记而不是正确的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1868807/