├── .gitignore ├── src ├── inside-emacs-02 │ ├── audios │ │ ├── speak-up-2020-06-12-part-1.mp3 │ │ ├── speak-up-2020-06-12-part-2.mp3 │ │ ├── speak-up-2020-06-12-part-3.mp3 │ │ ├── speak-up-2020-06-12-part-4.mp3 │ │ ├── speak-up-2020-06-12-part-5.mp3 │ │ ├── speak-up-2020-06-12-part-6.mp3 │ │ ├── speak-up-2020-06-12-part-7.mp3 │ │ ├── speak-up-2020-06-12-part-8.mp3 │ │ ├── speak-up-2020-06-12-part-9.mp3 │ │ ├── speak-up-2020-06-22-part-1.mp3 │ │ ├── speak-up-2020-06-22-part-2.mp3 │ │ ├── speak-up-2020-06-22-part-3.mp3 │ │ ├── speak-up-2020-06-22-part-4.mp3 │ │ ├── speak-up-2020-06-22-part-5.mp3 │ │ ├── speak-up-2020-06-24-part-1.mp3 │ │ ├── speak-up-2020-06-24-part-2.mp3 │ │ ├── speak-up-2020-06-24-part-3.mp3 │ │ ├── speak-up-2020-06-24-part-4.mp3 │ │ └── speak-up-2020-06-24-part-5.mp3 │ ├── find-marked-files │ │ ├── file-1.txt │ │ ├── file-2.txt │ │ ├── file-3.txt │ │ ├── file-4.txt │ │ ├── file-5.txt │ │ └── file-6.txt │ └── kmacro.org ├── inside-emacs-06-part-10 │ ├── error.el │ └── spreadsheet.org ├── inside-emacs-01 │ ├── iy-go-to-char-kill-region.txt │ ├── iy-go-to-char.txt │ ├── astUtils.test.js │ ├── App.test.js │ └── replace-string.html ├── inside-emacs-04-part-01 │ ├── some-file.el │ ├── some-file.txt │ └── company-setup.el ├── inside-emacs-04-part-02 │ ├── some-file.el │ ├── some-file.txt │ └── company-setup.el ├── inside-emacs-03 │ ├── drag-stuff.org │ ├── smartparens.org │ ├── other-window-scroll-buffer │ │ ├── selected-window │ │ ├── file-3.js │ │ ├── file-1.js │ │ └── file-2.js │ └── add-cursor-on-click.org ├── inside-emacs-06-part-01 │ ├── table.csv │ └── org-table.org ├── inside-emacs-06-part-08 │ ├── setup.el │ └── radio-table.html ├── inside-emacs-06-part-06 │ ├── org │ │ └── org-table.el │ └── org-table.org ├── inside-emacs-06-part-07 │ ├── org-table.org │ └── org │ │ ├── org-table.el │ │ └── ox-html.el ├── inside-emacs-06-part-03 │ ├── org-meta-return.el │ └── org-table.org ├── inside-emacs-06-part-02 │ ├── previous-row.el │ ├── org-table.org │ └── org │ │ ├── org-table.el │ │ ├── org.el │ │ └── org-keys.el ├── inside-emacs-05-part-02 │ └── emacs.service ├── inside-emacs-06-part-12 │ └── quick-calc.org ├── inside-emacs-06-part-05 │ ├── org-table.org │ └── org │ │ └── org-table.el ├── inside-emacs-06-part-04 │ └── org-table.org ├── inside-emacs-06-part-13 │ └── paycheck.org ├── inside-emacs-06-part-11 │ └── spreadsheet.org ├── inside-emacs-06-part-09 │ └── spreadsheet.org └── inside-emacs-06-part-14 │ └── tables.org ├── LICENSE ├── README.md └── q-and-a.org /.gitignore: -------------------------------------------------------------------------------- 1 | *~ -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-12-part-1.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-12-part-2.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-12-part-3.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-12-part-4.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-12-part-5.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-12-part-6.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-12-part-7.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-12-part-8.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-12-part-9.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-22-part-1.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-22-part-2.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-22-part-3.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-22-part-4.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-22-part-5.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-24-part-1.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-24-part-2.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-24-part-3.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-24-part-4.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-02/audios/speak-up-2020-06-24-part-5.mp3: -------------------------------------------------------------------------------- 1 | fake audio to play with dired-mode -------------------------------------------------------------------------------- /src/inside-emacs-06-part-10/error.el: -------------------------------------------------------------------------------- 1 | ;; list evaluation, `intern' and `funcall' 2 | 3 | (funcall (intern "upcase") "inside emacs") 4 | -------------------------------------------------------------------------------- /src/inside-emacs-01/iy-go-to-char-kill-region.txt: -------------------------------------------------------------------------------- 1 | Et ça, c'est la seule chose qui nous intéresse. Donc qu'il y ait 2 | des personnes qui soit prof 3 | -------------------------------------------------------------------------------- /src/inside-emacs-04-part-01/some-file.el: -------------------------------------------------------------------------------- 1 | (defun my-readme () 2 | "docstring" 3 | (interactive) 4 | (delete-other-windows) 5 | (let ((file-name "./README.org")) 6 | (find-file file-name))) 7 | -------------------------------------------------------------------------------- /src/inside-emacs-04-part-02/some-file.el: -------------------------------------------------------------------------------- 1 | (defun my-readme () 2 | "docstring" 3 | (interactive) 4 | (delete-other-windows) 5 | (let ((file-name "./README.org")) 6 | (find-file file-name))) 7 | -------------------------------------------------------------------------------- /src/inside-emacs-03/drag-stuff.org: -------------------------------------------------------------------------------- 1 | * prettier 2 | - See [[https://prettier.io/docs/en/cli.html][prettier cli (documentation)]]. 3 | - If you want to format ~file.html~ html file, run the command 4 | ~prettier --write file.html~. 5 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-01/table.csv: -------------------------------------------------------------------------------- 1 | ID (Integer) Name (String) Address (String) 2 | 102 Yonezawa Akinori Naha, Okinawa 3 | 202 Nilay Patel Sendai, Miyagi 4 | 104 Murata Makoto Kumamoto, Kumamoto 5 | 152 Matsumoto Yukihiro Okinawa, Okinawa 6 | -------------------------------------------------------------------------------- /src/inside-emacs-01/iy-go-to-char.txt: -------------------------------------------------------------------------------- 1 | - Commodo quis imperdiet massa tincidunt? In cursus turpis massa 2 | tincidunt dui ut ornare lectus sit amet est placerat in egestas erat 3 | imperdiet sed euismod nisi porta lorem mollis aliquam ut. 4 | 5 | - 6 | -------------------------------------------------------------------------------- /src/inside-emacs-03/smartparens.org: -------------------------------------------------------------------------------- 1 | * How can I automatically restart applications on boot/reboot? 2 | - Use ~pm2 startup~ and ~pm2 save~ commands. 3 | - Enable the pm2 startup hook (~pm2 startup~). 4 | - Freeze a process list for automatic respawn (~pm2 save~). 5 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-08/setup.el: -------------------------------------------------------------------------------- 1 | (defun indent-buffer (&rest _r) 2 | "Indent the whole buffer." 3 | (let ((inhibit-message t)) 4 | (indent-region (point-min) (point-max)))) 5 | 6 | (advice-add 'orgtbl-insert-radio-table :after 'indent-buffer) 7 | (advice-add 'orgtbl-ctrl-c-ctrl-c :after 'indent-buffer) 8 | -------------------------------------------------------------------------------- /src/inside-emacs-01/astUtils.test.js: -------------------------------------------------------------------------------- 1 | it('Makes "strikeThrough" markup', () => { 2 | const content = `+strikeThrough+`; 3 | const ast = parse(content); 4 | const node = astGoToNode(ast, [0, 0]); 5 | const { container } = render(); 6 | expect(container.firstChild).toMatchInlineSnapshot(` 7 | 8 | strikeThrough 9 | 10 | `); 11 | }) 12 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-06/org/org-table.el: -------------------------------------------------------------------------------- 1 | ;;; part of org 2 | ;; You can find this function in the original file `lisp/org/org-table.el' 3 | ;; Emacs source repository 4 | ;; $ git clone https://git.savannah.gnu.org/git/emacs.git 5 | 6 | (defun orgtbl-to-tsv (table params) 7 | "Convert the orgtbl-mode table to TAB separated material." 8 | (orgtbl-to-generic table (org-combine-plists '(:sep "\t") params))) 9 | -------------------------------------------------------------------------------- /src/inside-emacs-04-part-01/some-file.txt: -------------------------------------------------------------------------------- 1 | Bibendum neque egestas congue quisque egestas diam in arcu cursus 2 | euismod quis viverra nibh cras pulvinar mattis nunc, sed blandit 3 | libero volutpat sed! Massa ultricies mi, quis hendrerit dolor magna. 4 | 5 | Pharetra et ultrices neque ornare aenean euismod elementum nisi, quis 6 | eleifend quam adipiscing vitae proin sagittis, nisl rhoncus mattis 7 | rhoncus, urna neque viverra justo, nec? 8 | -------------------------------------------------------------------------------- /src/inside-emacs-04-part-02/some-file.txt: -------------------------------------------------------------------------------- 1 | Bibendum neque egestas congue quisque egestas diam in arcu cursus 2 | euismod quis viverra nibh cras pulvinar mattis nunc, sed blandit 3 | libero volutpat sed! Massa ultricies mi, quis hendrerit dolor magna. 4 | 5 | Pharetra et ultrices neque ornare aenean euismod elementum nisi, quis 6 | eleifend quam adipiscing vitae proin sagittis, nisl rhoncus mattis 7 | rhoncus, urna neque viverra justo, nec? 8 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-07/org-table.org: -------------------------------------------------------------------------------- 1 | * orgtbl-to-html parameters 2 | :PROPERTIES: 3 | :TABLE_EXPORT_FILE: table.html 4 | :TABLE_EXPORT_FORMAT: orgtbl-to-html :html-table-row-open-tag color-even-lines 5 | :END: 6 | 7 | | a1 | a2 | a3 | 8 | | b1 | b2 | b3 | 9 | | c1 | c2 | c3 | 10 | | d1 | d2 | d3 | 11 | 12 | #+BEGIN_SRC emacs-lisp 13 | (defun color-even-lines (number _ _ _ _ _) 14 | "Color even lines." 15 | (if (zerop (mod number 2)) 16 | "" 17 | "")) 18 | #+END_SRC 19 | -------------------------------------------------------------------------------- /src/inside-emacs-02/find-marked-files/file-1.txt: -------------------------------------------------------------------------------- 1 | FILE 1 FILE 1 FILE 1 FILE 1 2 | FILE 1 FILE 1 FILE 1 FILE 1 3 | FILE 1 FILE 1 FILE 1 FILE 1 4 | FILE 1 FILE 1 FILE 1 FILE 1 5 | FILE 1 FILE 1 FILE 1 FILE 1 6 | FILE 1 FILE 1 FILE 1 FILE 1 7 | FILE 1 FILE 1 FILE 1 FILE 1 8 | FILE 1 FILE 1 FILE 1 FILE 1 9 | FILE 1 FILE 1 FILE 1 FILE 1 10 | FILE 1 FILE 1 FILE 1 FILE 1 11 | FILE 1 FILE 1 FILE 1 FILE 1 12 | FILE 1 FILE 1 FILE 1 FILE 1 13 | FILE 1 FILE 1 FILE 1 FILE 1 14 | FILE 1 FILE 1 FILE 1 FILE 1 15 | FILE 1 FILE 1 FILE 1 FILE 1 16 | FILE 1 FILE 1 FILE 1 FILE 1 17 | FILE 1 FILE 1 FILE 1 FILE 1 18 | -------------------------------------------------------------------------------- /src/inside-emacs-02/find-marked-files/file-2.txt: -------------------------------------------------------------------------------- 1 | FILE 2 FILE 2 FILE 2 FILE 2 2 | FILE 2 FILE 2 FILE 2 FILE 2 3 | FILE 2 FILE 2 FILE 2 FILE 2 4 | FILE 2 FILE 2 FILE 2 FILE 2 5 | FILE 2 FILE 2 FILE 2 FILE 2 6 | FILE 2 FILE 2 FILE 2 FILE 2 7 | FILE 2 FILE 2 FILE 2 FILE 2 8 | FILE 2 FILE 2 FILE 2 FILE 2 9 | FILE 2 FILE 2 FILE 2 FILE 2 10 | FILE 2 FILE 2 FILE 2 FILE 2 11 | FILE 2 FILE 2 FILE 2 FILE 2 12 | FILE 2 FILE 2 FILE 2 FILE 2 13 | FILE 2 FILE 2 FILE 2 FILE 2 14 | FILE 2 FILE 2 FILE 2 FILE 2 15 | FILE 2 FILE 2 FILE 2 FILE 2 16 | FILE 2 FILE 2 FILE 2 FILE 2 17 | FILE 2 FILE 2 FILE 2 FILE 2 18 | -------------------------------------------------------------------------------- /src/inside-emacs-02/find-marked-files/file-3.txt: -------------------------------------------------------------------------------- 1 | FILE 3 FILE 3 FILE 3 FILE 3 2 | FILE 3 FILE 3 FILE 3 FILE 3 3 | FILE 3 FILE 3 FILE 3 FILE 3 4 | FILE 3 FILE 3 FILE 3 FILE 3 5 | FILE 3 FILE 3 FILE 3 FILE 3 6 | FILE 3 FILE 3 FILE 3 FILE 3 7 | FILE 3 FILE 3 FILE 3 FILE 3 8 | FILE 3 FILE 3 FILE 3 FILE 3 9 | FILE 3 FILE 3 FILE 3 FILE 3 10 | FILE 3 FILE 3 FILE 3 FILE 3 11 | FILE 3 FILE 3 FILE 3 FILE 3 12 | FILE 3 FILE 3 FILE 3 FILE 3 13 | FILE 3 FILE 3 FILE 3 FILE 3 14 | FILE 3 FILE 3 FILE 3 FILE 3 15 | FILE 3 FILE 3 FILE 3 FILE 3 16 | FILE 3 FILE 3 FILE 3 FILE 3 17 | FILE 3 FILE 3 FILE 3 FILE 3 18 | -------------------------------------------------------------------------------- /src/inside-emacs-02/find-marked-files/file-4.txt: -------------------------------------------------------------------------------- 1 | FILE 4 FILE 4 FILE 4 FILE 4 2 | FILE 4 FILE 4 FILE 4 FILE 4 3 | FILE 4 FILE 4 FILE 4 FILE 4 4 | FILE 4 FILE 4 FILE 4 FILE 4 5 | FILE 4 FILE 4 FILE 4 FILE 4 6 | FILE 4 FILE 4 FILE 4 FILE 4 7 | FILE 4 FILE 4 FILE 4 FILE 4 8 | FILE 4 FILE 4 FILE 4 FILE 4 9 | FILE 4 FILE 4 FILE 4 FILE 4 10 | FILE 4 FILE 4 FILE 4 FILE 4 11 | FILE 4 FILE 4 FILE 4 FILE 4 12 | FILE 4 FILE 4 FILE 4 FILE 4 13 | FILE 4 FILE 4 FILE 4 FILE 4 14 | FILE 4 FILE 4 FILE 4 FILE 4 15 | FILE 4 FILE 4 FILE 4 FILE 4 16 | FILE 4 FILE 4 FILE 4 FILE 4 17 | FILE 4 FILE 4 FILE 4 FILE 4 18 | -------------------------------------------------------------------------------- /src/inside-emacs-02/find-marked-files/file-5.txt: -------------------------------------------------------------------------------- 1 | FILE 5 FILE 5 FILE 5 FILE 5 2 | FILE 5 FILE 5 FILE 5 FILE 5 3 | FILE 5 FILE 5 FILE 5 FILE 5 4 | FILE 5 FILE 5 FILE 5 FILE 5 5 | FILE 5 FILE 5 FILE 5 FILE 5 6 | FILE 5 FILE 5 FILE 5 FILE 5 7 | FILE 5 FILE 5 FILE 5 FILE 5 8 | FILE 5 FILE 5 FILE 5 FILE 5 9 | FILE 5 FILE 5 FILE 5 FILE 5 10 | FILE 5 FILE 5 FILE 5 FILE 5 11 | FILE 5 FILE 5 FILE 5 FILE 5 12 | FILE 5 FILE 5 FILE 5 FILE 5 13 | FILE 5 FILE 5 FILE 5 FILE 5 14 | FILE 5 FILE 5 FILE 5 FILE 5 15 | FILE 5 FILE 5 FILE 5 FILE 5 16 | FILE 5 FILE 5 FILE 5 FILE 5 17 | FILE 5 FILE 5 FILE 5 FILE 5 18 | -------------------------------------------------------------------------------- /src/inside-emacs-02/find-marked-files/file-6.txt: -------------------------------------------------------------------------------- 1 | FILE 6 FILE 6 FILE 6 FILE 6 2 | FILE 6 FILE 6 FILE 6 FILE 6 3 | FILE 6 FILE 6 FILE 6 FILE 6 4 | FILE 6 FILE 6 FILE 6 FILE 6 5 | FILE 6 FILE 6 FILE 6 FILE 6 6 | FILE 6 FILE 6 FILE 6 FILE 6 7 | FILE 6 FILE 6 FILE 6 FILE 6 8 | FILE 6 FILE 6 FILE 6 FILE 6 9 | FILE 6 FILE 6 FILE 6 FILE 6 10 | FILE 6 FILE 6 FILE 6 FILE 6 11 | FILE 6 FILE 6 FILE 6 FILE 6 12 | FILE 6 FILE 6 FILE 6 FILE 6 13 | FILE 6 FILE 6 FILE 6 FILE 6 14 | FILE 6 FILE 6 FILE 6 FILE 6 15 | FILE 6 FILE 6 FILE 6 FILE 6 16 | FILE 6 FILE 6 FILE 6 FILE 6 17 | FILE 6 FILE 6 FILE 6 FILE 6 18 | -------------------------------------------------------------------------------- /src/inside-emacs-02/kmacro.org: -------------------------------------------------------------------------------- 1 | * ghostnotes92 2 | - https://soundcloud.com/ghostnotes92/graveyard-shift 3 | - https://soundcloud.com/ghostnotes92/tape-7 4 | - https://soundcloud.com/ghostnotes92/ghost-notes-same-plan 5 | - https://soundcloud.com/ghostnotes92/ghost-notes-night-writer 6 | - https://soundcloud.com/ghostnotes92/different-roles 7 | - https://soundcloud.com/ghostnotes92/ghost-notes-she-found-me 8 | * sons of south 9 | - https://soundcloud.com/sons-of-south/too-much-to-lose 10 | - https://soundcloud.com/sons-of-south/southside-boy 11 | - https://soundcloud.com/sons-of-south/snake-eyes-feat-jumaphist 12 | - https://soundcloud.com/sons-of-south/scratch-of-south-feat-djoe-the-architect 13 | -------------------------------------------------------------------------------- /src/inside-emacs-01/App.test.js: -------------------------------------------------------------------------------- 1 | describe('App', () => { 2 | const content = ` 3 | * Headline 1 4 | ** Headline 1.1 5 | *** Headline 1.1.1 6 | - item 1 7 | - item 2 8 | #+BEGIN_SRC bash 9 | some code 1 10 | #+END_SRC 11 | *** Headline 1.1.2 12 | - item 1 13 | - item 2 14 | * Headline 2 15 | ** Headline 2.1 16 | *** Headline 2.1.1 17 | - item 1 18 | - item 2 19 | - item 3 20 | #+BEGIN_SRC bash 21 | some code 2 22 | #+END_SRC`; 23 | 24 | 25 | it('renders the 3 tricks of the content', () => { 26 | const ast = parse(content); 27 | const { getByText } = render( 28 | 29 | ); 30 | const headerContent = getByText(/Headline 1.1.1/i); 31 | expect(headerContent).toBeInTheDocument(); 32 | }); 33 | }) 34 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-03/org-meta-return.el: -------------------------------------------------------------------------------- 1 | ;;; my-org-meta-return 2 | 3 | (defun my-org-meta-return (&optional arg) 4 | "Insert a new heading or wrap a region in a table. 5 | Calls `org-insert-heading', `org-insert-item' or 6 | `org-table-wrap-region', depending on context." 7 | (interactive "P") 8 | (org-check-before-invisible-edit 'insert) 9 | (or (run-hook-with-args-until-success 'org-metareturn-hook) 10 | (if (org-at-table-p) 11 | (org-table-wrap-region arg) 12 | (call-interactively 13 | (cond (arg #'org-insert-heading) 14 | ((org-in-item-p) #'org-insert-item) 15 | (t #'org-insert-heading)))))) 16 | 17 | (define-key org-mode-map (kbd "") 'my-org-meta-return) 18 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-02/previous-row.el: -------------------------------------------------------------------------------- 1 | (defun my-org-table-previous-row () 2 | "Go to the previous row (same column) in the current table. 3 | Before doing so, re-align the table if necessary." 4 | (interactive) 5 | (unless (org-at-table-hline-p) 6 | (org-table-maybe-eval-formula) 7 | (org-table-maybe-recalculate-line)) 8 | (if (and org-table-automatic-realign 9 | org-table-may-need-update) 10 | (org-table-align)) 11 | (let ((col (org-table-current-column))) 12 | (when (and (org-at-table-p) 13 | (not (= (org-table-current-line) 1))) 14 | (previous-line) 15 | (unless (org-at-table-hline-p) 16 | (org-table-goto-column col))))) 17 | 18 | (define-key org-mode-map (kbd "M-m") 'my-org-table-previous-row) 19 | -------------------------------------------------------------------------------- /src/inside-emacs-03/other-window-scroll-buffer/selected-window: -------------------------------------------------------------------------------- 1 | selected-window 2 | selected-window 3 | selected-window 4 | selected-window 5 | selected-window 6 | selected-window 7 | selected-window 8 | selected-window 9 | selected-window 10 | selected-window 11 | selected-window 12 | selected-window 13 | -------------------------------------------------------------------------------- /src/inside-emacs-05-part-02/emacs.service: -------------------------------------------------------------------------------- 1 | ## If your Emacs is installed in a non-standard location, you may need 2 | ## to copy this file to a standard directory, eg ~/.config/systemd/user/ . 3 | ## If you install this file by hand, change the "Exec" lines below 4 | ## to use absolute file names for the executables. 5 | [Unit] 6 | Description=Emacs text editor 7 | Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/ 8 | 9 | [Service] 10 | Type=notify 11 | ExecStart=/usr/bin/emacs --fg-daemon 12 | ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)" 13 | # The location of the SSH auth socket varies by distribution, and some 14 | # set it from PAM, so don't override by default. 15 | # Environment=SSH_AUTH_SOCK=%t/keyring/ssh 16 | Restart=on-failure 17 | 18 | [Install] 19 | WantedBy=default.target 20 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-08/radio-table.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

orgtbl-mode and radio tables

5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
b1IloveEmacs
29 | 30 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-12/quick-calc.org: -------------------------------------------------------------------------------- 1 | * quick-calc 2 | # M-x quick-calc 3 | # C-u M-x quick-calc 4 | # C-j 5 | 6 | 6 7 | 8 | 6 9 | 10 | 6 11 | 12 | * logical operations 13 | 14 | if(2>1, 4, 0) --> 4 15 | 0 && 1 --> 0 16 | 5 && 1 --> 1 17 | 0 || 1 --> 1 18 | 0 || 0 --> 0 19 | !6 --> 0 20 | in(3,[1,2,3]) --> 1 21 | in(3,[-5..5]) --> 1 22 | in(10,[-5..5]) --> 0 23 | 24 | * strings and variables 25 | 26 | "a string" --> [97, 32, 115, 116, 114, 105, 110, 103] 27 | 28 | 29 | string("a string") --> a string 30 | 31 | 32 | foo + 2 --> foo + 2 33 | foo := 2 --> 2 34 | foo + 2 --> 4 35 | 36 | * Calc functions showcase 37 | 38 | # Random Numbers 39 | 40 | random(6) --> 2 41 | random(1.) --> 0.228447152517 42 | 43 | # Building Vectors 44 | 45 | vconcat([1,2],[3,4]) --> [1, 2, 3, 4] 46 | 47 | # Manipulating Vectors 48 | 49 | find([1,1,2,3], 2) --> 3 50 | sort([3,7,5,1]) --> [1, 3, 5, 7] 51 | rsort([3,7,5,1]) --> [7, 5, 3, 1] 52 | 53 | # Set Operations 54 | 55 | rdup([1,1,2,3,3]) --> [1, 2, 3] 56 | vunion([1,1,2], [2,3]) --> [1, 2, 3] 57 | -------------------------------------------------------------------------------- /src/inside-emacs-01/replace-string.html: -------------------------------------------------------------------------------- 1 |
2 |

POPULAR TAGS

3 |

4 | Travel New York Dinner 5 | Salmon France Drinks 6 | Ideas Flavors Cuisine 7 | Chicken Dressing Fried 8 | Fish Duck 9 |

