{"id":249,"date":"2010-03-10T11:28:40","date_gmt":"2010-03-10T09:28:40","guid":{"rendered":"http:\/\/yesybl.org\/blogcn\/?p=249"},"modified":"2019-07-06T03:41:34","modified_gmt":"2019-07-05T19:41:34","slug":"emacs%e4%b8%ad%e5%9c%a8%e6%8c%87%e5%ae%9a%e5%8c%ba%e5%9f%9f%ef%bc%88region%e4%b8%ad%e5%88%a0%e9%99%a4%e9%87%8d%e5%a4%8d%e8%a1%8c%e7%9a%84%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/www.yesybl.com\/?p=249","title":{"rendered":"Emacs\u4e2d\u5728\u6307\u5b9a\u533a\u57df\uff08region)\u4e2d\u5220\u9664\u91cd\u590d\u884c\u7684\u51fd\u6570"},"content":{"rendered":"<p>\u5c06\u4ee5\u4e0b\u4ee3\u7801\u52a0\u5165\u5230.emacs\u6587\u4ef6\u4e2d<\/p>\n<pre lang=\"lisp\">(defun uniq-lines (beg end)\n  \"Unique lines in region.\nCalled from a program, there are two arguments:\nBEG and END (region to sort).\"\n  (interactive \"r\")\n  (save-excursion\n    (save-restriction\n      (narrow-to-region beg end)\n      (goto-char (point-min))\n      (while (not (eobp))\n        (kill-line 1)\n        (yank)\n        (let ((next-line (point)))\n          (while\n              (re-search-forward\n               (format \"^%s\" (regexp-quote (car kill-ring))) nil t)\n            (replace-match \"\" nil nil))\n          (goto-char next-line))))))\n<\/pre>\n<p>\u7136\u540e\u5728\u7f16\u8f91\u533a\u57df\u4e2d\u8bbe\u5b9aregion. \u5e76\u901a\u8fc7<\/p>\n<pre lang=\"text\">M-x uniq-lines\n<\/pre>\n<p>\u6267\u884c\u51fd\u6570\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<a href=\"https:\/\/www.yesybl.com\/?p=249\" rel=\"bookmark\" title=\"Permalink to Emacs\u4e2d\u5728\u6307\u5b9a\u533a\u57df\uff08region)\u4e2d\u5220\u9664\u91cd\u590d\u884c\u7684\u51fd\u6570\"><p>\u5c06\u4ee5\u4e0b\u4ee3\u7801\u52a0\u5165\u5230.emacs\u6587\u4ef6\u4e2d (defun uniq-lines (beg end) &#8220;Unique lines in region. Called from a program, there are two arguments: BEG and END (region to sort).&#8221; (interactive &#8220;r&#8221;) (save-excursion (save-restriction (narrow-to-region beg end) (goto-char (point-min)) (while (not (eobp)) (kill-line 1) (yank) (let ((next-line (point))) (while (re-search-forward (format &#8220;^%s&#8221; (regexp-quote (car kill-ring))) nil t) (replace-match &#8220;&#8221; nil nil)) (goto-char [&hellip;]<\/p>\n<\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pa4z28-41","_links":{"self":[{"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/posts\/249"}],"collection":[{"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=249"}],"version-history":[{"count":3,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/posts\/249\/revisions"}],"predecessor-version":[{"id":750,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=\/wp\/v2\/posts\/249\/revisions\/750"}],"wp:attachment":[{"href":"https:\/\/www.yesybl.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yesybl.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}