emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Dynamic keybindings in the manual
@ 2022-09-25 15:30 Timothy
  2022-09-25 17:52 ` Juan Manuel Macías
  2022-09-26  4:52 ` Bastien
  0 siblings, 2 replies; 5+ messages in thread
From: Timothy @ 2022-09-25 15:30 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1850 bytes --]

Hi All,

(skip to the rule if you’re not interested in a preamble)

In the recent discussion about potentially no longer generating `org-release' in
the Makefile, it was mentioned that `orgcard.tex' may be a bit of a blocker to
that.

This prompted me to take a look at `orgcard.tex' and I was surprised to discover
that it’s TeX TeX, not even LaTeX, and it has hard-coded keybindings.

Neither of those things seemed great to me, so I thought I’d try my hand at
whipping up an Org version. In doing so I made a macro that inserts the
appropriate keybinding.

┌────
│ #+macro: key (eval (format "{{{kbd(%s%s)}}}" (if $2 (concat $1 " ") "") (or (org-string-nw-p (key-description (or (where-is-internal (intern (string-trim (or $2 $1))) nil t) ))) (format "M-x %s" (string-trim (or $2 $1))))))
└────

――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Looking at the manual, I see that it too has hardcoded keybindings. Considering
that occasional changes can easily slip by (see
<https://list.orgmode.org/20220916214715.109658-1-laalsaas@systemli.org>, just one
week ago), I think it would make sense to adopt a similar approach.

Instead of having
┌────
│ {{{kbd(C-c C-r)}}} (~org-reveal~)
└────


We could have
┌────
│ {{{cmd(org-reveal)}}}
└────


With the use of the earlier `key' macro and
┌────
│ #+macro: cmd {{{key($1)}}} (~$1~)
└────

While I think this could be a good idea, I don’t think I’m likely to get to this
any time soon, so I’m shooting this off to the ML in case other people are
interested.

All the best,
Timothy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dynamic keybindings in the manual
  2022-09-25 15:30 Dynamic keybindings in the manual Timothy
@ 2022-09-25 17:52 ` Juan Manuel Macías
  2022-09-26  4:52 ` Bastien
  1 sibling, 0 replies; 5+ messages in thread
From: Juan Manuel Macías @ 2022-09-25 17:52 UTC (permalink / raw)
  To: Timothy; +Cc: orgmode

[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]

Hi, Timothy,

Timothy writes:

