发现match-end一个很久没人注意到的文档错误

经过

最近一直在看Emacs的源代码 偶然翻到了match-end. 在src/search.c line 2801-2815.

DEFUN ("match-end", Fmatch_end, Smatch_end, 1, 1, 0,
       doc: /* Return position of end of text matched by last search.
SUBEXP, a number, specifies the parenthesized subexpression in the last
  regexp for which to return the start position.
Value is nil if SUBEXPth subexpression didn't match, or there were fewer
  than SUBEXP subexpressions.
SUBEXP zero means the entire text matched by the whole regexp or whole
  string.

Return value is undefined if the last search failed.  */)
  (Lisp_Object subexp)
{
  return match_limit (subexp, 0);
}

注意看 这里

in the last regexp for which to return the start position

实际上match-end返回的是 the end position.

原因

我们用magit-blame

发现原来是Eli Zaretskii在24年的文档修改时 将match-beginning复制到match-end时忘记修改了这里.

现状

目前文档已经修复并合并进主线了

9 个赞