且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Emacs:防弹列表?

更新时间:2023-12-05 15:49:28

编辑:并入Andreas Rohler的建议:

incorporated Andreas Rohler's suggestion:

这在您的测试用例中适用于我: / p>



This works for me in your test case:

(defun my-up-list ()
  (interactive)
  (let ((s (syntax-ppss)))
    (when (nth 3 s)
      (goto-char (nth 8 s))))
  (ignore-errors (up-list)))

syntax-ppss 返回一个列表,如果你在一个字符串中,第三个元素存在,第八个元素是字符串的开头(如果你在一个,否则为零)。

syntax-ppss returns a list, the third element of which exists if you're inside a string, and the 8th element is the beginning of the string (if you're in one, otherwise nil).