diff --git a/README.md b/README.md deleted file mode 100644 index 400e9b9..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# emacs_tutorial - -Some hints to use GNU-emacs \ No newline at end of file diff --git a/README.org b/README.org new file mode 100644 index 0000000..358688e --- /dev/null +++ b/README.org @@ -0,0 +1,46 @@ +* Emacs tutorial + + Some hints to use GNU-emacs + + Emacs is a modular and extensible text editor. Users can customize and use only the + specific packages that are needed for their tasks. + + Emacs is free software project with many years of development and a very active + community. + + This editor can be used for multiple purposes, for instance: + + - Edit files from different programming languages or any plain text + - Access a shell and execute tasks in a machine + - Write, edit and export text in multiple formats (html, odt, pdf...) + - Read texts (pdf, epub, html...) + - Create slides/presentations + - Build diagrams + - Browse the internet + - Explore and edit a computer file system + - Keep track of tasks using agenda, daily, contact list, "to-do" list... + - Arrange and track multiple projects and tasks + - Use your email + - Listen music and watch videos + +* Contents + + * [[./doc/init_emacs.org][Initialize emacs]] + * [[./doc/help.org][Manuals and help about using emacs]] + * [[./doc/movement.org][Movement and text edition]] + * Using emacs commands + * [[./doc/using_meta.org][Using 'meta' (M-x)]] + * [[./doc/using_alt.org][Using 'Alt' (M)]] + * [[./doc/using_ctrl_x.org][Using 'CTRL + x']] + * [[./doc/using_ctrl.org][Using 'CTRL']] + * [[./doc/ddbb_use.org][Using ddbd to keep your contacts]] + * [[./doc/org_intro.org][Introduction to emacs org-mode]] + * [[./doc/dired.org][How to use 'dired']] + * [[./doc/packages.org][Dealing with packages in emacs]] + * [[./doc/R_in_emacs.org][Using R in emacs]] + * [[./doc/links_emacs.org][Links to learn more about emacs]] + +* To-do list + +** TODO [#A] Read about 'info' package :read: +** TODO [#A] Read this https://plantarum.ca/ :read: diff --git a/doc/R_in_emacs.org b/doc/R_in_emacs.org new file mode 100644 index 0000000..9e7643e --- /dev/null +++ b/doc/R_in_emacs.org @@ -0,0 +1,67 @@ +#+DATE: 2021 + +* Using R within emacs + +** Open R manuals in Emacs-ess + +The function ~?help.start()~ from ~utils~ package doesn't open the R manuals +in R vanilla + +#+begin_src R + ?help.start() +#+end_src + +#+RESULTS: + +To find the help files with rutils in Emacs-ess, use: + +: M-x ess-rutils-html-docs + +To open the help documents in browser, check the value of variable +and set the browser + +#+begin_src R + test <- options() + head(test) +#+end_src + +#+RESULTS: +| TRUE | cairo | iceweasel | FALSE | FALSE | FALSE | + +#+begin_src R + test <- options() + names(test[1:10]) +#+end_src + +#+RESULTS: +| add.smooth | +| bitmapType | +| browser | +| browserNLdisabled | +| CBoundsCheck | +| check.bounds | +| citation.bibtex.max | +| continue | +| contrasts | +| defaultPackages | + +: > option(browser = "iceweasel") # setting a browser + +The manuals can also be accessed using 'info' program in emacs, e.g. + +: C-h i + +Then use 'ALT' + 'm' and write the initial words of the manual you +are looking for: + +: M m R + +All the R manual can be accesed. From ~$ man R~. Typing in terminal 'info -f' followed +by the name of each section: + + * info -f R-intro + * info -f R-data + * info -f R-exts + * info -f R-FAQ + * info -f R-lang + * info -f R-ints diff --git a/doc/ddbb_use.org b/doc/ddbb_use.org new file mode 100644 index 0000000..a3dae7d --- /dev/null +++ b/doc/ddbb_use.org @@ -0,0 +1,72 @@ +#+DATE: 2021 + +* Using bbdb in emacs + +BBDB is the "Big Brother’s Insidious Database". It can be used as +email/phone contacts address book. + +** How to install + +Install bbdb + +: M-x package-install bbdb + +Install "bbdb-vcard" to extract vcard information + +: M-x package-install bbdb-vcard + +Install helm-bbdb to query the database using ~helm~ package + +: M-x package-install helm-bbdb + +** How to create a new record + +: M-x bbdb-create + +Or use helm + +: M-x helm-bbdb + +Then, write the name of the new record. If it is not in the list, ~helm~ will ask +if it should be included. + +** Importing records from vcard (phone or email) + +: M-x bbdb-vcard-import-file + +: M-x bbdb-save + +** Edit records + +Open bbdb and press "e" on the line to be edited in bbdb buffer. Or use: + +: M-x bbdb-edit-field + +** Display records + +: M-x bbdb-display-records + +: M-x bbdb-display-all-records + +: M-x helm-bbdb + +** Add birthdays to agenda + +Include this code in one of the agenda files: + +#+begin_example + * Anniversaries + :PROPERTIES: + :CATEGORY: Anniv + :END: + %%(org-bbdb-anniversaries-future) +#+end_example + +This includes a reminder 7 days before the birthday in the agenda. + +Then go to bbdb and add a new field + +: M-x bbdb-insert-field + +Now you can write the new field name "anniversary" and include a date for this +field. diff --git a/doc/dired.org b/doc/dired.org new file mode 100644 index 0000000..1db2ebd --- /dev/null +++ b/doc/dired.org @@ -0,0 +1,46 @@ +#+DATE: 2021 + +* Dired + +Dired is a directory manager. You can find, open copy, move, delete query and +manipulate files and directories. + +** Open a directory with dired and initialize mark regxexp: + +: %m + +Then, use regex to mark the files. + +This will mark all the html files in directory + +: \.html$ + +This includes all temporary files in dired + +: $~ + + This marks all files beginning with "_78" + +: ^_78 + +** Delete, copy, move files or directories + +- To delete, first flag the files ("d"). Then, use "x" to execute delete. +- To compare two files, mark the first file, then go to the other file and press "=" +- To rename or move files first flag the file, then use "R" +- Mark all files within a directory (except '.' or '..'): ~*s~ +- Unmark all marked files in directory: ~U~ +- To copy files use "C" over the file you want to copy +- Convert files or directories to lower (~%l~) or upper case (~%u~) + +* Tips + + * 'f11' toggle full screen mode the current frame + * ibuffer kill multiple buffers + * After open a list of buffers "M-x ibuffer" mark itens with "m" +and kill with "D" + * Avoid ido auto complete to rename a file with similar name to those in directory + * Once you've typed the filename you want, hit C-j instead of RET. + * You can temporarily switch back to the "normal" minibuffer behaviour by hitting C-f. Then you can tab-complete the old filename, and edit it as needed. + * From [[https://stackoverflow.com/questions/23741014/how-to-stop-auto-complete-from-overwriting-a-file-that-is-similarly-named][Stackoverflow]] + * To use ~nano~ editor within emacs use 'CTRL+shift+x' instead of 'CTRL+X' diff --git a/doc/help.org b/doc/help.org new file mode 100644 index 0000000..6a00f22 --- /dev/null +++ b/doc/help.org @@ -0,0 +1,44 @@ +#+DATE: 2021 +#+OPTIONS: num:nil toc:2 + +* Find manuals, info or help within emacs + +** info + +The info files are located in '/usr/share/'. Check the number of files +in terminal: + +#+begin_src sh + ls /usr/share/info/*info*gz | wc -l +#+end_src + +#+RESULTS: +: 231 + +Within emacs, 'info' can be visited with 'CTRL-h i'. This opens a file with all +the manuals. + +: C-h i + +To search for files within the manuals, you can use 'ALT' then 'm' (menu) and +then 'some words you need to find'. + +To search 'awk' manual within info manuals: + +: M m awk + +** man + +Using the 'man' program to find available manuals + +: M-x man + +Then search for the desired manual within the options. + +** woman + +Using the 'woman' program to find available manuals + +: M-x woman + +Using the 'man' program to find available manuals diff --git a/doc/init_emacs.org b/doc/init_emacs.org new file mode 100644 index 0000000..0984da7 --- /dev/null +++ b/doc/init_emacs.org @@ -0,0 +1,28 @@ +#+DATE: 2021 +#+OPTIONS: num:nil toc:2 + +* How to initialize emacs + +** Open a session from graphic interface + +Check you application lists and open emacs. + +** Initializing emacs with specific arguments from a shell + +To open emacs without user configurations, i.e., open a new vanila emacs session open a terminal emulator and write: + +#+begin_example bash + emacs -Q +#+end_example + +Debug when init: + +#+begin_example bash + emacs --debug-init +#+end_example + +Open emacs withtout using X windows: + +#+begin_example bash + emacs -nw +#+end_example diff --git a/doc/links_emacs.org b/doc/links_emacs.org new file mode 100644 index 0000000..96b0a32 --- /dev/null +++ b/doc/links_emacs.org @@ -0,0 +1,26 @@ +#+DATE: 2021 + +* Links to learn about Emacs + +** Emacs conference: + + * https://emacsconf.org/ + +** Tutorial spacemacs + + * https://www.brodrigues.co/blog/2019-05-19-spacemacs/ + * https://github.com/ntop/n2n + * https://orgmode.org/ + * https://github.com/ch11ng/exwm/wiki + * https://writequit.org/denver-emacs/presentations/2017-04-11-time-clocking-with-org.html + * [[https://org-babel.readthedocs.io/en/][Org Babel reference card]] + +** Org + + * https://orgmode.org/Changes.html + +** Other links + + * https://odysee.com/@SystemCrafters:e + * https://wiki.systemcrafters.cc/ + * https://protesilaos.com/politics/ diff --git a/doc/movement.org b/doc/movement.org new file mode 100644 index 0000000..03bfc86 --- /dev/null +++ b/doc/movement.org @@ -0,0 +1,15 @@ +#+DATE: 2021 + +* Movement and text edition + +Deleting words or characters + +| Keybinding | Action | +|------------+----------------------------------------------| +| | Delete the character just before the cursor | +| C-d | Delete the next character after the cursor | +| M- | Kill the word immediately before the cursor | +| M-d | Kill the next word after the cursor | +| C-k | Kill from the cursor position to end of line | +| M-k | Kill to the end of the current sentence | +|------------+----------------------------------------------| diff --git a/doc/org_intro.org b/doc/org_intro.org new file mode 100644 index 0000000..a0120dd --- /dev/null +++ b/doc/org_intro.org @@ -0,0 +1,64 @@ +#+DATE: 2021 + +* org mode + +To opemn the org manual: + +: M-x org-info + +** Create task list and include date and time + +Save a ".org" file. Then write your tasks using "*" to show hierarchy or nesting +structure in tasks. + +** Using Pomodoro in org mode + +- Install pomodoro + +: M-x [RET] package-install org-pomodoro + +- Initialize a clock in a task + +: M-x [RET] org-clock-in + +- Initialize pomodoro + +: M-x [RET] org-pomodoro + +** org-babel + +Reference for header arguments: + +https://org-babel.readthedocs.io/en/latest/header-args/ + +** Org babel does not embedd R plot + +org version 9.3 + +https://orgmode.org/Changes_old.html + +:file header argument no longer assume "file" :results + +The "file" :results value is now mandatory for a code block returning a link to a file. +The :file or :file-ext header arguments no longer imply a "file" result is expected. + +[[https://emacs.stackexchange.com/questions/54695/no-graphic-output-for-matlab-src-block-in-org-mode?newreg=dc27c692d7d949989ba432459d370995][Answer in stackexchange]] + +** Include templates in org babel + +Use: + +: M-x org-insert-structure-template + +Or keybinding + +: C-c C, + +Then choose an option (src, example, center, comment) + +Or use org-tempo. To include a src code block in the document: + +: | Move to end of buffer | +| | % | Query replace | +| | Shift +$ | Spell-checking region [fn:1] | +| | | | + +* Footnotes + +[fn:1] Should select the region to be checked before run the keystroke diff --git a/doc/using_ctrl.org b/doc/using_ctrl.org new file mode 100644 index 0000000..561c2f0 --- /dev/null +++ b/doc/using_ctrl.org @@ -0,0 +1,54 @@ +#+DATE: 2021 + +* Commands + +Use CTRL (C), ALT (M), Ctrl + x (C-x) or ALT + x ( M-x) to edit + +#+Caption: Some examples on how to use 'Ctrl' in emacs + +| Keystroke | Keystroke | Action | +|-----------+--------------------------+-----------------------------------------------------------| +| C | tab | Changing tab view | +| | y | Yanking or paste | +| | space | Marking text to select | +| | w | Killing text | +| | k | Killing text | +| | shift/ | Undo | +| | "/" | Undo | +| | _ | Undo. Also Redo after an "undo" | +| | v | Move to the end of buffer | +| | l | Move view around cursor | +| | p | Move to previous screen view | +| | n | Move to next screen view | +| | b | Move backwards screen view | +| | f | Move forwards screen view | +| | a | Move to beginning of sentence | +| | e | Move to the end of sentence | +| | s | Search forward for strings | +| | s and then | Search retreats | +| | r | Search backward for strings | +| | M-v ("ALT-v") | Scroll bottom frame | +| | h | Help | +| | h with - c - a "command" | Help for commands | +| | h m | Display info on minor modes | +| | c-C-j | Switch to line in Term mode | +| | c-C-k | Swith to character in Term mode | +| | h r | Opens the manual | +| | c C-s | Scheduling a task in Todo list | +| | c C-d | Including a deadline in Todo list | +| | c C-x C-i | org-clock-in | +| | c C-x C-o | org-clock-out | +| | c C-c | Used to access markdown options | +| | c [ | org-agenda-file-to-front | +| | c ] | org-remove-file (from list agenda) | +| | \ | Enable or disable input method | +| | c-C-, | org-insert-structure-template | +| |