From 2f2d32cbbcf0eb439b412c86211cbea271755087 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Mon, 28 Nov 2022 22:20:06 +0100 Subject: [PATCH] add help function, moving readme help content to help function --- README.md | 41 --------------------------- README.org | 37 ------------------------- lisp/my/my.el | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index 20e98e3d..d1cd0f7e 100644 --- a/README.md +++ b/README.md @@ -39,11 +39,7 @@ installed linux packages as requirements inside `sripts/install.sh`. General key bindings and functions -- `M->` (`end-of-buffer`) -- `M-<` (`begin-of-buffer`) -- `C-x b` (`counsel-switch-buffer`) - `C-x |` (`toggle-window-split`) toggle horizontal/vertical of 2 window split -- `C-x h` (`mark-whole-buffer`) - `C-x TAB` (`indent-rigidly`) indent lines in the region - `C-r` (`query-replace-regexp`) replace text - `M-` (`move-line-up`) @@ -51,12 +47,6 @@ General key bindings and functions - `C-x RET f` (`set-buffer-file-coding-system`) e.g. set to =utf-8 - (`decode-coding-region`) e.g. decode to `utf-8` (郭富城Aaron Kwok) - (`diff-buffer-with-file`) show a diff between buffer (current state) and file (saved state) -- `C-h f` (`helpful-callable`) -- `C-h v` (`helpful-variable`) -- `mouse-6` scroll right -- `mouse-7` scroll left -- `mouse-8` (`previous-buffer`) -- `mouse-9` (`next-buffer`) Spelling (flyspell ispell) bindings and functions @@ -69,27 +59,6 @@ Spelling (flyspell ispell) bindings and functions ## Org -Org key bindings and functions - -- `C-c |` (`org-table-create-or-convert-from-region`) convert seperator 1. TAB, 2. comma, 3. space -- `C-u C-c |` (`org-table-create-or-convert-from-region`) convert using comma (CSV) seperator -- `C-u C-u C-c |` (`org-table-create-or-convert-from-region`) convert using TAB -- `C-u C-c |` (`org-table-create-or-convert-from-region`) convert using N spaces -- `C-u REGEX C-c |` (`org-table-create-or-convert-from-region`) convert using regex to match seperator -- `C-c C-x \` (`org-toggle-pretty-entries`) e.g. displays `\pm` as ± - -Org table - -- `S-` (`org-shiftright`) move cell right -- `S-` (`org-shiftleft`) move cell left -- `S-` (`org-shiftup`) move cell up -- `S-` (`org-shiftdown`) move cell down -- (`org-table-blank-field`) clear cell - -Org src block - -- `C-c C-v t` (`org-babel-tangle`) create a file with the content of the block; use in `header:` `:tangle filename` - Org export - `` (`my-org-export-html`) @@ -103,16 +72,6 @@ Org export - `C-c C-e l a` (`my-org-article-latex-export-to-pdf`) PDF-article file, see also Article export - `C-c C-e l t` (`my-org-article-latex-export-to-letter`) PDF-letter file -**Important** - -- For **Gnuplot** source blocks: Do not use `%` inside Gnuplot source - block but `\%` or in format command `\%%` - - % starts a comment in LaTeX and therefore stops further - interpretations like a closing bracket `}` etc. - - Gnuplot graphics are imported as .tex (text, axis, legend) and - .eps (figure) files. - - `\%` `\%%` can also be used for HTML SVG export - diff --git a/README.org b/README.org index 0087acc6..c5fa4b0b 100644 --- a/README.org +++ b/README.org @@ -26,11 +26,7 @@ installed linux packages as requirements inside =sripts/install.sh=. :CUSTOM_ID: packages :END: General key bindings and functions -- =M->= (=end-of-buffer=) -- =M-<= (=begin-of-buffer=) -- =C-x b= (=counsel-switch-buffer=) - =C-x |= (=toggle-window-split=) toggle horizontal/vertical of 2 window split -- =C-x h= (=mark-whole-buffer=) - =C-x TAB= (=indent-rigidly=) indent lines in the region - =C-r= (=query-replace-regexp=) replace text - =M-= (=move-line-up=) @@ -38,12 +34,6 @@ General key bindings and functions - =C-x RET f= (=set-buffer-file-coding-system=) e.g. set to =utf-8 - (=decode-coding-region=) e.g. decode to =utf-8= (郭富城Aaron Kwok) - (=diff-buffer-with-file=) show a diff between buffer (current state) and file (saved state) -- =C-h f= (=helpful-callable=) -- =C-h v= (=helpful-variable=) -- =mouse-6= scroll right -- =mouse-7= scroll left -- =mouse-8= (=previous-buffer=) -- =mouse-9= (=next-buffer=) Spelling (flyspell ispell) bindings and functions - (=flyspell-mode=) toggle spelling @@ -54,24 +44,6 @@ Spelling (flyspell ispell) bindings and functions :PROPERTIES: :CUSTOM_ID: org :END: -Org key bindings and functions -- =C-c |= (=org-table-create-or-convert-from-region=) convert seperator 1. TAB, 2. comma, 3. space -- =C-u C-c |= (=org-table-create-or-convert-from-region=) convert using comma (CSV) seperator -- =C-u C-u C-c |= (=org-table-create-or-convert-from-region=) convert using TAB -- =C-u C-c |= (=org-table-create-or-convert-from-region=) convert using N spaces -- =C-u REGEX C-c |= (=org-table-create-or-convert-from-region=) convert using regex to match seperator -- =C-c C-x \= (=org-toggle-pretty-entries=) e.g. displays =\pm= as ± - -Org table -- =S-= (=org-shiftright=) move cell right -- =S-= (=org-shiftleft=) move cell left -- =S-= (=org-shiftup=) move cell up -- =S-= (=org-shiftdown=) move cell down -- (=org-table-blank-field=) clear cell - -Org src block -- =C-c C-v t= (=org-babel-tangle=) create a file with the content of the block; use in =header:= =:tangle filename= - Org export - == (=my-org-export-html=) - == (=my-org-export-pdf=) @@ -84,15 +56,6 @@ Org export - =C-c C-e l a= (=my-org-article-latex-export-to-pdf=) PDF-article file, see also Article export - =C-c C-e l t= (=my-org-article-latex-export-to-letter=) PDF-letter file -*Important* -- For *Gnuplot* source blocks: Do not use =%= inside Gnuplot source - block but =\%= or in format command =\%%= - - % starts a comment in LaTeX and therefore stops further - interpretations like a closing bracket =}= etc. - - Gnuplot graphics are imported as .tex (text, axis, legend) and - .eps (figure) files. - - =\%= =\%%= can also be used for HTML SVG export - *** Template for an article export (HTML and LaTeX) :PROPERTIES: :CUSTOM_ID: export-article diff --git a/lisp/my/my.el b/lisp/my/my.el index 6e304de6..e4011cbc 100644 --- a/lisp/my/my.el +++ b/lisp/my/my.el @@ -26,6 +26,82 @@ :prefix "my-" :group 'emacs) +(defun my-help () + "Display help" + (interactive) + (let ((buffer-name "*Quick Help*")) + (with-current-buffer (get-buffer-create buffer-name) + (define-derived-mode my-org-help-mode org-mode "Org help mode" + "Major mode for help buffers using Org mode") + (insert "\ + +*General Commands* /S: shift, C: control, M: alt or ⌘/ + + [[save-buffer][Save]] ............... =[C-x]= =[C-s]= Help ..................... =[C-h]= + [[write-file][Save as]] ............ =[C-x]= =[C-w]= [[keyboard-quit][Cancel]] ................... =[C-g]= + [[find-file][Open file]] .......... =[C-x]= =[C-f]= [[undo][Undo]] ..................... =[C-/]= + [[counsel-recentf][Open recent]] ........ =[C-x]= =[C-r]= [[kill-buffer][Close buffer]] ......... =[C-x]= =[k]= + [[dired][Browse directory]] ..... =[C-x]= =[d]= [[counsel-switch-buffer][Switch buffer]] ........ =[C-x]= =[b]= + [[previous-buffer][Previous buffer]] ... =[C-x]= =[left]= [[next-buffer][Next buffer]] ...... =[C-x]= =[right]= + [[save-buffers-kill-terminal][Quit]] ............... =[C-x]= =[C-c]= + + [[swiper][Search]] ................... =[C-s]= [[goto-line][Go to line]] ......... =[M-g]= =[M-g]= + Replace .................. =[M-%]= Execute .................. =[M-x]= + [[begin-of-buffer][Begin of buffer]] .......... =[M-<]= [[end-of-buffer][End of buffer]] ............ =[M->]= + [[beginning-of-line][Begin of line]] ............ =[C-a]= [[end-of-line][End of line]] .............. =[C-e]= + + Mark ................... =[C-spc]= Copy from mark............ =[M-w]= + Kill from mark............ =[C-w]= Kill from cursor.......... =[C-k]= + [[yank][Paste]] .................... =[C-y]= Paste older .............. =[M-y]= + [[mark-whole-buffer][Mark whole buffer]] .... =[C-x]= =[h]= + /[[info:emacs#Key%2520Bindings][Other key bindings]]/ + +*Mouse* + + Scroll right ......... =[mouse-6]= Scroll left .......... =[mouse-7]= + [[previous-buffer][Previous buffer]] ...... =[mouse-8]= [[next-buffer][Next buffer]] .......... =[mouse-9]= + + +*Org* + + [[org-toggle-pretty-entities][Pretty entities]] (\\xyz to UTF8 char) ................ =[C-c]= =[C-x]= =[\\]= + + /TABLE/ + [[org-shiftleft][Move cell left]] ........ =[S-left]= [[org-shiftright][Move cell right]] ....... =[S-right]= + [[org-shiftup][Move cell up]] ............ =[S-up]= [[org-shiftdown][Move cell down]] ......... =[S-down]= + [[org-table-blank-field][Clear cell]] ............. =[space]= + + [[org-table-create-or-convert-from-region][Convert]] seperator (1. tab, 2. comma, 3. space) ........... =[C-c]= =[|]= + [[org-table-create-or-convert-from-region][Convert]] using comma separator ...................... =[C-u]= =[C-c]= =[|]= + [[org-table-create-or-convert-from-region][Convert]] using tab separator .................. =[C-u]= =[C-u]= =[C-c]= =[|]= + [[org-table-create-or-convert-from-region][Convert]] using N spaces separator ........... =[C-u]= =INTEGER= =[C-c]= =[|]= + [[org-table-create-or-convert-from-region][Convert]] using regex to match separator ....... =[C-u]= =REGEX= =[C-c]= =[|]= + + /SRC/ + [[org-babel-tangle][write src block to file]] (=:tangle filename=) ......... =[C-c]= =[C-v]= =[t]= + + For *Gnuplot* source blocks: Do not use =%= but =\\%= or in a format + command =\\%%= + - =%= starts a comment in LaTeX and therefore stops further + interpretations like a closing bracket =}= etc. + - Gnuplot graphics are imported as .tex (text, axis, legend) and + .eps (figure) files. + - =\\%= and =\\%%= can also be used for HTML SVG export + + [[elisp:(my-org-article-help)][Article]] help + +") + (my-org-help-mode) + (goto-char (point-min)) + (local-set-key (kbd "q") 'kill-buffer-and-window) + (local-set-key (kbd "C-g") 'kill-buffer-and-window) + (not-modified) + (read-only-mode)) + (pop-to-buffer buffer-name '((display-buffer-below-selected) + (window-parameters . ((no-other-window . nil))) + (window-height . fit-window-to-buffer))) + (message "C-g - Quit, q - Quit"))) + (defun my-eval-string (string) "Evaluate elisp code stored in a string." (eval (car (read-from-string (format "(progn %s)" string)))))