Emacsist RSS --- If never, make it ever: C-h C-h

Phillip Lord: m-buffer 0.11


这里 查看更多 Emacs 相关推荐文章最新 Emacs 圈的动态. 欢迎关注微信公众账号: Emacsist

m-buffer is a package which provides a high-level convienience API for interacting, searching and changing the contents of an Emacs buffer. It abstracts away from Emacs’ use of global state, and provides list-orientated operations removing the need for explicit looping.

Hence, we can replace:

(while (re-search-forward "foo" nil t)
     (replace-match "bar"))  


 (m-buffer-match (current-buffer) "foo")

m-buffer also protects global state, so the first form actually needs to be something closer to:

  (goto-char (point-min))
    (while (re-search-forward "foo" nil t)
      (replace-match "bar"))))  

There have been a few changes since the 0.10 release (Lord 2015)*. The interface has been improved slightly (in a backward compatible way). In addition some error-checking has been added to pick up what I think was counter-intuitive behaviour. So, previously:

(m-buffer-match-page (current-buffer) **:regexp**"this")  

would return all matches to “this” rather than pages.

The biggest change, however, has been the full use of lenticular source documentation (Lord 2015b)*, which provides a richer explanation of the code base. At the moment, I think that this is very usable, although I am aware that it is less clean than, for example, the documentation for dash, but it still is a nice demonstration of how lenticular text can work.

原文出处: Phillip Lord
原文地址: http://www.russet.org.uk/blog/3065
原文时间: 2015-04-16 00:45
本文地址: http://emacsist.com/10120
整理时间: 2015-04-16 13:35

本文由 Hick 整理,转载请保留以上信息;
COPYLEFTThe articles on this site come from Internet, thanks to all the original authors.
      If anything about COPYRIGHT, or LEFT, please contact Emacsist at gmail dot com .