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

标签 emacs lisp 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))))

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

最佳答案

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

关于emacs - Elisp 函数返回标记而不是正确的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1868807/

相关文章:

emacs - 如何在emacs中为特定的正则表达式包装对齐正则表达式

variables - 在 Elisp 中,如何访问从闭包本地绑定(bind)的符号的值单元格?

emacs - 有没有练习光标控制的emacs游戏?

scheme - 非空 Scheme 列表是否包含至少一个原子?

lisp - 在 Tcl 中模拟 lisp cons 单元

emacs - 如何在 elisp defun 中为交互式目录选择设置默认路径?

emacs - 如何使 vc-diff 输出更紧凑

Emacs 中的 Python 解释器重复行

lisp - 如何在 Windows 中安装 gtk-cffi?

Java 编码风格和 Emacs cc-mode 配置