{"id":5095,"date":"2016-03-28T13:41:00","date_gmt":"2016-03-28T17:41:00","guid":{"rendered":"http:\/\/irreal.org\/blog\/?p=5095"},"modified":"2016-03-28T13:41:20","modified_gmt":"2016-03-28T17:41:20","slug":"some-oldies-but-goodies","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=5095","title":{"rendered":"Some Oldies but Goodies"},"content":{"rendered":"<p> When I find a useful Emacs package or tip, I almost always write about it so others can take advantage of them too. The other day I was using one of those packages and thought, \u201cGee, this is really neat. Everybody should be using it.\u201d That coupled with the fact that I keep seeing posts or tweets asking about how to do some of these things made me think that it would be worth revisiting some of them. These tips\/packages are ones that I use almost everyday and wouldn&#8217;t want to live without. <\/p>\n<p> Without further ado, here&#8217;s a list of tips\/packages that I find very useful along with the original Irreal post that discussed them: <\/p>\n<ol class=\"org-ol\">\n<li>Looking up a word from Emacs. Abo-abo has a very nice small package, <a href=\"http:\/\/irreal.org\/blog\/?p=3994\">Defining the Word at Point<\/a>, that will look up the word at point and give you the definition in the minibuffer. It&#8217;s incredibly useful; I&#8217;ve already used it in this post.<\/li>\n<li>Everyone agrees that <code>zap-to-char<\/code> is useful but then go on to complain that it should really zap <i>up to<\/i> the character. It turns out that there&#8217;s already an Emacs function that lets you <a href=\"http:\/\/irreal.org\/blog\/?p=1536\">Zap Up To A Character<\/a>. Read the post to see how to enable it.<\/li>\n<li>\n<p> We all know about \u3010<kbd>Ctrl<\/kbd>+<kbd>h<\/kbd> <kbd>f<\/kbd>\u3011 and \u3010<kbd>Ctrl<\/kbd>+<kbd>h<\/kbd> <kbd>k<\/kbd>\u3011 to bring up documentation about a specified function or a function bound to a key. One of Irreal&#8217;s frequent commenters, Phil, notes that you can also bring up the source for those functions too (<a href=\"http:\/\/irreal.org\/blog\/?p=1781\">Help From Phil<\/a>) using the functions: <\/p>\n<ul class=\"org-ul\">\n<li><code>find-function<\/code><\/li>\n<li><code>find-function-on-key<\/code><\/li>\n<li><code>find-variable<\/code><\/li>\n<li><code>find-library<\/code><\/li>\n<\/ul>\n<p> I bind these to the keys corresponding to the documentation functions but with the letter after the \u3010<kbd>Ctrl<\/kbd>+<kbd>h<\/kbd>\u3011 modified with \u3010<kbd>Ctrl<\/kbd>\u3011 so that <code>find-function<\/code>, for example, is bound to the \u3010<kbd>Ctrl<\/kbd>+<kbd>h<\/kbd> <kbd>Ctrl<\/kbd>+<kbd>f<\/kbd>\u3011 shortcut. <\/p>\n<\/li>\n<li>\n<p> A trick I learned from Tim Visher is evaluating an sexp in an Emacs buffer and replacing the sexp by the result. I wrote about that and the code I used to accomplish it in <a href=\"http:\/\/irreal.org\/blog\/?p=297\">Eval and Replace in Emacs<\/a>. I&#8217;ve since replaced the code with<br  \/> <\/p>\n<div class=\"org-src-container\">\n<pre class=\"src src-emacs-lisp\"><span style=\"color: #b22222;\">;; <\/span><span style=\"color: #b22222;\">From Lars Tveito: https:\/\/github.com\/larstvei\/dot-emacs\/blob\/master\/init.org<\/span>\n<span style=\"color: #b22222;\">;; <\/span><span style=\"color: #b22222;\">This avoids overloading C-c C-e in org-mode<\/span>\n(<span style=\"color: #a020f0;\">defadvice<\/span> <span style=\"color: #0000ff;\">eval-last-sexp<\/span> (around replace-sexp (arg) activate)\n  <span style=\"color: #8b2252;\">\"Evaluate and replace when called with a prefix argument.\"<\/span>\n  (<span style=\"color: #a020f0;\">if<\/span> arg\n      (<span style=\"color: #a020f0;\">let<\/span> ((pos (point)))\n        ad-do-it\n        (goto-char pos)\n        (backward-kill-sexp)\n        (forward-sexp))\n    ad-do-it))\n<\/pre>\n<\/div>\n<\/li>\n<li>From one of Sacha&#8217;s chats, <a href=\"http:\/\/irreal.org\/blog\/?p=3616\">Sacha Chats with Steve Purcell<\/a>, I learned about one of the most useful packages I have: <code>whole-line-or-region<\/code>. It lets you use certain commands, like \u3010<kbd>Meta<\/kbd>+<kbd>w<\/kbd>\u3011 that normally work on a region, on the entire current line if no region is defined. I can&#8217;t tell you how useful this is. I use it every single day including several times in writing this post.<\/li>\n<li>I often want to do a <code>ping<\/code> or <code>traceroute<\/code> and used to switch to a terminal to run them. Then I found out about the <a href=\"http:\/\/irreal.org\/blog\/?p=1301\">Emacs Net Utilities<\/a> that lets me run them from within Emacs. Later I improved that a bit by making them run in a temporary screen: <a href=\"http:\/\/irreal.org\/blog\/?p=2247\">Running Ping in Emacs<\/a>.<\/li>\n<\/ol>\n<p> I hope you find some or all of these tips\/packages as useful as I do. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I find a useful Emacs package or tip, I almost always write about it so others can take advantage of them too. The other day I was using one of those packages and thought, \u201cGee, this is really neat. &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=5095\">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],"class_list":["post-5095","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5095","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=5095"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5095\/revisions"}],"predecessor-version":[{"id":5096,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5095\/revisions\/5096"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}