Questions tagged «line-numbers»


2
在大型缓冲区中获取“行中行号”的更快方法
line-number-at-pos当点接近缓冲区的末端时,该函数(当重复约50次时)会导致半大缓冲区(例如50,000条线)明显减速。减速是指总计约1.35秒。 与其使用100%的elisp函数对行进行计数并转到缓冲区的顶部,我对一种混合方法感兴趣,该方法利用了负责出现在模式行上的行号的内置C功能。不管缓冲区的大小如何,出现在模式行上的行号都会以光速出现。 这是一个测试功能: (defmacro measure-time (&rest body) "Measure the time it takes to evaluate BODY. http://lists.gnu.org/archive/html/help-gnu-emacs/2008-06/msg00087.html" `(let ((time (current-time))) ,@body (message "%.06f" (float-time (time-since time))))) (measure-time (let* ( line-numbers (window-start (window-start)) (window-end (window-end))) (save-excursion (goto-char window-end) (while (re-search-backward "\n" window-start t) (push (line-number-at-pos) line-numbers))) line-numbers))

3
错误显示行号
假设emacs引发了一些我不理解的错误。也许错误提示“符号的变量值无效:模式”,但是modes代码中出现了很多符号,因此我需要一些上下文。可以将Emacs配置为提及lisp代码的行号,以便我知道是什么代码导致了错误吗? 我尝试这样做(setq stack-trace-on-error '(buffer-read-only))并运行了永久代码,以获取堆栈跟踪。也没有堆栈跟踪。 我也尝试过调用edebug-defun我的函数并逐步执行它。直到我退出该函数后,才会引发错误。 (对于开发elisp的一般调试技能,我对当前遇到的特定错误的原因确实不那么感兴趣。请提供有关如何从行号,sexp或堆栈跟踪中获取信息的建议)错误。)

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.