10 |
11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020, Tony Aldon, tony.aldon.adm@gmail.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/inside-emacs-04-part-02/company-setup.el: -------------------------------------------------------------------------------- 1 | ;;; get starded with company 2 | (require 'company) 3 | (add-hook 'after-init-hook 'global-company-mode) 4 | 5 | ;;;company-backends variable 6 | (defun company-emacs-lisp-mode () 7 | "Set up `company-mode' for `emacs-lisp-mode'." 8 | (set (make-local-variable 'company-backends) 9 | '((company-yasnippet 10 | :with 11 | company-elisp 12 | company-dabbrev-code 13 | company-files)))) 14 | 15 | (add-hook 'emacs-lisp-mode-hook 'company-emacs-lisp-mode) 16 | 17 | (defun company-text-mode () 18 | "Set up `company-mode' for `text-mode'." 19 | (setq company-minimum-prefix-length 3) 20 | (set (make-local-variable 'company-backends) 21 | '((company-files) company-dabbrev))) 22 | 23 | (add-hook 'text-mode-hook 'company-text-mode) 24 | 25 | ;;; customize company frontend variables 26 | (setq company-idle-delay 0) 27 | (setq company-selection-wrap-around t) 28 | (setq company-tooltip-limit 6) 29 | 30 | (setq company-minimum-prefix-length 1) 31 | (make-variable-buffer-local 'company-minimum-prefix-length) 32 | 33 | (setq company-transformers '(company-sort-by-backend-importance)) 34 | 35 | ;;; company-active-map 36 | (define-key company-active-map (kbd ">") 'company-filter-candidates) 37 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-07/org/org-table.el: -------------------------------------------------------------------------------- 1 | ;;; part of org 2 | ;; You can find this function in the original file `lisp/org/org-table.el' 3 | ;; Emacs source repository 4 | ;; $ git clone https://git.savannah.gnu.org/git/emacs.git 5 | 6 | (defun orgtbl-to-html (table params) 7 | "Convert the orgtbl-mode TABLE to HTML. 8 | 9 | TABLE is a list, each entry either the symbol `hline' for 10 | a horizontal separator line, or a list of fields for that line. 11 | PARAMS is a property list of parameters that can influence the 12 | conversion. All parameters from `orgtbl-to-generic' are 13 | supported. It is also possible to use the following one: 14 | 15 | :attributes 16 | 17 | Attributes and values, as a plist, which will be used in 18 | tag." 19 | (require 'ox-html) 20 | (orgtbl-to-generic 21 | table 22 | (org-combine-plists 23 | ;; Provide sane default values. 24 | (list :backend 'html 25 | :html-table-data-tags '("" . "") 26 | :html-table-use-header-tags-for-first-column nil 27 | :html-table-align-individual-fields t 28 | :html-table-row-tags '("" . "") 29 | :html-table-attributes 30 | (if (plist-member params :attributes) 31 | (plist-get params :attributes) 32 | '(:border "2" :cellspacing "0" :cellpadding "6" :rules "groups" 33 | :frame "hsides"))) 34 | params))) 35 | -------------------------------------------------------------------------------- /src/inside-emacs-04-part-01/company-setup.el: -------------------------------------------------------------------------------- 1 | ;;; get starded with company 2 | (require 'company) 3 | (add-hook 'after-init-hook 'global-company-mode) 4 | 5 | ;;; set custom faces 6 | (let ((black-1 "#151515") 7 | (black-2 "#333333") 8 | (gray "#8c8c8c") 9 | (white-1 "#dedede") 10 | (white-0 "ffffff") 11 | (orange "#fd971f") 12 | (cyan-1 "#017a7e") 13 | (cyan-2 "#02eaf3")) 14 | (custom-set-faces 15 | `(company-preview ((t (:foreground ,white-1 :background ,black-2 :bold t)))) 16 | `(company-preview-search ((t (:foreground ,orange :background ,black-2 :bold t)))) 17 | `(company-preview-common ((t (:foreground ,white-0 :background ,black-2 :bold t)))) 18 | `(company-scrollbar-bg ((t (:background ,black-2)))) 19 | `(company-scrollbar-fg ((t (:foreground ,white-0 :bold t)))) 20 | `(company-tooltip ((t (:foreground ,gray :background ,black-1 )))) 21 | `(company-tooltip-common ((t (:foreground ,cyan-1 :weight bold)))) 22 | `(company-tooltip-common-selection ((t (:foreground ,cyan-2 :weight bold)))) 23 | `(company-tooltip-selection ((t (:foreground ,white-1 :bold t)))) 24 | `(company-tooltip-annotation ((t (:foreground ,orange)))) 25 | `(company-tooltip-annotation-selection ((t (:foreground ,orange)))) 26 | `(company-tooltip-search ((t (:foreground ,orange :bold t)))) 27 | `(company-tooltip-search-selection ((t (:foreground ,orange :bold t)))))) 28 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-02/org-table.org: -------------------------------------------------------------------------------- 1 | * Moving inside a field 2 | # M-a (org-backward-sentence) 3 | # M-e (org-forward-sentence) 4 | 5 | | binding | inkscape command | section | Default | 6 | |---------+-------------------------+---------+---------| 7 | | C-t | Dialogs Toggle | Dialogs | F12 | 8 | | a | Dialog Align Distribute | Dialogs | C-S-a | 9 | | e | Dialog Export | Dialogs | C-S-e | 10 | 11 | * Moving between fields 12 | # use of TAB and S-TAB 13 | 14 | | binding | inkscape command | section | Default | 15 | |---------+-------------------------+---------+---------| 16 | | C-t | Dialogs Toggle | Dialogs | F12 | 17 | | a | Dialog Align Distribute | Dialogs | C-S-a | 18 | | e | Dialog Export | Dialogs | C-S-e | 19 | 20 | # use of C-m or RET 21 | 22 | | binding | inkscape command | section | Default | 23 | |---------+-------------------------+---------+---------| 24 | | C-t | Dialogs Toggle | Dialogs | F12 | 25 | | a | Dialog Align Distribute | Dialogs | C-S-a | 26 | | e | Dialog Export | Dialogs | C-S-e | 27 | 28 | * Coding my-org-table-previous-row 29 | # to play with my-org-table-previous-row 30 | 31 | | binding | inkscape command | section | Default | 32 | |---------+-------------------------+---------+---------| 33 | | C-t | Dialogs Toggle | Dialogs | F12 | 34 | | a | Dialog Align Distribute | Dialogs | C-S-a | 35 | | e | Dialog Export | Dialogs | C-S-e | 36 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-01/org-table.org: -------------------------------------------------------------------------------- 1 | * create tables 2 | # TAB, RET and | 3 | 4 | | expense | price | 5 | | bar | 12 | 6 | | food | 21 | 7 | 8 | | expense | price | 9 | |---------+-------| 10 | | bar | 12 | 11 | 12 | # use C-| 13 | 14 | | | | | | | 15 | |---+---+---+---+---| 16 | | | | | | | 17 | 18 | # use C-| and provide format: 2x2 19 | 20 | | | | 21 | |---+---| 22 | | | | 23 | 24 | * convert from region 25 | # org-table-create-or-convert-from-region 26 | 27 | # use C-| on a region 28 | 29 | expense,price 30 | bar,12 31 | food,21 32 | 33 | expense price 34 | bar 12 35 | food 21 36 | 37 | expense price 38 | bar 12 39 | food 21 40 | 41 | # use C-u C-u C-u C-| on a region to provide a regexp separator 42 | 43 | name:tags 44 | jack:tall,blond 45 | kim:small,brown 46 | 47 | # retrieve a table from wikipedia 48 | # https://en.wikipedia.org/wiki/Relation_(database) 49 | 50 | | ID (Integer) | Name (String) | Address (String) | 51 | | 102 | Yonezawa Akinori | Naha, Okinawa | 52 | | 202 | Nilay Patel | Sendai, Miyagi | 53 | | 104 | Murata Makoto | Kumamoto, Kumamoto | 54 | | 152 | Matsumoto Yukihiro | Okinawa, Okinawa | 55 | 56 | * import tables 57 | # M-x org-table-import 58 | 59 | | ID (Integer) | Name (String) | Address (String) | 60 | | 102 | Yonezawa Akinori | Naha, Okinawa | 61 | | 202 | Nilay Patel | Sendai, Miyagi | 62 | | 104 | Murata Makoto | Kumamoto, Kumamoto | 63 | | 152 | Matsumoto Yukihiro | Okinawa, Okinawa | 64 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-06/org-table.org: -------------------------------------------------------------------------------- 1 | * org-table-export 2 | # M-x org-table-export 3 | # orgtbl-to-tsv 4 | 5 | | a1 | a2 | 6 | | b1 | b2 | 7 | * org-table-export using properties 8 | :PROPERTIES: 9 | :TABLE_EXPORT_FILE: table.html 10 | :TABLE_EXPORT_FORMAT: orgtbl-to-html 11 | :END: 12 | # org-set-property (C-c C-x p) 13 | # M-x org-table-export 14 | 15 | | a1 | a2 | 16 | | b1 | b2 | 17 | * translator functions 18 | 19 | orgtbl-to-tsv 20 | orgtbl-to-csv 21 | orgtbl-to-latex 22 | orgtbl-to-html 23 | orgtbl-to-texinfo 24 | orgtbl-to-orgtbl 25 | orgtbl-to-table.el 26 | orgtbl-to-unicode 27 | 28 | * skip lines 29 | # M-x org-table-export 30 | # orgtbl-to-tsv :skip 1 31 | 32 | | a1 | a2 | 33 | | b1 | b2 | 34 | | c1 | c2 | 35 | 36 | * skip lines and columns using properties 37 | :PROPERTIES: 38 | :TABLE_EXPORT_FILE: table.csv 39 | :TABLE_EXPORT_FORMAT: orgtbl-to-tsv :skip 2 :skipcols (2 4) 40 | :END: 41 | 42 | | a1 | a2 | a3 | a4 | 43 | | b1 | b2 | b3 | b4 | 44 | | c1 | c2 | c3 | c4 | 45 | 46 | * do not export those lines 47 | :PROPERTIES: 48 | :TABLE_EXPORT_FILE: table.csv 49 | :TABLE_EXPORT_FORMAT: orgtbl-to-tsv 50 | :END: 51 | 52 | | | a1 | a2 | a3 | a4 | 53 | |---+----+----+----+----| 54 | | / | b1 | b2 | b3 | b4 | 55 | | | c1 | c2 | c3 | c4 | 56 | | / | d1 | d2 | d3 | d4 | 57 | 58 | * group columns 59 | :PROPERTIES: 60 | :TABLE_EXPORT_FILE: table.html 61 | :TABLE_EXPORT_FORMAT: orgtbl-to-html 62 | :END: 63 | 64 | | a1 | a2 | a3 | a4 | a5 | a6 | 65 | |----+----+----+----+----+----| 66 | | / | < | | | < | | 67 | | b1 | b2 | b3 | b4 | b5 | b6 | 68 | | c1 | c2 | c3 | c4 | c5 | c6 | 69 | | d1 | d2 | d3 | d4 | d5 | d6 | 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | `inside-emacs` is a **complementary material** for the video series **inside emacs**. 4 | 5 | Watch on my Youtube channel [Tony Aldon](https://youtu.be/F1IXixEhQwk) 6 | the playlists: 7 | - [ORG SPREADSHEET](https://www.youtube.com/watch?v=wrEYankhAIs&list=PLGMx7bOKMJTwx5eGVlBndN-teW1RhV7VQ&ab_channel=TonyAldon) 8 | - [ORG-TABLE](https://www.youtube.com/watch?v=pRXRwQ1GGr4&list=PLGMx7bOKMJTw4p7vs1kTGBAnW81NB57Wv&ab_channel=TonyAldon) 9 | - [INSIDE EMACS](https://www.youtube.com/watch?v=F1IXixEhQwk&list=PLGMx7bOKMJTxx2Vx155xbiOrb38Lp3nt1&ab_channel=TonyAldon) 10 | 11 | # Content 12 | 13 | If you want to reproduce some of the actions made in **inside 14 | emacs** videos, here you'll find: 15 | 16 | 1. Various list of the commands I use in the videos and the packages 17 | they belong to, 18 | 2. The code of the customized commands I use in the videos, 19 | 3. When it's possible, the files I use to make the videos. 20 | 21 | For instance, the informations corresponding to the video 22 | [tables, code blocks, the magic of org-mode | Inside Emacs #6 (part 14)](https://www.youtube.com/watch?v=ay7zslbSFqg) 23 | can be found: 24 | 1. in [./resources/videos/inside-emacs-06-part-14.org](./resources/videos/inside-emacs-06-part-14.org) 25 | for the commands, functions and variables used in the video, 26 | 2. in [./resources/src/inside-emacs-06-part-14/](./resources/src/inside-emacs-06-part-14/) 27 | for the files used in the video. 28 | 29 | # Contact 30 | 31 | Do you have any question or suggestion? Please, feel free to: 32 | * leave me a message on twitter @tonyaldon 34 | * or to email me at tony.aldon.adm@gmail.com. 35 | 36 | # License 37 | Project under MIT license 38 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-05/org-table.org: -------------------------------------------------------------------------------- 1 | * blank field 2 | # C-c SPC 3 | 4 | | 1 | C-c SPC will blank this field | 5 | | 2 | nothing special | 6 | 7 | # TAB, S-TAB or RET 8 | 9 | | TAB | start typing | 10 | | . | RET | 11 | | . | start typing | 12 | | start typing | S-TAB | 13 | 14 | # (setq org-table-auto-blank-field nil) 15 | 16 | | TAB | start typing | 17 | 18 | * org-table-copy-down 19 | # S-RET 20 | # M-x org-table-copy-down 21 | 22 | | word | word | number | interval | 23 | |------+------+--------+----------| 24 | | same | same | 1 | 0 | 25 | | | | | 5 | 26 | | | | | | 27 | 28 | | prefix | suffix | timestamp (by days) | 29 | | 0-xyz | xyz-0 | <2020-12-28 Mon> | 30 | | | | | 31 | 32 | # org-table-copy-increment 33 | 34 | * swapping fields 35 | # S-, S-, S-, S- 36 | 37 | | ... | a | ... | 38 | | b | XXX | c | 39 | | ... | p | ... | 40 | 41 | * operations on columns 42 | # M- and M- 43 | 44 | | A | B | XXX | C | D | 45 | | A | B | XXX | C | D | 46 | | A | B | XXX | C | D | 47 | | A | B | XXX | C | D | 48 | | A | B | XXX | C | D | 49 | 50 | # M-S- and M-S- 51 | 52 | | A | B | C | D | 53 | | A | B | C | D | 54 | | A | B | C | D | 55 | | A | B | C | D | 56 | | A | B | C | D | 57 | 58 | * operations on lines 59 | # M- and M- 60 | 61 | | A | A | A | A | A | 62 | | B | B | B | B | B | 63 | | XXX | XXX | XXX | XXX | XXX | 64 | | C | C | C | C | C | 65 | | D | D | D | D | D | 66 | 67 | # M-S- and M-S- 68 | 69 | | A | A | A | A | A | 70 | | B | B | B | B | B | 71 | | C | C | C | C | C | 72 | | D | D | D | D | D | 73 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-10/spreadsheet.org: -------------------------------------------------------------------------------- 1 | * Formula debugger 2 | # C-c C-c (org-ctrl-c-ctrl-c) 3 | # C-c { (org-table-toggle-formula-debugger) 4 | 5 | | value 1 | value 2 | sum | 6 | |---------+---------+--------| 7 | | 1 | 1 | #ERROR | 8 | #+TBLFM: $3='(+ $1 $2) 9 | 10 | | value 1 | value 2 | sum | 11 | |---------+---------+-----| 12 | | 1 | 1 | 2 | 13 | #+TBLFM: $3='(+ (string-to-number $1) (string-to-number $2)) 14 | 15 | * N and L formula flags 16 | # N flag 17 | 18 | | value 1 | value 2 | sum | 19 | |---------+---------+-----| 20 | | 1 | 1 | 2 | 21 | #+TBLFM: $3='(+ $1 $2);N 22 | 23 | # N flag 24 | 25 | | value 1 | value 2 | sum | 26 | |---------+----------+-----| 27 | | 1 | a string | 1 | 28 | #+TBLFM: $3='(+ $1 $2);N 29 | 30 | # L flag 31 | 32 | | value 1 | value 2 | sum | 33 | |---------+---------+-----| 34 | | 1 | 1 | 2 | 35 | #+TBLFM: $3='(+ $1 $2);L 36 | 37 | # L flag 38 | 39 | | function | string | case modified | 40 | |----------+--------------+---------------| 41 | | upcase | inside emacs | #ERROR | 42 | #+TBLFM: $3='($1 $2);L 43 | 44 | | function | string | case modified | 45 | |----------+--------------+---------------| 46 | | upcase | inside emacs | INSIDE EMACS | 47 | #+TBLFM: $3='($1 "$2");L 48 | 49 | * Limites of Formula debugger 50 | 51 | | function | string | case modified | 52 | |----------+--------------+---------------| 53 | | upcase | inside emacs | INSIDE EMACS | 54 | #+TBLFM: $3='($1 "$2");L 55 | 56 | | function | string | case modified | 57 | |----------+--------------+---------------| 58 | | upcase | inside emacs | #ERROR | 59 | #+TBLFM: $3='((intern $1) $2) 60 | 61 | | function | string | case modified | 62 | |----------+--------------+---------------| 63 | | upcase | inside emacs | INSIDE EMACS | 64 | #+TBLFM: $3='(funcall (intern $1) $2) 65 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-03/org-table.org: -------------------------------------------------------------------------------- 1 | * Wrap Text 2 | # M-x org-table-wrap-region 3 | 4 | | 1 | lorem ipsum dolor sit | 5 | | 2 | | 6 | | 3 | | 7 | | 4 | | 8 | 9 | # C-u M-x org-table-wrap-region 10 | 11 | | 1 | lorem | 12 | | 2 | ipsum | 13 | | 3 | dolor | 14 | | 4 | sit | 15 | 16 | * Wrap Expanded Text 17 | 18 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed 19 | do eiusmod tempor incididunt ut labore et dolore magna aliqua. 20 | 21 | # C-u 4 M-x org-table-wrap-region 22 | 23 | | Lorem ipsum dolor sit | 24 | | amet, consectetur | 25 | | adipiscing elit, sed do | 26 | | eiusmod tempor | 27 | | incididunt ut labore et | 28 | | dolore magna aliqua. | 29 | 30 | # C-u 8 M-x org-table-wrap-region 31 | 32 | | Lorem ipsum dolor sit amet, | 33 | | consectetur adipiscing elit, sed | 34 | | do eiusmod tempor incididunt ut | 35 | | labore et dolore magna aliqua. | 36 | 37 | * Edge Cases 38 | # C-u 3 M-x org-table-wrap-region 39 | 40 | | 1 | lorem ipsum dolor sit | 41 | | 2 | | 42 | | 3 | | 43 | | 4 | | 44 | 45 | # C-u 3 M-x org-table-wrap-region 46 | 47 | | 1 | lorem ipsum dolor sit | 48 | | 2 | | 49 | |---+-----------------------| 50 | | 3 | | 51 | | 4 | | 52 | 53 | # C-u 3 M-x org-table-wrap-region 54 | 55 | | 1 | lorem ipsum dolor sit | 56 | | 2 | | 57 | | 3 | amet | 58 | | 4 | | 59 | 60 | * org-meta-return command 61 | # 62 | # M-x org-meta-return 63 | 64 | | lorem ipsum dolor sit | 65 | | | 66 | | | 67 | | | 68 | 69 | # 70 | # M-x my-org-meta-return 71 | 72 | | lorem ipsum dolor sit | 73 | | | 74 | | | 75 | | | 76 | 77 | - item 78 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-04/org-table.org: -------------------------------------------------------------------------------- 1 | * Copy and Past Region 2 | ** scene 1-a 3 | # org-table-copy-region 4 | # org-table-paste-rectangle 5 | 6 | | ID | Name | Address | 7 | | 102 | Yonezawa | Naha, Okinawa | 8 | | 202 | Nilay | Sendai, Miyagi | 9 | | 104 | Murata | Kumamoto, Kumamoto | 10 | | 152 | Matsumoto | Okinawa, Okinawa | 11 | 12 | ** scene 1-b 13 | 14 | | ID | Name | Address | 15 | | 102 | Yonezawa | Naha, Okinawa | 16 | | 202 | Nilay | Sendai, Miyagi | 17 | | 104 | Murata | Kumamoto, Kumamoto | 18 | | 152 | Matsumoto | Okinawa, Okinawa | 19 | 20 | | ID | Name | Address | 21 | | 102 | Yonezawa | Naha, Okinawa | 22 | | 202 | Nilay | Sendai, Miyagi | 23 | | 104 | Murata | Kumamoto, Kumamoto | 24 | | 152 | Matsumoto | Okinawa, Okinawa | 25 | 26 | | ID | Name | Address | 27 | | 102 | Yonezawa | Naha, Okinawa | 28 | | 202 | Nilay | Sendai, Miyagi | 29 | | 104 | Murata | Kumamoto, Kumamoto | 30 | | 152 | Matsumoto | Okinawa, Okinawa | 31 | * Insert Horizontal Lines 32 | # C-c - 33 | 34 | | binding | command | 35 | | C-c - | org-table-insert-hline | 36 | | C-c RET | org-table-hline-and-move | 37 | 38 | # C-u C-c - 39 | 40 | | binding | command | 41 | | C-c - | org-table-insert-hline | 42 | | C-c RET | org-table-hline-and-move | 43 | 44 | # C-c RET 45 | 46 | | binding | command | 47 | | C-c - | org-table-insert-hline | 48 | | C-c RET | org-table-hline-and-move | 49 | 50 | # C-u C-c RET 51 | 52 | | binding | command | 53 | | C-c - | org-table-insert-hline | 54 | | C-c RET | org-table-hline-and-move | 55 | * Sort Table Lines 56 | # org-table-sort-lines 57 | # C-c ^ 58 | 59 | | id | word | date | 60 | |----+-------------+------------------| 61 | | 1 | lorem | <2020-12-18 Fri> | 62 | | 2 | ipsum | <2020-12-19 Sat> | 63 | | 3 | dolor | <2020-12-20 Sun> | 64 | | 4 | sit | <2020-12-21 Mon> | 65 | |----+-------------+------------------| 66 | | 5 | amet | <2020-12-22 Tue> | 67 | | 6 | consectetur | <2020-12-23 Wed> | 68 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-13/paycheck.org: -------------------------------------------------------------------------------- 1 | * overview 2 | | sales | bonus | 3 | |-------+-------| 4 | | 3 | 500 | 5 | | 5 | 1000 | 6 | | 7 | 1500 | 7 | 8 | ** team A 9 | # fixed part: 2000 10 | 11 | | teammates | sales | paycheck | 12 | |-----------+-------+----------| 13 | | Jack | 3 | 2500 | 14 | | Maria | 7 | 3500 | 15 | | Bob | 5 | 3000 | 16 | 17 | ** team B 18 | # fixed part: 3000 19 | 20 | | teammates | sales | paycheck | 21 | |-----------+-------+----------| 22 | | Jenny | 3 | 3500 | 23 | | Boby | 7 | 4500 | 24 | | Sandra | 5 | 4000 | 25 | * #+NAME and remote() 26 | 27 | #+NAME: bonus 28 | | sales | bonus | 29 | |-------+-------| 30 | | 3 | 500 | 31 | | 5 | 1000 | 32 | | 7 | 1500 | 33 | 34 | | sales | 35 | | [3, 5, 7] | 36 | #+TBLFM: @1$1=remote(bonus,@1$1)::@2$1=remote(bonus,@2$1..@4$1) 37 | 38 | * org-lookup-first 39 | 40 | #+NAME: bonus 41 | | sales | bonus($) | 42 | |-------+----------| 43 | | 3 | 500 | 44 | | 5 | 1000 | 45 | | 7 | 1500 | 46 | 47 | | teammates | sales | paycheck($) | 48 | |-----------+-------+-------------| 49 | | Jack | 3 | 2500 | 50 | | Maria | 7 | 3500 | 51 | | Bob | 5 | 3000 | 52 | #+TBLFM: $>='(+ 2000 (org-lookup-first $2 '(remote(bonus,@2$1..@4$1)) '(remote(bonus,@2$2..@4$2))));N 53 | 54 | * constants 55 | #+NAME: bonus 56 | | sales | bonus($) | 57 | |-------+----------| 58 | | 3 | 500 | 59 | | 5 | 1000 | 60 | | 7 | 1500 | 61 | ** team A 62 | :PROPERTIES: 63 | :FIXED: 2000 64 | :END: 65 | 66 | | teammates | sales | paycheck | 67 | |-----------+-------+----------| 68 | | Jack | 3 | 2500 | 69 | | Maria | 7 | 3500 | 70 | | Bob | 5 | 3000 | 71 | #+TBLFM: $>='(+ $PROP_FIXED (org-lookup-first $2 '(remote(bonus,@2$1..@4$1)) '(remote(bonus,@2$2..@4$2))));N 72 | 73 | ** team B 74 | :PROPERTIES: 75 | :FIXED: 3000 76 | :END: 77 | 78 | | teammates | sales | paycheck | 79 | |-----------+-------+----------| 80 | | Jenny | 3 | 3500 | 81 | | Boby | 7 | 4500 | 82 | | Sandra | 5 | 4000 | 83 | #+TBLFM: $>='(+ $PROP_FIXED (org-lookup-first $2 '(remote(bonus,@2$1..@4$1)) '(remote(bonus,@2$2..@4$2))));N 84 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-02/org/org-table.el: -------------------------------------------------------------------------------- 1 | ;;; part of org.el 2 | ;; find this command in the original file `lisp/org/org-table.el' 3 | ;; Emacs source repository 4 | ;; $ git clone https://git.savannah.gnu.org/git/emacs.git 5 | 6 | (defun org-table-next-row () 7 | "Go to the next row (same column) in the current table. 8 | Before doing so, re-align the table if necessary." 9 | (interactive) 10 | (org-table-maybe-eval-formula) 11 | (org-table-maybe-recalculate-line) 12 | (if (and org-table-automatic-realign 13 | org-table-may-need-update) 14 | (org-table-align)) 15 | (let ((col (org-table-current-column))) 16 | (beginning-of-line 2) 17 | (unless (bolp) (insert "\n")) ;missing newline at eob 18 | (when (or (not (org-at-table-p)) 19 | (org-at-table-hline-p)) 20 | (beginning-of-line 0) 21 | (org-table-insert-row 'below)) 22 | (org-table-goto-column col) 23 | (skip-chars-backward "^|\n\r") 24 | (when (looking-at " ") (forward-char)))) 25 | 26 | (defun org-table-current-column () 27 | "Return current column number." 28 | (interactive) 29 | (save-excursion 30 | (let ((pos (point))) 31 | (beginning-of-line) 32 | (if (not (search-forward "|" pos t)) 0 33 | (let ((column 1) 34 | (separator (if (org-at-table-hline-p) "[+|]" "|"))) 35 | (while (re-search-forward separator pos t) (cl-incf column)) 36 | column))))) 37 | 38 | (defun org-table-goto-column (n &optional on-delim force) 39 | "Move the cursor to the Nth column in the current table line. 40 | With optional argument ON-DELIM, stop with point before the left delimiter 41 | of the field. 42 | If there are less than N fields, just go to after the last delimiter. 43 | However, when FORCE is non-nil, create new columns if necessary." 44 | (interactive "p") 45 | (beginning-of-line 1) 46 | (when (> n 0) 47 | (while (and (> (setq n (1- n)) -1) 48 | (or (search-forward "|" (point-at-eol) t) 49 | (and force 50 | (progn (end-of-line 1) 51 | (skip-chars-backward "^|") 52 | (insert " | ") 53 | t))))) 54 | (when (and force (not (looking-at ".*|"))) 55 | (save-excursion (end-of-line 1) (insert " | "))) 56 | (if on-delim 57 | (backward-char 1) 58 | (if (looking-at " ") (forward-char 1))))) 59 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-11/spreadsheet.org: -------------------------------------------------------------------------------- 1 | * Editing in a field 2 | 3 | | value 1 | value 2 | results | 4 | |---------+---------+---------| 5 | | 1 | 1 | 2 | 6 | | 1 | 1 | 1 | 7 | #+TBLFM: @2$3=$1+$2::@3$3=$1*$2 8 | 9 | # C-c } org-table-toggle-coordinate-overlays 10 | 11 | | value 1 | value 2 | value 3 | value 4 | results | 12 | |---------+---------+---------+---------+---------| 13 | | | | | | | 14 | | | | | | | 15 | | | | | | | 16 | |---------+---------+---------+---------+---------| 17 | | | | | | | 18 | | | | | | | 19 | |---------+---------+---------+---------+---------| 20 | | | | | | | 21 | | | | | | | 22 | 23 | * Column formulas 24 | 25 | | value 1 | value 2 | value 3 | results | 26 | |---------+---------+---------+---------| 27 | | 1 | 1 | 1 | 3 | 28 | | 2 | 2 | 2 | 6 | 29 | | 3 | 3 | 3 | 9 | 30 | #+TBLFM: $4=vsum($1..$3) 31 | 32 | * Automatic adaptation of field references 33 | 34 | | value 1 | results | value 2 | 35 | |---------+---------+---------| 36 | | 3 | 9 | 3 | 37 | | 1 | 2 | 1 | 38 | #+TBLFM: @3$2=$1+$3::@2$2=$1*$3 39 | 40 | 41 | 42 | | value 1 | value 2 | results | 43 | |---------+---------+---------| 44 | | 1 | 1 | 2 | 45 | | 3 | 3 | 9 | 46 | #+TBLFM: @2$3=$1+$2::@3$3=$1*$2 47 | 48 | 49 | 50 | | value 1 | value 2 | results | 51 | |---------+---------+---------| 52 | | 1 | 1 | 2 | 53 | | 3 | 3 | 9 | 54 | #+TBLFM: @2$3=$1+$2::@3$3=$1*$2 55 | * Editing in the minibuffer 56 | # C-u C-c = C-c = 57 | | value 1 | value 2 | field formula | column formula | 58 | |---------+---------+---------------+----------------| 59 | | 1 | 1 | XXX | 2 | 60 | | 2 | 2 | 4 | 4 | 61 | | 3 | 3 | | 6 | 62 | #+TBLFM: $4=vsum($1..$2)::@2$3=XXX::@3$3=vsum($1..$2) 63 | 64 | * Editing in a dedicated buffer 65 | | value 1 | value 2 | field formula | column formula | 66 | |---------+---------+---------------+----------------| 67 | | 1 | 1 | YYY | 2 | 68 | | 2 | 2 | 4 | 4 | 69 | | 3 | 3 | 12 | 6 | 70 | #+TBLFM: $4=vsum($1..$2)::@2$3=YYY::@3$3=vsum($1..$2)::@4$3=vsum(@2$1..@4$2) 71 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-09/spreadsheet.org: -------------------------------------------------------------------------------- 1 | * TBLFM keyword 2 | # C-c C-c on the line starting by #+TBLFM: 3 | 4 | | Using Calc | Using Elisp | 5 | |------------+-------------| 6 | | 2 | | 7 | #+TBLFM: @2$1=1+1 8 | 9 | | Using Calc | Using Elisp | 10 | |------------+-------------| 11 | | | 4 | 12 | #+TBLFM: @2$2='(+ 2 2) 13 | 14 | # use :: to separate assignments 15 | 16 | | Using Calc | Using Elisp | 17 | |------------+-------------| 18 | | 2 | 4 | 19 | #+TBLFM: @2$1=1+1::@2$2='(+ 2 2) 20 | 21 | * left-hand side of an assignment 22 | # only @ or $ 23 | 24 | | | | | | | 25 | | | | | | | 26 | | | | | | | 27 | | | | | | | 28 | | XXX | XXX | XXX | XXX | XXX | 29 | #+TBLFM: @5=XXX 30 | 31 | | | | | | XXX | 32 | | | | | | XXX | 33 | | | | | | XXX | 34 | | | | | | XXX | 35 | | | | | | XXX | 36 | #+TBLFM: $5=XXX 37 | 38 | # @< first row 39 | # @> last row 40 | # $< first column 41 | # $> last column 42 | 43 | | XXX | XXX | XXX | XXX | XXX | 44 | | | | | | | 45 | | | | | | | 46 | | | | | | | 47 | | XXX | XXX | XXX | XXX | XXX | 48 | #+TBLFM: @<=XXX::@>=XXX 49 | 50 | | XXX | | | | XXX | 51 | | XXX | | | | XXX | 52 | | XXX | | | | XXX | 53 | | XXX | | | | XXX | 54 | | XXX | | | | XXX | 55 | #+TBLFM: $<=XXX::$>=XXX 56 | 57 | | | | | | | 58 | | | | | | | 59 | | | XXX | XXX | XXX | | 60 | | | | | | | 61 | | | | | | | 62 | #+TBLFM: @3$2..@3$4=XXX 63 | 64 | | | | | | | 65 | | | | XXX | | | 66 | | | | XXX | | | 67 | | | | XXX | | | 68 | | | | | | | 69 | #+TBLFM: @2$3..@4$3=XXX 70 | 71 | | | | | | | 72 | | | XXX | XXX | XXX | | 73 | | | XXX | XXX | XXX | | 74 | | | XXX | XXX | XXX | | 75 | | | | | | | 76 | #+TBLFM: @2$2..@4$4=XXX 77 | 78 | * right-hand side of an assignment 79 | # @ROW$COLUMN syntax 80 | 81 | | 1 | 2 | | 82 | | | | 3 | 83 | #+TBLFM: @2$3=@1$1+@1$2 84 | 85 | # omit @ 86 | 87 | | 1 | 2 | 3 | 88 | | | | | 89 | #+TBLFM: @1$3=$1+$2 90 | 91 | | 1 | 2 | 3 | 92 | | 1 | 3 | 4 | 93 | | 1 | 4 | 5 | 94 | #+TBLFM: $3=$1+$2 95 | 96 | # ranges with Calc formulas 97 | 98 | | 1 | 2 | 3 | [1, 2, 3] | 99 | #+TBLFM: @1$4=$1..$3 100 | 101 | | 1 | 2 | 3 | 6 | 102 | #+TBLFM: @1$4=vsum($1..$3) 103 | 104 | # ranges with Emacs Lisp form formulas 105 | 106 | | 1 | 2 | 3 | 123 | 107 | #+TBLFM: @1$4='(concat $1..$3) 108 | 109 | # @1 is not a range 110 | 111 | | 1 | 2 | 3 | 112 | | | | 3 | 113 | | | | 6 | 114 | #+TBLFM: @2$3=@1 115 | #+TBLFM: @3$3=vsum(@1$1..@1$3) 116 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-14/tables.org: -------------------------------------------------------------------------------- 1 | * pass tables to code blocks 2 | #+NAME: table-1 3 | | a1 | a2 | a3 | 4 | | b1 | b2 | b3 | 5 | | c1 | c2 | c3 | 6 | 7 | #+BEGIN_SRC emacs-lisp :var tab=table-1 8 | (format "%S" tab) 9 | #+END_SRC 10 | 11 | #+RESULTS: 12 | : 0.7868954904387528 13 | 14 | #+NAME: table-2 15 | | a1 | a2 | a3 | 16 | | b1 | b2 | b3 | 17 | | c1 | c2 | c3 | 18 | 19 | #+BEGIN_SRC emacs-lisp :var tab=table-2[1] 20 | (format "%S" tab) 21 | #+END_SRC 22 | 23 | #+RESULTS: 24 | : ("b1" "b2" "b3") 25 | 26 | #+BEGIN_SRC emacs-lisp :var tab=table-2[,1] 27 | (format "%S" tab) 28 | #+END_SRC 29 | 30 | #+RESULTS: 31 | : ("a2" "b2" "c2") 32 | 33 | #+BEGIN_SRC emacs-lisp :var tab=table-2[0:1,1:2] 34 | (format "%S" tab) 35 | #+END_SRC 36 | 37 | #+RESULTS: 38 | : (("a2" "a3") ("b2" "b3")) 39 | ** :colnames nil 40 | #+NAME: table-3 41 | | a1 | a2 | a3 | 42 | |----+----+----| 43 | | b1 | b2 | b3 | 44 | | c1 | c2 | c3 | 45 | 46 | #+BEGIN_SRC emacs-lisp :var tab=table-3 :colnames nil 47 | (mapcar (lambda (row) (mapcar 'upcase row)) tab) 48 | #+END_SRC 49 | 50 | #+RESULTS: 51 | | a1 | a2 | a3 | 52 | |----+----+----| 53 | | B1 | B2 | B3 | 54 | | C1 | C2 | C3 | 55 | ** :colnames no 56 | #+NAME: table-5 57 | | a1 | a2 | a3 | 58 | |----+----+----| 59 | | b1 | b2 | b3 | 60 | | c1 | c2 | c3 | 61 | 62 | #+BEGIN_SRC emacs-lisp :var tab=table-5 :colnames no 63 | (mapcar (lambda (row) (mapcar 'upcase row)) tab) 64 | #+END_SRC 65 | 66 | #+RESULTS: 67 | | A1 | A2 | A3 | 68 | | B1 | B2 | B3 | 69 | | C1 | C2 | C3 | 70 | ** :colnames yes 71 | #+NAME: table-4 72 | | a1 | a2 | a3 | 73 | | b1 | b2 | b3 | 74 | | c1 | c2 | c3 | 75 | 76 | #+BEGIN_SRC emacs-lisp :var tab=table-4 :colnames yes 77 | (mapcar (lambda (row) (mapcar 'upcase row)) tab) 78 | #+END_SRC 79 | 80 | #+RESULTS: 81 | | a1 | a2 | a3 | 82 | |----+----+----| 83 | | B1 | B2 | B3 | 84 | | C1 | C2 | C3 | 85 | * produce tables from code blocks 86 | 87 | #+BEGIN_SRC bash :results output 88 | printf "line 1\nline 2\nline 3\n" 89 | #+END_SRC 90 | 91 | #+RESULTS: 92 | : line 1 93 | : line 2 94 | : line 3 95 | 96 | #+BEGIN_SRC bash :results value 97 | printf "line 1\nline 2\nline 3\n" 98 | #+END_SRC 99 | 100 | #+RESULTS: 101 | : 0 102 | 103 | #+NAME: my-table 104 | #+BEGIN_SRC bash :results output table 105 | printf "line 1\nline 2\nline 3\n" 106 | #+END_SRC 107 | 108 | #+RESULTS: my-table 109 | | line | 1 | 110 | | line | 2 | 111 | | line | 3 | 112 | 113 | #+BEGIN_SRC emacs-lisp :var tab=my-table 114 | (mapcar (lambda (row) (mapcar 'upcase row)) tab) 115 | #+END_SRC 116 | 117 | #+RESULTS: 118 | | LINE | 1 | 119 | | LINE | 2 | 120 | | LINE | 3 | 121 | 122 | * org-sbe macro 123 | 124 | #+NAME: random-sum 125 | #+BEGIN_SRC python :results value :var x=0 126 | from random import random 127 | return(x + random()) 128 | #+END_SRC 129 | 130 | #+RESULTS: random-sum 131 | : 0.3223412668894684 132 | 133 | | value | random sum with python | 134 | |-------+------------------------| 135 | | 3 | 3.11 | 136 | #+TBLFM: $2='(org-sbe random-sum (x $1));%.2f 137 | -------------------------------------------------------------------------------- /src/inside-emacs-03/other-window-scroll-buffer/file-3.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | /** Walk in the AST tree (obtain with orga) and goto a specific node.*/ 4 | function astGoToNode(ast, branches) { 5 | var node = ast; 6 | if (branches == null) { 7 | return node; 8 | } 9 | for (let branch of branches) { 10 | node = node.children[branch]; 11 | } 12 | return node; 13 | } 14 | 15 | /** From nested list of nodes of type "list", "list.item", 16 | "headline" and "block" in the AST tree (obtain with "orga"), 17 | filters and returns an array of nodes only of the types 18 | "list.item" or "block". */ 19 | function astMakeListItemBlock(astList) { 20 | // var children = astGoToNode(astTopSection, [1,1]).children; 21 | var listItemBlock = []; 22 | for (var node = 0; node < astList.length; node++) { 23 | switch (astList[node].type) { 24 | case 'block': 25 | listItemBlock.push(astList[node]); 26 | break; 27 | case 'list': 28 | let itemList = astList[node].children; 29 | for (var item = 0; item < itemList.length; item++) { 30 | listItemBlock.push(itemList[item]); 31 | } 32 | break; 33 | default: 34 | } 35 | } 36 | return listItemBlock; 37 | } 38 | 39 | /** From a top section in the AST tree (obtain with orga) and the trick 40 | index ([2,1] for second headline at level 2 and first headline at level 3) 41 | in that top section returns a trick. **/ 42 | function astMakeTrick(astTopSection, trickIndex) { 43 | const headline2Index = trickIndex[0]; 44 | const headline3Index = trickIndex[1]; 45 | return { 46 | headline_1 : astGoToNode(astTopSection, [0,0]).value, 47 | headline_2 : astGoToNode(astTopSection, [headline2Index,0,0]).value, 48 | headline_3 : astGoToNode(astTopSection, [headline2Index, 49 | headline3Index,0,0]).value, 50 | list : astMakeListItemBlock( 51 | astGoToNode(astTopSection,[headline2Index,headline3Index]).children) 52 | }; 53 | } 54 | 55 | /** Make the list off all tricks of the AST tree (obtain with orga).*/ 56 | function astMakeTricks(ast) { 57 | let tricks = []; 58 | ast.children.forEach((astTopSection) => { 59 | astTopSection.children.slice(1).forEach((headline2,headline2Index) => { 60 | headline2.children.slice(1).forEach((headline3,headline3Index) => { 61 | let trickIndex = [headline2Index + 1, headline3Index + 1]; 62 | tricks.push(astMakeTrick(astTopSection, trickIndex)); 63 | }) 64 | }) 65 | }) 66 | return tricks 67 | } 68 | 69 | /** From a node AST tree (obtain with orga) returns its text 70 | content wrapped with the appropriate html tag.*/ 71 | function MarkupOrLink(props) { 72 | const astNode = props.node; 73 | let element; 74 | switch (astNode.type) { 75 | case 'text': 76 | element = astNode.value; 77 | break; 78 | case 'link': 79 | element = {astNode.desc} 80 | break; 81 | case 'strikeThrough': 82 | element = {astNode.children[0].value}; 83 | break; 84 | case 'underline': 85 | element = 86 | {astNode.children[0].value} 87 | ; 88 | break; 89 | case 'bold': 90 | element = {astNode.children[0].value}; 91 | break; 92 | case 'italic': 93 | element = {astNode.children[0].value}; 94 | break; 95 | case 'code': 96 | element = {astNode.children[0].value}; 97 | break; 98 | case 'verbatim': 99 | element = {astNode.children[0].value}; 100 | break; 101 | default: 102 | } 103 | return element; 104 | } 105 | 106 | export { astGoToNode, astMakeListItemBlock, astMakeTrick, 107 | astMakeTricks, MarkupOrLink } 108 | -------------------------------------------------------------------------------- /src/inside-emacs-03/other-window-scroll-buffer/file-1.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import './App.scss' 3 | import { astMakeTricks, MarkupOrLink } from './astUtils.js' 4 | import { Collapse } from 'react-collapse' 5 | 6 | function NavBar() { 7 | return ( 8 | 36 | ); 37 | } 38 | 39 | function Footer() { 40 | return ( 41 |
42 |
43 |

Tricks by Tony Aldon

44 |
45 |
46 | ); 47 | } 48 | 49 | class Trick extends React.Component { 50 | constructor(props) { 51 | super(props); 52 | this.state = {isOpened: false}; 53 | } 54 | 55 | handleClick = () => { 56 | this.setState({isOpened: !this.state.isOpened}) 57 | } 58 | 59 | render () { 60 | const title = this.props.trick.headline_3; 61 | const nodeList = this.props.trick.list; 62 | const items = nodeList.map((node,index) => { 63 | if (node.type === 'list.item') { 64 | return ( 65 |
  • 66 | 69 |
  • 70 | ); 71 | } else { 72 | return ( 73 | 77 | ); 78 | } 79 | }); 80 | return ( 81 |
    82 |
    83 | 91 |
    92 | 97 |
      {items}
    98 |
    99 |
    100 | ); 101 | } 102 | } 103 | 104 | function Block(props) { 105 | const language = props.block.params[0]; 106 | const code = props.block.value; 107 | return ( 108 |
    109 |       {code}
    110 |     
    111 | ); 112 | } 113 | 114 | function Paragraph(props) { 115 | const paragraphList = props.paragraph; 116 | const paragraph = paragraphList.map((node,index) => 117 | ); 118 | return ( 119 |

    {paragraph}

    120 | ); 121 | } 122 | 123 | function App(props) { 124 | const ast = props.ast; 125 | const tricks = astMakeTricks(ast); 126 | const trickList = tricks.map((trick,index) => 127 | ); 131 | return ( 132 |
    133 | 134 |
      {trickList}
    135 |
    136 |
    137 | ); 138 | } 139 | 140 | export { App, NavBar, Trick, Block, Paragraph } 141 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-05/org/org-table.el: -------------------------------------------------------------------------------- 1 | ;;; part of org.el 2 | ;; find this command in the original file `lisp/org/org-table.el' 3 | ;; Emacs source repository 4 | ;; $ git clone https://git.savannah.gnu.org/git/emacs.git 5 | 6 | (defun org-table-copy-down (n) 7 | "Copy the value of the current field one row below. 8 | 9 | If the field at the cursor is empty, copy the content of the 10 | nearest non-empty field above. With argument N, use the Nth 11 | non-empty field. 12 | 13 | If the current field is not empty, it is copied down to the next 14 | row, and the cursor is moved with it. Therefore, repeating this 15 | command causes the column to be filled row-by-row. 16 | 17 | If the variable `org-table-copy-increment' is non-nil and the 18 | field is a number, a timestamp, or is either prefixed or suffixed 19 | with a number, it will be incremented while copying. By default, 20 | increment by the difference between the value in the current 21 | field and the one in the field above, if any. To increment using 22 | a fixed integer, set `org-table-copy-increment' to a number. In 23 | the case of a timestamp, increment by days. 24 | 25 | However, when N is 0, do not increment the field at all." 26 | (interactive "p") 27 | (org-table-check-inside-data-field) 28 | (let* ((beg (org-table-begin)) 29 | (column (org-table-current-column)) 30 | (initial-field (save-excursion 31 | (let ((f (org-string-nw-p (org-table-get-field)))) 32 | (and f (org-trim f))))) 33 | field field-above next-field) 34 | (save-excursion 35 | ;; Get reference field. 36 | (if initial-field (setq field initial-field) 37 | (beginning-of-line) 38 | (setq field 39 | (catch :exit 40 | (while (re-search-backward org-table-dataline-regexp beg t) 41 | (let ((f (org-string-nw-p (org-table-get-field column)))) 42 | (cond ((and (> n 1) f) (cl-decf n)) 43 | (f (throw :exit (org-trim f))) 44 | (t nil)) 45 | (beginning-of-line))) 46 | (user-error "No non-empty field found")))) 47 | ;; Check if increment is appropriate, and how it should be done. 48 | (when (and org-table-copy-increment (/= n 0)) 49 | ;; If increment step is not explicit, get non-empty field just 50 | ;; above the field being incremented to guess it. 51 | (unless (numberp org-table-copy-increment) 52 | (setq field-above 53 | (let ((f (unless (= beg (line-beginning-position)) 54 | (forward-line -1) 55 | (not (org-at-table-hline-p)) 56 | (org-table-get-field column)))) 57 | (and (org-string-nw-p f) 58 | (org-trim f))))) 59 | ;; Compute next field. 60 | (setq next-field (org-table--increment-field field field-above)))) 61 | ;; Since initial field in not empty, we modify row below instead. 62 | ;; Skip alignment since we do it at the end of the process anyway. 63 | (when initial-field 64 | (let ((org-table-may-need-update nil)) (org-table-next-row)) 65 | (org-table-blank-field)) 66 | ;; Insert the new field. NEW-FIELD may be nil if 67 | ;; `org-table-increment' is nil, or N = 0. In that case, copy 68 | ;; FIELD. 69 | (insert (or next-field field)) 70 | (org-table-maybe-recalculate-line) 71 | (org-table-align))) 72 | 73 | (defun org-table-blank-field () 74 | "Blank the current table field or active region." 75 | (interactive) 76 | (org-table-check-inside-data-field) 77 | (if (and (called-interactively-p 'any) (org-region-active-p)) 78 | (let (org-table-clip) 79 | (org-table-cut-region (region-beginning) (region-end))) 80 | (skip-chars-backward "^|") 81 | (backward-char 1) 82 | (if (looking-at "|[^|\n]+") 83 | (let* ((pos (match-beginning 0)) 84 | (match (match-string 0)) 85 | (len (org-string-width match))) 86 | (replace-match (concat "|" (make-string (1- len) ?\ ))) 87 | (goto-char (+ 2 pos)) 88 | (substring match 1))))) 89 | -------------------------------------------------------------------------------- /src/inside-emacs-03/other-window-scroll-buffer/file-2.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { render } from '@testing-library/react' 3 | import { screen, fireEvent } from '@testing-library/dom' 4 | import { App, NavBar, Trick, Block, Paragraph } from './App' 5 | import { parse } from 'orga' 6 | import { astMakeTrick } from './astUtils.js' 7 | 8 | it('renders header content', () => { 9 | const { getByText } = render(); 10 | const headerContent = getByText(/Tricks/i); 11 | expect(headerContent).toBeInTheDocument(); 12 | }) 13 | 14 | describe('Trick', () => { 15 | const content = ` 16 | * Headline 1 17 | ** Headline 1.1 18 | *** Headline 1.1.1 19 | - item 1 ~inline code~ and *bold words* 20 | - item 2 21 | #+BEGIN_SRC bash 22 | some code 1 23 | #+END_SRC 24 | - item 3 25 | ** Headline 1.2 26 | *** Headline 1.2.1 27 | - item 1 ~inline code~ and *bold words* 28 | `; 29 | 30 | it('renders "Trick" component collapsed', () => { 31 | const ast = parse(content); 32 | const astTopSection = ast.children[0]; 33 | const trickIndex = [1,1]; 34 | const trick = astMakeTrick(astTopSection, trickIndex); 35 | const { getByText, getByTestId, container } = render(); 36 | 37 | expect(getByText(/Headline 1.1.1/i)).toBeInTheDocument(); 38 | expect(getByTestId('trick-title').parentNode.parentNode.childNodes[1]) 39 | .toHaveStyle('overflow: hidden') 40 | }); 41 | 42 | it('shows and hides the content of the "Trick" component', () => { 43 | const ast = parse(content); 44 | const astTopSection = ast.children[0]; 45 | const trickIndex = [1,1]; 46 | const trick = astMakeTrick(astTopSection, trickIndex); 47 | const { getByText, getByTestId, container } = render(); 48 | 49 | expect(getByTestId('trick-title').parentNode.parentNode.childNodes[1]) 50 | .toHaveStyle('overflow: hidden') 51 | 52 | fireEvent.click(getByText(/Headline 1.1.1/i)); 53 | expect(getByTestId('trick-title').parentNode.parentNode.childNodes[1]) 54 | .toHaveStyle('overflow: initial') 55 | 56 | fireEvent.click(getByText(/Headline 1.1.1/i)); 57 | expect(getByTestId('trick-title').parentNode.parentNode.childNodes[1]) 58 | .toHaveStyle('overflow: hidden') 59 | }) 60 | }); 61 | 62 | it('renders "Block" component', () => { 63 | const content = ` 64 | #+BEGIN_SRC javascript 65 | const parser = new Parser() 66 | const ast = parser.parse('Hello World') 67 | #+END_SRC 68 | `; 69 | 70 | const ast = parse(content); 71 | const block = ast.children[0]; 72 | const { getByText } = render(); 73 | const blockText = getByText(/parse\('Hello World'\)/i); 74 | expect(blockText).toBeInTheDocument(); 75 | }) 76 | 77 | it('renders "Paragraph" component', () => { 78 | const content = ` 79 | _underline_ and +strikeThrough+ and *bold* and /italic/ and 80 | ~code~ and =verbatim= and [[https://github.com/tonyaldon/][link]]. 81 | `; 82 | 83 | const ast = parse(content); 84 | const paragraph = ast.children[0].children; 85 | const { getByText } = render(); 86 | expect(getByText(/underline/i)).toBeInTheDocument(); 87 | expect(getByText(/strikeThrough/i)).toBeInTheDocument(); 88 | expect(getByText(/bold/i)).toBeInTheDocument(); 89 | expect(getByText(/italic/i)).toBeInTheDocument(); 90 | expect(getByText(/code/i)).toBeInTheDocument(); 91 | expect(getByText(/verbatim/i)).toBeInTheDocument(); 92 | expect(getByText(/link/i)).toBeInTheDocument(); 93 | }) 94 | 95 | describe('App', () => { 96 | const content = ` 97 | * Headline 1 98 | ** Headline 1.1 99 | *** Headline 1.1.1 100 | - item 1 101 | - item 2 102 | #+BEGIN_SRC bash 103 | some code 1 104 | #+END_SRC 105 | *** Headline 1.1.2 106 | - item 1 107 | - item 2 108 | * Headline 2 109 | ** Headline 2.1 110 | *** Headline 2.1.1 111 | - item 1 112 | - item 2 113 | - item 3 114 | #+BEGIN_SRC bash 115 | some code 2 116 | #+END_SRC 117 | ** Headline 2.2 118 | *** Headline 2.2.1 119 | - item 1 120 | #+BEGIN_SRC bash 121 | some code 3 122 | #+END_SRC 123 | `; 124 | 125 | 126 | it('renders the 4 tricks of the content', () => { 127 | const ast = parse(content); 128 | const { getByText } = render( 129 | 130 | ); 131 | const trick_1 = getByText(/Headline 1.1.1/i); 132 | const trick_2 = getByText(/Headline 1.1.2/i); 133 | const trick_3 = getByText(/Headline 2.1.1/i); 134 | const trick_4 = getByText(/Headline 2.2.1/i); 135 | expect(trick_1).toBeInTheDocument(); 136 | expect(trick_2).toBeInTheDocument(); 137 | expect(trick_3).toBeInTheDocument(); 138 | expect(trick_4).toBeInTheDocument(); 139 | }); 140 | }) 141 | -------------------------------------------------------------------------------- /q-and-a.org: -------------------------------------------------------------------------------- 1 | #+TITLE: Questions and Answers 2 | #+AUTHOR: Tony Aldon 3 | #+DATE: <2021-08-23 Mon> 4 | 5 | As the number of videos produced increases, comments, questions, 6 | answers and conversations increase too. 7 | 8 | *Comments* sometimes contain /suggestions/ to improve the videos, 9 | sometimes they contain /emacs insights/ I didn't know, sometimes they 10 | contain /questions/, and sometimes they contain /kind words/. 11 | 12 | I *learn a lot* from all the *comments* I received, I /read/ all of them, 13 | and /answer/ to all. Thank you all for these instructive interactions. 14 | 15 | Those /interactions/ are *scattered* over the internet (Reddit, Youtube, 16 | twitter, ...) and with this document I try to *aggregate* them in a 17 | Q&A style. 18 | 19 | I hope this document is useful for you. 20 | 21 | If you have any questions or suggestions, *contact me* by [[mailto:tony.aldon.adm@gmail.com][mail]] or DM on 22 | Twitter ([[https://twitter.com/tonyaldon][@tonyaldon]]) or Reddit ([[https://www.reddit.com/user/tonyaldon][u/tonyaldon]]). 23 | 24 | * What key bindings paradigm are you using? 25 | 26 | The original question is "Would you mind sharing what you are using 27 | to navigate. Looks like any. Is it?" posted on Reddit (see [[https://www.reddit.com/r/emacs/comments/oc8ap9/the_bases_of_the_org_spreadsheet_limitless_is/h40pd0k?utm_source=share&utm_medium=web2x&context=3][comment]]). 28 | 29 | I've rebound mostly every standard keybindings. I've not thought 30 | about the general use of these bindings, I just wanted them to fit the 31 | specific [[https://github.com/tonyaldon/keyboard-layout][keyboard-layout]] I'm using. 32 | 33 | If I can't remember a key binding, mostly it's because I almost don't 34 | use the command it maps to. In that case, I remove it. 35 | 36 | ** Enhanced key bindings 37 | 38 | To get most of Emacs key bindings, I use the packages ~hydra~ and 39 | ~key-chord~. 40 | 41 | [[https://github.com/abo-abo/hydra][hydra]] package offers a flexible and convenient way to make a bunch of 42 | related commands share a same key sequence prefix. 43 | 44 | I set ~hydra-hint-display-type~ to ~'message~ to not have the minibuffer 45 | changed when I use an ~hydra~. And, all my ~hydras~ have the parameter 46 | ~:hint~ set to ~nil~. I never want to see the keys printed. 47 | 48 | [[https://github.com/emacsorphanage/key-chord][key-chord]] package implements support for mapping a pair of 49 | simultaneously pressed keys to a command and for mapping the same key 50 | being pressed twice in quick succession to a command. Such bindings 51 | are called "key chords". 52 | 53 | ** Emacs text navigation 54 | 55 | To jump to visible text using a char-based decision tree, I use 56 | [[https://github.com/abo-abo/avy][avy]]. 57 | 58 | To move to non visible text in the current buffer, I use the built-in 59 | ~isearch-forward~ and ~isearch-backward~ commands. 60 | 61 | To operate *lines* (including moving the cursor around), I use the 62 | *hydra* ~handy-line~ defined below. 63 | 64 | To operate on *s-expressions* (including moving the cursor around by 65 | s-exp steps), I use the *hydra* ~handy-sexp~ defined below. 66 | 67 | I use color to know when I've an active ~hydra~. When ~handy-line~ is 68 | *active* the cursor has the color ~#f92672~. When ~handy-sexp~ is 69 | *active* the cursor has the color ~#fa87ce~. 70 | 71 | Some commands used in those ~hydras~ depends on some custom commands 72 | defined in my little package ~handy~ that you can find here: 73 | 74 | [[https://github.com/tonyaldon/emacs.d/blob/master/packages/handy.el][tonyaldon/emacs.d/packages/handy.el]]. 75 | 76 | You can also find those ~hydra~ definitions in: 77 | 78 | [[https://github.com/tonyaldon/emacs.d/blob/master/init.el][tonyaldon/emacs.d/init.el]]. 79 | 80 | *** Operate on lines 81 | To operate on *lines* I use the following ~hydra~: 82 | 83 | #+BEGIN_SRC emacs-lisp 84 | (require 'handy) 85 | (require 'key-chord) 86 | (require 'org) 87 | (require 'drag-stuff) 88 | 89 | (defvar handy-line-active nil) 90 | 91 | (defun handy-line-active () 92 | "Toggle status of `handy-line-active'" 93 | (if handy-line-active 94 | (setq handy-line-active nil) 95 | (setq handy-line-active t))) 96 | 97 | (defhydra handy-line 98 | (:pre (progn (if insight-mode (insight-mode -1)) 99 | (set-cursor-color "#fa87ce")) 100 | :post (progn (set-cursor-color "#26f9ad") 101 | (handy-line-active)) 102 | :hint nil) 103 | ("M-l" recenter-top-bottom) 104 | ("t" handy-sexp/body :color blue) 105 | (";" handy-line-comment) 106 | ("DEL" delete-backward-char) 107 | ("~" set-mark-command) 108 | ("m" exchange-point-and-mark) 109 | ;; action on line(s) 110 | ("!" flush-lines) 111 | ("?" keep-lines) 112 | ;; current line 113 | ("k" kill-line) 114 | ("l" (kill-line 0)) 115 | ("x" handy-line-kill) 116 | ("y" handy-line-copy-paste-below) 117 | ("r" join-line) 118 | ("o" open-line) 119 | ("O" delete-blank-lines) 120 | ("," handy-cycle-spacing) 121 | ;; to insert text 122 | ("u" handy-line-add-above :color blue) 123 | ("]" handy-line-add-below :color blue) 124 | ("_" handy-add-space :color blue) 125 | ;; quick motions 126 | ("n" next-line) 127 | ("p" previous-line) 128 | ("f" forward-char) 129 | ("b" backward-char) 130 | ("i" back-to-indentation) 131 | ("a" move-beginning-of-line) 132 | ("e" move-end-of-line) 133 | ("M-f" forward-word) 134 | ("M-b" backward-word) 135 | ("M-e" org-forward-sentence) 136 | ("M-a" org-backward-sentence) 137 | ;; drag stuff 138 | ("d" drag-stuff-up) 139 | ("s" drag-stuff-down) 140 | ("" drag-stuff-left) 141 | ("" drag-stuff-right) 142 | ;; clean/undo/nil 143 | ("M--" undo) 144 | ("q" nil)) 145 | 146 | (defadvice move-beginning-of-line (before move-beginning-of-line-advice activate) 147 | (if (not mark-active) (push-mark))) 148 | 149 | (defadvice move-end-of-line (before move-end-of-line-advice activate) 150 | (if (not mark-active) (push-mark))) 151 | 152 | (defadvice handy-line/body (before handy-line-advice activate) 153 | (handy-line-active)) 154 | #+END_SRC 155 | 156 | *** Operate on sexps 157 | To operate on *sexps* I use the following ~hydra~: 158 | 159 | #+BEGIN_SRC emacs-lisp 160 | (require 'handy) 161 | (require 'hydra) 162 | (require 'smartparens) 163 | (require 'key-chord) 164 | 165 | (defhydra handy-sexp 166 | (:pre (progn (if insight-mode (insight-mode -1)) 167 | (set-cursor-color "#f92672")) 168 | :post (set-cursor-color "#26f9ad") 169 | :hint nil) 170 | ("t" handy-line/body :color blue) 171 | ;; miscellaneous 172 | ("~" set-mark-command) 173 | ("T" exchange-point-and-mark) 174 | ("r" join-line) 175 | ;; (";" sp-comment) 176 | ("_" handy-add-space :color blue) 177 | ;; kill 178 | ("M-d" sp-kill-sexp) 179 | ("DEL" sp-backward-kill-sexp) 180 | ("C" sp-copy-sexp) 181 | ("c" handy-avy-copy-past-sexp :color blue) 182 | ("C-y" sp-clone-sexp) 183 | ;; reshape 184 | ("," sp-change-enclosing :color blue) 185 | (";" sp-change-inner :color blue) 186 | (":" sp-split-sexp) 187 | ("M-:" sp-join-sexp) 188 | (">" sp-absorb-sexp) 189 | ("}" sp-emit-sexp) 190 | ("%" sp-convolute-sexp) 191 | ("M-f" sp-forward-slurp-sexp) 192 | ("M-b" sp-backward-slurp-sexp) 193 | ("" sp-splice-sexp-killing-backward) 194 | ("" sp-splice-sexp-killing-forward) 195 | ("" sp-raise-sexp) 196 | ("/" sp-splice-sexp) 197 | ;; motion 198 | ("M-p" sp-beginning-of-previous-sexp) 199 | ("M-n" sp-beginning-of-next-sexp) 200 | ("C-M-p" sp-end-of-previous-sexp) 201 | ("C-M-n" sp-end-of-next-sexp) 202 | ("f" sp-forward-sexp) 203 | ("b" sp-backward-sexp) 204 | ("n" sp-next-sexp) 205 | ("p" sp-previous-sexp) 206 | ("u" sp-backward-up-sexp) 207 | ("i" sp-down-sexp) 208 | ("x" sp-up-sexp) 209 | ("y" sp-backward-down-sexp) 210 | ("a" sp-beginning-of-sexp) 211 | ("e" sp-end-of-sexp) 212 | ("d" handy-sp-drag-backward) 213 | ("s" handy-sp-drag-forward) 214 | ;; parenthese type 215 | ("$" sp-show-enclosing-pair) 216 | ("{" sp-wrap-curly) 217 | ("(" sp-wrap-round) 218 | ("[" sp-wrap-square) 219 | ("M-r" sp-rewrap-sexp) 220 | ("]" sp-swap-enclosing-sexp) 221 | ;; --- 222 | ("M--" undo) 223 | ("q" nil)) 224 | #+END_SRC 225 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-07/org/ox-html.el: -------------------------------------------------------------------------------- 1 | ;;; part of org 2 | ;; You can find this code in the original file `lisp/org/ox-html.el' 3 | ;; Emacs source repository 4 | ;; $ git clone https://git.savannah.gnu.org/git/emacs.git 5 | 6 | ;;; Define Back-End 7 | 8 | (org-export-define-backend 'html 9 | '((bold . org-html-bold) 10 | (center-block . org-html-center-block) 11 | (clock . org-html-clock) 12 | (code . org-html-code) 13 | (drawer . org-html-drawer) 14 | (dynamic-block . org-html-dynamic-block) 15 | (entity . org-html-entity) 16 | (example-block . org-html-example-block) 17 | (export-block . org-html-export-block) 18 | (export-snippet . org-html-export-snippet) 19 | (fixed-width . org-html-fixed-width) 20 | (footnote-reference . org-html-footnote-reference) 21 | (headline . org-html-headline) 22 | (horizontal-rule . org-html-horizontal-rule) 23 | (inline-src-block . org-html-inline-src-block) 24 | (inlinetask . org-html-inlinetask) 25 | (inner-template . org-html-inner-template) 26 | (italic . org-html-italic) 27 | (item . org-html-item) 28 | (keyword . org-html-keyword) 29 | (latex-environment . org-html-latex-environment) 30 | (latex-fragment . org-html-latex-fragment) 31 | (line-break . org-html-line-break) 32 | (link . org-html-link) 33 | (node-property . org-html-node-property) 34 | (paragraph . org-html-paragraph) 35 | (plain-list . org-html-plain-list) 36 | (plain-text . org-html-plain-text) 37 | (planning . org-html-planning) 38 | (property-drawer . org-html-property-drawer) 39 | (quote-block . org-html-quote-block) 40 | (radio-target . org-html-radio-target) 41 | (section . org-html-section) 42 | (special-block . org-html-special-block) 43 | (src-block . org-html-src-block) 44 | (statistics-cookie . org-html-statistics-cookie) 45 | (strike-through . org-html-strike-through) 46 | (subscript . org-html-subscript) 47 | (superscript . org-html-superscript) 48 | (table . org-html-table) 49 | (table-cell . org-html-table-cell) 50 | (table-row . org-html-table-row) 51 | (target . org-html-target) 52 | (template . org-html-template) 53 | (timestamp . org-html-timestamp) 54 | (underline . org-html-underline) 55 | (verbatim . org-html-verbatim) 56 | (verse-block . org-html-verse-block)) 57 | :filters-alist '((:filter-options . org-html-infojs-install-script) 58 | (:filter-parse-tree . org-html-image-link-filter) 59 | (:filter-final-output . org-html-final-function)) 60 | :menu-entry 61 | '(?h "Export to HTML" 62 | ((?H "As HTML buffer" org-html-export-as-html) 63 | (?h "As HTML file" org-html-export-to-html) 64 | (?o "As HTML file and open" 65 | (lambda (a s v b) 66 | (if a (org-html-export-to-html t s v b) 67 | (org-open-file (org-html-export-to-html nil s v b))))))) 68 | :options-alist 69 | '((:html-doctype "HTML_DOCTYPE" nil org-html-doctype) 70 | (:html-container "HTML_CONTAINER" nil org-html-container-element) 71 | (:description "DESCRIPTION" nil nil newline) 72 | (:keywords "KEYWORDS" nil nil space) 73 | (:html-html5-fancy nil "html5-fancy" org-html-html5-fancy) 74 | (:html-link-use-abs-url nil "html-link-use-abs-url" org-html-link-use-abs-url) 75 | (:html-link-home "HTML_LINK_HOME" nil org-html-link-home) 76 | (:html-link-up "HTML_LINK_UP" nil org-html-link-up) 77 | (:html-mathjax "HTML_MATHJAX" nil "" space) 78 | (:html-equation-reference-format "HTML_EQUATION_REFERENCE_FORMAT" nil org-html-equation-reference-format t) 79 | (:html-postamble nil "html-postamble" org-html-postamble) 80 | (:html-preamble nil "html-preamble" org-html-preamble) 81 | (:html-head "HTML_HEAD" nil org-html-head newline) 82 | (:html-head-extra "HTML_HEAD_EXTRA" nil org-html-head-extra newline) 83 | (:subtitle "SUBTITLE" nil nil parse) 84 | (:html-head-include-default-style 85 | nil "html-style" org-html-head-include-default-style) 86 | (:html-head-include-scripts nil "html-scripts" org-html-head-include-scripts) 87 | (:html-allow-name-attribute-in-anchors 88 | nil nil org-html-allow-name-attribute-in-anchors) 89 | (:html-divs nil nil org-html-divs) 90 | (:html-checkbox-type nil nil org-html-checkbox-type) 91 | (:html-extension nil nil org-html-extension) 92 | (:html-footnote-format nil nil org-html-footnote-format) 93 | (:html-footnote-separator nil nil org-html-footnote-separator) 94 | (:html-footnotes-section nil nil org-html-footnotes-section) 95 | (:html-format-drawer-function nil nil org-html-format-drawer-function) 96 | (:html-format-headline-function nil nil org-html-format-headline-function) 97 | (:html-format-inlinetask-function 98 | nil nil org-html-format-inlinetask-function) 99 | (:html-home/up-format nil nil org-html-home/up-format) 100 | (:html-indent nil nil org-html-indent) 101 | (:html-infojs-options nil nil org-html-infojs-options) 102 | (:html-infojs-template nil nil org-html-infojs-template) 103 | (:html-inline-image-rules nil nil org-html-inline-image-rules) 104 | (:html-link-org-files-as-html nil nil org-html-link-org-files-as-html) 105 | (:html-mathjax-options nil nil org-html-mathjax-options) 106 | (:html-mathjax-template nil nil org-html-mathjax-template) 107 | (:html-metadata-timestamp-format nil nil org-html-metadata-timestamp-format) 108 | (:html-postamble-format nil nil org-html-postamble-format) 109 | (:html-preamble-format nil nil org-html-preamble-format) 110 | (:html-prefer-user-labels nil nil org-html-prefer-user-labels) 111 | (:html-self-link-headlines nil nil org-html-self-link-headlines) 112 | (:html-table-align-individual-fields 113 | nil nil org-html-table-align-individual-fields) 114 | (:html-table-caption-above nil nil org-html-table-caption-above) 115 | (:html-table-data-tags nil nil org-html-table-data-tags) 116 | (:html-table-header-tags nil nil org-html-table-header-tags) 117 | (:html-table-use-header-tags-for-first-column 118 | nil nil org-html-table-use-header-tags-for-first-column) 119 | (:html-tag-class-prefix nil nil org-html-tag-class-prefix) 120 | (:html-text-markup-alist nil nil org-html-text-markup-alist) 121 | (:html-todo-kwd-class-prefix nil nil org-html-todo-kwd-class-prefix) 122 | (:html-toplevel-hlevel nil nil org-html-toplevel-hlevel) 123 | (:html-use-infojs nil nil org-html-use-infojs) 124 | (:html-validation-link nil nil org-html-validation-link) 125 | (:html-viewport nil nil org-html-viewport) 126 | (:html-inline-images nil nil org-html-inline-images) 127 | (:html-table-attributes nil nil org-html-table-default-attributes) 128 | (:html-table-row-open-tag nil nil org-html-table-row-open-tag) 129 | (:html-table-row-close-tag nil nil org-html-table-row-close-tag) 130 | (:html-xml-declaration nil nil org-html-xml-declaration) 131 | (:html-wrap-src-lines nil nil org-html-wrap-src-lines) 132 | (:html-klipsify-src nil nil org-html-klipsify-src) 133 | (:html-klipse-css nil nil org-html-klipse-css) 134 | (:html-klipse-js nil nil org-html-klipse-js) 135 | (:html-klipse-selection-script nil nil org-html-klipse-selection-script) 136 | (:infojs-opt "INFOJS_OPT" nil nil) 137 | ;; Redefine regular options. 138 | (:creator "CREATOR" nil org-html-creator-string) 139 | (:with-latex nil "tex" org-html-with-latex) 140 | ;; Retrieve LaTeX header for fragments. 141 | (:latex-header "LATEX_HEADER" nil nil newline))) 142 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-02/org/org.el: -------------------------------------------------------------------------------- 1 | ;;; part of org.el 2 | ;; find this command in the original file `lisp/org/org.el' 3 | ;; Emacs source repository 4 | ;; $ git clone https://git.savannah.gnu.org/git/emacs.git 5 | ;; GNU Emacs source code and development is hosted on . 6 | 7 | (defun org-cycle (&optional arg) 8 | "TAB-action and visibility cycling for Org mode. 9 | 10 | This is the command invoked in Org mode by the `TAB' key. Its main 11 | purpose is outline visibility cycling, but it also invokes other actions 12 | in special contexts. 13 | 14 | When this function is called with a `\\[universal-argument]' prefix, rotate \ 15 | the entire 16 | buffer through 3 states (global cycling) 17 | 1. OVERVIEW: Show only top-level headlines. 18 | 2. CONTENTS: Show all headlines of all levels, but no body text. 19 | 3. SHOW ALL: Show everything. 20 | 21 | With a `\\[universal-argument] \\[universal-argument]' prefix argument, \ 22 | switch to the startup visibility, 23 | determined by the variable `org-startup-folded', and by any VISIBILITY 24 | properties in the buffer. 25 | 26 | With a `\\[universal-argument] \\[universal-argument] \ 27 | \\[universal-argument]' prefix argument, show the entire buffer, including 28 | any drawers. 29 | 30 | When inside a table, re-align the table and move to the next field. 31 | 32 | When point is at the beginning of a headline, rotate the subtree started 33 | by this line through 3 different states (local cycling) 34 | 1. FOLDED: Only the main headline is shown. 35 | 2. CHILDREN: The main headline and the direct children are shown. 36 | From this state, you can move to one of the children 37 | and zoom in further. 38 | 3. SUBTREE: Show the entire subtree, including body text. 39 | If there is no subtree, switch directly from CHILDREN to FOLDED. 40 | 41 | When point is at the beginning of an empty headline and the variable 42 | `org-cycle-level-after-item/entry-creation' is set, cycle the level 43 | of the headline by demoting and promoting it to likely levels. This 44 | speeds up creation document structure by pressing `TAB' once or several 45 | times right after creating a new headline. 46 | 47 | When there is a numeric prefix, go up to a heading with level ARG, do 48 | a `show-subtree' and return to the previous cursor position. If ARG 49 | is negative, go up that many levels. 50 | 51 | When point is not at the beginning of a headline, execute the global 52 | binding for `TAB', which is re-indenting the line. See the option 53 | `org-cycle-emulate-tab' for details. 54 | 55 | As a special case, if point is at the beginning of the buffer and there is 56 | no headline in line 1, this function will act as if called with prefix arg 57 | \(`\\[universal-argument] TAB', same as `S-TAB') also when called without \ 58 | prefix arg, but only 59 | if the variable `org-cycle-global-at-bob' is t." 60 | (interactive "P") 61 | (org-load-modules-maybe) 62 | (unless (or (run-hook-with-args-until-success 'org-tab-first-hook) 63 | (and org-cycle-level-after-item/entry-creation 64 | (or (org-cycle-level) 65 | (org-cycle-item-indentation)))) 66 | (let* ((limit-level 67 | (or org-cycle-max-level 68 | (and (boundp 'org-inlinetask-min-level) 69 | org-inlinetask-min-level 70 | (1- org-inlinetask-min-level)))) 71 | (nstars (and limit-level 72 | (if org-odd-levels-only 73 | (and limit-level (1- (* limit-level 2))) 74 | limit-level))) 75 | (org-outline-regexp 76 | (if (not (derived-mode-p 'org-mode)) 77 | outline-regexp 78 | (concat "\\*" (if nstars (format "\\{1,%d\\} " nstars) "+ ")))) 79 | (bob-special (and org-cycle-global-at-bob (not arg) (bobp) 80 | (not (looking-at org-outline-regexp)))) 81 | (org-cycle-hook 82 | (if bob-special 83 | (delq 'org-optimize-window-after-visibility-change 84 | (copy-sequence org-cycle-hook)) 85 | org-cycle-hook)) 86 | (pos (point))) 87 | 88 | (cond 89 | 90 | ((equal arg '(16)) 91 | (setq last-command 'dummy) 92 | (org-set-startup-visibility) 93 | (org-unlogged-message "Startup visibility, plus VISIBILITY properties")) 94 | 95 | ((equal arg '(64)) 96 | (org-show-all) 97 | (org-unlogged-message "Entire buffer visible, including drawers")) 98 | 99 | ((equal arg '(4)) (org-cycle-internal-global)) 100 | 101 | ;; Try hiding block at point. 102 | ((org-hide-block-toggle-maybe)) 103 | 104 | ;; Try cdlatex TAB completion 105 | ((org-try-cdlatex-tab)) 106 | 107 | ;; Table: enter it or move to the next field. 108 | ((org-at-table-p 'any) 109 | (if (org-at-table.el-p) 110 | (message "%s" (substitute-command-keys "\\\ 111 | Use `\\[org-edit-special]' to edit table.el tables")) 112 | (if arg (org-table-edit-field t) 113 | (org-table-justify-field-maybe) 114 | (call-interactively 'org-table-next-field)))) 115 | 116 | ((run-hook-with-args-until-success 'org-tab-after-check-for-table-hook)) 117 | 118 | ;; Global cycling: delegate to `org-cycle-internal-global'. 119 | (bob-special (org-cycle-internal-global)) 120 | 121 | ;; Drawers: delegate to `org-flag-drawer'. 122 | ((save-excursion 123 | (beginning-of-line 1) 124 | (looking-at org-drawer-regexp)) 125 | (org-flag-drawer ; toggle block visibility 126 | (not (get-char-property (match-end 0) 'invisible)))) 127 | 128 | ;; Show-subtree, ARG levels up from here. 129 | ((integerp arg) 130 | (save-excursion 131 | (org-back-to-heading) 132 | (outline-up-heading (if (< arg 0) (- arg) 133 | (- (funcall outline-level) arg))) 134 | (org-show-subtree))) 135 | 136 | ;; Inline task: delegate to `org-inlinetask-toggle-visibility'. 137 | ((and (featurep 'org-inlinetask) 138 | (org-inlinetask-at-task-p) 139 | (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol)))) 140 | (org-inlinetask-toggle-visibility)) 141 | 142 | ;; At an item/headline: delegate to `org-cycle-internal-local'. 143 | ((and (or (and org-cycle-include-plain-lists (org-at-item-p)) 144 | (save-excursion (move-beginning-of-line 1) 145 | (looking-at org-outline-regexp))) 146 | (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol)))) 147 | (org-cycle-internal-local)) 148 | 149 | ;; From there: TAB emulation and template completion. 150 | (buffer-read-only (org-back-to-heading)) 151 | 152 | ((run-hook-with-args-until-success 153 | 'org-tab-after-check-for-cycling-hook)) 154 | 155 | ((run-hook-with-args-until-success 156 | 'org-tab-before-tab-emulation-hook)) 157 | 158 | ((and (eq org-cycle-emulate-tab 'exc-hl-bol) 159 | (or (not (bolp)) 160 | (not (looking-at org-outline-regexp)))) 161 | (call-interactively (global-key-binding "\t"))) 162 | 163 | ((if (and (memq org-cycle-emulate-tab '(white whitestart)) 164 | (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")) 165 | (or (and (eq org-cycle-emulate-tab 'white) 166 | (= (match-end 0) (point-at-eol))) 167 | (and (eq org-cycle-emulate-tab 'whitestart) 168 | (>= (match-end 0) pos)))) 169 | t 170 | (eq org-cycle-emulate-tab t)) 171 | (call-interactively (global-key-binding "\t"))) 172 | 173 | (t (save-excursion 174 | (org-back-to-heading) 175 | (org-cycle))))))) 176 | 177 | (defun org-return (&optional indent) 178 | "Goto next table row or insert a newline. 179 | 180 | Calls `org-table-next-row' or `newline', depending on context. 181 | 182 | When optional INDENT argument is non-nil, call 183 | `newline-and-indent' instead of `newline'. 184 | 185 | When `org-return-follows-link' is non-nil and point is on 186 | a timestamp or a link, call `org-open-at-point'. However, it 187 | will not happen if point is in a table or on a \"dead\" 188 | object (e.g., within a comment). In these case, you need to use 189 | `org-open-at-point' directly." 190 | (interactive) 191 | (let ((context (if org-return-follows-link (org-element-context) 192 | (org-element-at-point)))) 193 | (cond 194 | ;; In a table, call `org-table-next-row'. However, before first 195 | ;; column or after last one, split the table. 196 | ((or (and (eq 'table (org-element-type context)) 197 | (not (eq 'table.el (org-element-property :type context))) 198 | (>= (point) (org-element-property :contents-begin context)) 199 | (< (point) (org-element-property :contents-end context))) 200 | (org-element-lineage context '(table-row table-cell) t)) 201 | (if (or (looking-at-p "[ \t]*$") 202 | (save-excursion (skip-chars-backward " \t") (bolp))) 203 | (insert "\n") 204 | (org-table-justify-field-maybe) 205 | (call-interactively #'org-table-next-row))) 206 | ;; On a link or a timestamp, call `org-open-at-point' if 207 | ;; `org-return-follows-link' allows it. Tolerate fuzzy 208 | ;; locations, e.g., in a comment, as `org-open-at-point'. 209 | ((and org-return-follows-link 210 | (or (and (eq 'link (org-element-type context)) 211 | ;; Ensure point is not on the white spaces after 212 | ;; the link. 213 | (let ((origin (point))) 214 | (org-with-point-at (org-element-property :end context) 215 | (skip-chars-backward " \t") 216 | (> (point) origin)))) 217 | (org-in-regexp org-ts-regexp-both nil t) 218 | (org-in-regexp org-tsr-regexp-both nil t) 219 | (org-in-regexp org-link-any-re nil t))) 220 | (call-interactively #'org-open-at-point)) 221 | ;; Insert newline in heading, but preserve tags. 222 | ((and (not (bolp)) 223 | (let ((case-fold-search nil)) 224 | (org-match-line org-complex-heading-regexp))) 225 | ;; At headline. Split line. However, if point is on keyword, 226 | ;; priority cookie or tags, do not break any of them: add 227 | ;; a newline after the headline instead. 228 | (let ((tags-column (and (match-beginning 5) 229 | (save-excursion (goto-char (match-beginning 5)) 230 | (current-column)))) 231 | (string 232 | (when (and (match-end 4) (org-point-in-group (point) 4)) 233 | (delete-and-extract-region (point) (match-end 4))))) 234 | ;; Adjust tag alignment. 235 | (cond 236 | ((not (and tags-column string))) 237 | (org-auto-align-tags (org-align-tags)) 238 | (t (org--align-tags-here tags-column))) ;preserve tags column 239 | (end-of-line) 240 | (org-show-entry) 241 | (if indent (newline-and-indent) (newline)) 242 | (when string (save-excursion (insert (org-trim string)))))) 243 | ;; In a list, make sure indenting keeps trailing text within. 244 | ((and indent 245 | (not (eolp)) 246 | (org-element-lineage context '(item))) 247 | (let ((trailing-data 248 | (delete-and-extract-region (point) (line-end-position)))) 249 | (newline-and-indent) 250 | (save-excursion (insert trailing-data)))) 251 | (t 252 | ;; Do not auto-fill when point is in an Org property drawer. 253 | (let ((auto-fill-function (and (not (org-at-property-p)) 254 | auto-fill-function))) 255 | (if indent 256 | (newline-and-indent) 257 | (newline))))))) 258 | 259 | 260 | (defun org-backward-sentence (&optional _arg) 261 | "Go to beginning of sentence, or beginning of table field. 262 | This will call `backward-sentence' or `org-table-beginning-of-field', 263 | depending on context." 264 | (interactive) 265 | (let* ((element (org-element-at-point)) 266 | (contents-begin (org-element-property :contents-begin element)) 267 | (table (org-element-lineage element '(table) t))) 268 | (if (and table 269 | (> (point) contents-begin) 270 | (<= (point) (org-element-property :contents-end table))) 271 | (call-interactively #'org-table-beginning-of-field) 272 | (save-restriction 273 | (when (and contents-begin 274 | (< (point-min) contents-begin) 275 | (> (point) contents-begin)) 276 | (narrow-to-region contents-begin 277 | (org-element-property :contents-end element))) 278 | (call-interactively #'backward-sentence))))) 279 | 280 | (defun org-forward-sentence (&optional _arg) 281 | "Go to end of sentence, or end of table field. 282 | This will call `forward-sentence' or `org-table-end-of-field', 283 | depending on context." 284 | (interactive) 285 | (if (and (org-at-heading-p) 286 | (save-restriction (skip-chars-forward " \t") (not (eolp)))) 287 | (save-restriction 288 | (narrow-to-region (line-beginning-position) (line-end-position)) 289 | (call-interactively #'forward-sentence)) 290 | (let* ((element (org-element-at-point)) 291 | (contents-end (org-element-property :contents-end element)) 292 | (table (org-element-lineage element '(table) t))) 293 | (if (and table 294 | (>= (point) (org-element-property :contents-begin table)) 295 | (< (point) contents-end)) 296 | (call-interactively #'org-table-end-of-field) 297 | (save-restriction 298 | (when (and contents-end 299 | (> (point-max) contents-end) 300 | ;; Skip blank lines between elements. 301 | (< (org-element-property :end element) 302 | (save-excursion (goto-char contents-end) 303 | (skip-chars-forward " \r\t\n")))) 304 | (narrow-to-region (org-element-property :contents-begin element) 305 | contents-end)) 306 | ;; End of heading is considered as the end of a sentence. 307 | (let ((sentence-end (concat (sentence-end) "\\|^\\*+ .*$"))) 308 | (call-interactively #'forward-sentence))))))) 309 | 310 | (define-derived-mode org-mode outline-mode "Org" 311 | "Outline-based notes management and organizer, alias 312 | \"Carsten's outline-mode for keeping track of everything.\" 313 | 314 | Org mode develops organizational tasks around a NOTES file which 315 | contains information about projects as plain text. Org mode is 316 | implemented on top of Outline mode, which is ideal to keep the content 317 | of large files well structured. It supports ToDo items, deadlines and 318 | time stamps, which magically appear in the diary listing of the Emacs 319 | calendar. Tables are easily created with a built-in table editor. 320 | Plain text URL-like links connect to websites, emails (VM), Usenet 321 | messages (Gnus), BBDB entries, and any files related to the project. 322 | For printing and sharing of notes, an Org file (or a part of it) 323 | can be exported as a structured ASCII or HTML file. 324 | 325 | The following commands are available: 326 | 327 | \\{org-mode-map}" 328 | (org-load-modules-maybe) 329 | (org-install-agenda-files-menu) 330 | (when org-link-descriptive (add-to-invisibility-spec '(org-link))) 331 | (add-to-invisibility-spec '(org-hide-block . t)) 332 | (add-to-invisibility-spec '(org-hide-drawer . t)) 333 | (setq-local outline-regexp org-outline-regexp) 334 | (setq-local outline-level 'org-outline-level) 335 | (setq bidi-paragraph-direction 'left-to-right) 336 | (when (and (stringp org-ellipsis) (not (equal "" org-ellipsis))) 337 | (unless org-display-table 338 | (setq org-display-table (make-display-table))) 339 | (set-display-table-slot 340 | org-display-table 4 341 | (vconcat (mapcar (lambda (c) (make-glyph-code c 'org-ellipsis)) 342 | org-ellipsis))) 343 | (setq buffer-display-table org-display-table)) 344 | (org-set-regexps-and-options) 345 | (org-set-font-lock-defaults) 346 | (when (and org-tag-faces (not org-tags-special-faces-re)) 347 | ;; tag faces set outside customize.... force initialization. 348 | (org-set-tag-faces 'org-tag-faces org-tag-faces)) 349 | ;; Calc embedded 350 | (setq-local calc-embedded-open-mode "# ") 351 | ;; Modify a few syntax entries 352 | (modify-syntax-entry ?\" "\"") 353 | (modify-syntax-entry ?\\ "_") 354 | (modify-syntax-entry ?~ "_") 355 | (modify-syntax-entry ?< "(>") 356 | (modify-syntax-entry ?> ")<") 357 | (setq-local font-lock-unfontify-region-function 'org-unfontify-region) 358 | ;; Activate before-change-function 359 | (setq-local org-table-may-need-update t) 360 | (add-hook 'before-change-functions 'org-before-change-function nil 'local) 361 | ;; Check for running clock before killing a buffer 362 | (add-hook 'kill-buffer-hook 'org-check-running-clock nil 'local) 363 | ;; Initialize macros templates. 364 | (org-macro-initialize-templates) 365 | ;; Initialize radio targets. 366 | (org-update-radio-target-regexp) 367 | ;; Indentation. 368 | (setq-local indent-line-function 'org-indent-line) 369 | (setq-local indent-region-function 'org-indent-region) 370 | ;; Filling and auto-filling. 371 | (org-setup-filling) 372 | ;; Comments. 373 | (org-setup-comments-handling) 374 | ;; Initialize cache. 375 | (org-element-cache-reset) 376 | ;; Beginning/end of defun 377 | (setq-local beginning-of-defun-function 'org-backward-element) 378 | (setq-local end-of-defun-function 379 | (lambda () 380 | (if (not (org-at-heading-p)) 381 | (org-forward-element) 382 | (org-forward-element) 383 | (forward-char -1)))) 384 | ;; Next error for sparse trees 385 | (setq-local next-error-function 'org-occur-next-match) 386 | ;; Make commit log messages from Org documents easier. 387 | (setq-local add-log-current-defun-function #'org-add-log-current-headline) 388 | ;; Make sure dependence stuff works reliably, even for users who set it 389 | ;; too late :-( 390 | (if org-enforce-todo-dependencies 391 | (add-hook 'org-blocker-hook 392 | 'org-block-todo-from-children-or-siblings-or-parent) 393 | (remove-hook 'org-blocker-hook 394 | 'org-block-todo-from-children-or-siblings-or-parent)) 395 | (if org-enforce-todo-checkbox-dependencies 396 | (add-hook 'org-blocker-hook 397 | 'org-block-todo-from-checkboxes) 398 | (remove-hook 'org-blocker-hook 399 | 'org-block-todo-from-checkboxes)) 400 | 401 | ;; Align options lines 402 | (setq-local 403 | align-mode-rules-list 404 | '((org-in-buffer-settings 405 | (regexp . "^[ \t]*#\\+[A-Z_]+:\\(\\s-*\\)\\S-+") 406 | (modes . '(org-mode))))) 407 | 408 | ;; Make isearch reveal context 409 | (setq-local outline-isearch-open-invisible-function 410 | (lambda (&rest _) (org-show-context 'isearch))) 411 | 412 | ;; Setup the pcomplete hooks 413 | (setq-local pcomplete-command-completion-function #'org-pcomplete-initial) 414 | (setq-local pcomplete-command-name-function #'org-command-at-point) 415 | (setq-local pcomplete-default-completion-function #'ignore) 416 | (setq-local pcomplete-parse-arguments-function #'org-parse-arguments) 417 | (setq-local pcomplete-termination-string "") 418 | (add-hook 'completion-at-point-functions 419 | #'pcomplete-completions-at-point nil t) 420 | (setq-local buffer-face-mode-face 'org-default) 421 | 422 | ;; If empty file that did not turn on Org mode automatically, make 423 | ;; it to. 424 | (when (and org-insert-mode-line-in-empty-file 425 | (called-interactively-p 'any) 426 | (= (point-min) (point-max))) 427 | (insert "# -*- mode: org -*-\n\n")) 428 | (unless org-inhibit-startup 429 | (org-unmodified 430 | (when org-startup-with-beamer-mode (org-beamer-mode)) 431 | (when (or org-startup-align-all-tables org-startup-shrink-all-tables) 432 | (org-table-map-tables 433 | (cond ((and org-startup-align-all-tables 434 | org-startup-shrink-all-tables) 435 | (lambda () (org-table-align) (org-table-shrink))) 436 | (org-startup-align-all-tables #'org-table-align) 437 | (t #'org-table-shrink)) 438 | t)) 439 | (when org-startup-with-inline-images (org-display-inline-images)) 440 | (when org-startup-with-latex-preview (org-latex-preview '(16))) 441 | (unless org-inhibit-startup-visibility-stuff (org-set-startup-visibility)) 442 | (when org-startup-truncated (setq truncate-lines t)) 443 | (when org-startup-indented (require 'org-indent) (org-indent-mode 1)))) 444 | ;; Try to set `org-hide' face correctly. 445 | (let ((foreground (org-find-invisible-foreground))) 446 | (when foreground 447 | (set-face-foreground 'org-hide foreground)))) 448 | -------------------------------------------------------------------------------- /src/inside-emacs-03/add-cursor-on-click.org: -------------------------------------------------------------------------------- 1 | * Backup 2 | ** rsync 3 | *** With rsync how can I always replace the DEST file by the SRC file? 4 | - Use ~-a~ flag of ~rsync~. 5 | - It is a quick way of saying you want recursion and want to 6 | preserve almost everything. 7 | - If you want to /always/ replace all the files with the same 8 | ~path~ on ~path/to/dest/~ by the files on ~path/to/src/~, run 9 | the command: 10 | 11 | #+BEGIN_SRC bash 12 | rsync -a path/to/src/ path/to/dest/ 13 | #+END_SRC 14 | 15 | *** With rsync how can I always replace the DEST file by the SRC file /only/ if the SRC file is newer than the ~DEST~ file? 16 | - Use ~-au~ flags of ~rsync~. 17 | - Skip files that are newer on the receiver (~-u~ flag). 18 | - If you want to replace all the files with the same 19 | ~path~ on ~path/to/dest/~ by the files on ~path/to/src/~ that 20 | are /newer/, run the command: 21 | 22 | #+BEGIN_SRC bash 23 | rsync -au path/to/src/ path/to/dest/ 24 | #+END_SRC 25 | 26 | *** With rsync how can I keep the newer file between DEST and SRC file on the receiver and keep a *copy* on the receiver of the *older* of ~DEST~ file and ~SRC~ file? 27 | - Use ~-aub~ flags of ~rsync~. 28 | - ~-u~ flag: skip files that are newer on the receiver. 29 | - ~-b~ flag: with this option, preexisting destination files are renamed as each file is transferred or deleted. 30 | - If you want to keep the /newer/ files between ~path/to/dest/~ 31 | and ~path/to/src/~ on the receiver (~path/to/dest/~) and keep a 32 | /copy/ on the receiver (~path/to/dest/~) of the /older/ files 33 | (by appending them a ~~~), run the command: 34 | 35 | #+BEGIN_SRC bash 36 | rsync -aub path/to/src/ path/to/dest/ 37 | #+END_SRC 38 | 39 | *** With rsync how can I synchronize DEST directory and SRC directory? 40 | - Use ~-au~ flags of ~rsync~. 41 | - ~-a~ flag: it is a quick way of saying you want recursion and want to preserve almost everything. 42 | - ~-u~ flag: skip files that are newer on the receiver. 43 | - If you want to synchronize ~path/to/src/~ and ~path/to/dest/~, 44 | that is (~DEST~ and ~SRC~ become the same copy, keeping 45 | all files that were on ~DEST~ but not on ~SRC~ and vice-versa, 46 | and keeping the newer files (with the same ~path~) of the ~DEST~ 47 | and ~SRC~ directory), run the commands: 48 | 49 | #+BEGIN_SRC bash 50 | rsync -au path/to/src/ path/to/dest/ 51 | rsync -au path/to/dest/ path/to/src/ 52 | #+END_SRC 53 | 54 | *** With rsync how can I synchronize DEST directory and SRC directory, keep a copy of the older files and generate a log file? 55 | - Use ~-aub~ and ~--backup-dir~ flags of ~rsync~. 56 | - It is a quick way of saying you want recursion and want to preserve almost everything (~-a~ flag). 57 | - ~-u~ flag: skip files that are newer on the receiver. 58 | - ~-b~ flag: with this option, preexisting destination files are 59 | renamed as each file is transferred or deleted. 60 | - ~--backup-dir~: in combination with the ~--backup~ option, this 61 | tells rsync to store all backups in the specified directory on the 62 | receiving side. 63 | - If you want to synchronize ~path/to/src/~ and ~path/to/dest/~, 64 | and keep a copy of the older files in a *specified directory* 65 | ~backup~ (on both directorise ~path/to/src/~ and ~path/to/dest/~) 66 | and a log file ~backup.log~ (available on both directorise ~path/to/src/~ 67 | and ~path/to/dest/~) that keep track of the synchronization 68 | process , run the commands: 69 | 70 | #+BEGIN_SRC bash 71 | rsync -aub --backup-dir="backup" path/to/dest/ path/to/src/ \ 72 | | tee -a path/to/src/backup.log 73 | rsync -aub --backup-dir="backup" path/to/src/ path/to/dest/ \ 74 | | tee -a path/to/src/backup.log 75 | rsync -aub --backup-dir="backup" path/to/dest/ path/to/src/ \ 76 | | tee -a path/to/src/backup.log 77 | rsync path/to/src/backup.log path/to/dest/backup.log 78 | #+END_SRC 79 | 80 | - Note 1: In the file ~backup.log~, you can see what happen 81 | during the synchronization. This way you can see the files that 82 | have been deleted on the ~SRC~ directory but still present on 83 | the ~DEST~ directory that you copied back into to the ~SRC~ 84 | directory. 85 | - Note 2: The directory ~backup~ contains all older files. 86 | - Note 3: If on the ~SRC~ and ~DEST~ you had the file ~path-to/some-file~ 87 | that differed, after the synchronization you can see the 88 | difference (how the newer was changed from the older), by running 89 | the command: 90 | 91 | #+BEGIN_SRC bash 92 | git diff path/to/src/backup/path-to/some-file path/to/src/path-to/some-file 93 | #+END_SRC 94 | 95 | - Note 4: After the synchronization, if you are happy, you can delete 96 | on both side (~SRC~ and ~DEST~ directories), the file 97 | ~backup.log~ and the directory ~backup~. To do so, run the 98 | commands: 99 | 100 | #+BEGIN_SRC bash 101 | rm -rf path/to/src/backup path/to/src/backup.log 102 | rm -rf path/to/dest/backup path/to/dest/backup.log 103 | #+END_SRC 104 | 105 | *** With rsync how can I delete files on DEST that are not present on SRC? 106 | - Use ~-a~, ~--delete~ flags of ~rsync~. 107 | - (~-a~ flag): it is a quick way of saying you want recursion and want to preserve almost everything. 108 | - ~--delete~ flag: this tells rsync to delete extraneous files from 109 | the receiving side (ones that aren’t on the sending side), but 110 | only for the directories that are being synchronized. You must have 111 | asked rsync to send the whole directory (e.g. "dir" or "dir/") 112 | without using a wildcard for the directory’s contents 113 | (e.g. "dir/*") since the wildcard is expanded by the shell and rsync 114 | thus gets a request to transfer individual files, not the files’ 115 | parent directory. 116 | - If you want to delete files on ~path/to/dest/~ that are not present 117 | on ~path/to/src/~, run the command: 118 | 119 | #+BEGIN_SRC bash 120 | rsync -a --delete path/to/src/ path/to/dest/ 121 | #+END_SRC 122 | 123 | *** With rsync how can I delete files on DEST that I've note exclude the first time with rsync ? 124 | - Use ~-a~, ~--delete-excluded~, ~--exclude~ flags of ~rsync~. 125 | - ~-a~ flag: it is a quick way of saying you want recursion and want to preserve almost everything. 126 | - ~--delete-excluded~ flag: in addition to deleting the files on the receiving side that are not on the sending side, this tells rsync to also delete any files on the receiving side that are excluded with ~--exclude~. 127 | - ~--exclude~ flag: exclude files matching a pattern. 128 | - If you first have send the directories ~node_modules~ 129 | accidentally from the ~path/to/src/~ directory to the 130 | ~path/to/dest/~ directory, you can delete them later. To do so, 131 | run the command: 132 | 133 | #+BEGIN_SRC bash 134 | rsync -a --exclude="*node_modules*" --delete-excluded \ 135 | path/to/src/ path/to/dest/ 136 | #+END_SRC 137 | 138 | *** With rsync how can I do a incremental backup? 139 | - Use ~-avz~, ~--exclude~ and ~--exclude-exclude~ flags of 140 | ~rsync~ command. 141 | - ~-a~ flag: it is a quick way of saying you want recursion and want 142 | to preserve almost everything. 143 | - ~-v~ flag: increases the amount of information you are given during 144 | the transfer. 145 | - ~-z~ flag: compresses the file data as it is sent to the destination 146 | machine. 147 | - ~--exclude~ flag: exclude files matching a pattern. 148 | - ~--delete-excluded~ flag: in addition to deleting the files on 149 | the receiving side that are not on the sending side, this tells 150 | rsync to also delete any files on the receiving side that are 151 | excluded with ~--exclude~. 152 | - If you want ~DEST~ directory to be the exact copy of ~SRC~ 153 | directory, but you just want to send the file that have changed 154 | ~SRC~, delete on ~DEST~ the file you have deleted on ~SRC~, and 155 | do not send (exclude) on ~DEST~ the ~node_modules~ directory on 156 | ~SRC~, run the command: 157 | 158 | #+BEGIN_SRC bash 159 | rsync -avz --exclude="*node_modules*" --delete-exclude \ 160 | path/to/src/ path/to/dest/ 161 | #+END_SRC 162 | 163 | ** Backup and archive 164 | *** What is a Backup? 165 | - A /backup/ is a copy of data that can be used to restore the 166 | original in the event that your data is lost or damaged. If a 167 | company experiences data loss due to hardware failure, human 168 | error or natural disaster, a backup can be used to quickly 169 | restore that data. 170 | *** What is an Archive? 171 | - An /archive/ is a collection of historical records that are kept 172 | for long-term retention and used for future 173 | reference. Typically, archives contain data that is not actively 174 | used. 175 | *** What is the difference between /backup/ and /archive/? 176 | - Basically, a /backup/ is a /copy/ of a set of data, while an 177 | /archive/ holds /original/ data that has been /removed/ from its 178 | original location. 179 | ** Back up /etc directory 180 | *** How can I review or revert changes that were made to /etc? 181 | - Use ~etckeeper~ tool. 182 | - ~etckeeper~: store ~/etc~ in ~git~. 183 | - See [[https://etckeeper.branchable.com/README/][etckeeper]] README. 184 | - If you want to install and initialize ~etckeeper~ on ubuntu, 185 | run the commands: 186 | 187 | #+BEGIN_SRC bash 188 | sudo apt install etckeeper 189 | #+END_SRC 190 | 191 | - If you want to ~commit~ changes made in ~/etc~ installing new 192 | package using ~apt~, do /nothing/, ~etckeeper~ do it for you. 193 | - If you want to ~commit~ changes made in ~/etc~, run the 194 | commands: 195 | 196 | #+BEGIN_SRC bash 197 | cd /etc 198 | sudo git add . # or only a few files 199 | sudo git commit -m "your message" 200 | #+END_SRC 201 | 202 | - If you want to /configure/ and tweak ~etckeeper~, see files and 203 | directories ~/etc/etckeeper/~ and ~/etc/etckeeper/etckeeper.conf~. 204 | - If you want to /skip/ some files or directories from being 205 | stored into ~git~ repository, add them to ~/etc/.gitignore~. 206 | - If I want to /revert/ changes to a previous state (commit), you 207 | must ~checkout~ to the previous commit and re-initialize 208 | ~etckeeper~, to do so run the commands: 209 | 210 | #+BEGIN_SRC bash 211 | sudo git checkout 212 | sudo etckeeper init 213 | #+END_SRC 214 | 215 | *** How can I back up the /etc directory to usb drive? 216 | - Use ~rsync~ command. 217 | - ~rsync~: a fast, versatile, remote (and local) file-copying tool. 218 | - Be aware that ~/etc~ directory contains secret informations. For 219 | instance, SHA-512 password are stored in the file 220 | ~/etc/shadow~. 221 | ** Large files with git 222 | *** What is ~git-annex~? 223 | - [[https://git-annex.branchable.com/][git-annex (homepage)]] 224 | - [[https://git-annex.branchable.com/not/][git-annex is NOT ...]] 225 | - [[https://git-annex.branchable.com/walkthrough/][git-annex (walkthrough)]] 226 | - [[https://git-annex.branchable.com/tips/emacs_integration/][git-annex (emacs integration)]] 227 | *** What is ~git-lfs~? 228 | - [[https://git-lfs.github.com/][git-lfs (homepage)]] 229 | - [[https://www.atlassian.com/git/tutorials/git-lfs][git-lfs (tutorial)]] 230 | - [[https://www.youtube.com/watch?v=006RUPVIP-c][git-lfs (talk)]] 231 | *** What is the difference between ~git-lfs~ and ~git-annex~? 232 | - See discussions [[https://git-annex.branchable.com/todo/git_smudge_clean_interface_suboptiomal/][git smudge clean interface suboptiomal]] and [[https://lwn.net/Articles/774125/][large 233 | files with git (article)]]. 234 | - ~git-lfs~ differs from ~git-annex~ in that: 235 | - With ~git-lfs~, all the large files in the repository are usually 236 | present in the working tree; it doesn't have a way to drop content 237 | that is not wanted locally while keeping other content locally 238 | available, as ~git-annex~ does. 239 | - And so ~git-lfs~ does not need to be able to get content like 240 | ~git-annex~ can do either. 241 | - ~git-lfs~ also differs in that it uses a central server, which is 242 | trusted to retain content, so it doesn't try to avoid losing the 243 | local copy, which could be the only copy, as ~git-annex~ does. 244 | 245 | * UI 246 | ** GTK 247 | *** How to make chromium using ~GTK~? 248 | - If you want that ~chromium~ uses ~GTK~, in ~chromium~ allow ~GTK+~ 249 | theme in: ~Settings > Preferences > Appearence > Use GTK+ theme~. 250 | *** How can I add ~emacs~ like keybinding in ~GTK~ applications like ~chromium~? 251 | - In ~gtk-2~ add the line in your ~GTK~ config file 252 | ~/.gtkrc-2.0~. 253 | 254 | #+BEGIN_SRC text 255 | gtk-key-theme-name = "Emacs" 256 | #+END_SRC 257 | 258 | - In ~gtk-3~, add the following line in your ~GTK~ config file 259 | ~/.config/gtk-3.0/settings.ini~. 260 | 261 | #+BEGIN_SRC text 262 | gtk-key-theme-name = Emacs 263 | #+END_SRC 264 | 265 | *** Where the emacs like keybinding in ~GTK~ applications are defined? 266 | - In ~gtk-2~, the implemented ~emacs~ keybinding can be found in the 267 | file ~/usr/share/themes/Emacs/gtk-2.0-key/gtkrc~: 268 | 269 | #+BEGIN_SRC text 270 | # 271 | # Bindings for GtkTextView and GtkEntry 272 | # 273 | binding "gtk-emacs-text-entry" 274 | { 275 | bind "b" { "move-cursor" (logical-positions, -1, 0) } 276 | bind "b" { "move-cursor" (logical-positions, -1, 1) } 277 | bind "f" { "move-cursor" (logical-positions, 1, 0) } 278 | bind "f" { "move-cursor" (logical-positions, 1, 1) } 279 | 280 | bind "b" { "move-cursor" (words, -1, 0) } 281 | bind "b" { "move-cursor" (words, -1, 1) } 282 | bind "f" { "move-cursor" (words, 1, 0) } 283 | bind "f" { "move-cursor" (words, 1, 1) } 284 | 285 | bind "a" { "move-cursor" (paragraph-ends, -1, 0) } 286 | bind "a" { "move-cursor" (paragraph-ends, -1, 1) } 287 | bind "e" { "move-cursor" (paragraph-ends, 1, 0) } 288 | bind "e" { "move-cursor" (paragraph-ends, 1, 1) } 289 | 290 | bind "w" { "cut-clipboard" () } 291 | bind "y" { "paste-clipboard" () } 292 | 293 | bind "d" { "delete-from-cursor" (chars, 1) } 294 | bind "d" { "delete-from-cursor" (word-ends, 1) } 295 | bind "k" { "delete-from-cursor" (paragraph-ends, 1) } 296 | bind "backslash" { "delete-from-cursor" (whitespace, 1) } 297 | 298 | bind "space" { "delete-from-cursor" (whitespace, 1) 299 | "insert-at-cursor" (" ") } 300 | bind "KP_Space" { "delete-from-cursor" (whitespace, 1) 301 | "insert-at-cursor" (" ") } 302 | 303 | # 304 | # Some non-Emacs keybindings people are attached to 305 | # 306 | bind "u" { 307 | "move-cursor" (paragraph-ends, -1, 0) 308 | "delete-from-cursor" (paragraph-ends, 1) 309 | } 310 | bind "h" { "delete-from-cursor" (chars, -1) } 311 | bind "w" { "delete-from-cursor" (word-ends, -1) } 312 | } 313 | 314 | # 315 | # Bindings for GtkTextView 316 | # 317 | binding "gtk-emacs-text-view" 318 | { 319 | bind "p" { "move-cursor" (display-lines, -1, 0) } 320 | bind "p" { "move-cursor" (display-lines, -1, 1) } 321 | bind "n" { "move-cursor" (display-lines, 1, 0) } 322 | bind "n" { "move-cursor" (display-lines, 1, 1) } 323 | 324 | bind "space" { "set-anchor" () } 325 | bind "KP_Space" { "set-anchor" () } 326 | } 327 | 328 | # 329 | # Bindings for GtkTreeView 330 | # 331 | binding "gtk-emacs-tree-view" 332 | { 333 | bind "s" { "start-interactive-search" () } 334 | bind "f" { "move-cursor" (logical-positions, 1) } 335 | bind "b" { "move-cursor" (logical-positions, -1) } 336 | } 337 | 338 | # 339 | # Bindings for menus 340 | # 341 | binding "gtk-emacs-menu" 342 | { 343 | bind "n" { "move-current" (next) } 344 | bind "p" { "move-current" (prev) } 345 | bind "f" { "move-current" (child) } 346 | bind "b" { "move-current" (parent) } 347 | } 348 | 349 | class "GtkEntry" binding "gtk-emacs-text-entry" 350 | class "GtkTextView" binding "gtk-emacs-text-entry" 351 | class "GtkTextView" binding "gtk-emacs-text-view" 352 | class "GtkTreeView" binding "gtk-emacs-tree-view" 353 | class "GtkMenuShell" binding "gtk-emacs-menu" 354 | #+END_SRC 355 | 356 | - In ~gtk-3~, the implemented ~emacs~ keybinding can be found in the 357 | file ~/usr/share/themes/Emacs/gtk-3.0/gtk-keys.css~. 358 | 359 | #+BEGIN_SRC css 360 | /* 361 | * Bindings for GtkTextView and GtkEntry 362 | */ 363 | @binding-set gtk-emacs-text-entry 364 | { 365 | bind "b" { "move-cursor" (logical-positions, -1, 0) }; 366 | bind "b" { "move-cursor" (logical-positions, -1, 1) }; 367 | bind "f" { "move-cursor" (logical-positions, 1, 0) }; 368 | bind "f" { "move-cursor" (logical-positions, 1, 1) }; 369 | 370 | bind "b" { "move-cursor" (words, -1, 0) }; 371 | bind "b" { "move-cursor" (words, -1, 1) }; 372 | bind "f" { "move-cursor" (words, 1, 0) }; 373 | bind "f" { "move-cursor" (words, 1, 1) }; 374 | 375 | bind "a" { "move-cursor" (paragraph-ends, -1, 0) }; 376 | bind "a" { "move-cursor" (paragraph-ends, -1, 1) }; 377 | bind "e" { "move-cursor" (paragraph-ends, 1, 0) }; 378 | bind "e" { "move-cursor" (paragraph-ends, 1, 1) }; 379 | 380 | /* bind "w" { "cut-clipboard" () }; */ 381 | bind "y" { "paste-clipboard" () }; 382 | 383 | bind "d" { "delete-from-cursor" (chars, 1) }; 384 | bind "d" { "delete-from-cursor" (word-ends, 1) }; 385 | bind "k" { "delete-from-cursor" (paragraph-ends, 1) }; 386 | bind "backslash" { "delete-from-cursor" (whitespace, 1) }; 387 | 388 | bind "space" { "delete-from-cursor" (whitespace, 1) 389 | "insert-at-cursor" (" ") }; 390 | bind "KP_Space" { "delete-from-cursor" (whitespace, 1) 391 | "insert-at-cursor" (" ") }; 392 | /* 393 | * Some non-Emacs keybindings people are attached to 394 | */ 395 | bind "u" { "move-cursor" (paragraph-ends, -1, 0) 396 | "delete-from-cursor" (paragraph-ends, 1) }; 397 | 398 | bind "h" { "delete-from-cursor" (chars, -1) }; 399 | bind "w" { "delete-from-cursor" (word-ends, -1) }; 400 | } 401 | 402 | /* 403 | * Bindings for GtkTextView 404 | */ 405 | @binding-set gtk-emacs-text-view 406 | { 407 | bind "p" { "move-cursor" (display-lines, -1, 0) }; 408 | bind "p" { "move-cursor" (display-lines, -1, 1) }; 409 | bind "n" { "move-cursor" (display-lines, 1, 0) }; 410 | bind "n" { "move-cursor" (display-lines, 1, 1) }; 411 | 412 | bind "space" { "set-anchor" () }; 413 | bind "KP_Space" { "set-anchor" () }; 414 | } 415 | 416 | /* 417 | * Bindings for GtkTreeView 418 | */ 419 | @binding-set gtk-emacs-tree-view 420 | { 421 | bind "s" { "start-interactive-search" () }; 422 | bind "f" { "move-cursor" (logical-positions, 1) }; 423 | bind "b" { "move-cursor" (logical-positions, -1) }; 424 | } 425 | 426 | /* 427 | * Bindings for menus 428 | */ 429 | @binding-set gtk-emacs-menu 430 | { 431 | bind "n" { "move-current" (next) }; 432 | bind "p" { "move-current" (prev) }; 433 | bind "f" { "move-current" (child) }; 434 | bind "b" { "move-current" (parent) }; 435 | } 436 | 437 | entry { 438 | -gtk-key-bindings: gtk-emacs-text-entry; 439 | } 440 | 441 | textview { 442 | -gtk-key-bindings: gtk-emacs-text-entry, gtk-emacs-text-view; 443 | } 444 | 445 | treeview { 446 | -gtk-key-bindings: gtk-emacs-tree-view; 447 | } 448 | 449 | GtkMenuShell { 450 | -gtk-key-bindings: gtk-emacs-menu; 451 | } 452 | #+END_SRC 453 | ** Xft 454 | *** How can I scale up my screen view? 455 | - Use ~~/.Xresources~ file and/or ~xrdb~ command. 456 | - Many desktop environments use ~xrdb~ to load ~~/.Xresources~ 457 | files on session startup to initialize the resource database. 458 | - See [[https://wiki.archlinux.org/index.php/x_resources][Xresources]] and [[https://wiki.archlinux.org/index.php/HiDPI][HiDPX]] archlinux. 459 | - If you want to scale up what you see on your screen, saying that 460 | your ~dpi~ (dot per inch) is equal to ~96~ and you want to 461 | raise up to ~144 dpi~ (dpi must be a multiple of 96), you can 462 | add this line ~Xft.dpi: 144~ to the file ~~/.Xresources~, and 463 | run the command: 464 | 465 | #+BEGIN_SRC bash 466 | xrdb -merge ~/.Xresources 467 | #+END_SRC 468 | 469 | - If you want to check the currently loaded resources, run the 470 | command: 471 | 472 | #+BEGIN_SRC bash 473 | xrdb -query all 474 | #+END_SRC 475 | 476 | - To see the default settings of your installed ~X11 apps~, look in 477 | ~/etc/X11/app-defaults/~. 478 | ** i3 window manager 479 | *** How can I debug i3status and i3blocks config files? 480 | - Use ~i3status~ or ~i3bloks~ commands. 481 | - ~i3blocks~: a flexible scheduler for your i3bar blocks. 482 | - ~i3status~: generates a status line for i3bar. 483 | - If you want to debug ~i3status~ config file, run the command: 484 | 485 | #+BEGIN_SRC bash 486 | i3status ~/config/i3/config 487 | #+END_SRC 488 | 489 | - If you want to debug ~i3blocks~ config file, run the command: 490 | 491 | #+BEGIN_SRC bash 492 | i3blocks -c ~/.config/i3blocks/config 493 | #+END_SRC 494 | 495 | *** How can I know the key name use by i3 config file for a specific key? 496 | - Use ~xev~ command. 497 | - ~xev~: print contents of X events. 498 | - If you want to get information about a specific key on your 499 | keyboard, that you can use in your i3 config file, run the 500 | command ~xev~ in your terminal, a (Event tester) window popup, then press the 501 | key from which you want to get information. For instance, 502 | pressing the ~space~ key on my keyboard, I get this following 503 | output where ~keycode 65 (keysym 0x20, space)~ is the interesting 504 | part and the name to use in i3 config file is ~space~. 505 | 506 | #+BEGIN_SRC text 507 | KeyRelease event, serial 34, synthetic NO, window 0x1400001, 508 | root 0x14f, subw 0x0, time 713381482, (524,452), root:(528,472), 509 | state 0x0, keycode 65 (keysym 0x20, space), same_screen YES, 510 | XLookupString gives 1 bytes: (20) " " 511 | XFilterEvent returns: False 512 | #+END_SRC 513 | 514 | ** Gnome 515 | *** How can I reset all gnome settings? 516 | - Use ~gnome-tweaks~ command. 517 | - ~gnome-tweaks~: customize your Ubuntu Gnome desktop. 518 | - If you want to reset all gnome desktop settings to default, 519 | launch ~gnome-tweak~ and in its gnome menu click ~Reset to 520 | Defaults~. 521 | - if you want to install ~gnome-tweaks~, run the command: 522 | 523 | #+BEGIN_SRC bash 524 | sudo apt install gnome-tweaks 525 | #+END_SRC 526 | 527 | *** How can I modify the text size on Gnome desktop? 528 | - Use ~gsettings~ command. 529 | - ~gsettings~: GSettings configuration tool. 530 | - See example [[https://askubuntu.com/questions/197828/how-to-find-and-change-the-screen-dpi][find and change the screen dpi]] on askubuntu. 531 | - If you want to change the ~dpi~ in Ubuntu Gnome desktop, you 532 | can't because it's hard coded to a value of ~96 dpi~. But you 533 | can change the text size of the applications. For instance, to 534 | increase the text size by ~1.2~ (of the hard coded ~96 dpi~, 535 | i.e. ~1.2*96~), /set/ to ~1.2~ the value of the /key/ 536 | ~text-scaling-factor~ of the /shema/ ~org.gnome.desktop.interface~ 537 | run the command: 538 | 539 | #+BEGIN_SRC bash 540 | gsettings set org.gnome.desktop.interface text-scaling-factor 1.2 541 | #+END_SRC 542 | 543 | - If you want to go back to the default text size, /reset/ the 544 | value of /key/ ~text-scaling-factor~. To do so, run the command: 545 | 546 | #+BEGIN_SRC bash 547 | gsettings reset org.gnome.desktop.interface text-scaling-factor 548 | #+END_SRC 549 | 550 | ** fonts 551 | *** How can I list all available font on my system? 552 | - Use ~fc-list~ command. 553 | - ~fc-list~: list available fonts. 554 | - If you want to list all available font, run the command: 555 | 556 | #+BEGIN_SRC bash 557 | fc-list 558 | #+END_SRC 559 | 560 | - Note: the font ~symbola~ allow you to print all ~unicode~ character. 561 | -------------------------------------------------------------------------------- /src/inside-emacs-06-part-02/org/org-keys.el: -------------------------------------------------------------------------------- 1 | ;;; org-keys.el --- Key bindings for Org mode -*- lexical-binding: t; -*- 2 | 3 | ;; Copyright (C) 2018-2020 Free Software Foundation, Inc. 4 | 5 | ;; Author: Nicolas Goaziou 6 | 7 | ;; This file is part of GNU Emacs. 8 | 9 | ;; GNU Emacs is free software; you can redistribute it and/or modify 10 | ;; it under the terms of the GNU General Public License as published by 11 | ;; the Free Software Foundation, either version 3 of the License, or 12 | ;; (at your option) any later version. 13 | 14 | ;; GNU Emacs is distributed in the hope that it will be useful, 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | ;; GNU General Public License for more details. 18 | 19 | ;; You should have received a copy of the GNU General Public License 20 | ;; along with GNU Emacs. If not, see . 21 | 22 | ;;; Commentary: 23 | 24 | ;; This library adds bindings for Org mode buffers. It also 25 | ;; implements both Speed keys and Babel speed keys. See manual for 26 | ;; details. 27 | 28 | ;;; Code: 29 | 30 | (require 'cl-lib) 31 | 32 | (defvar org-outline-regexp) 33 | 34 | (declare-function org-add-note "org" ()) 35 | (declare-function org-agenda "org" (&optional arg org-keys restriction)) 36 | (declare-function org-agenda-file-to-front "org" (&optional to-end)) 37 | (declare-function org-agenda-remove-restriction-lock "org" (&optional noupdate)) 38 | (declare-function org-agenda-set-restriction-lock "org" (&optional type)) 39 | (declare-function org-archive-subtree "org" (&optional find-done)) 40 | (declare-function org-archive-subtree-default "org" ()) 41 | (declare-function org-archive-subtree-default-with-confirmation "org" ()) 42 | (declare-function org-archive-to-archive-sibling "org" ()) 43 | (declare-function org-at-heading-p "org" (&optional ignored)) 44 | (declare-function org-attach "org" ()) 45 | (declare-function org-backward-element "org" ()) 46 | (declare-function org-backward-heading-same-level "org" (arg &optional invisible-ok)) 47 | (declare-function org-backward-paragraph "org" ()) 48 | (declare-function org-backward-sentence "org" (&optional arg)) 49 | (declare-function org-beginning-of-line "org" (&optional n)) 50 | (declare-function org-clock-cancel "org" ()) 51 | (declare-function org-clock-display "org" (&optional arg)) 52 | (declare-function org-clock-goto "org" (&optional select)) 53 | (declare-function org-clock-in "org" (&optional select start-time)) 54 | (declare-function org-clock-in-last "org" (&optional arg)) 55 | (declare-function org-clock-out "org" (&optional switch-to-state fail-quietly at-time)) 56 | (declare-function org-clone-subtree-with-time-shift "org" (n &optional shift)) 57 | (declare-function org-columns "org" (&optional global columns-fmt-string)) 58 | (declare-function org-comment-dwim "org" (arg)) 59 | (declare-function org-copy "org" ()) 60 | (declare-function org-copy-special "org" ()) 61 | (declare-function org-copy-visible "org" (beg end)) 62 | (declare-function org-ctrl-c-ctrl-c "org" (&optional arg)) 63 | (declare-function org-ctrl-c-minus "org" ()) 64 | (declare-function org-ctrl-c-ret "org" ()) 65 | (declare-function org-ctrl-c-star "org" ()) 66 | (declare-function org-ctrl-c-tab "org" (&optional arg)) 67 | (declare-function org-cut-special "org" ()) 68 | (declare-function org-cut-subtree "org" (&optional n)) 69 | (declare-function org-cycle "org" (&optional arg)) 70 | (declare-function org-cycle-agenda-files "org" ()) 71 | (declare-function org-date-from-calendar "org" ()) 72 | (declare-function org-dynamic-block-insert-dblock "org" (&optional arg)) 73 | (declare-function org-dblock-update "org" (&optional arg)) 74 | (declare-function org-deadline "org" (arg1 &optional time)) 75 | (declare-function org-decrease-number-at-point "org" (&optional inc)) 76 | (declare-function org-delete-backward-char "org" (n)) 77 | (declare-function org-delete-char "org" (n)) 78 | (declare-function org-delete-indentation "org" (&optional arg)) 79 | (declare-function org-demote-subtree "org" ()) 80 | (declare-function org-display-outline-path "org" (&optional file current separator just-return-string)) 81 | (declare-function org-down-element "org" ()) 82 | (declare-function org-edit-special "org" (&optional arg)) 83 | (declare-function org-element-at-point "org-element" ()) 84 | (declare-function org-element-type "org-element" (element)) 85 | (declare-function org-emphasize "org" (&optional char)) 86 | (declare-function org-end-of-line "org" (&optional n)) 87 | (declare-function org-entry-put "org" (pom property value)) 88 | (declare-function org-eval-in-calendar "org" (form &optional keepdate)) 89 | (declare-function org-evaluate-time-range "org" (&optional to-buffer)) 90 | (declare-function org-export-dispatch "org" (&optional arg)) 91 | (declare-function org-feed-goto-inbox "org" (feed)) 92 | (declare-function org-feed-update-all "org" ()) 93 | (declare-function org-fill-paragraph "org" (&optional justify region)) 94 | (declare-function org-find-file-at-mouse "org" (ev)) 95 | (declare-function org-footnote-action "org" (&optional special)) 96 | (declare-function org-force-cycle-archived "org" ()) 97 | (declare-function org-force-self-insert "org" (n)) 98 | (declare-function org-forward-element "org" ()) 99 | (declare-function org-forward-heading-same-level "org" (arg &optional invisible-ok)) 100 | (declare-function org-forward-paragraph "org" ()) 101 | (declare-function org-forward-sentence "org" (&optional arg)) 102 | (declare-function org-goto "org" (&optional alternative-interface)) 103 | (declare-function org-goto-calendar "org" (&optional arg)) 104 | (declare-function org-inc-effort "org" ()) 105 | (declare-function org-increase-number-at-point "org" (&optional inc)) 106 | (declare-function org-info-find-node "org" (&optional nodename)) 107 | (declare-function org-insert-all-links "org" (arg &optional pre post)) 108 | (declare-function org-insert-drawer "org" (&optional arg drawer)) 109 | (declare-function org-insert-heading-respect-content "org" (&optional invisible-ok)) 110 | (declare-function org-insert-last-stored-link "org" (arg)) 111 | (declare-function org-insert-link "org" (&optional complete-file link-location default-description)) 112 | (declare-function org-insert-structure-template "org" (type)) 113 | (declare-function org-insert-todo-heading "org" (arg &optional force-heading)) 114 | (declare-function org-insert-todo-heading-respect-content "org" (&optional force-state)) 115 | (declare-function org-kill-line "org" (&optional arg)) 116 | (declare-function org-kill-note-or-show-branches "org" ()) 117 | (declare-function org-list-make-subtree "org" ()) 118 | (declare-function org-mark-element "org" ()) 119 | (declare-function org-mark-ring-goto "org" (&optional n)) 120 | (declare-function org-mark-ring-push "org" (&optional pos buffer)) 121 | (declare-function org-mark-subtree "org" (&optional up)) 122 | (declare-function org-match-sparse-tree "org" (&optional todo-only match)) 123 | (declare-function org-meta-return "org" (&optional arg)) 124 | (declare-function org-metadown "org" (&optional _arg)) 125 | (declare-function org-metaleft "org" (&optional _)) 126 | (declare-function org-metaright "org" (&optional _arg)) 127 | (declare-function org-metaup "org" (&optional _arg)) 128 | (declare-function org-narrow-to-block "org" ()) 129 | (declare-function org-narrow-to-element "org" ()) 130 | (declare-function org-narrow-to-subtree "org" ()) 131 | (declare-function org-next-block "org" (arg &optional backward block-regexp)) 132 | (declare-function org-next-link "org" (&optional search-backward)) 133 | (declare-function org-next-visible-heading "org" (arg)) 134 | (declare-function org-open-at-mouse "org" (ev)) 135 | (declare-function org-open-at-point "org" (&optional arg reference-buffer)) 136 | (declare-function org-open-line "org" (n)) 137 | (declare-function org-paste-special "org" (arg)) 138 | (declare-function org-plot/gnuplot "org-plot" (&optional params)) 139 | (declare-function org-previous-block "org" (arg &optional block-regexp)) 140 | (declare-function org-previous-link "org" ()) 141 | (declare-function org-previous-visible-heading "org" (arg)) 142 | (declare-function org-priority "org" (&optional action show)) 143 | (declare-function org-promote-subtree "org" ()) 144 | (declare-function org-redisplay-inline-images "org" ()) 145 | (declare-function org-refile "org" (&optional arg1 default-buffer rfloc msg)) 146 | (declare-function org-reftex-citation "org" ()) 147 | (declare-function org-reload "org" (&optional arg1)) 148 | (declare-function org-remove-file "org" (&optional file)) 149 | (declare-function org-resolve-clocks "org" (&optional only-dangling-p prompt-fn last-valid)) 150 | (declare-function org-return "org" (&optional indent)) 151 | (declare-function org-return-indent "org" ()) 152 | (declare-function org-reveal "org" (&optional siblings)) 153 | (declare-function org-schedule "org" (arg &optional time)) 154 | (declare-function org-self-insert-command "org" (N)) 155 | (declare-function org-set-effort "org" (&optional increment value)) 156 | (declare-function org-set-property "org" (property value)) 157 | (declare-function org-set-property-and-value "org" (use-last)) 158 | (declare-function org-set-tags-command "org" (&optional arg)) 159 | (declare-function org-shiftcontroldown "org" (&optional n)) 160 | (declare-function org-shiftcontrolleft "org" ()) 161 | (declare-function org-shiftcontrolright "org" ()) 162 | (declare-function org-shiftcontrolup "org" (&optional n)) 163 | (declare-function org-shiftdown "org" (&optional arg)) 164 | (declare-function org-shiftleft "org" (&optional arg)) 165 | (declare-function org-shiftmetadown "org" (&optional _arg)) 166 | (declare-function org-shiftmetaleft "org" ()) 167 | (declare-function org-shiftmetaright "org" ()) 168 | (declare-function org-shiftmetaup "org" (&optional arg)) 169 | (declare-function org-shiftright "org" (&optional arg)) 170 | (declare-function org-shifttab "org" (&optional arg)) 171 | (declare-function org-shiftup "org" (&optional arg)) 172 | (declare-function org-show-all "org" (&optional types)) 173 | (declare-function org-show-children "org" (&optional level)) 174 | (declare-function org-show-subtree "org" ()) 175 | (declare-function org-sort "org" (&optional with-case)) 176 | (declare-function org-sparse-tree "org" (&optional arg type)) 177 | (declare-function org-table-blank-field "org" ()) 178 | (declare-function org-table-copy-down "org" (n)) 179 | (declare-function org-table-create-or-convert-from-region "org" (arg)) 180 | (declare-function org-table-create-with-table\.el "org-table" ()) 181 | (declare-function org-table-edit-field "org" (arg)) 182 | (declare-function org-table-eval-formula "org" (&optional arg equation suppress-align suppress-const suppress-store suppress-analysis)) 183 | (declare-function org-table-field-info "org" (arg)) 184 | (declare-function org-table-rotate-recalc-marks "org" (&optional newchar)) 185 | (declare-function org-table-sum "org" (&optional beg end nlast)) 186 | (declare-function org-table-toggle-coordinate-overlays "org" ()) 187 | (declare-function org-table-toggle-formula-debugger "org" ()) 188 | (declare-function org-time-stamp "org" (arg &optional inactive)) 189 | (declare-function org-time-stamp-inactive "org" (&optional arg)) 190 | (declare-function org-timer "org" (&optional restart no-insert)) 191 | (declare-function org-timer-item "org" (&optional arg)) 192 | (declare-function org-timer-pause-or-continue "org" (&optional stop)) 193 | (declare-function org-timer-set-timer "org" (&optional opt)) 194 | (declare-function org-timer-start "org" (&optional offset)) 195 | (declare-function org-timer-stop "org" ()) 196 | (declare-function org-todo "org" (&optional arg1)) 197 | (declare-function org-toggle-archive-tag "org" (&optional find-done)) 198 | (declare-function org-toggle-checkbox "org" (&optional toggle-presence)) 199 | (declare-function org-toggle-comment "org" ()) 200 | (declare-function org-toggle-fixed-width "org" ()) 201 | (declare-function org-toggle-inline-images "org" (&optional include-linked)) 202 | (declare-function org-latex-preview "org" (&optional arg)) 203 | (declare-function org-toggle-narrow-to-subtree "org" ()) 204 | (declare-function org-toggle-ordered-property "org" ()) 205 | (declare-function org-toggle-pretty-entities "org" ()) 206 | (declare-function org-toggle-tags-groups "org" ()) 207 | (declare-function org-toggle-time-stamp-overlays "org" ()) 208 | (declare-function org-transpose-element "org" ()) 209 | (declare-function org-transpose-words "org" ()) 210 | (declare-function org-tree-to-indirect-buffer "org" (&optional arg)) 211 | (declare-function org-up-element "org" ()) 212 | (declare-function org-update-statistics-cookies "org" (all)) 213 | (declare-function org-yank "org" (&optional arg)) 214 | (declare-function orgtbl-ascii-plot "org-table" (&optional ask)) 215 | 216 | 217 | 218 | ;;; Variables 219 | 220 | (defvar org-mode-map (make-sparse-keymap) 221 | "Keymap fo Org mode.") 222 | 223 | (defvaralias 'org-CUA-compatible 'org-replace-disputed-keys) 224 | 225 | (defcustom org-replace-disputed-keys nil 226 | "Non-nil means use alternative key bindings for some keys. 227 | 228 | Org mode uses S- keys for changing timestamps and priorities. 229 | These keys are also used by other packages like Shift Select mode, 230 | CUA mode or Windmove. If you want to use Org mode together with 231 | one of these other modes, or more generally if you would like to 232 | move some Org mode commands to other keys, set this variable and 233 | configure the keys with the variable `org-disputed-keys'. 234 | 235 | This option is only relevant at load-time of Org mode, and must be set 236 | *before* org.el is loaded. Changing it requires a restart of Emacs to 237 | become effective." 238 | :group 'org-startup 239 | :type 'boolean 240 | :safe #'booleanp) 241 | 242 | (defcustom org-use-extra-keys nil 243 | "Non-nil means use extra key sequence definitions for certain commands. 244 | This happens automatically if `window-system' is nil. This 245 | variable lets you do the same manually. You must set it before 246 | loading Org." 247 | :group 'org-startup 248 | :type 'boolean 249 | :safe #'booleanp) 250 | 251 | (defcustom org-disputed-keys 252 | '(([(shift up)] . [(meta p)]) 253 | ([(shift down)] . [(meta n)]) 254 | ([(shift left)] . [(meta -)]) 255 | ([(shift right)] . [(meta +)]) 256 | ([(control shift right)] . [(meta shift +)]) 257 | ([(control shift left)] . [(meta shift -)])) 258 | "Keys for which Org mode and other modes compete. 259 | This is an alist, cars are the default keys, second element specifies 260 | the alternative to use when `org-replace-disputed-keys' is t. 261 | 262 | Keys can be specified in any syntax supported by `define-key'. 263 | The value of this option takes effect only at Org mode startup, 264 | therefore you'll have to restart Emacs to apply it after changing." 265 | :group 'org-startup 266 | :type 'alist) 267 | 268 | (defcustom org-mouse-1-follows-link 269 | (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t) 270 | "Non-nil means mouse-1 on a link will follow the link. 271 | A longer mouse click will still set point. Needs to be set 272 | before org.el is loaded." 273 | :group 'org-link-follow 274 | :version "26.1" 275 | :package-version '(Org . "8.3") 276 | :type '(choice 277 | (const :tag "A double click follows the link" double) 278 | (const :tag "Unconditionally follow the link with mouse-1" t) 279 | (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450)) 280 | :safe t) 281 | 282 | (defcustom org-tab-follows-link nil 283 | "Non-nil means on links TAB will follow the link. 284 | Needs to be set before Org is loaded. 285 | This really should not be used, it does not make sense, and the 286 | implementation is bad." 287 | :group 'org-link-follow 288 | :type 'boolean) 289 | 290 | (defcustom org-follow-link-hook nil 291 | "Hook that is run after a link has been followed." 292 | :group 'org-link-follow 293 | :type 'hook) 294 | 295 | (defcustom org-return-follows-link nil 296 | "Non-nil means on links RET will follow the link. 297 | In tables, the special behavior of RET has precedence." 298 | :group 'org-link-follow 299 | :type 'boolean 300 | :safe t) 301 | 302 | 303 | ;;; Functions 304 | 305 | ;;;; Base functions 306 | (defun org-key (key) 307 | "Select key according to `org-replace-disputed-keys' and `org-disputed-keys'. 308 | Or return the original if not disputed." 309 | (when org-replace-disputed-keys 310 | (let* ((nkey (key-description key)) 311 | (x (cl-find-if (lambda (x) (equal (key-description (car x)) nkey)) 312 | org-disputed-keys))) 313 | (setq key (if x (cdr x) key)))) 314 | key) 315 | 316 | (defun org-defkey (keymap key def) 317 | "Define a key, possibly translated, as returned by `org-key'." 318 | (define-key keymap (org-key key) def)) 319 | 320 | (defun org-remap (map &rest commands) 321 | "In MAP, remap the functions given in COMMANDS. 322 | COMMANDS is a list of alternating OLDDEF NEWDEF command names." 323 | (let (new old) 324 | (while commands 325 | (setq old (pop commands) new (pop commands)) 326 | (org-defkey map (vector 'remap old) new)))) 327 | 328 | 329 | ;;; Mouse map 330 | 331 | (defvar org-mouse-map (make-sparse-keymap)) 332 | (org-defkey org-mouse-map [mouse-2] 'org-open-at-mouse) 333 | (org-defkey org-mouse-map [mouse-3] 'org-find-file-at-mouse) 334 | 335 | (when org-mouse-1-follows-link 336 | (org-defkey org-mouse-map [follow-link] 'mouse-face)) 337 | 338 | (when org-tab-follows-link 339 | (org-defkey org-mouse-map (kbd "") #'org-open-at-point) 340 | (org-defkey org-mouse-map (kbd "TAB") #'org-open-at-point)) 341 | 342 | 343 | ;;; Read date map 344 | 345 | (defvar org-read-date-minibuffer-local-map 346 | (let* ((map (make-sparse-keymap))) 347 | (set-keymap-parent map minibuffer-local-map) 348 | (org-defkey map (kbd ".") 349 | (lambda () (interactive) 350 | ;; Are we at the beginning of the prompt? 351 | (if (looking-back "^[^:]+: " 352 | (let ((inhibit-field-text-motion t)) 353 | (line-beginning-position))) 354 | (org-eval-in-calendar '(calendar-goto-today)) 355 | (insert ".")))) 356 | (org-defkey map (kbd "C-.") 357 | (lambda () (interactive) 358 | (org-eval-in-calendar '(calendar-goto-today)))) 359 | (org-defkey map (kbd "M-S-") 360 | (lambda () (interactive) 361 | (org-eval-in-calendar '(calendar-backward-month 1)))) 362 | (org-defkey map (kbd "ESC S-") 363 | (lambda () (interactive) 364 | (org-eval-in-calendar '(calendar-backward-month 1)))) 365 | (org-defkey map (kbd "M-S-") 366 | (lambda () (interactive) 367 | (org-eval-in-calendar '(calendar-forward-month 1)))) 368 | (org-defkey map (kbd "ESC S-") 369 | (lambda () (interactive) 370 | (org-eval-in-calendar '(calendar-forward-month 1)))) 371 | (org-defkey map (kbd "M-S-") 372 | (lambda () (interactive) 373 | (org-eval-in-calendar '(calendar-backward-year 1)))) 374 | (org-defkey map (kbd "ESC S-") 375 | (lambda () (interactive) 376 | (org-eval-in-calendar '(calendar-backward-year 1)))) 377 | (org-defkey map (kbd "M-S-") 378 | (lambda () (interactive) 379 | (org-eval-in-calendar '(calendar-forward-year 1)))) 380 | (org-defkey map (kbd "ESC S-") 381 | (lambda () (interactive) 382 | (org-eval-in-calendar '(calendar-forward-year 1)))) 383 | (org-defkey map (kbd "S-") 384 | (lambda () (interactive) 385 | (org-eval-in-calendar '(calendar-backward-week 1)))) 386 | (org-defkey map (kbd "S-") 387 | (lambda () (interactive) 388 | (org-eval-in-calendar '(calendar-forward-week 1)))) 389 | (org-defkey map (kbd "S-") 390 | (lambda () (interactive) 391 | (org-eval-in-calendar '(calendar-backward-day 1)))) 392 | (org-defkey map (kbd "S-") 393 | (lambda () (interactive) 394 | (org-eval-in-calendar '(calendar-forward-day 1)))) 395 | (org-defkey map (kbd "!") 396 | (lambda () (interactive) 397 | (org-eval-in-calendar '(diary-view-entries)) 398 | (message ""))) 399 | (org-defkey map (kbd ">") 400 | (lambda () (interactive) 401 | (org-eval-in-calendar '(calendar-scroll-left 1)))) 402 | (org-defkey map (kbd "<") 403 | (lambda () (interactive) 404 | (org-eval-in-calendar '(calendar-scroll-right 1)))) 405 | (org-defkey map (kbd "C-v") 406 | (lambda () (interactive) 407 | (org-eval-in-calendar 408 | '(calendar-scroll-left-three-months 1)))) 409 | (org-defkey map (kbd "M-v") 410 | (lambda () (interactive) 411 | (org-eval-in-calendar 412 | '(calendar-scroll-right-three-months 1)))) 413 | map) 414 | "Keymap for minibuffer commands when using `org-read-date'.") 415 | 416 | 417 | ;;; Global bindings 418 | 419 | ;;;; Outline functions 420 | (define-key org-mode-map [menu-bar headings] 'undefined) 421 | (define-key org-mode-map [menu-bar hide] 'undefined) 422 | (define-key org-mode-map [menu-bar show] 'undefined) 423 | 424 | (define-key org-mode-map [remap outline-mark-subtree] #'org-mark-subtree) 425 | (define-key org-mode-map [remap outline-show-subtree] #'org-show-subtree) 426 | (define-key org-mode-map [remap outline-forward-same-level] 427 | #'org-forward-heading-same-level) 428 | (define-key org-mode-map [remap outline-backward-same-level] 429 | #'org-backward-heading-same-level) 430 | (define-key org-mode-map [remap outline-show-branches] 431 | #'org-kill-note-or-show-branches) 432 | (define-key org-mode-map [remap outline-promote] #'org-promote-subtree) 433 | (define-key org-mode-map [remap outline-demote] #'org-demote-subtree) 434 | (define-key org-mode-map [remap outline-insert-heading] #'org-ctrl-c-ret) 435 | (define-key org-mode-map [remap outline-next-visible-heading] 436 | #'org-next-visible-heading) 437 | (define-key org-mode-map [remap outline-previous-visible-heading] 438 | #'org-previous-visible-heading) 439 | (define-key org-mode-map [remap show-children] #'org-show-children) 440 | 441 | ;;;; Make `C-c C-x' a prefix key 442 | (org-defkey org-mode-map (kbd "C-c C-x") (make-sparse-keymap)) 443 | 444 | ;;;; TAB key with modifiers 445 | (org-defkey org-mode-map (kbd "C-i") #'org-cycle) 446 | (org-defkey org-mode-map (kbd "") #'org-cycle) 447 | (org-defkey org-mode-map (kbd "C-") #'org-force-cycle-archived) 448 | ;; Override text-mode binding to expose `complete-symbol' for 449 | ;; pcomplete functionality. 450 | (org-defkey org-mode-map (kbd "M-") nil) 451 | (org-defkey org-mode-map (kbd "M-TAB") nil) 452 | (org-defkey org-mode-map (kbd "ESC ") nil) 453 | (org-defkey org-mode-map (kbd "ESC TAB") nil) 454 | 455 | (org-defkey org-mode-map (kbd "") #'org-shifttab) 456 | (org-defkey org-mode-map (kbd "S-") #'org-shifttab) 457 | (org-defkey org-mode-map (kbd "S-TAB") #'org-shifttab) 458 | (define-key org-mode-map (kbd "") #'org-shifttab) 459 | 460 | ;;;; RET/ key with modifiers 461 | (org-defkey org-mode-map (kbd "S-") #'org-table-copy-down) 462 | (org-defkey org-mode-map (kbd "S-RET") #'org-table-copy-down) 463 | (org-defkey org-mode-map (kbd "M-S-") #'org-insert-todo-heading) 464 | (org-defkey org-mode-map (kbd "M-S-RET") #'org-insert-todo-heading) 465 | (org-defkey org-mode-map (kbd "ESC S-") #'org-insert-todo-heading) 466 | (org-defkey org-mode-map (kbd "ESC S-RET") #'org-insert-todo-heading) 467 | (org-defkey org-mode-map (kbd "M-") #'org-meta-return) 468 | (org-defkey org-mode-map (kbd "M-RET") #'org-meta-return) 469 | (org-defkey org-mode-map (kbd "ESC ") #'org-meta-return) 470 | (org-defkey org-mode-map (kbd "ESC RET") #'org-meta-return) 471 | 472 | ;;;; Cursor keys with modifiers 473 | (org-defkey org-mode-map (kbd "M-") #'org-metaleft) 474 | (org-defkey org-mode-map (kbd "M-") #'org-metaright) 475 | (org-defkey org-mode-map (kbd "ESC ") #'org-metaright) 476 | (org-defkey org-mode-map (kbd "M-") #'org-metaup) 477 | (org-defkey org-mode-map (kbd "ESC ") #'org-metaup) 478 | (org-defkey org-mode-map (kbd "M-") #'org-metadown) 479 | (org-defkey org-mode-map (kbd "ESC ") #'org-metadown) 480 | 481 | (org-defkey org-mode-map (kbd "C-M-S-") #'org-increase-number-at-point) 482 | (org-defkey org-mode-map (kbd "C-M-S-") #'org-decrease-number-at-point) 483 | (org-defkey org-mode-map (kbd "M-S-") #'org-shiftmetaleft) 484 | (org-defkey org-mode-map (kbd "ESC S-") #'org-shiftmetaleft) 485 | (org-defkey org-mode-map (kbd "M-S-") #'org-shiftmetaright) 486 | (org-defkey org-mode-map (kbd "ESC S-") #'org-shiftmetaright) 487 | (org-defkey org-mode-map (kbd "M-S-") #'org-shiftmetaup) 488 | (org-defkey org-mode-map (kbd "ESC S-") #'org-shiftmetaup) 489 | (org-defkey org-mode-map (kbd "M-S-") #'org-shiftmetadown) 490 | (org-defkey org-mode-map (kbd "ESC S-") #'org-shiftmetadown) 491 | 492 | (org-defkey org-mode-map (kbd "S-") #'org-shiftup) 493 | (org-defkey org-mode-map (kbd "S-") #'org-shiftdown) 494 | (org-defkey org-mode-map (kbd "S-") #'org-shiftleft) 495 | (org-defkey org-mode-map (kbd "S-") #'org-shiftright) 496 | 497 | (org-defkey org-mode-map (kbd "C-S-") #'org-shiftcontrolright) 498 | (org-defkey org-mode-map (kbd "C-S-") #'org-shiftcontrolleft) 499 | (org-defkey org-mode-map (kbd "C-S-") #'org-shiftcontrolup) 500 | (org-defkey org-mode-map (kbd "C-S-") #'org-shiftcontroldown) 501 | 502 | ;;;; Extra keys for TTY access. 503 | 504 | ;; We only set them when really needed because otherwise the 505 | ;; menus don't show the simple keys 506 | 507 | (when (or org-use-extra-keys (not window-system)) 508 | (org-defkey org-mode-map (kbd "C-c C-x c") #'org-table-copy-down) 509 | (org-defkey org-mode-map (kbd "C-c C-x m") #'org-meta-return) 510 | (org-defkey org-mode-map (kbd "C-c C-x M") #'org-insert-todo-heading) 511 | (org-defkey org-mode-map (kbd "C-c C-x RET") #'org-meta-return) 512 | (org-defkey org-mode-map (kbd "ESC RET") #'org-meta-return) 513 | (org-defkey org-mode-map (kbd "ESC ") #'org-metaleft) 514 | (org-defkey org-mode-map (kbd "C-c C-x l") #'org-metaleft) 515 | (org-defkey org-mode-map (kbd "ESC ") #'org-metaright) 516 | (org-defkey org-mode-map (kbd "C-c C-x r") #'org-metaright) 517 | (org-defkey org-mode-map (kbd "C-c C-x u") #'org-metaup) 518 | (org-defkey org-mode-map (kbd "C-c C-x d") #'org-metadown) 519 | (org-defkey org-mode-map (kbd "C-c C-x L") #'org-shiftmetaleft) 520 | (org-defkey org-mode-map (kbd "C-c C-x R") #'org-shiftmetaright) 521 | (org-defkey org-mode-map (kbd "C-c C-x U") #'org-shiftmetaup) 522 | (org-defkey org-mode-map (kbd "C-c C-x D") #'org-shiftmetadown) 523 | (org-defkey org-mode-map (kbd "C-c ") #'org-shiftup) 524 | (org-defkey org-mode-map (kbd "C-c ") #'org-shiftdown) 525 | (org-defkey org-mode-map (kbd "C-c ") #'org-shiftleft) 526 | (org-defkey org-mode-map (kbd "C-c ") #'org-shiftright) 527 | (org-defkey org-mode-map (kbd "C-c C-x ") #'org-shiftcontrolright) 528 | (org-defkey org-mode-map (kbd "C-c C-x ") #'org-shiftcontrolleft)) 529 | 530 | ;;;; Narrowing bindings 531 | (org-defkey org-mode-map (kbd "C-x n s") #'org-narrow-to-subtree) 532 | (org-defkey org-mode-map (kbd "C-x n b") #'org-narrow-to-block) 533 | (org-defkey org-mode-map (kbd "C-x n e") #'org-narrow-to-element) 534 | 535 | ;;;; Remap usual Emacs bindings 536 | (org-remap org-mode-map 537 | 'self-insert-command 'org-self-insert-command 538 | 'delete-char 'org-delete-char 539 | 'delete-backward-char 'org-delete-backward-char 540 | 'kill-line 'org-kill-line 541 | 'open-line 'org-open-line 542 | 'yank 'org-yank 543 | 'comment-dwim 'org-comment-dwim 544 | 'move-beginning-of-line 'org-beginning-of-line 545 | 'move-end-of-line 'org-end-of-line 546 | 'forward-paragraph 'org-forward-paragraph 547 | 'backward-paragraph 'org-backward-paragraph 548 | 'backward-sentence 'org-backward-sentence 549 | 'forward-sentence 'org-forward-sentence 550 | 'fill-paragraph 'org-fill-paragraph 551 | 'delete-indentation 'org-delete-indentation 552 | 'transpose-words 'org-transpose-words) 553 | 554 | ;;;; All the other keys 555 | (org-defkey org-mode-map (kbd "|") #'org-force-self-insert) 556 | (org-defkey org-mode-map (kbd "C-c C-r") #'org-reveal) 557 | (org-defkey org-mode-map (kbd "C-M-t") #'org-transpose-element) 558 | (org-defkey org-mode-map (kbd "M-}") #'org-forward-element) 559 | (org-defkey org-mode-map (kbd "ESC }") #'org-forward-element) 560 | (org-defkey org-mode-map (kbd "M-{") #'org-backward-element) 561 | (org-defkey org-mode-map (kbd "ESC {") #'org-backward-element) 562 | (org-defkey org-mode-map (kbd "C-c C-^") #'org-up-element) 563 | (org-defkey org-mode-map (kbd "C-c C-_") #'org-down-element) 564 | (org-defkey org-mode-map (kbd "C-c C-f") #'org-forward-heading-same-level) 565 | (org-defkey org-mode-map (kbd "C-c C-b") #'org-backward-heading-same-level) 566 | (org-defkey org-mode-map (kbd "C-c M-f") #'org-next-block) 567 | (org-defkey org-mode-map (kbd "C-c M-b") #'org-previous-block) 568 | (org-defkey org-mode-map (kbd "C-c $") #'org-archive-subtree) 569 | (org-defkey org-mode-map (kbd "C-c C-x C-s") #'org-archive-subtree) 570 | (org-defkey org-mode-map (kbd "C-c C-x C-a") #'org-archive-subtree-default) 571 | (org-defkey org-mode-map (kbd "C-c C-x d") #'org-insert-drawer) 572 | (org-defkey org-mode-map (kbd "C-c C-x a") #'org-toggle-archive-tag) 573 | (org-defkey org-mode-map (kbd "C-c C-x A") #'org-archive-to-archive-sibling) 574 | (org-defkey org-mode-map (kbd "C-c C-x b") #'org-tree-to-indirect-buffer) 575 | (org-defkey org-mode-map (kbd "C-c C-x q") #'org-toggle-tags-groups) 576 | (org-defkey org-mode-map (kbd "C-c C-j") #'org-goto) 577 | (org-defkey org-mode-map (kbd "C-c C-t") #'org-todo) 578 | (org-defkey org-mode-map (kbd "C-c C-q") #'org-set-tags-command) 579 | (org-defkey org-mode-map (kbd "C-c C-s") #'org-schedule) 580 | (org-defkey org-mode-map (kbd "C-c C-d") #'org-deadline) 581 | (org-defkey org-mode-map (kbd "C-c ;") #'org-toggle-comment) 582 | (org-defkey org-mode-map (kbd "C-c C-w") #'org-refile) 583 | (org-defkey org-mode-map (kbd "C-c M-w") #'org-copy) 584 | (org-defkey org-mode-map (kbd "C-c /") #'org-sparse-tree) ;minor-mode reserved 585 | (org-defkey org-mode-map (kbd "C-c \\") #'org-match-sparse-tree) ;minor-mode r. 586 | (org-defkey org-mode-map (kbd "C-c RET") #'org-ctrl-c-ret) 587 | (org-defkey org-mode-map (kbd "C-c C-x c") #'org-clone-subtree-with-time-shift) 588 | (org-defkey org-mode-map (kbd "C-c C-x v") #'org-copy-visible) 589 | (org-defkey org-mode-map (kbd "C-") #'org-insert-heading-respect-content) 590 | (org-defkey org-mode-map (kbd "C-S-") #'org-insert-todo-heading-respect-content) 591 | (org-defkey org-mode-map (kbd "C-c C-x C-n") #'org-next-link) 592 | (org-defkey org-mode-map (kbd "C-c C-x C-p") #'org-previous-link) 593 | (org-defkey org-mode-map (kbd "C-c C-l") #'org-insert-link) 594 | (org-defkey org-mode-map (kbd "C-c M-l") #'org-insert-last-stored-link) 595 | (org-defkey org-mode-map (kbd "C-c C-M-l") #'org-insert-all-links) 596 | (org-defkey org-mode-map (kbd "C-c C-o") #'org-open-at-point) 597 | (org-defkey org-mode-map (kbd "C-c %") #'org-mark-ring-push) 598 | (org-defkey org-mode-map (kbd "C-c &") #'org-mark-ring-goto) 599 | (org-defkey org-mode-map (kbd "C-c C-z") #'org-add-note) ;alternative binding 600 | (org-defkey org-mode-map (kbd "C-c .") #'org-time-stamp) ;minor-mode reserved 601 | (org-defkey org-mode-map (kbd "C-c !") #'org-time-stamp-inactive) ;minor-mode r. 602 | (org-defkey org-mode-map (kbd "C-c ,") #'org-priority) ;minor-mode reserved 603 | (org-defkey org-mode-map (kbd "C-c C-y") #'org-evaluate-time-range) 604 | (org-defkey org-mode-map (kbd "C-c >") #'org-goto-calendar) 605 | (org-defkey org-mode-map (kbd "C-c <") #'org-date-from-calendar) 606 | (org-defkey org-mode-map (kbd "C-,") #'org-cycle-agenda-files) 607 | (org-defkey org-mode-map (kbd "C-'") #'org-cycle-agenda-files) 608 | (org-defkey org-mode-map (kbd "C-c [") #'org-agenda-file-to-front) 609 | (org-defkey org-mode-map (kbd "C-c ]") #'org-remove-file) 610 | (org-defkey org-mode-map (kbd "C-c C-x <") #'org-agenda-set-restriction-lock) 611 | (org-defkey org-mode-map (kbd "C-c C-x >") #'org-agenda-remove-restriction-lock) 612 | (org-defkey org-mode-map (kbd "C-c -") #'org-ctrl-c-minus) 613 | (org-defkey org-mode-map (kbd "C-c *") #'org-ctrl-c-star) 614 | (org-defkey org-mode-map (kbd "C-c TAB") #'org-ctrl-c-tab) 615 | (org-defkey org-mode-map (kbd "C-c ^") #'org-sort) 616 | (org-defkey org-mode-map (kbd "C-c C-c") #'org-ctrl-c-ctrl-c) 617 | (org-defkey org-mode-map (kbd "C-c C-k") #'org-kill-note-or-show-branches) 618 | (org-defkey org-mode-map (kbd "C-c #") #'org-update-statistics-cookies) 619 | (org-defkey org-mode-map (kbd "RET") #'org-return) 620 | (org-defkey org-mode-map (kbd "C-j") #'org-return-indent) 621 | (org-defkey org-mode-map (kbd "C-c ?") #'org-table-field-info) 622 | (org-defkey org-mode-map (kbd "C-c SPC") #'org-table-blank-field) 623 | (org-defkey org-mode-map (kbd "C-c +") #'org-table-sum) 624 | (org-defkey org-mode-map (kbd "C-c =") #'org-table-eval-formula) 625 | (org-defkey org-mode-map (kbd "C-c '") #'org-edit-special) 626 | (org-defkey org-mode-map (kbd "C-c `") #'org-table-edit-field) 627 | (org-defkey org-mode-map (kbd "C-c \" a") #'orgtbl-ascii-plot) 628 | (org-defkey org-mode-map (kbd "C-c \" g") #'org-plot/gnuplot) 629 | (org-defkey org-mode-map (kbd "C-c |") #'org-table-create-or-convert-from-region) 630 | (org-defkey org-mode-map (kbd "C-#") #'org-table-rotate-recalc-marks) 631 | (org-defkey org-mode-map (kbd "C-c ~") #'org-table-create-with-table.el) 632 | (org-defkey org-mode-map (kbd "C-c C-a") #'org-attach) 633 | (org-defkey org-mode-map (kbd "C-c }") #'org-table-toggle-coordinate-overlays) 634 | (org-defkey org-mode-map (kbd "C-c {") #'org-table-toggle-formula-debugger) 635 | (org-defkey org-mode-map (kbd "C-c C-e") #'org-export-dispatch) 636 | (org-defkey org-mode-map (kbd "C-c :") #'org-toggle-fixed-width) 637 | (org-defkey org-mode-map (kbd "C-c C-x C-f") #'org-emphasize) 638 | (org-defkey org-mode-map (kbd "C-c C-x f") #'org-footnote-action) 639 | (org-defkey org-mode-map (kbd "C-c @") #'org-mark-subtree) 640 | (org-defkey org-mode-map (kbd "M-h") #'org-mark-element) 641 | (org-defkey org-mode-map (kbd "ESC h") #'org-mark-element) 642 | (org-defkey org-mode-map (kbd "C-c C-*") #'org-list-make-subtree) 643 | (org-defkey org-mode-map (kbd "C-c C-x C-w") #'org-cut-special) 644 | (org-defkey org-mode-map (kbd "C-c C-x M-w") #'org-copy-special) 645 | (org-defkey org-mode-map (kbd "C-c C-x C-y") #'org-paste-special) 646 | (org-defkey org-mode-map (kbd "C-c C-x C-t") #'org-toggle-time-stamp-overlays) 647 | (org-defkey org-mode-map (kbd "C-c C-x C-i") #'org-clock-in) 648 | (org-defkey org-mode-map (kbd "C-c C-x C-x") #'org-clock-in-last) 649 | (org-defkey org-mode-map (kbd "C-c C-x C-z") #'org-resolve-clocks) 650 | (org-defkey org-mode-map (kbd "C-c C-x C-o") #'org-clock-out) 651 | (org-defkey org-mode-map (kbd "C-c C-x C-j") #'org-clock-goto) 652 | (org-defkey org-mode-map (kbd "C-c C-x C-q") #'org-clock-cancel) 653 | (org-defkey org-mode-map (kbd "C-c C-x C-d") #'org-clock-display) 654 | (org-defkey org-mode-map (kbd "C-c C-x x") #'org-dynamic-block-insert-dblock) 655 | (org-defkey org-mode-map (kbd "C-c C-x C-u") #'org-dblock-update) 656 | (org-defkey org-mode-map (kbd "C-c C-x C-l") #'org-latex-preview) 657 | (org-defkey org-mode-map (kbd "C-c C-x C-v") #'org-toggle-inline-images) 658 | (org-defkey org-mode-map (kbd "C-c C-x C-M-v") #'org-redisplay-inline-images) 659 | (org-defkey org-mode-map (kbd "C-c C-x \\") #'org-toggle-pretty-entities) 660 | (org-defkey org-mode-map (kbd "C-c C-x C-b") #'org-toggle-checkbox) 661 | (org-defkey org-mode-map (kbd "C-c C-x p") #'org-set-property) 662 | (org-defkey org-mode-map (kbd "C-c C-x P") #'org-set-property-and-value) 663 | (org-defkey org-mode-map (kbd "C-c C-x e") #'org-set-effort) 664 | (org-defkey org-mode-map (kbd "C-c C-x E") #'org-inc-effort) 665 | (org-defkey org-mode-map (kbd "C-c C-x o") #'org-toggle-ordered-property) 666 | (org-defkey org-mode-map (kbd "C-c C-,") #'org-insert-structure-template) 667 | (org-defkey org-mode-map (kbd "C-c C-x .") #'org-timer) 668 | (org-defkey org-mode-map (kbd "C-c C-x -") #'org-timer-item) 669 | (org-defkey org-mode-map (kbd "C-c C-x 0") #'org-timer-start) 670 | (org-defkey org-mode-map (kbd "C-c C-x _") #'org-timer-stop) 671 | (org-defkey org-mode-map (kbd "C-c C-x ;") #'org-timer-set-timer) 672 | (org-defkey org-mode-map (kbd "C-c C-x ,") #'org-timer-pause-or-continue) 673 | (org-defkey org-mode-map (kbd "C-c C-x C-c") #'org-columns) 674 | (org-defkey org-mode-map (kbd "C-c C-x !") #'org-reload) 675 | (org-defkey org-mode-map (kbd "C-c C-x g") #'org-feed-update-all) 676 | (org-defkey org-mode-map (kbd "C-c C-x G") #'org-feed-goto-inbox) 677 | (org-defkey org-mode-map (kbd "C-c C-x [") #'org-reftex-citation) 678 | (org-defkey org-mode-map (kbd "C-c C-x I") #'org-info-find-node) 679 | 680 | 681 | ;;; Speed keys 682 | 683 | (defcustom org-use-speed-commands nil 684 | "Non-nil means activate single letter commands at beginning of a headline. 685 | This may also be a function to test for appropriate locations where speed 686 | commands should be active. 687 | 688 | For example, to activate speed commands when the point is on any 689 | star at the beginning of the headline, you can do this: 690 | 691 | (setq org-use-speed-commands 692 | (lambda () (and (looking-at org-outline-regexp) (looking-back \"^\\**\"))))" 693 | :group 'org-structure 694 | :type '(choice 695 | (const :tag "Never" nil) 696 | (const :tag "At beginning of headline stars" t) 697 | (function))) 698 | 699 | (defcustom org-speed-commands-user nil 700 | "Alist of additional speed commands. 701 | This list will be checked before `org-speed-commands-default' 702 | when the variable `org-use-speed-commands' is non-nil 703 | and when the cursor is at the beginning of a headline. 704 | The car of each entry is a string with a single letter, which must 705 | be assigned to `self-insert-command' in the global map. 706 | The cdr is either a command to be called interactively, a function 707 | to be called, or a form to be evaluated. 708 | An entry that is just a list with a single string will be interpreted 709 | as a descriptive headline that will be added when listing the speed 710 | commands in the Help buffer using the `?' speed command." 711 | :group 'org-structure 712 | :type '(repeat :value ("k" . ignore) 713 | (choice :value ("k" . ignore) 714 | (list :tag "Descriptive Headline" (string :tag "Headline")) 715 | (cons :tag "Letter and Command" 716 | (string :tag "Command letter") 717 | (choice 718 | (function) 719 | (sexp)))))) 720 | 721 | (defcustom org-speed-command-hook 722 | '(org-speed-command-activate org-babel-speed-command-activate) 723 | "Hook for activating speed commands at strategic locations. 724 | Hook functions are called in sequence until a valid handler is 725 | found. 726 | 727 | Each hook takes a single argument, a user-pressed command key 728 | which is also a `self-insert-command' from the global map. 729 | 730 | Within the hook, examine the cursor position and the command key 731 | and return nil or a valid handler as appropriate. Handler could 732 | be one of an interactive command, a function, or a form. 733 | 734 | Set `org-use-speed-commands' to non-nil value to enable this 735 | hook. The default setting is `org-speed-command-activate'." 736 | :group 'org-structure 737 | :version "24.1" 738 | :type 'hook) 739 | 740 | (defconst org-speed-commands-default 741 | '(("Outline Navigation") 742 | ("n" . (org-speed-move-safe 'org-next-visible-heading)) 743 | ("p" . (org-speed-move-safe 'org-previous-visible-heading)) 744 | ("f" . (org-speed-move-safe 'org-forward-heading-same-level)) 745 | ("b" . (org-speed-move-safe 'org-backward-heading-same-level)) 746 | ("F" . org-next-block) 747 | ("B" . org-previous-block) 748 | ("u" . (org-speed-move-safe 'outline-up-heading)) 749 | ("j" . org-goto) 750 | ("g" . (org-refile t)) 751 | ("Outline Visibility") 752 | ("c" . org-cycle) 753 | ("C" . org-shifttab) 754 | (" " . org-display-outline-path) 755 | ("s" . org-toggle-narrow-to-subtree) 756 | ("k" . org-cut-subtree) 757 | ("=" . org-columns) 758 | ("Outline Structure Editing") 759 | ("U" . org-metaup) 760 | ("D" . org-metadown) 761 | ("r" . org-metaright) 762 | ("l" . org-metaleft) 763 | ("R" . org-shiftmetaright) 764 | ("L" . org-shiftmetaleft) 765 | ("i" . (progn (forward-char 1) (call-interactively 766 | 'org-insert-heading-respect-content))) 767 | ("^" . org-sort) 768 | ("w" . org-refile) 769 | ("a" . org-archive-subtree-default-with-confirmation) 770 | ("@" . org-mark-subtree) 771 | ("#" . org-toggle-comment) 772 | ("Clock Commands") 773 | ("I" . org-clock-in) 774 | ("O" . org-clock-out) 775 | ("Meta Data Editing") 776 | ("t" . org-todo) 777 | ("," . (org-priority)) 778 | ("0" . (org-priority ?\ )) 779 | ("1" . (org-priority ?A)) 780 | ("2" . (org-priority ?B)) 781 | ("3" . (org-priority ?C)) 782 | (":" . org-set-tags-command) 783 | ("e" . org-set-effort) 784 | ("E" . org-inc-effort) 785 | ("W" . (lambda(m) (interactive "sMinutes before warning: ") 786 | (org-entry-put (point) "APPT_WARNTIME" m))) 787 | ("Agenda Views etc") 788 | ("v" . org-agenda) 789 | ("/" . org-sparse-tree) 790 | ("Misc") 791 | ("o" . org-open-at-point) 792 | ("?" . org-speed-command-help) 793 | ("<" . (org-agenda-set-restriction-lock 'subtree)) 794 | (">" . (org-agenda-remove-restriction-lock))) 795 | "The default speed commands.") 796 | 797 | (defun org-print-speed-command (e) 798 | (if (> (length (car e)) 1) 799 | (progn 800 | (princ "\n") 801 | (princ (car e)) 802 | (princ "\n") 803 | (princ (make-string (length (car e)) ?-)) 804 | (princ "\n")) 805 | (princ (car e)) 806 | (princ " ") 807 | (if (symbolp (cdr e)) 808 | (princ (symbol-name (cdr e))) 809 | (prin1 (cdr e))) 810 | (princ "\n"))) 811 | 812 | (defun org-speed-command-help () 813 | "Show the available speed commands." 814 | (interactive) 815 | (unless org-use-speed-commands 816 | (user-error "Speed commands are not activated, customize `org-use-speed-commands'")) 817 | (with-output-to-temp-buffer "*Help*" 818 | (princ "User-defined Speed commands\n===========================\n") 819 | (mapc #'org-print-speed-command org-speed-commands-user) 820 | (princ "\n") 821 | (princ "Built-in Speed commands\n=======================\n") 822 | (mapc #'org-print-speed-command org-speed-commands-default)) 823 | (with-current-buffer "*Help*" 824 | (setq truncate-lines t))) 825 | 826 | (defun org-speed-move-safe (cmd) 827 | "Execute CMD, but make sure that the cursor always ends up in a headline. 828 | If not, return to the original position and throw an error." 829 | (interactive) 830 | (let ((pos (point))) 831 | (call-interactively cmd) 832 | (unless (and (bolp) (org-at-heading-p)) 833 | (goto-char pos) 834 | (error "Boundary reached while executing %s" cmd)))) 835 | 836 | (defun org-speed-command-activate (keys) 837 | "Hook for activating single-letter speed commands. 838 | `org-speed-commands-default' specifies a minimal command set. 839 | Use `org-speed-commands-user' for further customization." 840 | (when (or (and (bolp) (looking-at org-outline-regexp)) 841 | (and (functionp org-use-speed-commands) 842 | (funcall org-use-speed-commands))) 843 | (cdr (assoc keys (append org-speed-commands-user 844 | org-speed-commands-default))))) 845 | 846 | 847 | ;;; Babel speed keys 848 | 849 | (defvar org-babel-key-prefix "\C-c\C-v" 850 | "The key prefix for Babel interactive key-bindings. 851 | See `org-babel-key-bindings' for the list of interactive Babel 852 | functions which are assigned key bindings, and see 853 | `org-babel-map' for the actual babel keymap.") 854 | 855 | (defvar org-babel-map (make-sparse-keymap) 856 | "The keymap for interactive Babel functions.") 857 | 858 | (defvar org-babel-key-bindings 859 | '(("p" . org-babel-previous-src-block) 860 | ("\C-p" . org-babel-previous-src-block) 861 | ("n" . org-babel-next-src-block) 862 | ("\C-n" . org-babel-next-src-block) 863 | ("e" . org-babel-execute-maybe) 864 | ("\C-e" . org-babel-execute-maybe) 865 | ("o" . org-babel-open-src-block-result) 866 | ("\C-o" . org-babel-open-src-block-result) 867 | ("\C-v" . org-babel-expand-src-block) 868 | ("v" . org-babel-expand-src-block) 869 | ("u" . org-babel-goto-src-block-head) 870 | ("\C-u" . org-babel-goto-src-block-head) 871 | ("g" . org-babel-goto-named-src-block) 872 | ("r" . org-babel-goto-named-result) 873 | ("\C-r" . org-babel-goto-named-result) 874 | ("\C-b" . org-babel-execute-buffer) 875 | ("b" . org-babel-execute-buffer) 876 | ("\C-s" . org-babel-execute-subtree) 877 | ("s" . org-babel-execute-subtree) 878 | ("\C-d" . org-babel-demarcate-block) 879 | ("d" . org-babel-demarcate-block) 880 | ("\C-t" . org-babel-tangle) 881 | ("t" . org-babel-tangle) 882 | ("\C-f" . org-babel-tangle-file) 883 | ("f" . org-babel-tangle-file) 884 | ("\C-c" . org-babel-check-src-block) 885 | ("c" . org-babel-check-src-block) 886 | ("\C-j" . org-babel-insert-header-arg) 887 | ("j" . org-babel-insert-header-arg) 888 | ("\C-l" . org-babel-load-in-session) 889 | ("l" . org-babel-load-in-session) 890 | ("\C-i" . org-babel-lob-ingest) 891 | ("i" . org-babel-lob-ingest) 892 | ("\C-I" . org-babel-view-src-block-info) 893 | ("I" . org-babel-view-src-block-info) 894 | ("\C-z" . org-babel-switch-to-session) 895 | ("z" . org-babel-switch-to-session-with-code) 896 | ("\C-a" . org-babel-sha1-hash) 897 | ("a" . org-babel-sha1-hash) 898 | ("h" . org-babel-describe-bindings) 899 | ("\C-x" . org-babel-do-key-sequence-in-edit-buffer) 900 | ("x" . org-babel-do-key-sequence-in-edit-buffer) 901 | ("k" . org-babel-remove-result-one-or-many) 902 | ("\C-\M-h" . org-babel-mark-block)) 903 | "Alist of key bindings and interactive Babel functions. 904 | This list associates interactive Babel functions 905 | with keys. Each element of this list will add an entry to the 906 | `org-babel-map' using the letter key which is the `car' of the 907 | a-list placed behind the generic `org-babel-key-prefix'.") 908 | 909 | (define-key org-mode-map org-babel-key-prefix org-babel-map) 910 | (pcase-dolist (`(,key . ,def) org-babel-key-bindings) 911 | (define-key org-babel-map key def)) 912 | 913 | (defun org-babel-speed-command-activate (keys) 914 | "Hook for activating single-letter code block commands." 915 | (when (and (bolp) 916 | (let ((case-fold-search t)) (looking-at "[ \t]*#\\+begin_src")) 917 | (eq 'src-block (org-element-type (org-element-at-point)))) 918 | (cdr (assoc keys org-babel-key-bindings)))) 919 | 920 | ;;;###autoload 921 | (defun org-babel-describe-bindings () 922 | "Describe all keybindings behind `org-babel-key-prefix'." 923 | (interactive) 924 | (describe-bindings org-babel-key-prefix)) 925 | 926 | 927 | (provide 'org-keys) 928 | ;;; org-keys.el ends here 929 | --------------------------------------------------------------------------------