You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
4.3 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <link rel="icon" type="image/png" href="/favicon.ico">
  7. <link rel="canonical" href="https://www.mcmillen.dev/blog/20070522-emacs-tips.html">
  8. <link rel="alternate" type="application/atom+xml" href="https://www.mcmillen.dev/feed.atom" title="Colin McMillen's Blog - Atom">
  9. <title>Emacs Tips | Colin McMillen</title>
  10. <link rel="preconnect" href="https://fonts.gstatic.com">
  11. <link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@500;700&display=block" rel="stylesheet">
  12. <link href="https://fonts.googleapis.com/css?family=Fira+Mono:500&display=block" rel="stylesheet">
  13. <link rel="stylesheet" href="/pygments.css">
  14. <link rel="stylesheet" href="/style.css">
  15. <meta name="twitter:card" content="summary">
  16. <meta name="twitter:site" content="@mcmillen">
  17. <meta name="twitter:title" content="Emacs Tips | Colin McMillen">
  18. <meta name="twitter:description" content="These are some emacs keybindings (and other functions) that I once found useful. I’ve mostly used Sublime Text for the last few years, however. Editing">
  19. </head>
  20. <script>
  21. function fixEmails() {
  22. const mailtoArray = [
  23. 'm', 'a', 'i', 'l', 't', 'o', ':',
  24. 'c', 'o', 'l', 'i', 'n', '@',
  25. 'm', 'c', 'm', 'i', 'l', 'l', 'e', 'n',
  26. '.', 'd', 'e', 'v'];
  27. const mailtoLink = mailtoArray.join('');
  28. const anchors = document.getElementsByTagName('a');
  29. for (let i = 0; i < anchors.length; i++) {
  30. const anchor = anchors[i];
  31. if (anchor.href == 'mailto:email@example.com') {
  32. anchor.href = mailtoLink;
  33. if (anchor.innerText == 'colin at mcmillen dot dev') {
  34. anchor.innerText = mailtoLink.substring(7);
  35. }
  36. }
  37. }
  38. }
  39. </script>
  40. <body onload="fixEmails()">
  41. <div id="page-container">
  42. <div id="content-wrap">
  43. <div id="header">
  44. <div class="content">
  45. <a href="/" class="undecorated">Colin McMillen</a>
  46. <span style="float: right;"><a href="/feed.atom"><img src="/img/rss.svg" alt="Atom feed" style="width: 17px; height: 17px; margin-bottom: 1px;"></a></span>
  47. <span style="float: right;"><a href="https://twitter.com/mcmillen"><img src="/img/twitter.svg" alt="@mcmillen"></a></span>
  48. </div>
  49. </div>
  50. <div class="content">
  51. <h1 id="emacs-tips">Emacs Tips</h1>
  52. <p><em>Posted 2007-05-22, updated 2021-07-01.</em></p>
  53. <p>These are some emacs keybindings (and other functions) that I once found useful. I&rsquo;ve mostly used Sublime Text for the last few years, however.</p>
  54. <h2 id="editing">Editing</h2>
  55. <p><code>C-[SPC]</code>: set mark<br>
  56. <code>C-x C-x</code>: exchange point and mark<br>
  57. <code>C-w</code>: kill (AKA &ldquo;cut&rdquo;)<br>
  58. <code>M-w</code>: kill-ring-save (AKA &ldquo;copy&rdquo;)<br>
  59. <code>C-y</code>: yank (AKA &ldquo;paste&rdquo;)<br>
  60. <code>M-h</code>: Put region around current paragraph (mark-paragraph).<br>
  61. <code>C-x h</code>: Put region around the entire buffer (mark-whole-buffer).<br>
  62. <code>C-u C-[SPC]</code>: Move in mark ring<br>
  63. <code>M-d</code>: Kill word<br>
  64. <code>M-[DEL]</code>: Kill word backwards<br>
  65. <code>C-M-k</code>: Kill the following balanced expression (kill-sexp)</p>
  66. <h2 id="registers">Registers</h2>
  67. <p><code>C-x r r</code>: Save position of point in register r (point-to-register).<br>
  68. <code>C-x r j r</code>: Jump to the position saved in register r (jump-to-register).<br>
  69. <code>C-x r s r</code>: Copy region into register r (copy-to-register).<br>
  70. <code>C-x r i r</code>: Insert text from register r (insert-register).</p>
  71. <h2 id="bookmarks">Bookmarks</h2>
  72. <p><code>C-x r m [RET]</code>: Set the bookmark for the visited file, at point.<br>
  73. <code>C-x r m bookmark [RET]</code>: Set the bookmark named bookmark at point (bookmark-set).<br>
  74. <code>C-x r b bookmark [RET]</code>: Jump to the bookmark named bookmark (bookmark-jump).<br>
  75. <code>C-x r l</code>: List all bookmarks (list-bookmarks).<br>
  76. <code>M-x bookmark-save</code>: Save all the current bookmark values in the default bookmark file.</p>
  77. <h2 id="miscellaneous">Miscellaneous</h2>
  78. <p><code>M-`</code> shows the menu.<br>
  79. <code>M-x highlight-changes-mode</code> toggles showing the changes you&rsquo;ve made to the file since the last save.</p>
  80. </div>
  81. </div>
  82. <div id="footer">
  83. <div class="content">
  84. &copy; 2023 <a href="/" class="undecorated">Colin McMillen</a>. No cookies, no tracking.
  85. </div>
  86. </div>
  87. </div>
  88. </body>
  89. </html>