From 968ddaeec10aa14829b220378838d4617e9bae8d Mon Sep 17 00:00:00 2001 From: qorg11 Date: Mon, 25 May 2020 03:10:22 +0200 Subject: [PATCH] Added a bunch of things --- emacs/{introduction => 1_Introduction}/.lorem | 0 emacs/1_Introduction/0_Getting_help.md | 31 ++++++++ .../moving.md => 1_Introduction/1_Moving.md} | 1 + emacs/1_Introduction/2_Files.md | 72 +++++++++++++++++++ .../{introduction => 1_Introduction}/index.md | 0 .../index.md | 0 .../lisp.md | 0 .../perl.md | 0 emacs/index.md | 17 +++-- 9 files changed, 117 insertions(+), 4 deletions(-) rename emacs/{introduction => 1_Introduction}/.lorem (100%) create mode 100644 emacs/1_Introduction/0_Getting_help.md rename emacs/{introduction/moving.md => 1_Introduction/1_Moving.md} (99%) create mode 100644 emacs/1_Introduction/2_Files.md rename emacs/{introduction => 1_Introduction}/index.md (100%) rename emacs/{Practical_Work_In_Emacs => X_Practical_Work_In_Emacs}/index.md (100%) rename emacs/{Practical_Work_In_Emacs => X_Practical_Work_In_Emacs}/lisp.md (100%) rename emacs/{Practical_Work_In_Emacs => X_Practical_Work_In_Emacs}/perl.md (100%) diff --git a/emacs/introduction/.lorem b/emacs/1_Introduction/.lorem similarity index 100% rename from emacs/introduction/.lorem rename to emacs/1_Introduction/.lorem diff --git a/emacs/1_Introduction/0_Getting_help.md b/emacs/1_Introduction/0_Getting_help.md new file mode 100644 index 0000000..bb5a49b --- /dev/null +++ b/emacs/1_Introduction/0_Getting_help.md @@ -0,0 +1,31 @@ +# Getting help about Emacs + +Emacs is a very big software and you'll surely will need help about +it. There are some ways to get help on Emacs. + +## Self documenting text editor + +Emacs claims to be a *self-documenting* text editor. And it's true: + +Emacs has a lot of built-in documentation. For example. If you don't +know what the C-r keybindings do, you can do this: + +C-h k C-r_ + +Emacs will split and will show what the keybindings you gave does. + +Emacs has a built-in tutorial. You can access to it by pressing C-h t. + +## Getting help from another users + +You can talk to other Emacs users and ask them for help on some sites: + +* [Emacs stack exchange](https://emacs.stackexchange.com/) +* [The help-gnu-emacs mailing list](https://lists.gnu.org/archive/html/help-gnu-emacs/) +* #emacs on freenode + +## Tips about emacs + +There's a [twitter account](https://twitter.com/iLemming) which post +tips about Spacemacs and Emacs. The account's owner also posts useful +packages you can install in Emacs. diff --git a/emacs/introduction/moving.md b/emacs/1_Introduction/1_Moving.md similarity index 99% rename from emacs/introduction/moving.md rename to emacs/1_Introduction/1_Moving.md index a87f398..079263c 100644 --- a/emacs/introduction/moving.md +++ b/emacs/1_Introduction/1_Moving.md @@ -37,6 +37,7 @@ love it more than "comfortable" Vim key bindings. If moving character by character is too slow, you can try using the M-f and M-b to move word by word. M-p and M-n don't do anything. So don't try it. + ## Moving even faster Sometimes you just have to go to the end or beginning of the diff --git a/emacs/1_Introduction/2_Files.md b/emacs/1_Introduction/2_Files.md new file mode 100644 index 0000000..fa22773 --- /dev/null +++ b/emacs/1_Introduction/2_Files.md @@ -0,0 +1,72 @@ +# Editing files on Emacs + +Emacs is a text editor. So its main function is to edit text. You can +open a file with C-x C-f ```(find-file)``` and type the name of the +file you want to open, for example: + +C-x C-f myfile + +That will create a buffer[^1] which your file's contents. + +There is another ways to visit a file in Emacs. for example: + +C-x C-r `(file-find-read-only)`: This will open a file but won't allow +you to make changes on it. + +C-x 4 f `(find-file-other-window)`: This splits your Emacs window +vertically and puts the selected file you gave on the buffer bellow + +C-x 5 f `(find-file-other-frame)`: This opens another Emacs window[^2] +and puts the selected file on a new buffer. + +# Opening remote files + +Emacs comes with TRAMP which can be used to open remote files. To open +a remote file. Press C-x C-f ```(find-file)``` and follow this syntax: + +~~~ +/method:host:filename +/method:user@host:filename +/method:user@host#port:filename +~~~ + +If you don't gave a method (put - as method) Emacs do the following: + +1. If `host` starts with ftp, Emacs will use ftp +2. If `user` is "*ftp*" or "*anonymous*" Emacs will use ftp. +3. If the variable `tramp-default-method` is ftp, Emacs will use ftp. +4. If ssh-agent is running, Emacs will use ftp. +5. Otherwise, Emacs will use ssh. + +Try opening this remote file: `ftp://test.rebex.net/readme.txt` + +To do this, press C-x C-f ```(find-file)``` and type this +/ftp:demo@test.rebex.net:/readme.txt + +Emacs will ask for a password. This password is `password` + +This is a read only ftp server, but if it allowed write, you could +write the remote file with C-x C-s `(save-buffer)` + +## Writing text + +To add text to a buffer, you just type what you want to add on the +buffer, unlike Vi/Vim Emacs do not have an "INSERT" mode. + +When you finish typing and want to save what you have done press C-x C-s `(save-buffer)` + +## Reverting edits on Emacs + +Emacs, like every other text editor, allows to undo what you've done. + +If you have done massive changes to a file and want to revert it, type +`M-x revert-buffer` Emacs will ask confirmation. Since this reverts to +the saved version of the buffer. If you saved the file after some +changes, this method will not work. You can undo your last change to +the file with some shorcuts: C-x u, C-/ and C-_ `(undo)` + +[^1]: A buffer is where the text resides on your Emacs window, +everything in Emacs is a buffer. In other words, a buffer holds +your text file. +[^2]: This is not a new Emacs run, it is called a "frame" These +two emacs window shares the opened buffers. diff --git a/emacs/introduction/index.md b/emacs/1_Introduction/index.md similarity index 100% rename from emacs/introduction/index.md rename to emacs/1_Introduction/index.md diff --git a/emacs/Practical_Work_In_Emacs/index.md b/emacs/X_Practical_Work_In_Emacs/index.md similarity index 100% rename from emacs/Practical_Work_In_Emacs/index.md rename to emacs/X_Practical_Work_In_Emacs/index.md diff --git a/emacs/Practical_Work_In_Emacs/lisp.md b/emacs/X_Practical_Work_In_Emacs/lisp.md similarity index 100% rename from emacs/Practical_Work_In_Emacs/lisp.md rename to emacs/X_Practical_Work_In_Emacs/lisp.md diff --git a/emacs/Practical_Work_In_Emacs/perl.md b/emacs/X_Practical_Work_In_Emacs/perl.md similarity index 100% rename from emacs/Practical_Work_In_Emacs/perl.md rename to emacs/X_Practical_Work_In_Emacs/perl.md diff --git a/emacs/index.md b/emacs/index.md index 5abd1cf..286933d 100644 --- a/emacs/index.md +++ b/emacs/index.md @@ -2,7 +2,7 @@ Emacs (short for Editor MACroS) is a text editor[^1] made by some weird guy in the late 70s, and had too many implementations, such as -Xemacs, Freemacs, µEmacs (microemacs). in 1984 (lmao), the GNU project ~~stole~~ +XEmacs, Freemacs, µEmacs (microemacs). in 1984 (lmao), the GNU project ~~stole~~ rewrote the original Emacs code and the most used version of Emacs was born: GNU Emacs. @@ -10,7 +10,7 @@ born: GNU Emacs. Windows users: (Or their nearly GNU mirror) -Mac Users: brew install emacs, I guess. +Mac Users: brew install Emacs, I guess. GNU/Linux users: probably the "emacs" package on your distro's repos @@ -20,8 +20,8 @@ Plan 9 users: What are you doing here? # Other versions of Emacs -As mencioned above, there are other versions of emacs, most of them -are obsolete (Xemacs for example). µEmacs is the emacs version used +As mentioned above, there are other versions of emacs, most of them +are obsolete (XEmacs for example). µEmacs is the emacs version used by Linus Torvalds[^2] I do not recommend to use it. If you want to use a mini Emacs, you should try [Zile](https://gnu.org/software/zile) or [Jed](http://www.jedsoft.org/jed/). Zile is stupidly minimum while Jed @@ -30,6 +30,15 @@ real GNU Emacs. You can find more about Emacs on the sidebar. +# Information about Emacs + +In Emacs, everything is an Emacs Lisp function, each keybinding, every +M-x function is written in Emacs Lisp, Emacs Lisp is a complete +programming language. So that's why you can see browsers inside Emacs. + +In this book, I'll write the name of the function in front of a +keybinding. Because they're pretty self explanatory + **Highly work in progress, please [contribute](https://gitlab.com/qorg11/kill9)** [^1]: Some people call it a "operating system", but I prefer to call it a Emacs Lisp interpreter.