{"id":9478,"date":"2021-02-11T19:21:10","date_gmt":"2021-02-12T00:21:10","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=9478"},"modified":"2021-02-11T19:21:10","modified_gmt":"2021-02-12T00:21:10","slug":"goto-char-1-vs-goto-char-point-min","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=9478","title":{"rendered":"(goto-char 1) vs. (goto-char (point-min))"},"content":{"rendered":"<p>Here\u2019s a short tip for all you Elispers that clears up an obscure point about moving around in buffers. For a long time I\u2019ve been dimly aware that the preferred way to move to the start of a buffer is<\/p>\n<div class=\"org-src-container\">\n<pre class=\"src src-emacs-lisp\">(goto-char (point-min))\n<\/pre>\n<\/div>\n<p>instead of the simpler<\/p>\n<div class=\"org-src-container\">\n<pre class=\"src src-emacs-lisp\">(goto-char 1)\n<\/pre>\n<\/div>\n<p>The reason for that is obvious once it\u2019s pointed out: if the buffer is narrowed, the first point in the buffer may not be 1. Still, it never seemed to make a difference in practice. Xah Lee comes to the rescue with a <a href=\"http:\/\/ergoemacs.org\/misc\/elisp_point_minimum_vs_1.html?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A+XahsEmacsBlog+%28Xah%27s+Emacs+Blog%29\">concise post that explains what\u2019s really going on<\/a>. Take a look at Lee\u2019s post to see why either form works but it <i>is<\/i> best to use <code>(point-min)<\/code>.<\/p>\n<p>As a final exercise, suppose that like Lee, you decide to replace every <code>(goto-char 1)<\/code> with <code>(goto-char (point-min))<\/code> in all the <code>.el<\/code> files in, say, your <code>~\/src<\/code> directory. How would you do that?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here\u2019s a short tip for all you Elispers that clears up an obscure point about moving around in buffers. For a long time I\u2019ve been dimly aware that the preferred way to move to the start of a buffer is &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=9478\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18,28],"class_list":["post-9478","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs","tag-emacs-lisp"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9478"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9478\/revisions"}],"predecessor-version":[{"id":9479,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/9478\/revisions\/9479"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}