{"id":910,"date":"2015-12-31T18:21:51","date_gmt":"2015-12-31T18:21:51","guid":{"rendered":"http:\/\/malemuk.com\/olofee\/?p=910"},"modified":"2018-02-01T18:11:56","modified_gmt":"2018-02-01T18:11:56","slug":"emacs-tips","status":"publish","type":"post","link":"http:\/\/malemuk.com\/olofee\/emacs-tips\/","title":{"rendered":"Emacs tips"},"content":{"rendered":"<p><strong>Essential shortcuts<\/strong><br \/>\nM-: META key (ALT on most keyboards)<br \/>\nC-: CONTROL key<br \/>\nC-x C-f : open file<br \/>\nC-x b : switch to buffer<br \/>\nC-x k : kill buffer<br \/>\nC-s : search text forward<br \/>\nC-r : search text backward<br \/>\nC-+ \/ C&#8211; : Zoom in\/out<br \/>\nC-space: mark set (start of the text to mark)<br \/>\nC-w: cut<br \/>\nM-w: copy<br \/>\nC-y: paste<\/p>\n<p><strong>Useful shortcuts<\/strong><br \/>\nC-l : scroll to current line in the middle of the window<br \/>\nC-x 2 : split window horizontally<br \/>\nC-x 3 : split window vertically<\/p>\n<p><strong>Use of accents<\/strong><br \/>\nM-x set-input-method latin-1-prefix<br \/>\nThis will make accent characters combine with the following characters, so that you can type `\u201d u\u2019 to achieve `\u00fc\u2019, for example.<\/p>\n<p><strong>Interactively Find and Replace String Patterns on Multiple Files<\/strong><br \/>\nWe suppose all files are in the same folder.<\/p>\n<ul>\n<li>Open the folder:<\/li>\n<li>C-x d<\/li>\n<li>Mark the files to be included in the find\/replace operation: m. To unmark files: u<\/li>\n<li>M-x dired-do-query-replace-regexp (or Q)<\/li>\n<li>to accept a replacement: y, to skip: n<\/li>\n<li>to accept for the whole file and move to next file: !<\/li>\n<li>to continue the query-replace if you fall out of the loop:<\/li>\n<li>M-, (i.e. Meta-comma)<\/li>\n<li>to save all modified buffers (Emacs version &gt; 22.2), show all buffers:<\/li>\n<li>M-x ibuffer<\/li>\n<li>select modified buffers: * u, save them: S (capital S)<\/li>\n<li>If you simply want to search for a regexp, use:<\/li>\n<li>M-x dired-do-search (or A)<\/li>\n<li>use M-, (Meta-comma) to loop through the results<\/li>\n<\/ul>\n<p><strong>Dired &#8212; marking files with similar pattern<\/strong><br \/>\nUseful for example if you want to mark simultaneously all .tex files in a folder.<br \/>\n% m .tex$<br \/>\n(if you omit the $, .tex~ files will be marked as well)<\/p>\n<p><strong>Regexp<\/strong><br \/>\nInsert a newline in a regexp or replacement string: CTRL-Q CTRL-J<\/p>\n<p><strong>Change coding system (between DOS and Unix)<\/strong><br \/>\nDOS to Unix:\u00a0C-x RET f undecided-unix<br \/>\nUnix to DOS:\u00a0C-x RET f undecided-dos<\/p>\n<p><strong>Buffer coding system<\/strong><br \/>\nIn my case, the coding system that works when writing LaTeX files in Norwegian is iso-latin-1-unix. It&#8217;s the default when I create new .tex files, however, it may change when pasting text from e.g. my browser. The following commands revert to the right coding system:<br \/>\nC-x RET f iso-latin-1-unix<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Essential shortcuts M-: META key (ALT on most keyboards) C-: CONTROL key C-x C-f : open file C-x b : switch to buffer C-x k : kill buffer C-s : search text forward C-r : search text backward C-+ \/ C&#8211; : Zoom in\/out C-space: mark set (start of the text to mark) C-w: cut [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-910","post","type-post","status-publish","format-standard","hentry","category-computer-stuff"],"jetpack-related-posts":[{"id":137,"url":"http:\/\/malemuk.com\/olofee\/alpine-configuration\/","url_meta":{"origin":910,"position":0},"title":"Alpine configuration","date":"October 23, 2010","format":false,"excerpt":"Alpine is to email software what Emacs is to text-editing software. I love it. First, create a collection list -- I think you may skip this part if you're using pop instead of imap: S L A Nickname: any nickname Server: my.server.net:port\/ssl\/user=my_username If you're not using ssl, write tls instead.\u2026","rel":"nofollow","context":"In \"Computer stuff\"","img":{"src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/malemuk.com\/olofee\/wp-json\/wp\/v2\/posts\/910","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/malemuk.com\/olofee\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/malemuk.com\/olofee\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/malemuk.com\/olofee\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/malemuk.com\/olofee\/wp-json\/wp\/v2\/comments?post=910"}],"version-history":[{"count":6,"href":"http:\/\/malemuk.com\/olofee\/wp-json\/wp\/v2\/posts\/910\/revisions"}],"predecessor-version":[{"id":2915,"href":"http:\/\/malemuk.com\/olofee\/wp-json\/wp\/v2\/posts\/910\/revisions\/2915"}],"wp:attachment":[{"href":"http:\/\/malemuk.com\/olofee\/wp-json\/wp\/v2\/media?parent=910"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/malemuk.com\/olofee\/wp-json\/wp\/v2\/categories?post=910"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/malemuk.com\/olofee\/wp-json\/wp\/v2\/tags?post=910"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}