In this file I add new things I learn about Emacs and orgmode.
QUESTION
and #FIXME
mark section where help is needed.
Pure Windows - Windows executable (not WSL, just from shell):
emacs.exe
starts GUI (Russian font ok, preferred option)emacs.exe -nw
for text moderunemacs.exe
(runs GUI, has issue with bad Russian font spacing)
WSL:
- WSL in terminal (cmder) with bash (Ubuntu)
- XServ graphics (X410) - pipeline to start a bit complex
VSCode extension:
- syntax highlighing and some commands
- no agenda view
Mobile:
- Android + Termux + Emacs (You will probably need something like Hacker’s Keyboard to input the shortcuts effectively)
- Orgzly
- Install emacs on WSL with
sudo apt-get install emacs
- Launch emacs with
emacs -nw <FILENAME.org>
command - Open a file with F10 - File menu
- Edit file
- Save file C-x C-s
- Exit Emacs C-x C-c
Must configure terminal to resolve key binding conflicts like Ctrl-C.
- Selection with Shift is already built-in part of Emacs, but not org-mode
- Start with ‘M-x customize’ to find options about Shift selection
- Set CUA (Ctrl-Z/X/C/V) as part of F10 menu with Enter
- Save options
Use just one, any of them:
- ~/.emacs is a config file
- ~/.emacs.d is a directory with init.el config file
- Original article with X410 recommendation
- On WSL 1 works at 127.0.0.1
- X410 is available form Windows Store (USD10 with discount), it saves a ton of time for configuration, including the fonts.
- Selecting a Keyboard Layout
- This page details the use of the
setxkbmap
command to set X410 keyboard layout. By example, to set keyboard layout to Russian, the command issetxkbmap ru
.
Kill it with C-x 1 or try (setq inhibit-splash-screen t)
.
You can configure orgmode to use Shift-arrows for selection
with org-support-shift-select
.
Unsure how it works on emacs, is it C-s? What about replace? Please recommend some tutorial on this?
I currently use <Remove other windows> from File menu. Maybe I can do better.
- Similar to Alt-Shift-arrows in Notepad++:
How to select a rectangle in emacs Most voted answer (53 votes) said that C-x SPC starts
rectangle-mark-mode
that is similar to the functionality you request from Notepad++, but with all the operations available to Emacs. The selected rectangle can be copied with M-w or killed with C-w, by example. More information here. - Multiline cursor for editing (similar to ctrl-alt-arrow in VS Code): https://emacs.stackexchange.com/questions/751/fundamentals-of-multiple-cursors
M-X shell
- C-x o move to the other window
- C-x 1 maximixe current buffer
- C-x 2 split current window vertically
- C-x 3 split current window horizontally
- C-x b ask for the name of a buffer and display it in current window
- C-x B split current window and show a buffer list in the other window
- C-x B split current window and show a buffer list in the other window
- C-x k kills buffer
Imagine I needed something like
~emacs README.md –run “C-c C-e h h”
How would it do it? Using emacs lisp?
The command is M-x revert-buffer (details).
M-x revert-buffer
- TAB shows/hides headers (quite powerful!)
- Shift-TAB opens all headers
- Alt + left or right changes header level
- Alt + up or down moves lines around
- Shift - arrow:
- changes list numbering style
- cycles TODO-DONE in header
- selects in CUA mode
- Alt - arrow has limits within a header
- In VS Code Alt Up/Down move line wherever
- Is there some key combination that moves lines across file
- Currently using C-k C-y
- Shift-Arrow-Up/Down maybe?
- https://emacs.stackexchange.com/questions/68140/unrestricted-movement-of-lines-alt-up-down
- Use
[[url][]]
syntax or C-c C-l - Internal hyperlink here
- Or link to file
- Link example
As guide suggests:
- C-c . for active date-only timestamp (Active = it creates an entry on Org agenda)
- C-c ! for inactive date-only timestamp (Inactive = it doesn’t create entries on Org agenda)
- S-arrow for change
- C-u C-c . and C-u C-c ! for timestamp including date and time, active and inactive respectively
- You must type [0/0] or [0%] for checkbox
- Only X counts for completion, not `x` or `+`
- C-c C-c toggles and recalculates
- QUESTION: what can recalculate on its own?
- Check Rainer König video OrgMode E01S05: Checklists
Sample checkbox list [2/3], [66%]:
- [X] Item 1
- [X] Item 2
- [ ] Item 3
- Use F10 and menu for agenda view
Why is C-c a undefined? Shoud I define it?
Seems to be undefined by default, but this page of the Org mode guide says that with (global-set-key (kbd "C-c a") 'org-agenda)
can be set.
If the keyboard shortcut isn’t activated,
you can activate the agenda view manually with M-x org-agenda.
This Emacs Stackexchange question shows Emacs-Lisp code to make sorting by priority the default in agenda view
(defun hw-org-agenda-sort-habits (a b)
"Sort habits first by user priority, then by schedule+deadline+consistency."
(let ((ha (get-text-property 1 'org-habit-p a))
(hb (get-text-property 1 'org-habit-p b)))
(when (and ha hb)
(let ((pa (org-get-priority a))
(pb (org-get-priority b)))
(cond ((> pa pb) +1)
((< pa pb) -1)
((= pa pb) (org-cmp-values a b 'priority)))))))
(setq org-agenda-cmp-user-defined 'hw-org-agenda-sort-habits
org-agenda-sorting-strategy '((agenda time-up user-defined-down habit-down)
(todo priority-down category-keep)
(tags priority-down category-keep)
(search category-keep)))
In Emacs you close a buffer with C-x k
*** Clock this!
- Start: C-c C-x C-i
- End: C-c C-x C-o
It is easy to “clock-in” to a particular task by positioning point within an item and typing C-c C-x C-i and clocking out with C-c C-x C-o.
https://www.adventuresinwhy.com/post/org-mode-timekeeping/
SJ: In the same way the body cannot sustain exercise indefinitely, but needs to rest after a period of sustained effort, so does the brain. So pomodoro is a good practice, but you need to tailor the focus and rest periods to your personal optimum./
- Start table from menu
- C-c C-c to format
How to view calendar (it was popping up accidantally when I hit something wrong).
- Sort this list is C-c ^
- Add cycling todo tags
#+SEQ_TODO:
- Archive tasks through Org menu
- Defintion list with
::
separator - Github search for org files with
[[https://github.com/search?o=asc&q=language%3Aorg&s=indexed&type=Code][language:org]]
- C-k C-y can move lines
What are productive scenarios for using org-mode?
The best advice I’ve heard for using org-mode in some sort of GTD system was not to try and set up categories when you start. Start with just a bunch of TODOs, and slowly grow the system as you feel the need to.
SJ:
- As a general notebook for brainstorming and keeping interesting ideas at hand.
- Org mode can execute code in several programming languages, so it can also be used to automate tasks that require collections of scripts.
- It can even be used as database client for SQL databases, and the result of SQL queries can be shown in Org tables.
- To measure your productivity by tabulating hourly, weekly, daily views on your clock-ins and clock-outs.
- Alongside existing productivity methodologies like GTD
- buffer
- a screen that represents a file or Emacs own output
- frame
- is a new window for the whole program
- modeline
- a line at the bottom of a screen with something like
-UUU(DOS)**--F1
- window
- is a windows inside editor
- * is a header
- drawer box has :NAME: and :END:
New:
Essential:
Extension:
Academic:
- https://sachachua.com/blog/2014/01/tips-learning-org-mode-emacs/
- https://blog.aaronbieber.com/2016/09/24/an-agenda-for-life-with-org-mode.html
- https://github.com/abcdw/notes/blob/master/notes/20210805075718-the_modern_emacs.org
- https://github.com/zkat/sheeple/blob/5393c74737ccf22c3fd5f390076b75c38453cb04/presentation/sheeple-talk-22-10-09.org
- https://raw.githubusercontent.com/ymd-h/cpprb/c44cf5d53f807e58f71d1a2e1cf46aa92b5e193d/README.org
- https://raw.githubusercontent.com/deopurkar/ag2021/f73c35fede17a123806102306ce0c47bc2a87cd9/course.org
- https://raw.githubusercontent.com/Literate-DevOps/literate-programming-tutorials/0dcff18ae2047fb46df1edc2cde7b2ea0cb57a12/how-to/01-assassinate-the-archbishop-of-canterbury-in-1170-ce/how-to-assassinate-the-archbishop-of-canterbury-in-1170-ce.org
I try to avoid more complicated topics:
- packages and complex configuration
- programming in lisp
- spacemacs, emacs-doom and similar
- org-roam
- org-capture
- email with gnus
- git with magit
- export to latex and beamer
Command | Action |
---|---|
M-x <command> | Run command by name |
M-x shell | Run Shell |
F10 | Upper menu |
C-s | Advanced search |
C-c C-c | Toggle or recalculate |
C-k C-y | Kill and undo line |
C-c C-e h h | Create HTML |
C-x 1 | Remove window |
Way out | |
C-g | Kill, stop or exit |
ESC-ESC-ESC | Exit (hopefully) |
q | Exit (sometimes) |
Not Emacs: | |
Fn-Esc | Lock Fn key (Lenovo) |
M-x:
- revert-buffer (in File menu)
- customize
- shell
- query-replace-regexp (asks for a regular expression, replaces it, it is very powerful to automate editing tasks)