emacs-ez.tex 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  1. % Created 2018-04-09 Mon 10:25
  2. % Intended LaTeX compiler: pdflatex
  3. \documentclass[11pt]{article}
  4. \usepackage[utf8]{inputenc}
  5. \usepackage[T1]{fontenc}
  6. \usepackage{graphicx}
  7. \usepackage{grffile}
  8. \usepackage{longtable}
  9. \usepackage{wrapfig}
  10. \usepackage{rotating}
  11. \usepackage[normalem]{ulem}
  12. \usepackage{amsmath}
  13. \usepackage{textcomp}
  14. \usepackage{amssymb}
  15. \usepackage{capt-of}
  16. \usepackage{hyperref}
  17. \usepackage{lmodern}
  18. \usepackage[QX]{fontenc}
  19. \author{Joshua Branson}
  20. \date{\today}
  21. \title{Emacs Cheatsheat}
  22. \hypersetup{
  23. pdfauthor={Joshua Branson},
  24. pdftitle={Emacs Cheatsheat},
  25. pdfkeywords={},
  26. pdfsubject={},
  27. pdfcreator={Emacs 25.3.1 (Org mode 9.1.9)},
  28. pdflang={English}}
  29. \begin{document}
  30. \maketitle
  31. \section{Why use Emacs?}
  32. \label{sec:orgd8d41e3}
  33. For starters, Emacs is freedom respecting software. This is often shortened to "free software", or "libre software". This means that one has the right to:
  34. \begin{itemize}
  35. \item 0 run the program for any reason.
  36. \item 1 the right to help yourself.
  37. This is the right to study the source code and change it.
  38. \item 2 The right to help your neighbor.
  39. This is the right to distribute unmodified copies of Emacs to your neighbor. You could also even sell this program to your neighbor!
  40. \item 3 The right to help your community.
  41. This is the right to distribute your modified version of Emacs. You could also sell your modified version!
  42. So Emacs grants you, the user, many freedoms that other programs lack. Please notice that this is computing freedom. Free software is liberty software, not necessarily gratis software. However, Emacs is Free software, and it can usually be obtained as gratis software.
  43. \end{itemize}
  44. There are also some practical reasons to use Emacs. Plenty of programmers these days use drastically simple programming editors like notepad, notepad++, nano. These editors are "What you see is what you get" type editors, and they are frustratingly lacking in good features, and one cannot easily configure these editors. Emacs gives you the ability to install hundreds, if not thousands of add-ons, and configure \textbf{everything} that your text editor does.
  45. So what can Emacs do? You can use emacs to use commands to manipulate and transpose regions of text, write in nearly every programming language imaginable, read your email, browse the internet, play games, browse local files, look at a photo gallery, stream internet music, watch online movies (coming soon), create text expandable abbreviations, clock your working hours, invoice clients, schedule your weekly agenda, syntax checking, browse documentation, commit your development changes to version control, emulate vim, all of which can be configured and tweaked emacs in numerous ways. If that doesn't satisfy you, then you can programmatically change emacs' behavior to better suit your development workflow.
  46. \section{Emacs Introduction}
  47. \label{sec:org9a8e7e3}
  48. Emacs is a incredibly old software. It's been around since the late 80s and early 90s, and its amazing flexibility is probably what has kept it alive this long. Learning Emacs can be a huge challenge of its own, but if you take the time to learn Emacs, the rewards are astonishing.
  49. \begin{center}
  50. \includegraphics[width=.9\linewidth]{/home/joshua/pictures/emacs_learning_curves.png}
  51. \end{center}
  52. (Original source appears to be Steve Rowe's blog. “A friend of mine put this together” \href{https://blogs.msdn.microsoft.com/steverowe/2004/11/17/code-editor-learning-curves/}{Source}).
  53. Since Emacs is so old, it created some terminology that modern text editors do not use. For example Emacs has "Frames" and "Windows", "yanking" and "killing" and no other text editor uses those terms, but the best way to learn Emacs, is to dive into the terminology. So put on your big programming pants, and follow me down the Emacs golden brick road of confusion!
  54. So go ahead and launch Emacs. When you do, you should see a blinking rectangle. When you start to type this rectangle moves and letters appear. That blinking rectangle is called \emph{point}. When \emph{point} moves around the text, we say that point moves in the \emph{buffer}. The \emph{buffer} then is a region in Emacs that contains text. Since you've just started Emacs, the whole Emacs graphical display is one \emph{frame}. You can also launch Emacs from the terminal and that is still just one frame of Emacs. If you open a second instance of Emacs, you now have two frames. Emacs also has windows. An Emacs \emph{window} is the portion of Emacs that contains the buffer, or the text. It's also possible to for a frame to have multiple windows. You can read more about creating and deleting windows and frames in \hyperref[sec:orgcd0af05]{Frame and Window Commands}.
  55. \section{Built in Emacs Features}
  56. \label{sec:org0ecb61a}
  57. \subsection{Movement}
  58. \label{sec:orgc25e6fb}
  59. One can always use the arrow keys to move point, but Emacs provides some nifty ways of moving point as well. Pressing and holding the control key whilst hitting "f" will move point forward one character. In Emacs lingo we call that a keychord, and it is denoted like this "C-f". Similarly, holding and pressing the control key, then hitting "b" will move point backward one character. That keychord is denoted as "C-b". "C-p" will move point back to the up previous line, and "C-n" will move point down to the next line. So the basic movement keys look like this:
  60. \begin{verbatim}
  61. "C-p"
  62. /\
  63. ||
  64. ||
  65. ||
  66. ||
  67. "C-b" <-------------||--------------> "C-f"
  68. ||
  69. ||
  70. ||
  71. ||
  72. ||
  73. ||
  74. \/
  75. "C-n"
  76. \end{verbatim}
  77. \subsection{Yanking and Killing}
  78. \label{sec:orge6ac8d8}
  79. Most text editors use the words "cutting", "pasting", and "coping" for the commands \texttt{C-x}, \texttt{C-v}, and \texttt{C-c}. Emacs used different words and different commands. What is normally called cutting is \emph{killing} in Emacs. In this way, one kills to the kill region, a section where Emacs stores killed text. Pasting is called \emph{yanking}. One yanks from the kill region to past into the buffer. Copying in Emacs is also called copying.
  80. To kill or copy a region of text, you must first \emph{mark} that region or highlight it. To begin marking a region of text one presses \texttt{C-<space>} or \texttt{C-SPC}. \texttt{<space>} and \texttt{SPC} means hitting the spacebar key. Then you can move around point until you have marked the entire region. To kill the region type \texttt{C-w}. To copy the region type \texttt{M-w}. M stands for the meta key, which on today's keyboard usually means the alt key. So \texttt{M-w} means to press and hold the alt key, then hit the w key. Alternatively hitting the ESC key is the same as pressing and holding the alt key. So \texttt{M-w} is the same thing as \texttt{ESC-w}.
  81. To yank the killed or copied text back into the buffer press the \texttt{C-y} keychord.
  82. \subsection{Opening, Closing, and Saving Files}
  83. \label{sec:orga52ca85}
  84. When one opens and edits a file in Emacs, Emacs opens the file and puts the contents in an editable buffer. As you edit the buffer, you only change the a region in memory. When you type \texttt{C-x s} to save the current buffer, the buffer's content are saved in the file.
  85. Since I am constantly changing multiple files, I've modified my save function to save every open file. If you would like to do the same, you can put the following in your init file:
  86. \begin{verbatim}
  87. (add-hook 'after-save-hook #'(lambda ()
  88. (interactive)
  89. (save-some-buffers 1)))
  90. \end{verbatim}
  91. Emacs' default method of opening a files is ido mode, which is pronounced like "I do mode". \texttt{C-x C-f} or (find-file) opens a file in Emacs. One can press the tab key to complete a partially completed file name. Typing "\textasciitilde{}/" means to make ido search in the user's home directory. I personally do not enjoy using ido-mode. Instead I prefer \hyperref[sec:org2d2c82c]{helm-mode}.
  92. \subsection{Frame and Window Commands}
  93. \label{sec:orgcd0af05}
  94. Emacs has windows and frames, and they are probably not what you think they are. A Frame is probably what you would think a window is. So when you follow a link in your browser in a new window, that is a window in browser terminology. In Emacs you can do the same thing, but it is called opening a new frame. Go ahead and open a new frame now by typing \texttt{C-x 5 2}. To get back to one Emacs frame, you can either close the additional frame normally, or you can press \texttt{C-x 5 0}.
  95. An Emacs window then is the buffer portion of the frame that displays text. One frame can have multiple windows. If you type \texttt{C-x 1}, then Emacs is only displaying one window. Then, if you type \texttt{C-x 2} or \texttt{C-x 3}, then Emacs is displaying 2 windows. So a window then is a section of the Emacs Frame that contains text from a buffer. To make the current frame only display one buffer, you can press \texttt{C-x 1}.
  96. In emacs the entire emacs program takes up a \textbf{frame}. But emacs allows you to view two different files in the same frame, by splitting the frame in half, or in two \textbf{windows}.
  97. \begin{itemize}
  98. \item \texttt{C-x o} Delete the selected window
  99. \item \texttt{C-x 1} Delete all the windows except the one that currently has point
  100. \item \texttt{C-x \textasciicircum{}} make the selected window taller
  101. \item \texttt{C-x \{} make the selected window narrower
  102. \item \texttt{C-x \}} make the selected window wider
  103. \end{itemize}
  104. \subsection{Bookmarks}
  105. \label{sec:org43ddfcc}
  106. Emacs bookmarks are nifty ways of saving your place in a file. If you wish to return to some obscure local or remote file, you can easily save point's current position, and return to it later.
  107. \begin{itemize}
  108. \item \texttt{C-x r m} sets a bookmark for you at point and it prompts you to name it
  109. \item \texttt{C-x r b} jumps you to a bookmark
  110. \end{itemize}
  111. \subsection{Learning About Emacs}
  112. \label{sec:org4c3ad76}
  113. Emacs comes with some amazing documentation. \texttt{M-x info} will show you a list of the available documentation that comes with Emacs. This documentation is contained in info files, which can be easily navigated via Emacs.
  114. Emacs also has a pretty powerful help command: \texttt{C-h}. \texttt{C-h v} will let you learn some documentation about a particular Emacs variable, while \texttt{C-h f} will show you documentation for an Emacs elisp function. Every time that you hit a keychord, an equivalent Emacs function is called. In fact \texttt{C-h k KEYCHORD}, will tell you the documentation for the a function based on its keychord. For example, \texttt{C-h k C-n} will display documentation for the function "next-line".
  115. \subsection{Configuring Emacs with Lisp}
  116. \label{sec:orga27941d}
  117. Emacs' flexibility stems from the ability to program-matically change it via Emacs lisp. If you dislike a particular aspect of Emacs, then you can easily change it by putting in some Emacs lisp code into your init file. This is the file that Emacs loads every time on startup. Any Emacs lisp functionality that you code in your init file, will be available every time you start emacs. You can find your init file by checking out the variable \texttt{user-init-file}. To do this press the keychord \texttt{C-h v RET user-init-file RET}.
  118. \subsection{Dired}
  119. \label{sec:org25797aa}
  120. Dired is the emacs file manager. It opens a buffer displaying all your files in the specified directory. With it you can perform numerous commands on marked files, like deleting, copying, moving, or even creating your own command.
  121. \subsubsection{Commands}
  122. \label{sec:org4fee3b2}
  123. \begin{itemize}
  124. \item \texttt{n} next line
  125. \item \texttt{p} previous line
  126. \item \texttt{m} mark the current file under point
  127. \item \texttt{\% m REGEXP <RET>} mark files based on a regular expression
  128. \end{itemize}
  129. \subsubsection{Image Dired}
  130. \label{sec:org8ebe122}
  131. You can also view images inside dired! Mark the images you wish to view, then press C-t d (image-dired-display-thumbs). Alternatively, you could also just run the command M-x image-dired.
  132. \subsection{Macros}
  133. \label{sec:orgbcfe604}
  134. A Macro is a remembered sequence of Emacs keychords that can be repeated. This is useful to easily repeat complicated commands. For example, I can write out the numbers 1 through a 1000 by typing a few keys.
  135. \begin{itemize}
  136. \item \texttt{C-x (} begin recording a keyboard macro
  137. \item \texttt{C-x )} end recording a keyboard macro
  138. \item \texttt{C-x e} performs the last created keyboard macro
  139. \end{itemize}
  140. \subsection{Narrowing}
  141. \label{sec:org7ce16de}
  142. Narrowing commands make Emacs only display portions of the buffer, whilst hidding all other regions. While Emacs is narrowed, all entered commands only affected the displayed regions. This means any hidden area cannot be modified while Emacs is narrowed. This is useful if you only want a macro to execute within a specific function. Here are the relevant narrowing commands:
  143. \texttt{C-x n <letter>}
  144. \begin{itemize}
  145. \item \texttt{d} narrow to defun
  146. \item \texttt{r} widen to region
  147. \item \texttt{s} narrow to a org subtree
  148. \item \texttt{w} widden to the whole buffer
  149. \end{itemize}
  150. A much better way to use the narrowing commands is just to make emacs guess what you want whenever you press "C-x n", and that's what the following snippet does. I recommend that you put it in your .emacs file. The code works by figuring out which narrowing command you want to use. If point is currently in a definition, then the buffer will be narrowed to that definition. If point is in an org-subtree, then the buffer will be narrowed to that subtree.
  151. You can see the blog post where I found this code snippet \href{http://endlessparentheses.com/emacs-narrow-or-widen-dwim.html}{here.}
  152. \begin{verbatim}
  153. ;; Also set up narrow dwin
  154. (defun narrow-or-widen-dwim (p)
  155. "Widen if buffer is narrowed, narrow-dwim otherwise.
  156. Dwim means: region, org-src-block, org-subtree, or defun,
  157. whichever applies first. Narrowing to org-src-block actually
  158. calls `org-edit-src-code'.
  159. With prefix P, don't widen, just narrow even if buffer is
  160. already narrowed."
  161. (interactive "P")
  162. (declare (interactive-only))
  163. (cond ((and (buffer-narrowed-p) (not p)) (widen))
  164. ((region-active-p)
  165. (narrow-to-region (region-beginning) (region-end)))
  166. ((derived-mode-p 'org-mode)
  167. ;; `org-edit-src-code' is not a real narrowing
  168. ;; command. Remove this first conditional if you
  169. ;; don't want it.
  170. (cond ((ignore-errors (org-edit-src-code))
  171. (delete-other-windows))
  172. ((ignore-errors (org-narrow-to-block) t))
  173. (t (org-narrow-to-subtree))))
  174. ((derived-mode-p 'latex-mode)
  175. (LaTeX-narrow-to-environment))
  176. (t (narrow-to-defun))))
  177. ;; This line actually replaces Emacs' entire narrowing
  178. ;; keymap, that's how much I like this command. Only copy it
  179. ;; if that's what you want.
  180. (define-key ctl-x-map "n" #'narrow-or-widen-dwim)
  181. \end{verbatim}
  182. \subsection{org-mode}
  183. \label{sec:orgd079476}
  184. Emacs org-mode really deserves its own cheatsheat, so I won't go into much detail here, but I'll start you off with the basics. Org-mode is Emacs' organizational mode, and it's pure gold! With Org-mode I organize my daily agenda, todo lists. Parts of my emacs init files are written in it. I use it to keep track of my working hours, with which I then invoice clients. I use its markup to write MIME emails. I wrote all of my documentation in it, and I keep track of my finances with it! It truly is a remarkable emacs mode!
  185. \subsubsection{Org-mode's hierarchical structure}
  186. \label{sec:org137506d}
  187. Org-mode lets you easily insert headings and sub headings with "C-RET". If you press it many times, you'll have something like this:
  188. \begin{verbatim}
  189. *
  190. *
  191. *
  192. *
  193. \end{verbatim}
  194. A line with just one "\textbf{" is a top level heading. If it has a two "*}" below it, then it now has a sub-heading. Just like the following:
  195. \begin{verbatim}
  196. * I am a top level heading
  197. ** I am a sub-heading.
  198. \end{verbatim}
  199. You can use the tab key to show/hide any sub level headings.
  200. Org-mode is also great for todo lists. Hitting \texttt{C-c C-t} lets you mark an item as TODO or DONE.
  201. \paragraph{Todo lists}
  202. \label{sec:org1209f0c}
  203. One can easily create simple todo lists with org-mode. In any org file \texttt{C-RET} inserts a "*" into the buffer. Pressing "C-c C-t" will add the words "TODO". It'll look like:
  204. \begin{verbatim}
  205. * TODO
  206. \end{verbatim}
  207. Pressing \texttt{C-c C-t} again, will change the status to DONE. You will end up with something looking like:
  208. \begin{verbatim}
  209. * DONE
  210. \end{verbatim}
  211. \subsubsection{org-babel}
  212. \label{sec:org0265631}
  213. Org babel is a the best approach towards literate programming ever attempted, and it works! Almost all programming languages treat code as the first order citizen and hides comments behind a simple syntax. I will eventually move org babel into its own cheatsheet, but I will describe the basics for you here. For example here is some javascript:
  214. \begin{verbatim}
  215. console.log("hello world")
  216. \end{verbatim}
  217. Let's write a trivial js function the literate way
  218. \begin{verbatim}
  219. #+BEGIN_SRC js :exports code
  220. var i = 5;
  221. if (i < 6) {
  222. i++;
  223. }
  224. console.log (i);
  225. #+END_SRC
  226. \end{verbatim}
  227. Literate programming might not be the best method of coding large projects, but it incredibly useful for writing your Emacs config files. You can see an example of my org more custom-izations \href{https://github.com/jbranso/.emacs.d/blob/master/lisp/init-org.org}{here}.
  228. \paragraph{Specific header arguments}
  229. \label{sec:org631391f}
  230. \url{http://orgmode.org/manual/Specific-header-arguments.html} \\
  231. \href{org\#Specific\%20header\%20arguments}{info:org\#Specific header arguments} \\
  232. \begin{itemize}
  233. \item :results \\
  234. syntax: \\
  235. :results [raw | silent | value | output ] \\
  236. value is function mode. It means that org-mode will use the last executed command as the value of the output. ie:
  237. \begin{verbatim}
  238. import time
  239. print("Hello, today's date is %s" % time.ctime())
  240. print('Two plus two is')
  241. return 2 + 2
  242. \end{verbatim}
  243. \begin{verbatim}
  244. echo "hello world"
  245. echo "big cat"
  246. ls -lh | grep emacs.org
  247. \end{verbatim}
  248. \item :exports [code | results | node | both]
  249. \item :dir
  250. Specify a default directory that the code is to be run in
  251. :dir dir
  252. \begin{verbatim}
  253. ls
  254. \end{verbatim}
  255. \end{itemize}
  256. :dir can also specify remote directories to run code!
  257. \begin{verbatim}
  258. ls
  259. \end{verbatim}
  260. \section{Helpful Emacs modes}
  261. \label{sec:org406102e}
  262. \subsection{Bug Hunter}
  263. \label{sec:org0ea84be}
  264. If you fairly regularly change your init file, then you will at some point open your init file with a broken emacs. Bug hunter helps you quickly narrow down the cause of the error. You want to make sure that bug-hunter is loaded early in your init, but then anytime that you find another issue, just run.
  265. \texttt{M-x bug-hunter-init-file e RET}
  266. \url{https://github.com/Malabarba/elisp-bug-hunter}
  267. \subsection{Helm Mode}
  268. \label{sec:org2d2c82c}
  269. Helm mode is an interactive completetion framework that is much better than ido mode.
  270. C-c C-f helm-find-files
  271. In this mode typing "\textasciitilde{}/ manage js\$"
  272. will display a list of files in my home directory that contain the word "manage" and end with "js"
  273. Typing C-l will display the files is the parent directory.
  274. Typing C-z when point is on a directory, will show the files in that directory.
  275. Helm has nth commands. Instead of typing tab to get to the action menu
  276. just press C-e for the 2nd action
  277. and C-j for the 3rd action.
  278. You can also bind a key to an action menu
  279. (define-key helm-map (kbd "<C-tab>") 'helm-select-4th-action)
  280. \subsubsection{commands}
  281. \label{sec:orga94123e}
  282. You can learn how to write your own helm commands here: \href{http://wikemacs.org/wiki/How\_to\_write\_helm\_extensions}{write your own helm extentions}
  283. \texttt{C-c h m} open helm-man-woman
  284. \texttt{C-c h h g} open helm info gnus
  285. \texttt{C-c h h r} open the helm-emacs-info
  286. \texttt{C-c h b} is helm-resume which opens up the last helm instance.
  287. \texttt{M-<space>} mark candidate
  288. \texttt{C-h m} inside a helm window will show you all of helm's keybindings
  289. \subsection{El-doc}
  290. \label{sec:org98d6ece}
  291. El-doc shows you a function's documentation in the mini-bar as you write it. By default it works for emacs lisp extremely well. functions. You can add this to your init file if you'd like to try it for emacs lisp.
  292. \begin{verbatim}
  293. (add-hook 'emacs-lisp-mode-hook 'eldoc-mode)
  294. \end{verbatim}
  295. \subsection{Yasnippet}
  296. \label{sec:org8d0d875}
  297. Yasnippet is Emacs non-official but pretty much most commonly used snippet system. You can define an abbreviation, then when expanded does what the snippet file says to do.
  298. \url{http://ergoemacs.org/emacs/yasnippet\_templates\_howto.html}
  299. \subsubsection{Important Characters}
  300. \label{sec:org7fe9ab0}
  301. \begin{itemize}
  302. \item \texttt{\$\&} indents the line according to the major mode
  303. \item \texttt{`(some-lisp-code)`} embods lisp code
  304. \item \texttt{\$0} where point will be when the snippet ends
  305. \item \texttt{\$n} where n is a number ie: \texttt{\$1}, \texttt{\$2}, etc. If you have multiple \$3, then typing some text in one \$3 will also be put in
  306. the other \$3.
  307. \item =\$\{n:<placeholder text>\}
  308. \end{itemize}
  309. \subsection{Undo Tree}
  310. \label{sec:org74fa4be}
  311. Undo tree is a mode that lets you visually step through the changes that you have done to the buffer. You can step backwards and forwards through time. In normal creation of a documentent, a user typically creates several changes that the emacs undo command is not sufficient to solve. A document's historical content is not always linear. Instead, during normal editing, a user can write content that the normal emacs undo command forgets about. This is where undo tree is helpful. Invoking \texttt{M-x undo-tree} shows the user a visual representation of the buffer in time. Using the arrow keys (or conventional emacs replacements), one can step through a documentent's progression.
  312. \subsection{Ediff}
  313. \label{sec:org053654a}
  314. Ediff is emacs's cool way of comparing two files and merging them into one. \texttt{M-x ediff} starts the process. Emacs will prompt you to ediff two files, and then you can begin merging the files together.
  315. \subsubsection{Commands}
  316. \label{sec:orgd027687}
  317. \begin{itemize}
  318. \item \texttt{a} copies buffer a diff to buffer b
  319. \item \texttt{b} copies buffer b diff to buffer a
  320. \item \texttt{A} toggles readonly mode of buffer a
  321. \item \texttt{B} toggles readonly mode of buffer b
  322. \item \texttt{wa} save buffer a
  323. \item \texttt{wb} save buffer b
  324. \item \texttt{!} update the differance regions. If you press \texttt{a} and \texttt{b} multiple times, you should probably do a \texttt{!}
  325. \item \texttt{*} highlights the words in the diff region that differ
  326. \item \texttt{ra} restore the diff region in buffer a
  327. \item \texttt{rb} restore the diff region in buffer b
  328. \item \texttt{z} suspend the ediff session
  329. \item \texttt{s} make the merge buffer as small as possible
  330. \end{itemize}
  331. When you specify files, you can edit the files as root using tramp's syntax like this.
  332. /su::/path/to/file
  333. \subsection{Tramp}
  334. \label{sec:orgd2d54a3}
  335. Tramp is an emacs extension that lets you edit remote files. To use tramp, just begin by opening a file via \texttt{C-x C-f} (find-file) then typing one of the following special syntaxes:
  336. /HOST:FILENAME
  337. /USER@HOST:FILENAME
  338. /USER@HOST\#PORT:FILENAME
  339. /METHOD:USER@HOST:FILENAME
  340. /METHOD:USER@HOST\#PORT:FILENAME
  341. \section{Regexp}
  342. \label{sec:orga50996f}
  343. Regular expressions are nifty ways of searching/replacing regions of text.
  344. Consider this example
  345. \begin{verbatim}
  346. if (isadmin() || ismanager ()) {
  347. //some code here
  348. }
  349. \end{verbatim}
  350. Suppose that you want to add a space between both "is" in the functions. The following would do this:
  351. \texttt{M-x dired-do-query-replace-regexp is\textbackslash{}(admin\textbackslash{}|manager\textbackslash{}) RET is \textbackslash{}1 RET}
  352. But let's get a basic understanding of regexps.
  353. \section{Useful Elisp Libraries}
  354. \label{sec:orgf1745b5}
  355. \begin{itemize}
  356. \item ctable \url{https://github.com/kiwanami/emacs-ctable}
  357. \item s \url{https://github.com/magnars/s.el}
  358. \item f \url{https://github.com/rejeep/f.el}
  359. \item dash \url{https://github.com/magnars/dash.el}
  360. \end{itemize}
  361. \end{document}