> This prompted me to take a look at `orgcard.tex' and I was surprised to discover
> that it’s TeX TeX, not even LaTeX, and it has hard-coded keybindings.

Wow, it's in plainTeX... I've tried cleaning that document and removing
most of the code, as it's unnecessary. I've left just the sections in a
new LaTeX document, and redefined the \key command like so:

\newcommand\key[2]{%
  #1 \quad%
  \{\{\{kbd(#2)\}\}\}\par}

so that a line like this:

\key{rotate current subtree between states}{TAB}

produce in the PDF this, literally:

rotate current subtree between states {{{kbd(TAB)}}}

I don't know if this could help to copy the text from the PDF, create an
Org document and then manipulate those macros. In case this helps, I'm
attaching the new tex document here.

Best regards,

Juan Manuel

--
--
------------------------------------------------------
Juan Manuel Macías

https://juanmanuelmacias.com

https://lunotipia.juanmanuelmacias.com

https://gnutas.juanmanuelmacias.com


[-- Attachment #2: orgcard-clean.tex --]
[-- Type: application/x-tex, Size: 14555 bytes --]

% -*- coding: utf-8 -*-

\documentclass{article}

\parindent=0em

\newcommand\key[2]{%
  #1 \quad %
  \{\{\{kbd(#2)\}\}\}\par}

\begin{document}

\section{Getting Started}
\key{To read the on-line documentation try}{M-x org-info}

\section{Visibility Cycling}

\key{rotate current subtree between states}{TAB}
\key{rotate entire buffer between states}{S-TAB}
\key{restore property-dependent startup visibility}{C-u C-u TAB}
\key{show the whole file, including drawers}{C-u C-u C-u TAB}
\key{reveal context around point}{C-c C-r}
\key{toggle indented view}{M-x org-indent-mode}

\section{Motion}

\key{next/previous heading}{C-c C-n/p}
\key{next/previous heading, same level}{C-c C-f/b}
\key{backward to higher level heading}{C-c C-u}
\key{jump to another place in document}{C-c C-j}
\key{previous/next plain list item}{S-UP/DOWN}

\section{Structure Editing}

\key{insert new heading/item at current level}{M-RET}
\key{insert new heading after subtree}{C-RET}
\key{insert new TODO entry/checkbox item}{M-S-RET}
\key{insert TODO entry/ckbx after subtree}{C-S-RET}
\key{turn (head)line into item, cycle item type}{C-c -}
\key{turn item/line into headline}{C-c *}
\key{promote/demote heading}{M-LEFT/RIGHT}
\key{promote/demote current subtree}{M-S-LEFT/RIGHT}
\key{move subtree/list item up/down}{M-UP/DOWN}
\key{move the line at point up/down}{M-S-UP/DOWN}
\key{sort subtree/region/plain-list}{C-c \^{}}
\key{clone a subtree}{C-c C-x c}
\key{copy visible parts of the region}{C-c C-x v}
\key{kill/copy subtree}{C-c C-x C-w/M-w}
\key{yank subtree}{C-c C-x C-y or C-y}
\key{narrow buffer to subtree / widen}{C-x n s/w}

\section{Capture - Refile - Archiving}
\key{capture a new item (C-u C-u = goto last)}{C-c c}
\key{refile subtree (C-u C-u = goto last)}{C-c C-w}
\key{archive subtree using the default command}{C-c C-x C-a}
\key{move subtree to archive file}{C-c C-x C-s}
\key{toggle ARCHIVE tag / to ARCHIVE sibling}{C-c C-x a/A}
\key{force cycling of an ARCHIVEd tree}{C-TAB}

\section{Filtering and Sparse Trees}

\key{construct a sparse tree by various criteria}{C-c /}
\key{view TODO's in sparse tree}{C-c / t/T}
\key{global TODO list in agenda mode}{C-c a t}

\section{Tables}

{\bf Creating a table}

%\key{insert a new Org-mode table}{M-x org-table-create}
\key{just start typing, e.g.}{|Name|Phone|Age RET |- TAB}
\key{convert region to table}{C-c |}
\key{... separator at least 3 spaces}{C-3 C-c |}

{\bf Commands available inside tables}

The following commands work when the cursor is {\it inside a table}.
Outside of tables, the same keys may have other functionality.

{\bf Re-aligning and field motion}

\key{re-align the table without moving the cursor}{C-c C-c}
\key{re-align the table, move to next field}{TAB}
\key{move to previous field}{S-TAB}
\key{re-align the table, move to next row}{RET}
\key{move to beginning/end of field}{M-a/e}

{\bf Row and column editing}

\key{move the current column left}{M-LEFT/RIGHT}
\key{kill the current column}{M-S-LEFT}
\key{insert new column to left of cursor position}{M-S-RIGHT}

\key{move the current row up/down}{M-UP/DOWN}
\key{kill the current row or horizontal line}{M-S-UP}
\key{insert new row above the current row}{M-S-DOWN}
\key{insert hline below (\texttt{C-u} : above) current row}{C-c -}
\key{insert hline and move to line below it}{C-c RET}
\key{sort lines in region}{C-c \^{}}

{\bf Regions}

\key{cut/copy/paste rectangular region}{C-c C-x C-w/M-w/C-y}
%\key{copy rectangular region}{C-c C-x M-w}
%\key{paste rectangular region}{C-c C-x C-y}

{\bf Miscellaneous}

\key{to limit column width to \texttt{N} characters, use}{...| <N> |...}
\key{edit the current field in a separate window}{C-c `}
\key{make current field fully visible}{C-u TAB}
\key{export as tab-separated file}{M-x org-table-export}
\key{import tab-separated file}{M-x org-table-import}
\key{sum numbers in current column/rectangle}{C-c +}

{\bf Tables created with the \texttt{table.el} package}

\key{insert a new \texttt{table.el} table}{C-c ~}
\key{recognize existing table.el table}{C-c C-c}
\key{convert table (Org-mode $\leftrightarrow$ table.el)}{C-c ~}

{\bf Spreadsheet}

Formulas typed in field are executed by \texttt{TAB},
\texttt{RET} and \texttt{C-c C-c}.  \texttt{=} introduces a column
formula, \texttt{:=} a field formula.

\key{Example: Add Col1 and Col2}{|=\$1+\$2      |}
\key{... with printf format specification}{|=\$1+\$2;\%.2f|}
\key{... with constants from constants.el}{|=\$1/\$c/\$cm |}
\key{sum from 2nd to 3rd hline}{|:=vsum(@II..@III)|}
\key{apply current column formula}{| = |}

\key{set and eval column formula}{C-c =}
\key{set and eval field formula}{C-u C-c =}
\key{re-apply all stored equations to current line}{C-c *}
\key{re-apply all stored equations to entire table}{C-u C-c *}
\key{iterate table to stability}{C-u C-u C-c *}
\key{rotate calculation mark through \# * ! \^ \_ \$}{C-\#}
\key{show line, column, formula reference}{C-c ?}
\key{toggle grid / debugger}{C-c \}/\{}

{\it Formula Editor}

\key{edit formulas in separate buffer}{C-c '}
\key{exit and install new formulas}{C-c C-c}
\key{exit, install, and apply new formulas}{C-u C-c C-c}
\key{abort}{C-c C-q}
\key{toggle reference style}{C-c C-r}
\key{pretty-print Lisp formula}{TAB}
\key{complete Lisp symbol}{M-TAB}
\key{shift reference point}{S-cursor}
\key{shift test line for column references}{M-up/down}
\key{scroll the window showing the table}{M-S-up/down}
\key{toggle table coordinate grid}{C-c \}}

\section{Links}

\key{globally store link to the current location}{C-c l}
\key{insert a link (TAB completes stored links)}{C-c C-l}
\key{insert file link with file name completion}{C-u C-c C-l}
\key{edit (also hidden part of) link at point}{C-c C-l}

\key{open file links in emacs}{C-c C-o}
\key{...force open in emacs/other window}{C-u C-c C-o}
\key{open link at point}{mouse-1/2}
\key{...force open in emacs/other window}{mouse-3}
\key{record a position in mark ring}{C-c \%}
\key{jump back to last followed link(s)}{C-c \&}
\key{find next link}{C-c C-x C-n}
\key{find previous link}{C-c C-x C-p}
\key{edit code snippet of file at point}{C-c '}
\key{toggle inline display of linked images}{C-c C-x C-v}

\section{Working with Code (Babel)}

\key{execute code block at point}{C-c C-c}
\key{open results of code block at point}{C-c C-o}
\key{check code block at point for errors}{C-c C-v c}
\key{insert a header argument with completion}{C-c C-v j}
\key{view expanded body of code block at point}{C-c C-v v}
\key{view information about code block at point}{C-c C-v I}
\key{go to named code block}{C-c C-v g}
\key{go to named result}{C-c C-v r}
\key{go to the head of the current code block}{C-c C-v u}
\key{go to the next code block}{C-c C-v n}
\key{go to the previous code block}{C-c C-v p}
\key{demarcate a code block}{C-c C-v d}
\key{execute next key sequence in code edit buffer}{C-c C-v x}
\key{execute all code blocks in current buffer}{C-c C-v b}
\key{execute all code blocks in current subtree}{C-c C-v s}
\key{tangle code blocks in current file}{C-c C-v t}
\key{tangle code blocks in supplied file}{C-c C-v f}
\key{ingest all code blocks in supplied file into the Library of Babel}{C-c C-v i}
\key{switch to the session of the current code block}{C-c C-v z}
\key{load the current code block into a session}{C-c C-v l}
\key{view sha1 hash of the current code block}{C-c C-v a}

\section{Completion and Template Insertion}

In-buffer completion completes TODO keywords at headline start, TeX
macros after ``{\tt \\}'', option keywords after ``{\tt \#-}'', TAGS
after  ``{\tt :}'', and dictionary words elsewhere.

\key{complete word at point}{M-TAB}
\key{structure template (insert or wrap region)}{C-c C-,}

\section{TODO Items and Checkboxes}

\key{rotate the state of the current item}{C-c C-t}
\key{select next/previous state}{\quad\quad S-LEFT/RIGHT}
\key{select next/previous set}{\quad\quad\quad C-S-LEFT/RIGHT}
\key{toggle ORDERED property}{C-c C-x o}

\key{view TODO items in a sparse tree}{C-c / t}
\key{view 3rd TODO keyword's sparse tree}{C-3 C-c / t}
\key{set the priority of the current item}{C-c , [ABC]}
\key{remove priority cookie from current item}{C-c , SPC}
\key{raise/lower priority of current item}{S-UP/DOWN}

\key{insert new checkbox item in plain list}{M-S-RET}
\key{toggle checkbox(es) in region/entry/at point}{C-c C-x C-b}
\key{toggle checkbox at point}{C-c C-c}
%\key{checkbox statistics cookies: insert {\tt [/]} or {\tt [\%]}}{}
\key{update checkbox statistics (\texttt{C-u} : whole file)}{C-c \#}

\section{Tags}

\key{set tags for current heading}{C-c C-q}
\key{realign tags in all headings}{C-u C-c C-q}
\key{create sparse tree with matching tags}{C-c}
\key{globally (agenda) match tags at cursor}{C-c C-o}

\section{Properties and Column View}

\key{set property/effort}{C-c C-x p/e}
\key{special commands in property lines}{C-c C-c}
\key{next/previous allowed value}{S-LEFT/RIGHT}
\key{turn on column view}{C-c C-x C-c}
\key{capture columns view in dynamic block}{C-c C-x x}

\key{quit column view}{q}
\key{show full value}{v}
\key{edit value}{e}
\key{next/previous allowed value}{n/p or S-LEFT/RIGHT}
\key{edit allowed values list}{a}
\key{make column wider/narrower}{> / <}
\key{move column left/right}{M-LEFT/RIGHT}
\key{add new column}{M-S-RIGHT}
\key{Delete current column}{M-S-LEFT}


\section{Timestamps}

\key{prompt for date and insert timestamp}{C-c .}
\key{like \texttt{C-c .} but insert date and time format}{C-u C-c .}
\key{like \texttt{C-c .} but make stamp inactive}{C-c !} % FIXME
\key{insert DEADLINE timestamp}{C-c C-d}
\key{insert SCHEDULED timestamp}{C-c C-s}
\key{create sparse tree with all deadlines due}{C-c / d}
\key{the time between 2 dates in a time range}{C-c C-y}
\key{change timestamp at cursor $\pm 1$ day}{\quad\quad\quad\quad S-RIGHT/LEFT}
\key{change year/month/day at cursor by $\pm 1$}{S-UP/DOWN}
\key{access the calendar for the current date}{C-c >}
\key{insert timestamp matching date in calendar}{C-c <}
\key{access agenda for current date}{C-c C-o}
\key{select date while prompted}{mouse-1/RET}
%\key{... select date in calendar}{mouse-1/RET}
%\key{... scroll calendar back/forward one month}{< / >}
%\key{... forward/backward one day}{S-LEFT/RIGHT}
%\key{... forward/backward one week}{S-UP/DOWN}
%\key{... forward/backward one month}{M-S-LEFT/RIGHT}
\key{toggle custom format display for dates/times}{C-c C-x C-t}

{\bf Clocking time}

\key{start clock on current item}{C-c C-x C-i}
\key{stop/cancel clock on current item}{C-c C-x C-o/x}
\key{display total subtree times}{C-c C-x C-d}
\key{remove displayed times}{C-c C-c}
\key{insert/update table with clock report}{C-c C-x C-x}

\section{Agenda Views}

\key{add/move current file to front of agenda}{C-c [}
\key{remove current file from your agenda}{C-c ]}
\key{cycle through agenda file list}{C-'}
\key{set/remove restriction lock}{C-c C-x </>}

\key{compile agenda for the current week}{C-c a a}
\key{compile global TODO list}{C-c a t}
\key{compile TODO list for specific keyword}{C-c a T}
\key{match tags, TODO kwds, properties}{C-c a m}
\key{match only in TODO entries}{C-c a M}
\key{find stuck projects}{C-c a \#}
\key{configure custom commands}{C-c a C}
%\key{configure stuck projects}{C-c a !}
\key{agenda for date at cursor}{C-c C-o}

{\bf Commands available in an agenda buffer}

{\bf View Org file}

\key{show original location of item}{SPC/mouse-3}
%\key{... also available with}{mouse-3}
\key{show and recenter window}{L}
\key{goto original location in other window}{TAB/mouse-2}
%\key{... also available with}{mouse-2}
\key{goto original location, delete other windows}{RET}
\key{show subtree in indirect buffer, ded.\ frame}{C-c C-x b}
\key{toggle follow-mode}{F}

{\bf Change display}

\key{delete other windows}{o}
\key{view mode dispatcher}{v}
\key{switch to day/week/month/year/def view}{d w vm vy vSP}
\key{toggle diary entries / time grid / habits}{D / G / K}
\key{toggle entry text / clock report}{E / R}
\key{toggle display of logbook entries}{l / v l/L/c}
\key{toggle inclusion of archived trees/files}{v a/A}
\key{refresh agenda buffer with any changes}{r / g}
\key{filter with respect to a tag}{/}
\key{save all org-mode buffers}{s}
\key{display next/previous day,week,...}{f / b}
\key{goto today / some date (prompt)}{. / j}

{\bf Remote editing}

\key{digit argument}{0-9}
\key{change state of current TODO item}{t}
\key{kill item and source}{C-k}
\key{archive default}{\$ / a}
\key{refile the subtree}{C-c C-w}
\key{set/show tags of current headline}{: / T}
\key{set effort property (prefix=nth)}{e}
\key{set / compute priority of current item}{, / P}
\key{raise/lower priority of current item}{S-UP/DOWN}
\key{run an attachment command}{C-c C-a}
\key{schedule/set deadline for this item}{C-c C-s/d}
\key{change timestamp one day earlier/later}{S-LEFT/RIGHT}
\key{change timestamp to today}{>}
\key{insert new entry into diary}{i}
\key{start/stop/cancel the clock on current item}{I / O / X}
\key{jump to running clock entry}{J}
\key{mark / unmark / execute bulk action}{m / u / B}

{\bf Misc}

\key{follow one or offer all links in current entry}{C-c C-o}

{\bf Calendar commands}

\key{find agenda cursor date in calendar}{c}
\key{compute agenda for calendar cursor date}{c}
\key{show phases of the moon}{M}
\key{show sunrise/sunset times}{S}
\key{show holidays}{H}
\key{convert date to other calendars}{C}

{\bf Quit and Exit}

\key{quit agenda, remove agenda buffer}{q}
\key{exit agenda, remove all agenda buffers}{x}

\section{LaTeX and cdlatex-mode}

\key{preview LaTeX fragment}{C-c C-x C-l}
\key{expand abbreviation (cdlatex-mode)}{TAB}
\key{insert/modify math symbol (cdlatex-mode)}{` / '}
\key{insert citation using RefTeX}{C-c C-x [}

\section{Exporting and Publishing}

Exporting creates files with extensions {\it .txt\/} and {\it .html\/}
in the current directory.  Publishing puts the resulting file into
some other place.

\key{export/publish dispatcher}{C-c C-e}

\key{toggle asynchronous export}{C-c C-e C-a}
\key{toggle body/visible only export}{C-c C-e C-b/v}
\key{toggle subtree export}{C-c C-e C-s}
\key{insert template of export options}{C-c C-e \#}

\key{toggle fixed width for entry or region}{C-c :}
\key{toggle pretty display of scripts, entities}{C-c C-x {\tt\char`\\}}

Lines starting with \texttt{\#} and subtrees starting with COMMENT are
never exported.

\key{toggle COMMENT keyword on entry}{C-c ;}

\section{Dynamic Blocks}

\key{update dynamic block at point}{C-c C-x C-u}
\key{update all dynamic blocks}{C-u C-c C-x C-u}

\end{document}





%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dynamic keybindings in the manual
  2022-09-25 15:30 Dynamic keybindings in the manual Timothy
  2022-09-25 17:52 ` Juan Manuel Macías
@ 2022-09-26  4:52 ` Bastien
  2022-09-26  4:55   ` changing orgcard.tex (was: Dynamic keybindings in the manual) Timothy
  1 sibling, 1 reply; 5+ messages in thread
From: Bastien @ 2022-09-26  4:52 UTC (permalink / raw)
  To: Timothy; +Cc: emacs-orgmode

Hi Timothy,

Timothy <orgmode@tec.tecosaur.net> writes:

> In the recent discussion about potentially no longer generating `org-release' in
> the Makefile, it was mentioned that `orgcard.tex' may be a bit of a blocker to
> that.

If we are to make changes against orgcard.tex we should be careful to
stick to GNU conventions regarding creating refcards.

Also, maybe some improvements can be shared upstream against the Emacs
refcard?

-- 
 Bastien


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: changing orgcard.tex (was: Dynamic keybindings in the manual)
  2022-09-26  4:52 ` Bastien
@ 2022-09-26  4:55   ` Timothy
  2022-09-28  6:16     ` changing orgcard.tex Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Timothy @ 2022-09-26  4:55 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Timothy, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 531 bytes --]

Hi Bastien,

> If we are to make changes against orgcard.tex we should be careful to
> stick to GNU conventions regarding creating refcards.

Might you have a link to those conventions on hand?

> Also, maybe some improvements can be shared upstream against the Emacs
> refcard?

Possibly, while keybindings /rarely/ change, occasionally they do, and so I
personally consider it a significant improvement having them dynamically
determined. After I finish with this we could ask emacs-devel what they think.

All the best,
Timothy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: changing orgcard.tex
  2022-09-26  4:55   ` changing orgcard.tex (was: Dynamic keybindings in the manual) Timothy
@ 2022-09-28  6:16     ` Bastien
  0 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2022-09-28  6:16 UTC (permalink / raw)
  To: Timothy; +Cc: emacs-orgmode

Hi Timothy,

Timothy <orgmode@tec.tecosaur.net> writes:

>> If we are to make changes against orgcard.tex we should be careful to
>> stick to GNU conventions regarding creating refcards.
>
> Might you have a link to those conventions on hand?

I meant sticking to the .tex commands used for Emacs refcard and its
visual output.

-- 
 Bastien


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-28  6:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-25 15:30 Dynamic keybindings in the manual Timothy
2022-09-25 17:52 ` Juan Manuel Macías
2022-09-26  4:52 ` Bastien
2022-09-26  4:55   ` changing orgcard.tex (was: Dynamic keybindings in the manual) Timothy
2022-09-28  6:16     ` changing orgcard.tex Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).