Merge branch 'next'
This commit is contained in:
commit
5dc18f0c43
|
@ -184,62 +184,6 @@ If it is a directory, `ob-clojure-literate' will try to create Clojure project a
|
|||
(lambda (cons) (if (eq (car cons) :session) t cons))
|
||||
org-babel-default-header-args:clojure)))))
|
||||
|
||||
;;; Support `org-babel-initiate-session' / [C-c C-v z] to initialize Clojure session.
|
||||
|
||||
(defun org-babel-clojure-initiate-session (&optional session _params)
|
||||
"Initiate a session named SESSION according to PARAMS."
|
||||
(when (and session (not (string= session "none")))
|
||||
(save-window-excursion
|
||||
(unless (org-babel-comint-buffer-livep session)
|
||||
;; CIDER jack-in to the Clojure project directory.
|
||||
(cond
|
||||
((eq org-babel-clojure-backend 'cider)
|
||||
(require 'cider)
|
||||
(let ((session-buffer (save-window-excursion
|
||||
(cider-jack-in t)
|
||||
(current-buffer))))
|
||||
(if (org-babel-comint-buffer-livep session-buffer)
|
||||
(progn (sit-for .25) session-buffer))))
|
||||
((eq org-babel-clojure-backend 'slime)
|
||||
(error "Session evaluation with SLIME is not supported"))
|
||||
(t
|
||||
(error "Session initiate failed")))
|
||||
)
|
||||
(get-buffer session)
|
||||
)))
|
||||
|
||||
(defun org-babel-prep-session:clojure (session params)
|
||||
"Prepare SESSION according to the header arguments specified in PARAMS."
|
||||
(let* ((session (org-babel-clojure-initiate-session session))
|
||||
(var-lines (org-babel-variable-assignments:clojure params)))
|
||||
(when session
|
||||
(org-babel-comint-in-buffer session
|
||||
(mapc (lambda (var)
|
||||
(insert var) (comint-send-input nil t)
|
||||
(org-babel-comint-wait-for-output session)
|
||||
(sit-for .1) (goto-char (point-max))) var-lines)))
|
||||
session))
|
||||
|
||||
(defun org-babel-clojure-var-to-clojure (var)
|
||||
"Convert src block's `VAR' to Clojure variable."
|
||||
(if (listp var)
|
||||
(replace-regexp-in-string "(" "'(" var)
|
||||
(cond
|
||||
((stringp var)
|
||||
;; wrap org-babel passed in header argument value with quote in Clojure.
|
||||
(format "\"%s\"" var))
|
||||
(t
|
||||
(format "%s" var))))
|
||||
)
|
||||
|
||||
(defun org-babel-variable-assignments:clojure (params)
|
||||
"Return a list of Clojure statements assigning the block's variables in `PARAMS'."
|
||||
(mapcar
|
||||
(lambda (pair)
|
||||
(format "(def %s %s)"
|
||||
(car pair)
|
||||
(org-babel-clojure-var-to-clojure (cdr pair))))
|
||||
(org-babel--get-vars params)))
|
||||
|
||||
;;; Support header arguments :results graphics :file "image.png" by inject Clojure code.
|
||||
(defun ob-clojure-literate-inject-code (args)
|
||||
|
|
|
@ -1554,6 +1554,30 @@ you, configure the option ~org-table-auto-blank-field~.
|
|||
#+findex: org-table-kill-row
|
||||
Kill the current row or horizontal line.
|
||||
|
||||
- {{{kbd(S-UP)}}} (~org-table-move-cell-up~) ::
|
||||
|
||||
#+kindex: S-UP
|
||||
#+findex: org-table-move-cell-up
|
||||
Move cell up by swapping with adjacent cell.
|
||||
|
||||
- {{{kbd(S-DOWN)}}} (~org-table-move-cell-down~) ::
|
||||
|
||||
#+kindex: S-DOWN
|
||||
#+findex: org-table-move-cell-down
|
||||
Move cell down by swapping with adjacent cell.
|
||||
|
||||
- {{{kbd(S-LEFT)}}} (~org-table-move-cell-left~) ::
|
||||
|
||||
#+kindex: S-LEFT
|
||||
#+findex: org-table-move-cell-left
|
||||
Move cell left by swapping with adjacent cell.
|
||||
|
||||
- {{{kbd(S-RIGHT)}}} (~org-table-move-cell-right~) ::
|
||||
|
||||
#+kindex: S-RIGHT
|
||||
#+findex: org-table-move-cell-right
|
||||
Move cell right by swapping with adjacent cell.
|
||||
|
||||
- {{{kbd(M-S-DOWN)}}} (~org-table-insert-row~) ::
|
||||
|
||||
#+kindex: M-S-DOWN
|
||||
|
@ -3265,7 +3289,7 @@ current buffer:
|
|||
points to the current article, or, in some Gnus buffers, to the
|
||||
group. The description is constructed according to the variable
|
||||
~org-email-link-description-format~. By default, it refers to
|
||||
the addressee and the subject, possibly truncated.
|
||||
the addressee and the subject.
|
||||
|
||||
- /Web browsers: W3, W3M and EWW/ ::
|
||||
|
||||
|
@ -5363,7 +5387,7 @@ optional. The individual parts have the following meaning:
|
|||
| =X= | Checkbox status, =[X]= if all children are =[X]=. |
|
||||
| =X/= | Checkbox status, =[n/m]=. |
|
||||
| =X%= | Checkbox status, =[n%]=. |
|
||||
| =:= | Sum times, HH:MM, plain numbers are hours. |
|
||||
| =:= | Sum times, HH:MM, plain numbers are minutes. |
|
||||
| =:min= | Smallest time value in column. |
|
||||
| =:max= | Largest time value. |
|
||||
| =:mean= | Arithmetic mean of time values. |
|
||||
|
@ -5610,6 +5634,11 @@ This dynamic block has the following parameters:
|
|||
When non-~nil~, skip rows where the only non-empty specifier of
|
||||
the column view is =ITEM=.
|
||||
|
||||
- =:exclude-tags= ::
|
||||
|
||||
List of tags to exclude from column view table: entries with
|
||||
these tags will be excluded from the column view.
|
||||
|
||||
- =:indent= ::
|
||||
|
||||
When non-~nil~, indent each =ITEM= field according to its level.
|
||||
|
@ -6598,8 +6627,9 @@ be selected:
|
|||
|
||||
- =:step= ::
|
||||
|
||||
Set to ~week~ or ~day~ to split the table into chunks. To use
|
||||
this, ~:block~ or ~:tstart~, ~:tend~ are needed.
|
||||
Set to =day=, =week=, =month= or =year= to split the table into
|
||||
chunks. To use this, either =:block=, or =:tstart= and =:tend=
|
||||
are required.
|
||||
|
||||
- =:stepskip0= ::
|
||||
|
||||
|
@ -7570,91 +7600,97 @@ The following commands deal with attachments:
|
|||
After these keys, a list of commands is displayed and you must
|
||||
press an additional key to select a command:
|
||||
|
||||
- {{{kbd(a)}}} (~org-attach-attach~) ::
|
||||
- {{{kbd(a)}}} (~org-attach-attach~) ::
|
||||
|
||||
#+kindex: C-c C-a a
|
||||
#+findex: org-attach-attach
|
||||
#+vindex: org-attach-method
|
||||
Select a file and move it into the task's attachment
|
||||
directory. The file is copied, moved, or linked, depending
|
||||
on ~org-attach-method~. Note that hard links are not
|
||||
supported on all systems.
|
||||
#+kindex: C-c C-a a
|
||||
#+findex: org-attach-attach
|
||||
#+vindex: org-attach-method
|
||||
Select a file and move it into the task's attachment directory.
|
||||
The file is copied, moved, or linked, depending on
|
||||
~org-attach-method~. Note that hard links are not supported on
|
||||
all systems.
|
||||
|
||||
- {{{kbd(c)}}}/{{{kbd(m)}}}/{{{kbd(l)}}} ::
|
||||
- {{{kbd(c)}}}/{{{kbd(m)}}}/{{{kbd(l)}}} ::
|
||||
|
||||
#+kindex: C-c C-a c
|
||||
#+kindex: C-c C-a m
|
||||
#+kindex: C-c C-a l
|
||||
Attach a file using the copy/move/link method. Note that
|
||||
hard links are not supported on all systems.
|
||||
#+kindex: C-c C-a c
|
||||
#+kindex: C-c C-a m
|
||||
#+kindex: C-c C-a l
|
||||
Attach a file using the copy/move/link method. Note that hard
|
||||
links are not supported on all systems.
|
||||
|
||||
- {{{kbd(n)}}} (~org-attach-new~) ::
|
||||
- {{{kbd(b)}}} (~org-attach-buffer~) ::
|
||||
|
||||
#+kindex: C-c C-a n
|
||||
#+findex: org-attach-new
|
||||
Create a new attachment as an Emacs buffer.
|
||||
#+kindex: C-c C-a b
|
||||
#+findex: org-attach-buffer
|
||||
Select a buffer and save it as a file in the task's attachment
|
||||
directory.
|
||||
|
||||
- {{{kbd(z)}}} (~org-attach-sync~) ::
|
||||
- {{{kbd(n)}}} (~org-attach-new~) ::
|
||||
|
||||
#+kindex: C-c C-a z
|
||||
#+findex: org-attach-sync
|
||||
Synchronize the current task with its attachment directory, in case
|
||||
you added attachments yourself.
|
||||
#+kindex: C-c C-a n
|
||||
#+findex: org-attach-new
|
||||
Create a new attachment as an Emacs buffer.
|
||||
|
||||
- {{{kbd(o)}}} (~org-attach-open~) ::
|
||||
- {{{kbd(z)}}} (~org-attach-sync~) ::
|
||||
|
||||
#+kindex: C-c C-a o
|
||||
#+findex: org-attach-open
|
||||
#+vindex: org-file-apps
|
||||
Open current task's attachment. If there is more than one,
|
||||
prompt for a file name first. Opening follows the rules set
|
||||
by ~org-file-apps~. For more details, see the information
|
||||
on following hyperlinks (see [[*Handling Links]]).
|
||||
#+kindex: C-c C-a z
|
||||
#+findex: org-attach-sync
|
||||
Synchronize the current task with its attachment directory, in
|
||||
case you added attachments yourself.
|
||||
|
||||
- {{{kbd(O)}}} (~org-attach-open-in-emacs~) ::
|
||||
- {{{kbd(o)}}} (~org-attach-open~) ::
|
||||
|
||||
#+kindex: C-c C-a O
|
||||
#+findex: org-attach-open-in-emacs
|
||||
Also open the attachment, but force opening the file in
|
||||
Emacs.
|
||||
#+kindex: C-c C-a o
|
||||
#+findex: org-attach-open
|
||||
#+vindex: org-file-apps
|
||||
Open current task's attachment. If there is more than one,
|
||||
prompt for a file name first. Opening follows the rules set by
|
||||
~org-file-apps~. For more details, see the information on
|
||||
following hyperlinks (see [[*Handling Links]]).
|
||||
|
||||
- {{{kbd(f)}}} (~org-attach-reveal~) ::
|
||||
- {{{kbd(O)}}} (~org-attach-open-in-emacs~) ::
|
||||
|
||||
#+kindex: C-c C-a f
|
||||
#+findex: org-attach-reveal
|
||||
Open the current task's attachment directory.
|
||||
#+kindex: C-c C-a O
|
||||
#+findex: org-attach-open-in-emacs
|
||||
Also open the attachment, but force opening the file in Emacs.
|
||||
|
||||
- {{{kbd(F)}}} (~org-attach-reveal-in-emacs~) ::
|
||||
- {{{kbd(f)}}} (~org-attach-reveal~) ::
|
||||
|
||||
#+kindex: C-c C-a F
|
||||
#+findex: org-attach-reveal-in-emacs
|
||||
Also open the directory, but force using Dired in Emacs.
|
||||
#+kindex: C-c C-a f
|
||||
#+findex: org-attach-reveal
|
||||
Open the current task's attachment directory.
|
||||
|
||||
- {{{kbd(d)}}} (~org-attach-delete-one~) ::
|
||||
- {{{kbd(F)}}} (~org-attach-reveal-in-emacs~) ::
|
||||
|
||||
#+kindex: C-c C-a d
|
||||
Select and delete a single attachment.
|
||||
#+kindex: C-c C-a F
|
||||
#+findex: org-attach-reveal-in-emacs
|
||||
Also open the directory, but force using Dired in Emacs.
|
||||
|
||||
- {{{kbd(D)}}} (~org-attach-delete-all~) ::
|
||||
- {{{kbd(d)}}} (~org-attach-delete-one~) ::
|
||||
|
||||
#+kindex: C-c C-a D
|
||||
Delete all of a task's attachments. A safer way is to open
|
||||
the directory in Dired and delete from there.
|
||||
#+kindex: C-c C-a d
|
||||
Select and delete a single attachment.
|
||||
|
||||
- {{{kbd(s)}}} (~org-attach-set-directory~) ::
|
||||
- {{{kbd(D)}}} (~org-attach-delete-all~) ::
|
||||
|
||||
#+kindex: C-c C-a s
|
||||
#+cindex: @samp{ATTACH_DIR}, property
|
||||
Set a specific directory as the entry's attachment
|
||||
directory. This works by putting the directory path into
|
||||
the =ATTACH_DIR= property.
|
||||
#+kindex: C-c C-a D
|
||||
Delete all of a task's attachments. A safer way is to open the
|
||||
directory in Dired and delete from there.
|
||||
|
||||
- {{{kbd(i)}}} (~org-attach-set-inherit~) ::
|
||||
- {{{kbd(s)}}} (~org-attach-set-directory~) ::
|
||||
|
||||
#+kindex: C-c C-a i
|
||||
#+cindex: @samp{ATTACH_DIR_INHERIT}, property
|
||||
Set the =ATTACH_DIR_INHERIT= property, so that children use
|
||||
the same directory for attachments as the parent does.
|
||||
#+kindex: C-c C-a s
|
||||
#+cindex: @samp{ATTACH_DIR}, property
|
||||
Set a specific directory as the entry's attachment directory.
|
||||
This works by putting the directory path into the =ATTACH_DIR=
|
||||
property.
|
||||
|
||||
- {{{kbd(i)}}} (~org-attach-set-inherit~) ::
|
||||
|
||||
#+kindex: C-c C-a i
|
||||
#+cindex: @samp{ATTACH_DIR_INHERIT}, property
|
||||
Set the =ATTACH_DIR_INHERIT= property, so that children use the
|
||||
same directory for attachments as the parent does.
|
||||
|
||||
#+cindex: attach from Dired
|
||||
#+findex: org-attach-dired-to-subtree
|
||||
|
@ -12786,10 +12822,12 @@ around them. Both of these approaches can avoid referring to an
|
|||
external file.
|
||||
|
||||
#+cindex: @samp{HTML_CONTAINER_CLASS}, property
|
||||
#+cindex: @samp{HTML_HEADLINE_CLASS}, property
|
||||
In order to add styles to a sub-tree, use the =HTML_CONTAINER_CLASS=
|
||||
property to assign a class to the tree. In order to specify CSS
|
||||
styles for a particular headline, you can use the ID specified in
|
||||
a =CUSTOM_ID= property.
|
||||
a =CUSTOM_ID= property. You can also assign a specific class to
|
||||
a headline with the =HTML_HEADLINE_CLASS= property.
|
||||
|
||||
Never change the ~org-html-style-default~ constant. Instead use other
|
||||
simpler ways of customizing as described above.
|
||||
|
@ -15051,18 +15089,20 @@ connections.
|
|||
#+cindex: @samp{DESCRIPTION}, property
|
||||
#+cindex: @samp{LOCATION}, property
|
||||
#+cindex: @samp{TIMEZONE}, property
|
||||
#+cindex: @samp{CLASS}, property
|
||||
The iCalendar export back-end includes =SUMMARY=, =DESCRIPTION=,
|
||||
=LOCATION= and =TIMEZONE= properties from the Org entries when
|
||||
exporting. To force the back-end to inherit the =LOCATION= and
|
||||
=TIMEZONE= properties, configure the ~org-use-property-inheritance~
|
||||
variable.
|
||||
=LOCATION=, =TIMEZONE= and =CLASS= properties from the Org entries
|
||||
when exporting. To force the back-end to inherit the =LOCATION=,
|
||||
=TIMEZONE= and =CLASS= properties, configure the
|
||||
~org-use-property-inheritance~ variable.
|
||||
|
||||
#+vindex: org-icalendar-include-body
|
||||
When Org entries do not have =SUMMARY=, =DESCRIPTION= and =LOCATION=
|
||||
properties, the iCalendar export back-end derives the summary from the
|
||||
headline, and derives the description from the body of the Org item.
|
||||
The ~org-icalendar-include-body~ variable limits the maximum number of
|
||||
characters of the content are turned into its description.
|
||||
When Org entries do not have =SUMMARY=, =DESCRIPTION=, =LOCATION= and
|
||||
=CLASS= properties, the iCalendar export back-end derives the summary
|
||||
from the headline, and derives the description from the body of the
|
||||
Org item. The ~org-icalendar-include-body~ variable limits the
|
||||
maximum number of characters of the content are turned into its
|
||||
description.
|
||||
|
||||
The =TIMEZONE= property can be used to specify a per-entry time zone,
|
||||
and is applied to any entry with timestamp information. Time zones
|
||||
|
@ -15070,6 +15110,16 @@ should be specified as per the IANA time zone database format, e.g.,
|
|||
=Asia/Almaty=. Alternately, the property value can be =UTC=, to force
|
||||
UTC time for this entry only.
|
||||
|
||||
The =CLASS= property can be used to specify a per-entry visibility
|
||||
class or access restrictions, and is applied to any entry with class
|
||||
information. The iCalendar standard defines three visibility classes:
|
||||
- =PUBLIC= :: The entry is publicly visible (this is the default).
|
||||
- =CONFIDENTIAL= :: Only a limited group of clients get access to the
|
||||
event.
|
||||
- =PRIVATE= :: The entry can be retrieved only by its owner.
|
||||
The server should treat unknown class properties the same as
|
||||
=PRIVATE=.
|
||||
|
||||
Exporting to iCalendar format depends in large part on the
|
||||
capabilities of the destination application. Some are more lenient
|
||||
than others. Consult the Org mode FAQ for advice on specific
|
||||
|
@ -17636,29 +17686,29 @@ code block header arguments:
|
|||
Code blocks in the following languages are supported.
|
||||
|
||||
#+attr_texinfo: :columns 0.20 0.35 0.20 0.20
|
||||
| Language | Identifier | Language | Identifier |
|
||||
|------------+---------------+---------------+--------------|
|
||||
| Asymptote | =asymptote= | Lua | =lua= |
|
||||
| Awk | =awk= | MATLAB | =matlab= |
|
||||
| C | =C= | Mscgen | =mscgen= |
|
||||
| C++ | =C++=[fn:140] | OCaml | =ocaml= |
|
||||
| Clojure | =clojure= | Octave | =octave= |
|
||||
| CSS | =css= | Org mode | =org= |
|
||||
| D | =D=[fn:141] | Oz | =oz= |
|
||||
| ditaa | =ditaa= | Perl | =perl= |
|
||||
| Emacs Calc | =calc= | Plantuml | =plantuml= |
|
||||
| Emacs Lisp | =emacs-lisp= | Processing.js | =processing= |
|
||||
| Fortran | =fortran= | Python | =python= |
|
||||
| Gnuplot | =gnuplot= | R | =R= |
|
||||
| GNU Screen | =screen= | Ruby | =ruby= |
|
||||
| Graphviz | =dot= | Sass | =sass= |
|
||||
| Haskell | =haskell= | Scheme | =scheme= |
|
||||
| Java | =java= | Sed | =sed= |
|
||||
| Javascript | =js= | shell | =sh= |
|
||||
| LaTeX | =latex= | SQL | =sql= |
|
||||
| Ledger | =ledger= | SQLite | =sqlite= |
|
||||
| Lilypond | =lilypond= | Vala | =vala= |
|
||||
| Lisp | =lisp= | | |
|
||||
| Language | Identifier | Language | Identifier |
|
||||
|------------+---------------+----------------+--------------|
|
||||
| Asymptote | =asymptote= | Lisp | =lisp= |
|
||||
| Awk | =awk= | Lua | =lua= |
|
||||
| C | =C= | MATLAB | =matlab= |
|
||||
| C++ | =C++=[fn:140] | Mscgen | =mscgen= |
|
||||
| Clojure | =clojure= | Objective Caml | =ocaml= |
|
||||
| CSS | =css= | Octave | =octave= |
|
||||
| D | =D=[fn:141] | Org mode | =org= |
|
||||
| ditaa | =ditaa= | Oz | =oz= |
|
||||
| Emacs Calc | =calc= | Perl | =perl= |
|
||||
| Emacs Lisp | =emacs-lisp= | Plantuml | =plantuml= |
|
||||
| Eshell | =eshell= | Processing.js | =processing= |
|
||||
| Fortran | =fortran= | Python | =python= |
|
||||
| Gnuplot | =gnuplot= | R | =R= |
|
||||
| GNU Screen | =screen= | Ruby | =ruby= |
|
||||
| Graphviz | =dot= | Sass | =sass= |
|
||||
| Haskell | =haskell= | Scheme | =scheme= |
|
||||
| Java | =java= | Sed | =sed= |
|
||||
| Javascript | =js= | shell | =sh= |
|
||||
| LaTeX | =latex= | SQL | =sql= |
|
||||
| Ledger | =ledger= | SQLite | =sqlite= |
|
||||
| Lilypond | =lilypond= | Vala | =vala= |
|
||||
|
||||
Additional documentation for some languages is at
|
||||
https://orgmode.org/worg/org-contrib/babel/languages.html.
|
||||
|
|
|
@ -646,6 +646,12 @@ Re-align, move to previous field.
|
|||
@item @key{RET}
|
||||
Re-align the table and move down to next row. Creates a new row if
|
||||
necessary.
|
||||
@c
|
||||
@item S-@key{up}
|
||||
@itemx S-@key{down}
|
||||
@itemx S-@key{left}
|
||||
@itemx S-@key{right}
|
||||
Move a cell up, down, left, and right by swapping with adjacent cell.
|
||||
|
||||
@tsubheading{Column and row editing}
|
||||
@item M-@key{left}
|
||||
|
|
91
etc/ORG-NEWS
91
etc/ORG-NEWS
|
@ -10,6 +10,86 @@ See the end of the file for license conditions.
|
|||
|
||||
Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
|
||||
|
||||
* Version 9.3
|
||||
|
||||
** Incompatible changes
|
||||
*** Change in behavior on exit from an Org edit buffer
|
||||
Org will no longer attempt to restore the window configuration in the
|
||||
frame to which the user returns after editing a source block with
|
||||
~org-edit-src-code~. Instead, the window configuration will remain as
|
||||
it is.
|
||||
*** Change default value for ~org-email-link-description-format~
|
||||
|
||||
When linking from a mail buffer, Org used to truncate the subject of
|
||||
the message to 30 characters in order to build the description of the
|
||||
link. This behavior was considered as too surprising. As
|
||||
a consequence, Org no longer truncates subjects.
|
||||
|
||||
You can get the old behaviour back with the following:
|
||||
|
||||
: (setq org-email-link-description-format "Email %c: %.30s")
|
||||
|
||||
*** ~:file~ header argument no longer assume "file" ~:results~
|
||||
|
||||
The "file" ~:results~ value is now mandatory for a code block
|
||||
returning a link to a file. The ~:file~ or ~:file-ext~ header
|
||||
arguments no longer imply a "file" result is expected.
|
||||
|
||||
*** Plain numbers are hours in Column View mode
|
||||
|
||||
See [[git:3367ac9457]] for details.
|
||||
|
||||
** New features
|
||||
*** Babel
|
||||
**** Add LaTeX output support in PlantUML
|
||||
*** New property =HTML_HEADLINE_CLASS= in HTML export
|
||||
The new property =HTML_HEADLINE_CLASS= assigns a class attribute to
|
||||
a headline.
|
||||
*** Allow LaTeX attributes and captions for "table.el" tables
|
||||
Supported LaTeX attributes are ~:float~, ~:center~, ~:font~ and
|
||||
~:caption~.
|
||||
*** Attach buffer contents to headline
|
||||
With =<b>= key from attachment dispatcher (=<C-c C-a>=), it is now
|
||||
possible to write the contents of a buffer to a file in the headline
|
||||
attachement directory.
|
||||
*** iCalendar export respects a =CLASS= property
|
||||
|
||||
Set the =CLASS= property on an entry to specify a visibility class for
|
||||
that entry only during iCalendar export. The property can be set to
|
||||
anything the calendar server supports. The iCalendar standard defines
|
||||
the values =PUBLIC=, =CONFIDENTIAL=, =PRIVATE=, which can be
|
||||
interpreted as publicly visable, accessible to a specific group, and
|
||||
private respectively.
|
||||
|
||||
This property can be inherited during iCalendar export, depending on
|
||||
the value of ~org-use-property-inheritance~.
|
||||
|
||||
*** New parameter for =INCLUDE= keyword
|
||||
Add =:coding CODING-SYSTEM= to include files using a different coding
|
||||
system than the main Org document. For example:
|
||||
|
||||
#+begin_example
|
||||
,#+INCLUDE: "myfile.cmd" src cmd :coding cp850-dos
|
||||
#+end_example
|
||||
|
||||
*** New values in clock tables' step: =month= and =year=
|
||||
*** ODT export handles numbers cookies in lists
|
||||
*** New cell movement functions in tables
|
||||
~S-<UP>~, ~S-<DOWN>~, ~S-<RIGHT>~, and ~S-<LEFT>~ now move cells in
|
||||
the corresponding direction by swapping with the adjacent cell.
|
||||
|
||||
** New functions
|
||||
*** ~org-table-cell-up~
|
||||
*** ~org-table-cell-down~
|
||||
*** ~org-table-cell-left~
|
||||
*** ~org-table-cell-right~
|
||||
** Removed functions
|
||||
*** ~org-babel-set-current-result-hash~
|
||||
|
||||
It was unused throughout the code base.
|
||||
|
||||
** Miscellaneous
|
||||
*** Org Table reads numbers starting with 0 as strings
|
||||
* Version 9.2
|
||||
** Incompatible changes
|
||||
*** Removal of OrgStruct mode mode and radio lists
|
||||
|
@ -170,6 +250,17 @@ This is consistent with the naming of =org-dblock-write:columnview=
|
|||
options, where =:match= is also used as a headlines filter.
|
||||
|
||||
** New features
|
||||
*** Add ~:session~ support of ob-clojure for CIDER
|
||||
You can initialize source block session with Babel default keybinding
|
||||
=[C-c C-v C-z]= to use =sesman= session manager to link current
|
||||
project, directory or buffer with specific Clojure session, or
|
||||
=cider-jack-in= a new CIDER REPL if no CIDER REPLs available. In older
|
||||
CIDER version which has not =sesman= integrated, only has
|
||||
=cider-jack-in= without Clojure project is supported.
|
||||
#+begin_src clojure :session
|
||||
(dissoc Clojure 'JVM)
|
||||
(conj clojurists "stardiviner")
|
||||
#+end_src
|
||||
*** Add ~:results link~ support for Babel
|
||||
|
||||
With this output format, create a link to the file specified in
|
||||
|
|
|
@ -43,8 +43,10 @@
|
|||
(require 'ob)
|
||||
(require 'org-macs)
|
||||
|
||||
(declare-function cider-jack-in "ext:cider" (&optional prompt-project cljs-too))
|
||||
(declare-function cider-current-connection "ext:cider-client" (&optional type))
|
||||
(declare-function cider-current-ns "ext:cider-client" ())
|
||||
(declare-function cider-repls "ext:cider-connection" (&optional type ensure))
|
||||
(declare-function nrepl--merge "ext:nrepl-client" (dict1 dict2))
|
||||
(declare-function nrepl-dict-get "ext:nrepl-client" (dict key))
|
||||
(declare-function nrepl-dict-put "ext:nrepl-client" (dict key value))
|
||||
|
@ -54,6 +56,8 @@
|
|||
|
||||
(defvar nrepl-sync-request-timeout)
|
||||
(defvar cider-buffer-ns)
|
||||
(defvar sesman-system)
|
||||
(defvar cider-version)
|
||||
|
||||
(defvar org-babel-tangle-lang-exts)
|
||||
(add-to-list 'org-babel-tangle-lang-exts '("clojure" . "clj"))
|
||||
|
@ -211,6 +215,69 @@ using the :show-process parameter."
|
|||
(condition-case nil (org-babel-script-escape result)
|
||||
(error result)))))
|
||||
|
||||
(defun org-babel-clojure-initiate-session (&optional session _params)
|
||||
"Initiate a session named SESSION according to PARAMS."
|
||||
(when (and session (not (string= session "none")))
|
||||
(save-window-excursion
|
||||
(cond
|
||||
((org-babel-comint-buffer-livep session) nil)
|
||||
;; CIDER jack-in to the Clojure project directory.
|
||||
((eq org-babel-clojure-backend 'cider)
|
||||
(require 'cider)
|
||||
(let ((session-buffer
|
||||
(save-window-excursion
|
||||
(if (version< cider-version "0.18.0")
|
||||
;; Older CIDER (without sesman) still need to use
|
||||
;; old way.
|
||||
(cider-jack-in nil) ;jack-in without project
|
||||
;; New CIDER (with sesman to manage sessions).
|
||||
(unless (cider-repls)
|
||||
(let ((sesman-system 'CIDER))
|
||||
(call-interactively 'sesman-link-with-directory))))
|
||||
(current-buffer))))
|
||||
(when (org-babel-comint-buffer-livep session-buffer)
|
||||
(sit-for .25)
|
||||
session-buffer)))
|
||||
((eq org-babel-clojure-backend 'slime)
|
||||
(error "Session evaluation with SLIME is not supported"))
|
||||
(t
|
||||
(error "Session initiate failed")))
|
||||
(get-buffer session))))
|
||||
|
||||
(defun org-babel-prep-session:clojure (session params)
|
||||
"Prepare SESSION according to the header arguments specified in PARAMS."
|
||||
(let ((session (org-babel-clojure-initiate-session session))
|
||||
(var-lines (org-babel-variable-assignments:clojure params)))
|
||||
(when session
|
||||
(org-babel-comint-in-buffer session
|
||||
(dolist (var var-lines)
|
||||
(insert var)
|
||||
(comint-send-input nil t)
|
||||
(org-babel-comint-wait-for-output session)
|
||||
(sit-for .1)
|
||||
(goto-char (point-max)))))
|
||||
session))
|
||||
|
||||
(defun org-babel-clojure-var-to-clojure (var)
|
||||
"Convert src block's VAR to Clojure variable."
|
||||
(cond
|
||||
((listp var)
|
||||
(replace-regexp-in-string "(" "'(" var))
|
||||
((stringp var)
|
||||
;; Wrap Babel passed-in header argument value with quotes in Clojure.
|
||||
(format "\"%s\"" var))
|
||||
(t
|
||||
(format "%S" var))))
|
||||
|
||||
(defun org-babel-variable-assignments:clojure (params)
|
||||
"Return a list of Clojure statements assigning the block's variables in PARAMS."
|
||||
(mapcar
|
||||
(lambda (pair)
|
||||
(format "(def %s %s)"
|
||||
(car pair)
|
||||
(org-babel-clojure-var-to-clojure (cdr pair))))
|
||||
(org-babel--get-vars params)))
|
||||
|
||||
(provide 'ob-clojure)
|
||||
|
||||
;;; ob-clojure.el ends here
|
||||
|
|
|
@ -694,7 +694,8 @@ block."
|
|||
(not (listp r)))
|
||||
(list (list r))
|
||||
r)))
|
||||
(let ((file (cdr (assq :file params))))
|
||||
(let ((file (and (member "file" result-params)
|
||||
(cdr (assq :file params)))))
|
||||
;; If non-empty result and :file then write to :file.
|
||||
(when file
|
||||
;; If `:results' are special types like `link' or
|
||||
|
@ -1291,19 +1292,6 @@ CONTEXT specifies the context of evaluation. It can be `:eval',
|
|||
(looking-at org-babel-result-regexp)
|
||||
(match-string-no-properties 1)))))
|
||||
|
||||
(defun org-babel-set-current-result-hash (hash info)
|
||||
"Set the current in-buffer hash to HASH."
|
||||
(org-with-wide-buffer
|
||||
(goto-char (org-babel-where-is-src-block-result nil info))
|
||||
(looking-at org-babel-result-regexp)
|
||||
(goto-char (match-beginning 1))
|
||||
(mapc #'delete-overlay (overlays-at (point)))
|
||||
(forward-char org-babel-hash-show)
|
||||
(mapc #'delete-overlay (overlays-at (point)))
|
||||
(replace-match hash nil nil nil 1)
|
||||
(beginning-of-line)
|
||||
(org-babel-hide-hash)))
|
||||
|
||||
(defun org-babel-hide-hash ()
|
||||
"Hide the hash in the current results line.
|
||||
Only the initial `org-babel-hash-show' characters of the hash
|
||||
|
@ -2637,19 +2625,6 @@ parameters when merging lists."
|
|||
results
|
||||
(split-string
|
||||
(if (stringp value) value (eval value t))))))
|
||||
(`(,(or :file :file-ext) . ,value)
|
||||
;; `:file' and `:file-ext' are regular keywords but they
|
||||
;; imply a "file" `:results' and a "results" `:exports'.
|
||||
(when value
|
||||
(setq results
|
||||
(funcall merge results-exclusive-groups results '("file")))
|
||||
(unless (or (member "both" exports)
|
||||
(member "none" exports)
|
||||
(member "code" exports))
|
||||
(setq exports
|
||||
(funcall merge
|
||||
exports-exclusive-groups exports '("results"))))
|
||||
(push pair params)))
|
||||
(`(:exports . ,value)
|
||||
(setq exports (funcall merge
|
||||
exports-exclusive-groups
|
||||
|
@ -2940,7 +2915,7 @@ situations in which is it not appropriate."
|
|||
(defun org-babel--string-to-number (string)
|
||||
"If STRING represents a number return its value.
|
||||
Otherwise return nil."
|
||||
(and (string-match-p "\\`-?[0-9]*\\.?[0-9]*\\'" string)
|
||||
(and (string-match-p "\\`-?\\([0-9]\\|\\([1-9]\\|[0-9]*\\.\\)[0-9]*\\)\\'" string)
|
||||
(string-to-number string)))
|
||||
|
||||
(defun org-babel-import-elisp-from-file (file-name &optional separator)
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
;;; ob-eshell.el --- Babel Functions for Eshell -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2018 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: stardiviner <numbchild@gmail.com>
|
||||
;; Keywords: literate programming, reproducible research
|
||||
;; Homepage: https://orgmode.org
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Org Babel support for evaluating Eshell source code.
|
||||
|
||||
;;; Code:
|
||||
(require 'ob)
|
||||
(require 'eshell)
|
||||
|
||||
(defvar org-babel-default-header-args:eshell '())
|
||||
|
||||
(defun org-babel-execute:eshell (body params)
|
||||
"Execute a block of Eshell code BODY with PARAMS.
|
||||
This function is called by `org-babel-execute-src-block'.
|
||||
|
||||
The BODY can be any code which allowed executed in Eshell.
|
||||
Eshell allow to execute normal shell command and Elisp code.
|
||||
More details please reference Eshell Info.
|
||||
|
||||
The PARAMS are variables assignments."
|
||||
(let* ((session (org-babel-eshell-initiate-session
|
||||
(cdr (assq :session params))))
|
||||
(full-body (org-babel-expand-body:generic
|
||||
body params (org-babel-variable-assignments:eshell params))))
|
||||
(if session
|
||||
(progn
|
||||
(with-current-buffer session
|
||||
(dolist (line (split-string full-body "\n"))
|
||||
(goto-char eshell-last-output-end)
|
||||
(insert line)
|
||||
(eshell-send-input))
|
||||
;; get output of last input
|
||||
;; TODO: collect all output instead of last command's output.
|
||||
(goto-char eshell-last-input-end)
|
||||
(buffer-substring-no-properties (point) eshell-last-output-start)))
|
||||
(with-temp-buffer
|
||||
(eshell-command full-body t)
|
||||
(buffer-string)))))
|
||||
|
||||
(defun org-babel-prep-session:eshell (session params)
|
||||
"Prepare SESSION according to the header arguments specified in PARAMS."
|
||||
(let* ((session (org-babel-eshell-initiate-session session))
|
||||
;; Eshell session buffer is read from variable `eshell-buffer-name'.
|
||||
(eshell-buffer-name session)
|
||||
(var-lines (org-babel-variable-assignments:eshell params)))
|
||||
(call-interactively #'eshell)
|
||||
(mapc #'eshell-command var-lines)
|
||||
session))
|
||||
|
||||
(defun ob-eshell-session-live-p (session)
|
||||
"Non-nil if Eshell SESSION exists."
|
||||
(get-buffer session))
|
||||
|
||||
(defun org-babel-eshell-initiate-session (&optional session _params)
|
||||
"Initiate a session named SESSION."
|
||||
(when (and session (not (string= session "none")))
|
||||
(save-window-excursion
|
||||
(unless (ob-eshell-session-live-p session)
|
||||
(let ((eshell-buffer-name session)) (eshell))))
|
||||
session))
|
||||
|
||||
(defun org-babel-variable-assignments:eshell (params)
|
||||
"Convert ob-eshell :var specified variables into Eshell variables assignments."
|
||||
(mapcar
|
||||
(lambda (pair)
|
||||
(format "(setq %s %S)" (car pair) (cdr pair)))
|
||||
(org-babel--get-vars params)))
|
||||
|
||||
(defun org-babel-load-session:eshell (session body params)
|
||||
"Load BODY into SESSION with PARAMS."
|
||||
(save-window-excursion
|
||||
(let ((buffer (org-babel-prep-session:eshell session params)))
|
||||
(with-current-buffer buffer
|
||||
(goto-char (point-max))
|
||||
(insert (org-babel-chomp body)))
|
||||
buffer)))
|
||||
|
||||
(provide 'ob-eshell)
|
||||
|
||||
;;; ob-eshell.el ends here
|
106
lisp/ob-keys.el
106
lisp/ob-keys.el
|
@ -1,106 +0,0 @@
|
|||
;;; ob-keys.el --- Key Bindings for Babel -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Eric Schulte
|
||||
;; Keywords: literate programming, reproducible research
|
||||
;; Homepage: https://orgmode.org
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
||||
;; GNU Emacs is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; GNU Emacs is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; Add Org Babel keybindings to the Org mode keymap for exposing
|
||||
;; Org Babel functions. These will all share a common prefix. See
|
||||
;; the value of `org-babel-key-bindings' for a list of interactive
|
||||
;; functions and their associated keys.
|
||||
|
||||
;;; Code:
|
||||
(require 'ob-core)
|
||||
|
||||
(defvar org-babel-key-prefix "\C-c\C-v"
|
||||
"The key prefix for Babel interactive key-bindings.
|
||||
See `org-babel-key-bindings' for the list of interactive babel
|
||||
functions which are assigned key bindings, and see
|
||||
`org-babel-map' for the actual babel keymap.")
|
||||
|
||||
(defvar org-babel-map (make-sparse-keymap)
|
||||
"The keymap for interactive Babel functions.")
|
||||
|
||||
;;;###autoload
|
||||
(defun org-babel-describe-bindings ()
|
||||
"Describe all keybindings behind `org-babel-key-prefix'."
|
||||
(interactive)
|
||||
(describe-bindings org-babel-key-prefix))
|
||||
|
||||
(defvar org-babel-key-bindings
|
||||
'(("p" . org-babel-previous-src-block)
|
||||
("\C-p" . org-babel-previous-src-block)
|
||||
("n" . org-babel-next-src-block)
|
||||
("\C-n" . org-babel-next-src-block)
|
||||
("e" . org-babel-execute-maybe)
|
||||
("\C-e" . org-babel-execute-maybe)
|
||||
("o" . org-babel-open-src-block-result)
|
||||
("\C-o" . org-babel-open-src-block-result)
|
||||
("\C-v" . org-babel-expand-src-block)
|
||||
("v" . org-babel-expand-src-block)
|
||||
("u" . org-babel-goto-src-block-head)
|
||||
("\C-u" . org-babel-goto-src-block-head)
|
||||
("g" . org-babel-goto-named-src-block)
|
||||
("r" . org-babel-goto-named-result)
|
||||
("\C-r" . org-babel-goto-named-result)
|
||||
("\C-b" . org-babel-execute-buffer)
|
||||
("b" . org-babel-execute-buffer)
|
||||
("\C-s" . org-babel-execute-subtree)
|
||||
("s" . org-babel-execute-subtree)
|
||||
("\C-d" . org-babel-demarcate-block)
|
||||
("d" . org-babel-demarcate-block)
|
||||
("\C-t" . org-babel-tangle)
|
||||
("t" . org-babel-tangle)
|
||||
("\C-f" . org-babel-tangle-file)
|
||||
("f" . org-babel-tangle-file)
|
||||
("\C-c" . org-babel-check-src-block)
|
||||
("c" . org-babel-check-src-block)
|
||||
("\C-j" . org-babel-insert-header-arg)
|
||||
("j" . org-babel-insert-header-arg)
|
||||
("\C-l" . org-babel-load-in-session)
|
||||
("l" . org-babel-load-in-session)
|
||||
("\C-i" . org-babel-lob-ingest)
|
||||
("i" . org-babel-lob-ingest)
|
||||
("\C-I" . org-babel-view-src-block-info)
|
||||
("I" . org-babel-view-src-block-info)
|
||||
("\C-z" . org-babel-switch-to-session)
|
||||
("z" . org-babel-switch-to-session-with-code)
|
||||
("\C-a" . org-babel-sha1-hash)
|
||||
("a" . org-babel-sha1-hash)
|
||||
("h" . org-babel-describe-bindings)
|
||||
("\C-x" . org-babel-do-key-sequence-in-edit-buffer)
|
||||
("x" . org-babel-do-key-sequence-in-edit-buffer)
|
||||
("k" . org-babel-remove-result-one-or-many)
|
||||
("\C-\M-h" . org-babel-mark-block))
|
||||
"Alist of key bindings and interactive Babel functions.
|
||||
This list associates interactive Babel functions
|
||||
with keys. Each element of this list will add an entry to the
|
||||
`org-babel-map' using the letter key which is the `car' of the
|
||||
a-list placed behind the generic `org-babel-key-prefix'.")
|
||||
|
||||
(provide 'ob-keys)
|
||||
|
||||
;; Local variables:
|
||||
;; generated-autoload-file: "org-loaddefs.el"
|
||||
;; End:
|
||||
|
||||
;;; ob-keys.el ends here
|
|
@ -93,6 +93,8 @@ This function is called by `org-babel-execute-src-block'."
|
|||
" -teps" "")
|
||||
(if (string= (file-name-extension out-file) "pdf")
|
||||
" -tpdf" "")
|
||||
(if (string= (file-name-extension out-file) "tex")
|
||||
" -tlatex" "")
|
||||
(if (string= (file-name-extension out-file) "vdx")
|
||||
" -tvdx" "")
|
||||
(if (string= (file-name-extension out-file) "xmi")
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
;;; Code:
|
||||
(require 'org-macs)
|
||||
(require 'org-compat)
|
||||
(require 'org-keys)
|
||||
(require 'ob-eval)
|
||||
(require 'ob-core)
|
||||
(require 'ob-comint)
|
||||
(require 'ob-exp)
|
||||
(require 'ob-keys)
|
||||
(require 'ob-table)
|
||||
(require 'ob-lob)
|
||||
(require 'ob-ref)
|
||||
|
|
|
@ -177,6 +177,7 @@ Shows a list of commands and prompts for another key to execute a command."
|
|||
a Select a file and attach it to the task, using `org-attach-method'.
|
||||
c/m/l/y Attach a file using copy/move/link/symbolic-link method.
|
||||
u Attach a file from URL (downloading it).
|
||||
b Select a buffer and attach its contents to the task.
|
||||
n Create a new attachment, as an Emacs buffer.
|
||||
z Synchronize the current task with its attachment
|
||||
directory, in case you added attachments yourself.
|
||||
|
@ -193,7 +194,7 @@ D Delete all of a task's attachments. A safer way is
|
|||
s Set a specific attachment directory for this entry or reset to default.
|
||||
i Make children of the current entry inherit its attachment directory.")))
|
||||
(org-fit-window-to-buffer (get-buffer-window "*Org Attach*"))
|
||||
(message "Select command: [acmlyunzoOfFdD]")
|
||||
(message "Select command: [acmlyubnzoOfFdD]")
|
||||
(setq c (read-char-exclusive))
|
||||
(and (get-buffer "*Org Attach*") (kill-buffer "*Org Attach*"))))
|
||||
(cond
|
||||
|
@ -208,6 +209,7 @@ i Make children of the current entry inherit its attachment directory.")))
|
|||
(let ((org-attach-method 'lns)) (call-interactively 'org-attach-attach)))
|
||||
((memq c '(?u ?\C-u))
|
||||
(let ((org-attach-method 'url)) (call-interactively 'org-attach-url)))
|
||||
((eq c ?b) (call-interactively 'org-attach-buffer))
|
||||
((memq c '(?n ?\C-n)) (call-interactively 'org-attach-new))
|
||||
((memq c '(?z ?\C-z)) (call-interactively 'org-attach-sync))
|
||||
((memq c '(?o ?\C-o)) (call-interactively 'org-attach-open))
|
||||
|
@ -390,6 +392,21 @@ Only do this when `org-attach-store-link-p' is non-nil."
|
|||
(interactive "MURL of the file to attach: \n")
|
||||
(org-attach-attach url))
|
||||
|
||||
(defun org-attach-buffer (buffer-name)
|
||||
"Attach BUFFER-NAME's contents to current task.
|
||||
BUFFER-NAME is a string. Signals a `file-already-exists' error
|
||||
if it would overwrite an existing filename."
|
||||
(interactive "bBuffer whose contents should be attached: ")
|
||||
(let ((output (expand-file-name buffer-name (org-attach-dir t))))
|
||||
(when (file-exists-p output)
|
||||
(signal 'file-already-exists (list "File exists" output)))
|
||||
(when (and org-attach-file-list-property (not org-attach-inherited))
|
||||
(org-entry-add-to-multivalued-property
|
||||
(point) org-attach-file-list-property buffer-name))
|
||||
(org-attach-tag)
|
||||
(with-temp-file output
|
||||
(insert-buffer-substring buffer-name))))
|
||||
|
||||
(defun org-attach-attach (file &optional visit-dir method)
|
||||
"Move/copy/link FILE into the attachment directory of the current task.
|
||||
If VISIT-DIR is non-nil, visit the directory with dired.
|
||||
|
|
|
@ -522,8 +522,7 @@ cannot be translated."
|
|||
(cond ((functionp org-clock-heading-function)
|
||||
(funcall org-clock-heading-function))
|
||||
((org-before-first-heading-p) "???")
|
||||
(t (replace-regexp-in-string
|
||||
org-bracket-link-analytic-regexp "\\5"
|
||||
(t (org-link-display-format
|
||||
(org-no-properties (org-get-heading t t t t))))))
|
||||
|
||||
(defun org-clock-menu ()
|
||||
|
@ -2684,79 +2683,84 @@ LEVEL is an integer. Indent by two spaces per level above 1."
|
|||
(if (= level 1) ""
|
||||
(concat "\\_" (make-string (* 2 (1- level)) ?\s))))
|
||||
|
||||
(defun org-clocktable-increment-day (ts &optional n)
|
||||
"Increment day in TS by N (defaulting to 1).
|
||||
The TS argument has the same type as the return values of
|
||||
`float-time' or `current-time'."
|
||||
(let ((tsd (decode-time ts)))
|
||||
(cl-incf (nth 3 tsd) (or n 1))
|
||||
(setf (nth 8 tsd) nil) ; no time zone: increasing day skips one whole day
|
||||
(apply 'encode-time tsd)))
|
||||
|
||||
(defun org-clocktable-steps (params)
|
||||
"Step through the range to make a number of clock tables."
|
||||
(let* ((ts (plist-get params :tstart))
|
||||
(te (plist-get params :tend))
|
||||
(ws (plist-get params :wstart))
|
||||
(ms (plist-get params :mstart))
|
||||
(step0 (plist-get params :step))
|
||||
(stepskip0 (plist-get params :stepskip0))
|
||||
(block (plist-get params :block))
|
||||
cc tsb)
|
||||
(when block
|
||||
(setq cc (org-clock-special-range block nil t ws ms)
|
||||
ts (car cc)
|
||||
te (nth 1 cc)))
|
||||
(cond
|
||||
((numberp ts)
|
||||
;; If ts is a number, it's an absolute day number from
|
||||
;; org-agenda.
|
||||
(pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute ts)))
|
||||
(setq ts (float-time (encode-time 0 0 0 day month year)))))
|
||||
(ts (setq ts (org-matcher-time ts))))
|
||||
(cond
|
||||
((numberp te)
|
||||
;; Likewise for te.
|
||||
(pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute te)))
|
||||
(setq te (float-time (encode-time 0 0 0 day month year)))))
|
||||
(te (setq te (org-matcher-time te))))
|
||||
(setq tsb
|
||||
(if (eq step0 'week)
|
||||
(let ((dow (nth 6 (decode-time (seconds-to-time ts)))))
|
||||
(if (<= dow ws) ts
|
||||
(org-clocktable-increment-day ts ; decrement
|
||||
(- ws dow))))
|
||||
ts))
|
||||
(while (< (float-time tsb) te)
|
||||
"Create one ore more clock tables, according to PARAMS.
|
||||
Step through the range specifications in plist PARAMS to make
|
||||
a number of clock tables."
|
||||
(let* ((ignore-empty-tables (plist-get params :stepskip0))
|
||||
(step (plist-get params :step))
|
||||
(step-header
|
||||
(pcase step
|
||||
(`day "Daily report: ")
|
||||
(`week "Weekly report starting on: ")
|
||||
(`month "Monthly report starting on: ")
|
||||
(`year "Annual report starting on: ")
|
||||
(_ (user-error "Unknown `:step' specification: %S" step))))
|
||||
(week-start (or (plist-get params :wstart) 1))
|
||||
(month-start (or (plist-get params :mstart) 1))
|
||||
(range
|
||||
(pcase (plist-get params :block)
|
||||
(`nil nil)
|
||||
(range
|
||||
(org-clock-special-range range nil t week-start month-start))))
|
||||
;; For both START and END, any number is an absolute day
|
||||
;; number from Agenda. Otherwise, consider value to be an Org
|
||||
;; timestamp string. The `:block' property has precedence
|
||||
;; over `:tstart' and `:tend'.
|
||||
(start
|
||||
(pcase (if range (car range) (plist-get params :tstart))
|
||||
((and (pred numberp) n)
|
||||
(pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
|
||||
(apply #'encode-time (list 0 0 org-extend-today-until d m y))))
|
||||
(timestamp (seconds-to-time (org-matcher-time timestamp)))))
|
||||
(end
|
||||
(pcase (if range (nth 1 range) (plist-get params :tend))
|
||||
((and (pred numberp) n)
|
||||
(pcase-let ((`(,m ,d ,y) (calendar-gregorian-from-absolute n)))
|
||||
(apply #'encode-time (list 0 0 org-extend-today-until d m y))))
|
||||
(timestamp (seconds-to-time (org-matcher-time timestamp))))))
|
||||
(while (time-less-p start end)
|
||||
(unless (bolp) (insert "\n"))
|
||||
(let* ((start-time (seconds-to-time (max (float-time tsb) ts)))
|
||||
(dow (nth 6 (decode-time (seconds-to-time tsb))))
|
||||
(days-to-skip (cond ((eq step0 'day) 1)
|
||||
;; else 'week:
|
||||
((= dow ws) 7)
|
||||
(t (- ws dow)))))
|
||||
(setq tsb (time-to-seconds (org-clocktable-increment-day tsb
|
||||
days-to-skip)))
|
||||
(insert "\n"
|
||||
(if (eq step0 'day) "Daily report: "
|
||||
"Weekly report starting on: ")
|
||||
(format-time-string (org-time-stamp-format nil t) start-time)
|
||||
"\n")
|
||||
(let ((table-begin (line-beginning-position 0))
|
||||
(step-time
|
||||
(org-dblock-write:clocktable
|
||||
(org-combine-plists
|
||||
params
|
||||
(list
|
||||
:header "" :step nil :block nil
|
||||
:tstart (format-time-string (org-time-stamp-format t t)
|
||||
start-time)
|
||||
:tend (format-time-string (org-time-stamp-format t t)
|
||||
(seconds-to-time (min te tsb))))))))
|
||||
(re-search-forward "^[ \t]*#\\+END:")
|
||||
(when (and stepskip0 (equal step-time 0))
|
||||
;; Remove the empty table
|
||||
(delete-region (line-beginning-position) table-begin))))
|
||||
;; Insert header before each clock table.
|
||||
(insert "\n"
|
||||
step-header
|
||||
(format-time-string (org-time-stamp-format nil t) start)
|
||||
"\n")
|
||||
;; Compute NEXT, which is the end of the current clock table,
|
||||
;; according to step.
|
||||
(let* ((next
|
||||
(apply #'encode-time
|
||||
(pcase-let
|
||||
((`(,_ ,_ ,_ ,d ,m ,y ,dow . ,_) (decode-time start)))
|
||||
(pcase step
|
||||
(`day (list 0 0 org-extend-today-until (1+ d) m y))
|
||||
(`week
|
||||
(let ((offset (if (= dow week-start) 7
|
||||
(mod (- week-start dow) 7))))
|
||||
(list 0 0 org-extend-today-until (+ d offset) m y)))
|
||||
(`month (list 0 0 0 month-start (1+ m) y))
|
||||
(`year (list 0 0 org-extend-today-until 1 1 (1+ y)))))))
|
||||
(table-begin (line-beginning-position 0))
|
||||
(step-time
|
||||
;; Write clock table between START and NEXT.
|
||||
(org-dblock-write:clocktable
|
||||
(org-combine-plists
|
||||
params (list :header ""
|
||||
:step nil
|
||||
:block nil
|
||||
:tstart (format-time-string
|
||||
(org-time-stamp-format t t)
|
||||
start)
|
||||
:tend (format-time-string
|
||||
(org-time-stamp-format t t)
|
||||
;; Never include clocks past END.
|
||||
(if (time-less-p end next) end next)))))))
|
||||
(let ((case-fold-search t)) (re-search-forward "^[ \t]*#\\+END:"))
|
||||
;; Remove the table if it is empty and `:stepskip0' is
|
||||
;; non-nil.
|
||||
(when (and ignore-empty-tables (equal step-time 0))
|
||||
(delete-region (line-beginning-position) table-begin))
|
||||
(setq start next))
|
||||
(end-of-line 0))))
|
||||
|
||||
(defun org-clock-get-table-data (file params)
|
||||
|
|
|
@ -515,14 +515,6 @@ for the duration of the command.")
|
|||
(when (local-variable-p 'org-colview-initial-truncate-line-value)
|
||||
(setq truncate-lines org-colview-initial-truncate-line-value))))
|
||||
|
||||
(defun org-columns-compact-links (s)
|
||||
"Replace [[link][desc]] with [desc] or [link]."
|
||||
(while (string-match org-bracket-link-regexp s)
|
||||
(setq s (replace-match
|
||||
(concat "[" (match-string (if (match-end 3) 3 1) s) "]")
|
||||
t t s)))
|
||||
s)
|
||||
|
||||
(defun org-columns-show-value ()
|
||||
"Show the full value of the property."
|
||||
(interactive)
|
||||
|
@ -1124,16 +1116,7 @@ as a canonical duration, i.e., using units defined in
|
|||
"Apply FUN to time values TIMES.
|
||||
Return the result as a duration."
|
||||
(org-duration-from-minutes
|
||||
(apply fun
|
||||
(mapcar (lambda (time)
|
||||
;; Unlike to `org-duration-to-minutes' standard
|
||||
;; behavior, we want to consider plain numbers as
|
||||
;; hours. As a consequence, we treat them
|
||||
;; differently.
|
||||
(if (string-match-p "\\`[0-9]+\\(?:\\.[0-9]*\\)?\\'" time)
|
||||
(* 60 (string-to-number time))
|
||||
(org-duration-to-minutes time)))
|
||||
times))
|
||||
(apply fun (mapcar #'org-duration-to-minutes times))
|
||||
(org-duration-h:mm-only-p times)))
|
||||
|
||||
(defun org-columns--compute-spec (spec &optional update)
|
||||
|
@ -1340,14 +1323,15 @@ and variances (respectively) of the individual estimates."
|
|||
|
||||
;;; Dynamic block for Column view
|
||||
|
||||
(defun org-columns--capture-view (maxlevel match skip-empty format local)
|
||||
(defun org-columns--capture-view (maxlevel match skip-empty exclude-tags format local)
|
||||
"Get the column view of the current buffer.
|
||||
|
||||
MAXLEVEL sets the level limit. SKIP-EMPTY tells whether to skip
|
||||
empty rows, an empty row being one where all the column view
|
||||
specifiers but ITEM are empty. FORMAT is a format string for
|
||||
columns, or nil. When LOCAL is non-nil, only capture headings in
|
||||
current subtree.
|
||||
specifiers but ITEM are empty. EXCLUDE-TAGS is a list of tags
|
||||
that will be excluded from the resulting view. FORMAT is a
|
||||
format string for columns, or nil. When LOCAL is non-nil, only
|
||||
capture headings in current subtree.
|
||||
|
||||
This function returns a list containing the title row and all
|
||||
other rows. Each row is a list of fields, as strings, or
|
||||
|
@ -1370,9 +1354,13 @@ other rows. Each row is a list of fields, as strings, or
|
|||
'org-columns-value
|
||||
'org-columns-value-modified)))
|
||||
row)))
|
||||
(unless (and skip-empty
|
||||
(let ((r (delete-dups (remove "" row))))
|
||||
(or (null r) (and has-item (= (length r) 1)))))
|
||||
(unless (or
|
||||
(and skip-empty
|
||||
(let ((r (delete-dups (remove "" row))))
|
||||
(or (null r) (and has-item (= (length r) 1)))))
|
||||
(and exclude-tags
|
||||
(cl-some (lambda (tag) (member tag exclude-tags))
|
||||
(org-get-tags))))
|
||||
(push (cons (org-reduced-level (org-current-level)) (nreverse row))
|
||||
table)))))
|
||||
(or (and maxlevel (format "LEVEL<=%d" maxlevel))
|
||||
|
@ -1472,6 +1460,7 @@ PARAMS is a property list of parameters:
|
|||
(org-columns--capture-view (plist-get params :maxlevel)
|
||||
(plist-get params :match)
|
||||
(plist-get params :skip-empty-rows)
|
||||
(plist-get params :exclude-tags)
|
||||
(plist-get params :format)
|
||||
view-pos))))))
|
||||
(when table
|
||||
|
|
|
@ -81,6 +81,10 @@
|
|||
(defalias 'org-line-number-display-width 'line-number-display-width)
|
||||
(defun org-line-number-display-width (&rest _) 0))
|
||||
|
||||
(if (fboundp 'buffer-hash)
|
||||
(defalias 'org-buffer-hash 'buffer-hash)
|
||||
(defun org-buffer-hash () (md5 (current-buffer))))
|
||||
|
||||
|
||||
;;; Emacs < 25.1 compatibility
|
||||
|
||||
|
|
|
@ -0,0 +1,916 @@
|
|||
;;; org-keys.el --- Key bindings for Org mode -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2018 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; This library adds bindings for Org mode buffers. It also
|
||||
;; implements both Speed keys and Babel speed keys. See manual for
|
||||
;; details.
|
||||
|
||||
;;; Code:
|
||||
|
||||
(defvar org-outline-regexp)
|
||||
|
||||
(declare-function org-add-note "org" ())
|
||||
(declare-function org-agenda "org" (&optional arg org-keys restriction))
|
||||
(declare-function org-agenda-file-to-front "org" (&optional to-end))
|
||||
(declare-function org-agenda-remove-restriction-lock "org" (&optional noupdate))
|
||||
(declare-function org-agenda-set-restriction-lock "org" (&optional type))
|
||||
(declare-function org-archive-subtree "org" (&optional find-done))
|
||||
(declare-function org-archive-subtree-default "org" ())
|
||||
(declare-function org-archive-subtree-default-with-confirmation "org" ())
|
||||
(declare-function org-archive-to-archive-sibling "org" ())
|
||||
(declare-function org-at-heading-p "org" (&optional ignored))
|
||||
(declare-function org-attach "org" ())
|
||||
(declare-function org-backward-element "org" ())
|
||||
(declare-function org-backward-heading-same-level "org" (arg &optional invisible-ok))
|
||||
(declare-function org-backward-paragraph "org" ())
|
||||
(declare-function org-backward-sentence "org" (&optional arg))
|
||||
(declare-function org-beginning-of-line "org" (&optional n))
|
||||
(declare-function org-clock-cancel "org" ())
|
||||
(declare-function org-clock-display "org" (&optional arg))
|
||||
(declare-function org-clock-goto "org" (&optional select))
|
||||
(declare-function org-clock-in "org" (&optional select start-time))
|
||||
(declare-function org-clock-in-last "org" (&optional arg))
|
||||
(declare-function org-clock-out "org" (&optional switch-to-state fail-quietly at-time))
|
||||
(declare-function org-clock-report "org" (&optional arg))
|
||||
(declare-function org-clone-subtree-with-time-shift "org" (n &optional shift))
|
||||
(declare-function org-columns "org" (&optional global columns-fmt-string))
|
||||
(declare-function org-columns-insert-dblock "org" ())
|
||||
(declare-function org-comment-dwim "org" (arg))
|
||||
(declare-function org-copy "org" ())
|
||||
(declare-function org-copy-special "org" ())
|
||||
(declare-function org-copy-visible "org" (beg end))
|
||||
(declare-function org-ctrl-c-ctrl-c "org" (&optional arg))
|
||||
(declare-function org-ctrl-c-minus "org" ())
|
||||
(declare-function org-ctrl-c-ret "org" ())
|
||||
(declare-function org-ctrl-c-star "org" ())
|
||||
(declare-function org-ctrl-c-tab "org" (&optional arg))
|
||||
(declare-function org-cut-special "org" ())
|
||||
(declare-function org-cut-subtree "org" (&optional n))
|
||||
(declare-function org-cycle "org" (&optional arg))
|
||||
(declare-function org-cycle-agenda-files "org" ())
|
||||
(declare-function org-date-from-calendar "org" ())
|
||||
(declare-function org-dblock-update "org" (&optional arg))
|
||||
(declare-function org-deadline "org" (arg1 &optional time))
|
||||
(declare-function org-decrease-number-at-point "org" (&optional inc))
|
||||
(declare-function org-delete-backward-char "org" (n))
|
||||
(declare-function org-delete-char "org" (n))
|
||||
(declare-function org-delete-indentation "org" (&optional arg))
|
||||
(declare-function org-demote-subtree "org" ())
|
||||
(declare-function org-display-outline-path "org" (&optional file current separator just-return-string))
|
||||
(declare-function org-down-element "org" ())
|
||||
(declare-function org-edit-special "org" (&optional arg))
|
||||
(declare-function org-element-at-point "org-element" ())
|
||||
(declare-function org-element-type "org-element" (element))
|
||||
(declare-function org-emphasize "org" (&optional char))
|
||||
(declare-function org-end-of-line "org" (&optional n))
|
||||
(declare-function org-entry-put "org" (pom property value))
|
||||
(declare-function org-eval-in-calendar "org" (form &optional keepdate))
|
||||
(declare-function org-evaluate-time-range "org" (&optional to-buffer))
|
||||
(declare-function org-export-dispatch "org" (&optional arg))
|
||||
(declare-function org-feed-goto-inbox "org" (feed))
|
||||
(declare-function org-feed-update-all "org" ())
|
||||
(declare-function org-fill-paragraph "org" (&optional justify region))
|
||||
(declare-function org-find-file-at-mouse "org" (ev))
|
||||
(declare-function org-footnote-action "org" (&optional special))
|
||||
(declare-function org-force-cycle-archived "org" ())
|
||||
(declare-function org-force-self-insert "org" (n))
|
||||
(declare-function org-forward-element "org" ())
|
||||
(declare-function org-forward-heading-same-level "org" (arg &optional invisible-ok))
|
||||
(declare-function org-forward-paragraph "org" ())
|
||||
(declare-function org-forward-sentence "org" (&optional arg))
|
||||
(declare-function org-goto "org" (&optional alternative-interface))
|
||||
(declare-function org-goto-calendar "org" (&optional arg))
|
||||
(declare-function org-inc-effort "org" ())
|
||||
(declare-function org-increase-number-at-point "org" (&optional inc))
|
||||
(declare-function org-info-find-node "org" (&optional nodename))
|
||||
(declare-function org-insert-all-links "org" (arg &optional pre post))
|
||||
(declare-function org-insert-drawer "org" (&optional arg drawer))
|
||||
(declare-function org-insert-heading-respect-content "org" (&optional invisible-ok))
|
||||
(declare-function org-insert-last-stored-link "org" (arg))
|
||||
(declare-function org-insert-link "org" (&optional complete-file link-location default-description))
|
||||
(declare-function org-insert-structure-template "org" (type))
|
||||
(declare-function org-insert-todo-heading "org" (arg &optional force-heading))
|
||||
(declare-function org-insert-todo-heading-respect-content "org" (&optional force-state))
|
||||
(declare-function org-kill-line "org" (&optional arg))
|
||||
(declare-function org-kill-note-or-show-branches "org" ())
|
||||
(declare-function org-list-make-subtree "org" ())
|
||||
(declare-function org-mark-element "org" ())
|
||||
(declare-function org-mark-ring-goto "org" (&optional n))
|
||||
(declare-function org-mark-ring-push "org" (&optional pos buffer))
|
||||
(declare-function org-mark-subtree "org" (&optional up))
|
||||
(declare-function org-match-sparse-tree "org" (&optional todo-only match))
|
||||
(declare-function org-meta-return "org" (&optional arg))
|
||||
(declare-function org-metadown "org" (&optional _arg))
|
||||
(declare-function org-metaleft "org" (&optional _))
|
||||
(declare-function org-metaright "org" (&optional _arg))
|
||||
(declare-function org-metaup "org" (&optional _arg))
|
||||
(declare-function org-narrow-to-block "org" ())
|
||||
(declare-function org-narrow-to-element "org" ())
|
||||
(declare-function org-narrow-to-subtree "org" ())
|
||||
(declare-function org-next-block "org" (arg &optional backward block-regexp))
|
||||
(declare-function org-next-link "org" (&optional search-backward))
|
||||
(declare-function org-next-visible-heading "org" (arg))
|
||||
(declare-function org-open-at-mouse "org" (ev))
|
||||
(declare-function org-open-at-point "org" (&optional arg reference-buffer))
|
||||
(declare-function org-open-line "org" (n))
|
||||
(declare-function org-paste-special "org" (arg))
|
||||
(declare-function org-plot/gnuplot "org-plot" (&optional params))
|
||||
(declare-function org-previous-block "org" (arg &optional block-regexp))
|
||||
(declare-function org-previous-link "org" ())
|
||||
(declare-function org-previous-visible-heading "org" (arg))
|
||||
(declare-function org-priority "org" (&optional action show))
|
||||
(declare-function org-promote-subtree "org" ())
|
||||
(declare-function org-redisplay-inline-images "org" ())
|
||||
(declare-function org-refile "org" (&optional arg1 default-buffer rfloc msg))
|
||||
(declare-function org-reftex-citation "org" ())
|
||||
(declare-function org-reload "org" (&optional arg1))
|
||||
(declare-function org-remove-file "org" (&optional file))
|
||||
(declare-function org-resolve-clocks "org" (&optional only-dangling-p prompt-fn last-valid))
|
||||
(declare-function org-return "org" (&optional indent))
|
||||
(declare-function org-return-indent "org" ())
|
||||
(declare-function org-reveal "org" (&optional siblings))
|
||||
(declare-function org-schedule "org" (arg &optional time))
|
||||
(declare-function org-self-insert-command "org" (N))
|
||||
(declare-function org-set-effort "org" (&optional increment value))
|
||||
(declare-function org-set-property "org" (property value))
|
||||
(declare-function org-set-property-and-value "org" (use-last))
|
||||
(declare-function org-set-tags-command "org" (&optional arg))
|
||||
(declare-function org-shiftcontroldown "org" (&optional n))
|
||||
(declare-function org-shiftcontrolleft "org" ())
|
||||
(declare-function org-shiftcontrolright "org" ())
|
||||
(declare-function org-shiftcontrolup "org" (&optional n))
|
||||
(declare-function org-shiftdown "org" (&optional arg))
|
||||
(declare-function org-shiftleft "org" (&optional arg))
|
||||
(declare-function org-shiftmetadown "org" (&optional _arg))
|
||||
(declare-function org-shiftmetaleft "org" ())
|
||||
(declare-function org-shiftmetaright "org" ())
|
||||
(declare-function org-shiftmetaup "org" (&optional arg))
|
||||
(declare-function org-shiftright "org" (&optional arg))
|
||||
(declare-function org-shifttab "org" (&optional arg))
|
||||
(declare-function org-shiftup "org" (&optional arg))
|
||||
(declare-function org-show-all "org" (&optional types))
|
||||
(declare-function org-show-children "org" (&optional level))
|
||||
(declare-function org-show-subtree "org" ())
|
||||
(declare-function org-sort "org" (&optional with-case))
|
||||
(declare-function org-sparse-tree "org" (&optional arg type))
|
||||
(declare-function org-table-blank-field "org" ())
|
||||
(declare-function org-table-copy-down "org" (n))
|
||||
(declare-function org-table-create-or-convert-from-region "org" (arg))
|
||||
(declare-function org-table-create-with-table\.el "org-table" ())
|
||||
(declare-function org-table-edit-field "org" (arg))
|
||||
(declare-function org-table-eval-formula "org" (&optional arg equation suppress-align suppress-const suppress-store suppress-analysis))
|
||||
(declare-function org-table-field-info "org" (arg))
|
||||
(declare-function org-table-rotate-recalc-marks "org" (&optional newchar))
|
||||
(declare-function org-table-sum "org" (&optional beg end nlast))
|
||||
(declare-function org-table-toggle-coordinate-overlays "org" ())
|
||||
(declare-function org-table-toggle-formula-debugger "org" ())
|
||||
(declare-function org-time-stamp "org" (arg &optional inactive))
|
||||
(declare-function org-time-stamp-inactive "org" (&optional arg))
|
||||
(declare-function org-timer "org" (&optional restart no-insert))
|
||||
(declare-function org-timer-item "org" (&optional arg))
|
||||
(declare-function org-timer-pause-or-continue "org" (&optional stop))
|
||||
(declare-function org-timer-set-timer "org" (&optional opt))
|
||||
(declare-function org-timer-start "org" (&optional offset))
|
||||
(declare-function org-timer-stop "org" ())
|
||||
(declare-function org-todo "org" (&optional arg1))
|
||||
(declare-function org-toggle-archive-tag "org" (&optional find-done))
|
||||
(declare-function org-toggle-checkbox "org" (&optional toggle-presence))
|
||||
(declare-function org-toggle-comment "org" ())
|
||||
(declare-function org-toggle-fixed-width "org" ())
|
||||
(declare-function org-toggle-inline-images "org" (&optional include-linked))
|
||||
(declare-function org-toggle-latex-fragment "org" (&optional arg))
|
||||
(declare-function org-toggle-narrow-to-subtree "org" ())
|
||||
(declare-function org-toggle-ordered-property "org" ())
|
||||
(declare-function org-toggle-pretty-entities "org" ())
|
||||
(declare-function org-toggle-tags-groups "org" ())
|
||||
(declare-function org-toggle-time-stamp-overlays "org" ())
|
||||
(declare-function org-transpose-element "org" ())
|
||||
(declare-function org-transpose-words "org" ())
|
||||
(declare-function org-tree-to-indirect-buffer "org" (&optional arg))
|
||||
(declare-function org-up-element "org" ())
|
||||
(declare-function org-update-statistics-cookies "org" (all))
|
||||
(declare-function org-yank "org" (&optional arg))
|
||||
(declare-function orgtbl-ascii-plot "org-table" (&optional ask))
|
||||
|
||||
|
||||
|
||||
;;; Variables
|
||||
|
||||
(defvar org-mode-map (make-sparse-keymap)
|
||||
"Keymap fo Org mode.")
|
||||
|
||||
(defcustom org-replace-disputed-keys nil
|
||||
"Non-nil means use alternative key bindings for some keys.
|
||||
|
||||
Org mode uses S-<cursor> keys for changing timestamps and priorities.
|
||||
These keys are also used by other packages like Shift Select mode,
|
||||
CUA mode or Windmove. If you want to use Org mode together with
|
||||
one of these other modes, or more generally if you would like to
|
||||
move some Org mode commands to other keys, set this variable and
|
||||
configure the keys with the variable `org-disputed-keys'.
|
||||
|
||||
This option is only relevant at load-time of Org mode, and must be set
|
||||
*before* org.el is loaded. Changing it requires a restart of Emacs to
|
||||
become effective."
|
||||
:group 'org-startup
|
||||
:type 'boolean
|
||||
:safe #'booleanp)
|
||||
|
||||
(defcustom org-use-extra-keys nil
|
||||
"Non-nil means use extra key sequence definitions for certain commands.
|
||||
This happens automatically if `window-system' is nil. This
|
||||
variable lets you do the same manually. You must set it before
|
||||
loading Org."
|
||||
:group 'org-startup
|
||||
:type 'boolean
|
||||
:safe #'booleanp)
|
||||
|
||||
(defvaralias 'org-CUA-compatible 'org-replace-disputed-keys)
|
||||
|
||||
(defcustom org-disputed-keys
|
||||
'(([(shift up)] . [(meta p)])
|
||||
([(shift down)] . [(meta n)])
|
||||
([(shift left)] . [(meta -)])
|
||||
([(shift right)] . [(meta +)])
|
||||
([(control shift right)] . [(meta shift +)])
|
||||
([(control shift left)] . [(meta shift -)]))
|
||||
"Keys for which Org mode and other modes compete.
|
||||
This is an alist, cars are the default keys, second element specifies
|
||||
the alternative to use when `org-replace-disputed-keys' is t.
|
||||
|
||||
Keys can be specified in any syntax supported by `define-key'.
|
||||
The value of this option takes effect only at Org mode startup,
|
||||
therefore you'll have to restart Emacs to apply it after changing."
|
||||
:group 'org-startup
|
||||
:type 'alist)
|
||||
|
||||
(defcustom org-mouse-1-follows-link
|
||||
(if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t)
|
||||
"Non-nil means mouse-1 on a link will follow the link.
|
||||
A longer mouse click will still set point. Needs to be set
|
||||
before org.el is loaded."
|
||||
:group 'org-link-follow
|
||||
:version "26.1"
|
||||
:package-version '(Org . "8.3")
|
||||
:type '(choice
|
||||
(const :tag "A double click follows the link" double)
|
||||
(const :tag "Unconditionally follow the link with mouse-1" t)
|
||||
(integer :tag "mouse-1 click does not follow the link if longer than N ms" 450))
|
||||
:safe t)
|
||||
|
||||
(defcustom org-tab-follows-link nil
|
||||
"Non-nil means on links TAB will follow the link.
|
||||
Needs to be set before Org is loaded.
|
||||
This really should not be used, it does not make sense, and the
|
||||
implementation is bad."
|
||||
:group 'org-link-follow
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom org-follow-link-hook nil
|
||||
"Hook that is run after a link has been followed."
|
||||
:group 'org-link-follow
|
||||
:type 'hook)
|
||||
|
||||
(defcustom org-return-follows-link nil
|
||||
"Non-nil means on links RET will follow the link.
|
||||
In tables, the special behavior of RET has precedence."
|
||||
:group 'org-link-follow
|
||||
:type 'boolean
|
||||
:safe t)
|
||||
|
||||
|
||||
;;; Functions
|
||||
|
||||
;;;; Base functions
|
||||
(defun org-key (key)
|
||||
"Select key according to `org-replace-disputed-keys' and `org-disputed-keys'.
|
||||
Or return the original if not disputed."
|
||||
(when org-replace-disputed-keys
|
||||
(let* ((nkey (key-description key))
|
||||
(x (cl-find-if (lambda (x) (equal (key-description (car x)) nkey))
|
||||
org-disputed-keys)))
|
||||
(setq key (if x (cdr x) key))))
|
||||
key)
|
||||
|
||||
(defun org-defkey (keymap key def)
|
||||
"Define a key, possibly translated, as returned by `org-key'."
|
||||
(define-key keymap (org-key key) def))
|
||||
|
||||
(defun org-remap (map &rest commands)
|
||||
"In MAP, remap the functions given in COMMANDS.
|
||||
COMMANDS is a list of alternating OLDDEF NEWDEF command names."
|
||||
(let (new old)
|
||||
(while commands
|
||||
(setq old (pop commands) new (pop commands))
|
||||
(org-defkey map (vector 'remap old) new))))
|
||||
|
||||
|
||||
;;; Mouse map
|
||||
|
||||
(defvar org-mouse-map (make-sparse-keymap))
|
||||
(org-defkey org-mouse-map [mouse-2] 'org-open-at-mouse)
|
||||
(org-defkey org-mouse-map [mouse-3] 'org-find-file-at-mouse)
|
||||
|
||||
(when org-mouse-1-follows-link
|
||||
(org-defkey org-mouse-map [follow-link] 'mouse-face))
|
||||
|
||||
(when org-tab-follows-link
|
||||
(org-defkey org-mouse-map (kbd "<tab>") #'org-open-at-point)
|
||||
(org-defkey org-mouse-map (kbd "TAB") #'org-open-at-point))
|
||||
|
||||
|
||||
;;; Read date map
|
||||
|
||||
(defvar org-read-date-minibuffer-local-map
|
||||
(let* ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map minibuffer-local-map)
|
||||
(org-defkey map (kbd ".")
|
||||
(lambda () (interactive)
|
||||
;; Are we at the beginning of the prompt?
|
||||
(if (looking-back "^[^:]+: "
|
||||
(let ((inhibit-field-text-motion t))
|
||||
(line-beginning-position)))
|
||||
(org-eval-in-calendar '(calendar-goto-today))
|
||||
(insert "."))))
|
||||
(org-defkey map (kbd "C-.")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-goto-today))))
|
||||
(org-defkey map (kbd "M-S-<left>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-month 1))))
|
||||
(org-defkey map (kbd "ESC S-<left>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-month 1))))
|
||||
(org-defkey map (kbd "M-S-<right>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-month 1))))
|
||||
(org-defkey map (kbd "ESC S-<right>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-month 1))))
|
||||
(org-defkey map (kbd "M-S-<up>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-year 1))))
|
||||
(org-defkey map (kbd "ESC S-<up>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-year 1))))
|
||||
(org-defkey map (kbd "M-S-<down>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-year 1))))
|
||||
(org-defkey map (kbd "ESC S-<down>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-year 1))))
|
||||
(org-defkey map (kbd "S-<up>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-week 1))))
|
||||
(org-defkey map (kbd "S-<down>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-week 1))))
|
||||
(org-defkey map (kbd "S-<left>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-day 1))))
|
||||
(org-defkey map (kbd "S-<right>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-day 1))))
|
||||
(org-defkey map (kbd "!")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(diary-view-entries))
|
||||
(message "")))
|
||||
(org-defkey map (kbd ">")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-scroll-left 1))))
|
||||
(org-defkey map (kbd "<")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-scroll-right 1))))
|
||||
(org-defkey map (kbd "C-v")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar
|
||||
'(calendar-scroll-left-three-months 1))))
|
||||
(org-defkey map (kbd "M-v")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar
|
||||
'(calendar-scroll-right-three-months 1))))
|
||||
map)
|
||||
"Keymap for minibuffer commands when using `org-read-date'.")
|
||||
|
||||
|
||||
;;; Global bindings
|
||||
|
||||
;;;; Outline functions
|
||||
(define-key org-mode-map [menu-bar headings] 'undefined)
|
||||
(define-key org-mode-map [menu-bar hide] 'undefined)
|
||||
(define-key org-mode-map [menu-bar show] 'undefined)
|
||||
|
||||
(define-key org-mode-map [remap outline-mark-subtree] #'org-mark-subtree)
|
||||
(define-key org-mode-map [remap outline-show-subtree] #'org-show-subtree)
|
||||
(define-key org-mode-map [remap outline-forward-same-level]
|
||||
#'org-forward-heading-same-level)
|
||||
(define-key org-mode-map [remap outline-backward-same-level]
|
||||
#'org-backward-heading-same-level)
|
||||
(define-key org-mode-map [remap outline-show-branches]
|
||||
#'org-kill-note-or-show-branches)
|
||||
(define-key org-mode-map [remap outline-promote] #'org-promote-subtree)
|
||||
(define-key org-mode-map [remap outline-demote] #'org-demote-subtree)
|
||||
(define-key org-mode-map [remap outline-insert-heading] #'org-ctrl-c-ret)
|
||||
(define-key org-mode-map [remap outline-next-visible-heading]
|
||||
#'org-next-visible-heading)
|
||||
(define-key org-mode-map [remap outline-previous-visible-heading]
|
||||
#'org-previous-visible-heading)
|
||||
(define-key org-mode-map [remap show-children] #'org-show-children)
|
||||
|
||||
;;;; Make `C-c C-x' a prefix key
|
||||
(org-defkey org-mode-map (kbd "C-c C-x") (make-sparse-keymap))
|
||||
|
||||
;;;; TAB key with modifiers
|
||||
(org-defkey org-mode-map (kbd "C-i") #'org-cycle)
|
||||
(org-defkey org-mode-map (kbd "<tab>") #'org-cycle)
|
||||
(org-defkey org-mode-map (kbd "C-<tab>") #'org-force-cycle-archived)
|
||||
(org-defkey org-mode-map (kbd "M-<tab>") #'pcomplete)
|
||||
(org-defkey org-mode-map (kbd "ESC <tab>") #'pcomplete)
|
||||
|
||||
(org-defkey org-mode-map (kbd "<S-iso-leftab>") #'org-shifttab)
|
||||
(org-defkey org-mode-map (kbd "S-<tab>") #'org-shifttab)
|
||||
(define-key org-mode-map (kbd "<backtab>") #'org-shifttab)
|
||||
|
||||
;;;; RET key with modifiers
|
||||
(org-defkey org-mode-map (kbd "S-<return>") #'org-table-copy-down)
|
||||
(org-defkey org-mode-map (kbd "M-S-<return>") #'org-insert-todo-heading)
|
||||
(org-defkey org-mode-map (kbd "ESC S-<return>") #'org-insert-todo-heading)
|
||||
(org-defkey org-mode-map (kbd "M-RET") #'org-meta-return)
|
||||
(org-defkey org-mode-map (kbd "ESC RET") #'org-meta-return)
|
||||
|
||||
;;;; Cursor keys with modifiers
|
||||
(org-defkey org-mode-map (kbd "M-<left>") #'org-metaleft)
|
||||
(org-defkey org-mode-map (kbd "M-<right>") #'org-metaright)
|
||||
(org-defkey org-mode-map (kbd "ESC <right>") #'org-metaright)
|
||||
(org-defkey org-mode-map (kbd "M-<up>") #'org-metaup)
|
||||
(org-defkey org-mode-map (kbd "ESC <up>") #'org-metaup)
|
||||
(org-defkey org-mode-map (kbd "M-<down>") #'org-metadown)
|
||||
(org-defkey org-mode-map (kbd "ESC <down>") #'org-metadown)
|
||||
|
||||
(org-defkey org-mode-map (kbd "C-M-S-<right>") #'org-increase-number-at-point)
|
||||
(org-defkey org-mode-map (kbd "C-M-S-<left>") #'org-decrease-number-at-point)
|
||||
(org-defkey org-mode-map (kbd "M-S-<left>") #'org-shiftmetaleft)
|
||||
(org-defkey org-mode-map (kbd "ESC S-<left>") #'org-shiftmetaleft)
|
||||
(org-defkey org-mode-map (kbd "M-S-<right>") #'org-shiftmetaright)
|
||||
(org-defkey org-mode-map (kbd "ESC S-<right>") #'org-shiftmetaright)
|
||||
(org-defkey org-mode-map (kbd "M-S-<up>") #'org-shiftmetaup)
|
||||
(org-defkey org-mode-map (kbd "ESC S-<up>") #'org-shiftmetaup)
|
||||
(org-defkey org-mode-map (kbd "M-S-<down>") #'org-shiftmetadown)
|
||||
(org-defkey org-mode-map (kbd "ESC S-<down>") #'org-shiftmetadown)
|
||||
|
||||
(org-defkey org-mode-map (kbd "S-<up>") #'org-shiftup)
|
||||
(org-defkey org-mode-map (kbd "S-<down>") #'org-shiftdown)
|
||||
(org-defkey org-mode-map (kbd "S-<left>") #'org-shiftleft)
|
||||
(org-defkey org-mode-map (kbd "S-<right>") #'org-shiftright)
|
||||
|
||||
(org-defkey org-mode-map (kbd "C-S-<right>") #'org-shiftcontrolright)
|
||||
(org-defkey org-mode-map (kbd "C-S-<left>") #'org-shiftcontrolleft)
|
||||
(org-defkey org-mode-map (kbd "C-S-<up>") #'org-shiftcontrolup)
|
||||
(org-defkey org-mode-map (kbd "C-S-<down>") #'org-shiftcontroldown)
|
||||
|
||||
;;;; Extra keys for TTY access.
|
||||
|
||||
;; We only set them when really needed because otherwise the
|
||||
;; menus don't show the simple keys
|
||||
|
||||
(when (or org-use-extra-keys (not window-system))
|
||||
(org-defkey org-mode-map (kbd "C-c C-x c") #'org-table-copy-down)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x m") #'org-meta-return)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x M") #'org-insert-todo-heading)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x RET") #'org-meta-return)
|
||||
(org-defkey org-mode-map (kbd "ESC RET") #'org-meta-return)
|
||||
(org-defkey org-mode-map (kbd "ESC <left>") #'org-metaleft)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x l") #'org-metaleft)
|
||||
(org-defkey org-mode-map (kbd "ESC <right>") #'org-metaright)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x r") #'org-metaright)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x u") #'org-metaup)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x d") #'org-metadown)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x L") #'org-shiftmetaleft)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x R") #'org-shiftmetaright)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x U") #'org-shiftmetaup)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x D") #'org-shiftmetadown)
|
||||
(org-defkey org-mode-map (kbd "C-c <up>") #'org-shiftup)
|
||||
(org-defkey org-mode-map (kbd "C-c <down>") #'org-shiftdown)
|
||||
(org-defkey org-mode-map (kbd "C-c <left>") #'org-shiftleft)
|
||||
(org-defkey org-mode-map (kbd "C-c <right>") #'org-shiftright)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x <right>") #'org-shiftcontrolright)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x <left>") #'org-shiftcontrolleft))
|
||||
|
||||
;;;; Narrow map
|
||||
(org-defkey narrow-map "s" #'org-narrow-to-subtree)
|
||||
(org-defkey narrow-map "b" #'org-narrow-to-block)
|
||||
(org-defkey narrow-map "e" #'org-narrow-to-element)
|
||||
|
||||
;;;; Remap usual Emacs bindings
|
||||
(org-remap org-mode-map
|
||||
'self-insert-command 'org-self-insert-command
|
||||
'delete-char 'org-delete-char
|
||||
'delete-backward-char 'org-delete-backward-char
|
||||
'kill-line 'org-kill-line
|
||||
'open-line 'org-open-line
|
||||
'yank 'org-yank
|
||||
'comment-dwim 'org-comment-dwim
|
||||
'move-beginning-of-line 'org-beginning-of-line
|
||||
'move-end-of-line 'org-end-of-line
|
||||
'forward-paragraph 'org-forward-paragraph
|
||||
'backward-paragraph 'org-backward-paragraph
|
||||
'backward-sentence 'org-backward-sentence
|
||||
'forward-sentence 'org-forward-sentence
|
||||
'fill-paragraph 'org-fill-paragraph
|
||||
'delete-indentation 'org-delete-indentation
|
||||
'transpose-words 'org-transpose-words)
|
||||
|
||||
;;;; All the other keys
|
||||
(org-defkey org-mode-map (kbd "|") #'org-force-self-insert)
|
||||
(org-defkey org-mode-map (kbd "C-c C-r") #'org-reveal)
|
||||
(org-defkey org-mode-map (kbd "C-M-t") #'org-transpose-element)
|
||||
(org-defkey org-mode-map (kbd "M-}") #'org-forward-element)
|
||||
(org-defkey org-mode-map (kbd "ESC }") #'org-forward-element)
|
||||
(org-defkey org-mode-map (kbd "M-{") #'org-backward-element)
|
||||
(org-defkey org-mode-map (kbd "ESC {") #'org-backward-element)
|
||||
(org-defkey org-mode-map (kbd "C-c C-^") #'org-up-element)
|
||||
(org-defkey org-mode-map (kbd "C-c C-_") #'org-down-element)
|
||||
(org-defkey org-mode-map (kbd "C-c C-f") #'org-forward-heading-same-level)
|
||||
(org-defkey org-mode-map (kbd "C-c C-b") #'org-backward-heading-same-level)
|
||||
(org-defkey org-mode-map (kbd "C-c M-f") #'org-next-block)
|
||||
(org-defkey org-mode-map (kbd "C-c M-b") #'org-previous-block)
|
||||
(org-defkey org-mode-map (kbd "C-c $") #'org-archive-subtree)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-s") #'org-archive-subtree)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-a") #'org-archive-subtree-default)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x d") #'org-insert-drawer)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x a") #'org-toggle-archive-tag)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x A") #'org-archive-to-archive-sibling)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x b") #'org-tree-to-indirect-buffer)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x q") #'org-toggle-tags-groups)
|
||||
(org-defkey org-mode-map (kbd "C-c C-j") #'org-goto)
|
||||
(org-defkey org-mode-map (kbd "C-c C-t") #'org-todo)
|
||||
(org-defkey org-mode-map (kbd "C-c C-q") #'org-set-tags-command)
|
||||
(org-defkey org-mode-map (kbd "C-c C-s") #'org-schedule)
|
||||
(org-defkey org-mode-map (kbd "C-c C-d") #'org-deadline)
|
||||
(org-defkey org-mode-map (kbd "C-c ;") #'org-toggle-comment)
|
||||
(org-defkey org-mode-map (kbd "C-c C-w") #'org-refile)
|
||||
(org-defkey org-mode-map (kbd "C-c M-w") #'org-copy)
|
||||
(org-defkey org-mode-map (kbd "C-c /") #'org-sparse-tree) ;minor-mode reserved
|
||||
(org-defkey org-mode-map (kbd "C-c \\") #'org-match-sparse-tree) ;minor-mode r.
|
||||
(org-defkey org-mode-map (kbd "C-c RET") #'org-ctrl-c-ret)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x c") #'org-clone-subtree-with-time-shift)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x v") #'org-copy-visible)
|
||||
(org-defkey org-mode-map (kbd "C-<return>") #'org-insert-heading-respect-content)
|
||||
(org-defkey org-mode-map (kbd "C-S-<return>") #'org-insert-todo-heading-respect-content)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-n") #'org-next-link)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-p") #'org-previous-link)
|
||||
(org-defkey org-mode-map (kbd "C-c C-l") #'org-insert-link)
|
||||
(org-defkey org-mode-map (kbd "C-c M-l") #'org-insert-last-stored-link)
|
||||
(org-defkey org-mode-map (kbd "C-c C-M-l") #'org-insert-all-links)
|
||||
(org-defkey org-mode-map (kbd "C-c C-o") #'org-open-at-point)
|
||||
(org-defkey org-mode-map (kbd "C-c %") #'org-mark-ring-push)
|
||||
(org-defkey org-mode-map (kbd "C-c &") #'org-mark-ring-goto)
|
||||
(org-defkey org-mode-map (kbd "C-c C-z") #'org-add-note) ;alternative binding
|
||||
(org-defkey org-mode-map (kbd "C-c .") #'org-time-stamp) ;minor-mode reserved
|
||||
(org-defkey org-mode-map (kbd "C-c !") #'org-time-stamp-inactive) ;minor-mode r.
|
||||
(org-defkey org-mode-map (kbd "C-c ,") #'org-priority) ;minor-mode reserved
|
||||
(org-defkey org-mode-map (kbd "C-c C-y") #'org-evaluate-time-range)
|
||||
(org-defkey org-mode-map (kbd "C-c >") #'org-goto-calendar)
|
||||
(org-defkey org-mode-map (kbd "C-c <") #'org-date-from-calendar)
|
||||
(org-defkey org-mode-map (kbd "C-,") #'org-cycle-agenda-files)
|
||||
(org-defkey org-mode-map (kbd "C-'") #'org-cycle-agenda-files)
|
||||
(org-defkey org-mode-map (kbd "C-c [") #'org-agenda-file-to-front)
|
||||
(org-defkey org-mode-map (kbd "C-c ]") #'org-remove-file)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x <") #'org-agenda-set-restriction-lock)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x >") #'org-agenda-remove-restriction-lock)
|
||||
(org-defkey org-mode-map (kbd "C-c -") #'org-ctrl-c-minus)
|
||||
(org-defkey org-mode-map (kbd "C-c *") #'org-ctrl-c-star)
|
||||
(org-defkey org-mode-map (kbd "C-c TAB") #'org-ctrl-c-tab)
|
||||
(org-defkey org-mode-map (kbd "C-c ^") #'org-sort)
|
||||
(org-defkey org-mode-map (kbd "C-c C-c") #'org-ctrl-c-ctrl-c)
|
||||
(org-defkey org-mode-map (kbd "C-c C-k") #'org-kill-note-or-show-branches)
|
||||
(org-defkey org-mode-map (kbd "C-c #") #'org-update-statistics-cookies)
|
||||
(org-defkey org-mode-map (kbd "RET") #'org-return)
|
||||
(org-defkey org-mode-map (kbd "C-j") #'org-return-indent)
|
||||
(org-defkey org-mode-map (kbd "C-c ?") #'org-table-field-info)
|
||||
(org-defkey org-mode-map (kbd "C-c SPC") #'org-table-blank-field)
|
||||
(org-defkey org-mode-map (kbd "C-c +") #'org-table-sum)
|
||||
(org-defkey org-mode-map (kbd "C-c =") #'org-table-eval-formula)
|
||||
(org-defkey org-mode-map (kbd "C-c '") #'org-edit-special)
|
||||
(org-defkey org-mode-map (kbd "C-c `") #'org-table-edit-field)
|
||||
(org-defkey org-mode-map (kbd "C-c \" a") #'orgtbl-ascii-plot)
|
||||
(org-defkey org-mode-map (kbd "C-c \" g") #'org-plot/gnuplot)
|
||||
(org-defkey org-mode-map (kbd "C-c |") #'org-table-create-or-convert-from-region)
|
||||
(org-defkey org-mode-map (kbd "C-#") #'org-table-rotate-recalc-marks)
|
||||
(org-defkey org-mode-map (kbd "C-c ~") #'org-table-create-with-table.el)
|
||||
(org-defkey org-mode-map (kbd "C-c C-a") #'org-attach)
|
||||
(org-defkey org-mode-map (kbd "C-c }") #'org-table-toggle-coordinate-overlays)
|
||||
(org-defkey org-mode-map (kbd "C-c {") #'org-table-toggle-formula-debugger)
|
||||
(org-defkey org-mode-map (kbd "C-c C-e") #'org-export-dispatch)
|
||||
(org-defkey org-mode-map (kbd "C-c :") #'org-toggle-fixed-width)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-f") #'org-emphasize)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x f") #'org-footnote-action)
|
||||
(org-defkey org-mode-map (kbd "C-c @") #'org-mark-subtree)
|
||||
(org-defkey org-mode-map (kbd "M-h") #'org-mark-element)
|
||||
(org-defkey org-mode-map (kbd "ESC h") #'org-mark-element)
|
||||
(org-defkey org-mode-map (kbd "C-c C-*") #'org-list-make-subtree)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-w") #'org-cut-special)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x M-w") #'org-copy-special)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-y") #'org-paste-special)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-t") #'org-toggle-time-stamp-overlays)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-i") #'org-clock-in)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-x") #'org-clock-in-last)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-z") #'org-resolve-clocks)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-o") #'org-clock-out)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-j") #'org-clock-goto)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-q") #'org-clock-cancel)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-d") #'org-clock-display)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-r") #'org-clock-report)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-u") #'org-dblock-update)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-l") #'org-toggle-latex-fragment)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-v") #'org-toggle-inline-images)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-M-v") #'org-redisplay-inline-images)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x \\") #'org-toggle-pretty-entities)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-b") #'org-toggle-checkbox)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x p") #'org-set-property)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x P") #'org-set-property-and-value)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x e") #'org-set-effort)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x E") #'org-inc-effort)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x o") #'org-toggle-ordered-property)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x i") #'org-columns-insert-dblock)
|
||||
(org-defkey org-mode-map (kbd "C-c C-,") #'org-insert-structure-template)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x .") #'org-timer)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x -") #'org-timer-item)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x 0") #'org-timer-start)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x _") #'org-timer-stop)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x ;") #'org-timer-set-timer)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x ,") #'org-timer-pause-or-continue)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-c") #'org-columns)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x !") #'org-reload)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x g") #'org-feed-update-all)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x G") #'org-feed-goto-inbox)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x [") #'org-reftex-citation)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x I") #'org-info-find-node)
|
||||
|
||||
|
||||
;;; Speed keys
|
||||
|
||||
(defcustom org-use-speed-commands nil
|
||||
"Non-nil means activate single letter commands at beginning of a headline.
|
||||
This may also be a function to test for appropriate locations where speed
|
||||
commands should be active.
|
||||
|
||||
For example, to activate speed commands when the point is on any
|
||||
star at the beginning of the headline, you can do this:
|
||||
|
||||
(setq org-use-speed-commands
|
||||
(lambda () (and (looking-at org-outline-regexp) (looking-back \"^\\**\"))))"
|
||||
:group 'org-structure
|
||||
:type '(choice
|
||||
(const :tag "Never" nil)
|
||||
(const :tag "At beginning of headline stars" t)
|
||||
(function)))
|
||||
|
||||
(defcustom org-speed-commands-user nil
|
||||
"Alist of additional speed commands.
|
||||
This list will be checked before `org-speed-commands-default'
|
||||
when the variable `org-use-speed-commands' is non-nil
|
||||
and when the cursor is at the beginning of a headline.
|
||||
The car of each entry is a string with a single letter, which must
|
||||
be assigned to `self-insert-command' in the global map.
|
||||
The cdr is either a command to be called interactively, a function
|
||||
to be called, or a form to be evaluated.
|
||||
An entry that is just a list with a single string will be interpreted
|
||||
as a descriptive headline that will be added when listing the speed
|
||||
commands in the Help buffer using the `?' speed command."
|
||||
:group 'org-structure
|
||||
:type '(repeat :value ("k" . ignore)
|
||||
(choice :value ("k" . ignore)
|
||||
(list :tag "Descriptive Headline" (string :tag "Headline"))
|
||||
(cons :tag "Letter and Command"
|
||||
(string :tag "Command letter")
|
||||
(choice
|
||||
(function)
|
||||
(sexp))))))
|
||||
|
||||
(defcustom org-speed-command-hook
|
||||
'(org-speed-command-activate org-babel-speed-command-activate)
|
||||
"Hook for activating speed commands at strategic locations.
|
||||
Hook functions are called in sequence until a valid handler is
|
||||
found.
|
||||
|
||||
Each hook takes a single argument, a user-pressed command key
|
||||
which is also a `self-insert-command' from the global map.
|
||||
|
||||
Within the hook, examine the cursor position and the command key
|
||||
and return nil or a valid handler as appropriate. Handler could
|
||||
be one of an interactive command, a function, or a form.
|
||||
|
||||
Set `org-use-speed-commands' to non-nil value to enable this
|
||||
hook. The default setting is `org-speed-command-activate'."
|
||||
:group 'org-structure
|
||||
:version "24.1"
|
||||
:type 'hook)
|
||||
|
||||
(defconst org-speed-commands-default
|
||||
'(("Outline Navigation")
|
||||
("n" . (org-speed-move-safe 'org-next-visible-heading))
|
||||
("p" . (org-speed-move-safe 'org-previous-visible-heading))
|
||||
("f" . (org-speed-move-safe 'org-forward-heading-same-level))
|
||||
("b" . (org-speed-move-safe 'org-backward-heading-same-level))
|
||||
("F" . org-next-block)
|
||||
("B" . org-previous-block)
|
||||
("u" . (org-speed-move-safe 'outline-up-heading))
|
||||
("j" . org-goto)
|
||||
("g" . (org-refile t))
|
||||
("Outline Visibility")
|
||||
("c" . org-cycle)
|
||||
("C" . org-shifttab)
|
||||
(" " . org-display-outline-path)
|
||||
("s" . org-toggle-narrow-to-subtree)
|
||||
("k" . org-cut-subtree)
|
||||
("=" . org-columns)
|
||||
("Outline Structure Editing")
|
||||
("U" . org-metaup)
|
||||
("D" . org-metadown)
|
||||
("r" . org-metaright)
|
||||
("l" . org-metaleft)
|
||||
("R" . org-shiftmetaright)
|
||||
("L" . org-shiftmetaleft)
|
||||
("i" . (progn (forward-char 1) (call-interactively
|
||||
'org-insert-heading-respect-content)))
|
||||
("^" . org-sort)
|
||||
("w" . org-refile)
|
||||
("a" . org-archive-subtree-default-with-confirmation)
|
||||
("@" . org-mark-subtree)
|
||||
("#" . org-toggle-comment)
|
||||
("Clock Commands")
|
||||
("I" . org-clock-in)
|
||||
("O" . org-clock-out)
|
||||
("Meta Data Editing")
|
||||
("t" . org-todo)
|
||||
("," . (org-priority))
|
||||
("0" . (org-priority ?\ ))
|
||||
("1" . (org-priority ?A))
|
||||
("2" . (org-priority ?B))
|
||||
("3" . (org-priority ?C))
|
||||
(":" . org-set-tags-command)
|
||||
("e" . org-set-effort)
|
||||
("E" . org-inc-effort)
|
||||
("W" . (lambda(m) (interactive "sMinutes before warning: ")
|
||||
(org-entry-put (point) "APPT_WARNTIME" m)))
|
||||
("Agenda Views etc")
|
||||
("v" . org-agenda)
|
||||
("/" . org-sparse-tree)
|
||||
("Misc")
|
||||
("o" . org-open-at-point)
|
||||
("?" . org-speed-command-help)
|
||||
("<" . (org-agenda-set-restriction-lock 'subtree))
|
||||
(">" . (org-agenda-remove-restriction-lock)))
|
||||
"The default speed commands.")
|
||||
|
||||
(defun org-print-speed-command (e)
|
||||
(if (> (length (car e)) 1)
|
||||
(progn
|
||||
(princ "\n")
|
||||
(princ (car e))
|
||||
(princ "\n")
|
||||
(princ (make-string (length (car e)) ?-))
|
||||
(princ "\n"))
|
||||
(princ (car e))
|
||||
(princ " ")
|
||||
(if (symbolp (cdr e))
|
||||
(princ (symbol-name (cdr e)))
|
||||
(prin1 (cdr e)))
|
||||
(princ "\n")))
|
||||
|
||||
(defun org-speed-command-help ()
|
||||
"Show the available speed commands."
|
||||
(interactive)
|
||||
(unless org-use-speed-commands
|
||||
(user-error "Speed commands are not activated, customize `org-use-speed-commands'"))
|
||||
(with-output-to-temp-buffer "*Help*"
|
||||
(princ "User-defined Speed commands\n===========================\n")
|
||||
(mapc #'org-print-speed-command org-speed-commands-user)
|
||||
(princ "\n")
|
||||
(princ "Built-in Speed commands\n=======================\n")
|
||||
(mapc #'org-print-speed-command org-speed-commands-default))
|
||||
(with-current-buffer "*Help*"
|
||||
(setq truncate-lines t)))
|
||||
|
||||
(defun org-speed-move-safe (cmd)
|
||||
"Execute CMD, but make sure that the cursor always ends up in a headline.
|
||||
If not, return to the original position and throw an error."
|
||||
(interactive)
|
||||
(let ((pos (point)))
|
||||
(call-interactively cmd)
|
||||
(unless (and (bolp) (org-at-heading-p))
|
||||
(goto-char pos)
|
||||
(error "Boundary reached while executing %s" cmd))))
|
||||
|
||||
(defun org-speed-command-activate (keys)
|
||||
"Hook for activating single-letter speed commands.
|
||||
`org-speed-commands-default' specifies a minimal command set.
|
||||
Use `org-speed-commands-user' for further customization."
|
||||
(when (or (and (bolp) (looking-at org-outline-regexp))
|
||||
(and (functionp org-use-speed-commands)
|
||||
(funcall org-use-speed-commands)))
|
||||
(cdr (assoc keys (append org-speed-commands-user
|
||||
org-speed-commands-default)))))
|
||||
|
||||
|
||||
;;; Babel speed keys
|
||||
|
||||
(defvar org-babel-key-prefix "\C-c\C-v"
|
||||
"The key prefix for Babel interactive key-bindings.
|
||||
See `org-babel-key-bindings' for the list of interactive Babel
|
||||
functions which are assigned key bindings, and see
|
||||
`org-babel-map' for the actual babel keymap.")
|
||||
|
||||
(defvar org-babel-map (make-sparse-keymap)
|
||||
"The keymap for interactive Babel functions.")
|
||||
|
||||
(defvar org-babel-key-bindings
|
||||
'(("p" . org-babel-previous-src-block)
|
||||
("\C-p" . org-babel-previous-src-block)
|
||||
("n" . org-babel-next-src-block)
|
||||
("\C-n" . org-babel-next-src-block)
|
||||
("e" . org-babel-execute-maybe)
|
||||
("\C-e" . org-babel-execute-maybe)
|
||||
("o" . org-babel-open-src-block-result)
|
||||
("\C-o" . org-babel-open-src-block-result)
|
||||
("\C-v" . org-babel-expand-src-block)
|
||||
("v" . org-babel-expand-src-block)
|
||||
("u" . org-babel-goto-src-block-head)
|
||||
("\C-u" . org-babel-goto-src-block-head)
|
||||
("g" . org-babel-goto-named-src-block)
|
||||
("r" . org-babel-goto-named-result)
|
||||
("\C-r" . org-babel-goto-named-result)
|
||||
("\C-b" . org-babel-execute-buffer)
|
||||
("b" . org-babel-execute-buffer)
|
||||
("\C-s" . org-babel-execute-subtree)
|
||||
("s" . org-babel-execute-subtree)
|
||||
("\C-d" . org-babel-demarcate-block)
|
||||
("d" . org-babel-demarcate-block)
|
||||
("\C-t" . org-babel-tangle)
|
||||
("t" . org-babel-tangle)
|
||||
("\C-f" . org-babel-tangle-file)
|
||||
("f" . org-babel-tangle-file)
|
||||
("\C-c" . org-babel-check-src-block)
|
||||
("c" . org-babel-check-src-block)
|
||||
("\C-j" . org-babel-insert-header-arg)
|
||||
("j" . org-babel-insert-header-arg)
|
||||
("\C-l" . org-babel-load-in-session)
|
||||
("l" . org-babel-load-in-session)
|
||||
("\C-i" . org-babel-lob-ingest)
|
||||
("i" . org-babel-lob-ingest)
|
||||
("\C-I" . org-babel-view-src-block-info)
|
||||
("I" . org-babel-view-src-block-info)
|
||||
("\C-z" . org-babel-switch-to-session)
|
||||
("z" . org-babel-switch-to-session-with-code)
|
||||
("\C-a" . org-babel-sha1-hash)
|
||||
("a" . org-babel-sha1-hash)
|
||||
("h" . org-babel-describe-bindings)
|
||||
("\C-x" . org-babel-do-key-sequence-in-edit-buffer)
|
||||
("x" . org-babel-do-key-sequence-in-edit-buffer)
|
||||
("k" . org-babel-remove-result-one-or-many)
|
||||
("\C-\M-h" . org-babel-mark-block))
|
||||
"Alist of key bindings and interactive Babel functions.
|
||||
This list associates interactive Babel functions
|
||||
with keys. Each element of this list will add an entry to the
|
||||
`org-babel-map' using the letter key which is the `car' of the
|
||||
a-list placed behind the generic `org-babel-key-prefix'.")
|
||||
|
||||
(define-key org-mode-map org-babel-key-prefix org-babel-map)
|
||||
(pcase-dolist (`(,key . ,def) org-babel-key-bindings)
|
||||
(define-key org-babel-map key def))
|
||||
|
||||
(defun org-babel-speed-command-activate (keys)
|
||||
"Hook for activating single-letter code block commands."
|
||||
(when (and (bolp)
|
||||
(let ((case-fold-search t)) (looking-at "[ \t]*#\\+begin_src"))
|
||||
(eq 'src-block (org-element-type (org-element-at-point))))
|
||||
(cdr (assoc keys org-babel-key-bindings))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-babel-describe-bindings ()
|
||||
"Describe all keybindings behind `org-babel-key-prefix'."
|
||||
(interactive)
|
||||
(describe-bindings org-babel-key-prefix))
|
||||
|
||||
|
||||
(provide 'org-keys)
|
||||
;;; org-keys.el ends here
|
|
@ -32,10 +32,10 @@
|
|||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
(require 'ob-comint)
|
||||
(require 'org-macs)
|
||||
(require 'org-compat)
|
||||
(require 'ob-keys)
|
||||
(require 'ob-comint)
|
||||
(require 'org-keys)
|
||||
|
||||
(declare-function org-element-at-point "org-element" ())
|
||||
(declare-function org-element-class "org-element" (datum &optional parent))
|
||||
|
@ -270,9 +270,6 @@ issued in the language major mode buffer."
|
|||
(defvar-local org-src--remote nil)
|
||||
(put 'org-src--remote 'permanent-local t)
|
||||
|
||||
(defvar-local org-src--saved-temp-window-config nil)
|
||||
(put 'org-src--saved-temp-window-config 'permanent-local t)
|
||||
|
||||
(defvar-local org-src--source-type nil
|
||||
"Type of element being edited, as a symbol.")
|
||||
(put 'org-src--source-type 'permanent-local t)
|
||||
|
@ -475,7 +472,6 @@ When REMOTE is non-nil, do not try to preserve point or mark when
|
|||
moving from the edit area to the source.
|
||||
|
||||
Leave point in edit buffer."
|
||||
(setq org-src--saved-temp-window-config (current-window-configuration))
|
||||
(let* ((area (org-src--contents-area datum))
|
||||
(beg (copy-marker (nth 0 area)))
|
||||
(end (copy-marker (nth 1 area) t))
|
||||
|
@ -1172,10 +1168,7 @@ Throw an error if there is no such buffer."
|
|||
(write-back (org-src--goto-coordinates coordinates beg end))))
|
||||
;; Clean up left-over markers and restore window configuration.
|
||||
(set-marker beg nil)
|
||||
(set-marker end nil)
|
||||
(when org-src--saved-temp-window-config
|
||||
(set-window-configuration org-src--saved-temp-window-config)
|
||||
(setq org-src--saved-temp-window-config nil))))
|
||||
(set-marker end nil)))
|
||||
|
||||
|
||||
(provide 'org-src)
|
||||
|
|
|
@ -1442,6 +1442,80 @@ non-nil, the one above is used."
|
|||
(above min)
|
||||
(t max)))))))
|
||||
|
||||
(defun org-table--swap-cells (row1 col1 row2 col2)
|
||||
"Swap two cells indicated by the coordinates provided.
|
||||
ROW1, COL1, ROW2, COL2 are integers indicating the row/column
|
||||
position of the two cells that will be swapped in the table."
|
||||
(let ((content1 (org-table-get row1 col1))
|
||||
(content2 (org-table-get row2 col2)))
|
||||
(org-table-put row1 col1 content2)
|
||||
(org-table-put row2 col2 content1)))
|
||||
|
||||
(defun org-table--move-cell (direction)
|
||||
"Move the current cell in a cardinal direction.
|
||||
DIRECTION is a symbol among `up', `down', `left', and `right'.
|
||||
The contents the current cell are swapped with cell in the
|
||||
indicated direction. Raise an error if the move cannot be done."
|
||||
(let ((row-shift (pcase direction (`up -1) (`down 1) (_ 0)))
|
||||
(column-shift (pcase direction (`left -1) (`right 1) (_ 0))))
|
||||
(when (and (= 0 row-shift) (= 0 column-shift))
|
||||
(error "Invalid direction: %S" direction))
|
||||
;; Initialize `org-table-current-ncol' and `org-table-dlines'.
|
||||
(org-table-analyze)
|
||||
(let* ((row (org-table-current-line))
|
||||
(column (org-table-current-column))
|
||||
(target-row (+ row row-shift))
|
||||
(target-column (+ column column-shift))
|
||||
(org-table-current-nrow (1- (length org-table-dlines))))
|
||||
(when (or (< target-column 1)
|
||||
(< target-row 1)
|
||||
(> target-column org-table-current-ncol)
|
||||
(> target-row org-table-current-nrow))
|
||||
(user-error "Cannot move cell further"))
|
||||
(org-table--swap-cells row column target-row target-column)
|
||||
(org-table-goto-line target-row)
|
||||
(org-table-goto-column target-column))))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-table-move-cell-up ()
|
||||
"Move a single cell up in a table.
|
||||
Swap with anything in target cell."
|
||||
(interactive)
|
||||
(unless (org-table-check-inside-data-field)
|
||||
(error "No table at point"))
|
||||
(org-table--move-cell 'up)
|
||||
(org-table-align))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-table-move-cell-down ()
|
||||
"Move a single cell down in a table.
|
||||
Swap with anything in target cell."
|
||||
(interactive)
|
||||
(unless (org-table-check-inside-data-field)
|
||||
(error "No table at point"))
|
||||
(org-table--move-cell 'down)
|
||||
(org-table-align))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-table-move-cell-left ()
|
||||
"Move a single cell left in a table.
|
||||
Swap with anything in target cell."
|
||||
(interactive)
|
||||
(unless (org-table-check-inside-data-field)
|
||||
(error "No table at point"))
|
||||
(org-table--move-cell 'left)
|
||||
(org-table-align))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-table-move-cell-right ()
|
||||
"Move a single cell right in a table.
|
||||
Swap with anything in target cell."
|
||||
(interactive)
|
||||
(unless (org-table-check-inside-data-field)
|
||||
(error "No table at point"))
|
||||
(org-table--move-cell 'right)
|
||||
(org-table-align))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-table-delete-column ()
|
||||
"Delete a column from the table."
|
||||
|
|
|
@ -438,7 +438,9 @@ using three `C-u' prefix arguments."
|
|||
(if (numberp org-timer-default-timer)
|
||||
(number-to-string org-timer-default-timer)
|
||||
org-timer-default-timer))
|
||||
(effort-minutes (ignore-errors (floor (org-get-at-eol 'effort-minutes 1))))
|
||||
(effort-minutes (let ((effort (org-entry-get nil org-effort-property)))
|
||||
(when (org-string-nw-p effort)
|
||||
(floor (org-duration-to-minutes effort)))))
|
||||
(minutes (or (and (numberp opt) (number-to-string opt))
|
||||
(and (not (equal opt '(64)))
|
||||
effort-minutes
|
||||
|
|
742
lisp/org.el
742
lisp/org.el
|
@ -7,7 +7,7 @@
|
|||
;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Homepage: https://orgmode.org
|
||||
;; Version: 9.2
|
||||
;; Version: 9.3
|
||||
;;
|
||||
;; This file is part of GNU Emacs.
|
||||
;;
|
||||
|
@ -92,6 +92,7 @@
|
|||
|
||||
(eval-and-compile (require 'org-macs))
|
||||
(require 'org-compat)
|
||||
(require 'org-keys)
|
||||
|
||||
;; `org-outline-regexp' ought to be a defconst but is let-bound in
|
||||
;; some places -- e.g. see the macro `org-with-limited-levels'.
|
||||
|
@ -197,6 +198,10 @@ Stars are put in group 1 and the trimmed body in group 2.")
|
|||
(declare-function org-table-justify-field-maybe "org-table" (&optional new))
|
||||
(declare-function org-table-maybe-eval-formula "org-table" ())
|
||||
(declare-function org-table-maybe-recalculate-line "org-table" ())
|
||||
(declare-function org-table-move-cell-up "org-table" ())
|
||||
(declare-function org-table-move-cell-down "org-table" ())
|
||||
(declare-function org-table-move-cell-right "org-table" ())
|
||||
(declare-function org-table-move-cell-left "org-table" ())
|
||||
(declare-function org-table-next-row "org-table" ())
|
||||
(declare-function org-table-paste-rectangle "org-table" ())
|
||||
(declare-function org-table-recalculate "org-table" (&optional all noalign))
|
||||
|
@ -224,6 +229,7 @@ Stars are put in group 1 and the trimmed body in group 2.")
|
|||
(defvar ffap-url-regexp)
|
||||
(defvar org-element-paragraph-separate)
|
||||
(defvar org-indent-indentation-per-level)
|
||||
(defvar org-table-auto-blank-field)
|
||||
|
||||
;; load languages based on value of `org-babel-load-languages'
|
||||
(defvar org-babel-load-languages)
|
||||
|
@ -241,35 +247,25 @@ Stars are put in group 1 and the trimmed body in group 2.")
|
|||
(fmakunbound
|
||||
(intern (concat "org-babel-expand-body:" lang)))))))
|
||||
|
||||
(declare-function org-babel-tangle-file "ob-tangle" (file &optional target-file lang))
|
||||
|
||||
;;;###autoload
|
||||
(defun org-babel-load-file (file &optional compile)
|
||||
"Load Emacs Lisp source code blocks in the Org FILE.
|
||||
This function exports the source code using `org-babel-tangle'
|
||||
and then loads the resulting file using `load-file'. With prefix
|
||||
arg (noninteractively: 2nd arg) COMPILE the tangled Emacs Lisp
|
||||
file to byte-code before it is loaded."
|
||||
and then loads the resulting file using `load-file'. With
|
||||
optional prefix argument COMPILE, the tangled Emacs Lisp file is
|
||||
byte-compiled before it is loaded."
|
||||
(interactive "fFile to load: \nP")
|
||||
(let* ((age (lambda (file)
|
||||
(float-time
|
||||
(time-subtract (current-time)
|
||||
(nth 5 (or (file-attributes (file-truename file))
|
||||
(file-attributes file)))))))
|
||||
(base-name (file-name-sans-extension file))
|
||||
(exported-file (concat base-name ".el")))
|
||||
;; tangle if the Org file is newer than the elisp file
|
||||
(unless (and (file-exists-p exported-file)
|
||||
(> (funcall age file) (funcall age exported-file)))
|
||||
;; Tangle-file traversal returns reversed list of tangled files
|
||||
;; and we want to evaluate the first target.
|
||||
(setq exported-file
|
||||
(car (last (org-babel-tangle-file file exported-file "emacs-lisp")))))
|
||||
(message "%s %s"
|
||||
(if compile
|
||||
(progn (byte-compile-file exported-file 'load)
|
||||
"Compiled and loaded")
|
||||
(progn (load-file exported-file) "Loaded"))
|
||||
exported-file)))
|
||||
(let* ((tangled-file (concat (file-name-sans-extension file) ".el")))
|
||||
;; Tangle only if the Org file is newer than the Elisp file.
|
||||
(unless (org-file-newer-than-p tangled-file (nth 5 (file-attributes file)))
|
||||
(org-babel-tangle-file file tangled-file "emacs-lisp"))
|
||||
(if compile
|
||||
(progn
|
||||
(byte-compile-file tangled-file 'load)
|
||||
(message "Compiled and loaded %s" tangled-file))
|
||||
(load-file tangled-file)
|
||||
(message "Loaded %s" tangled-file))))
|
||||
|
||||
(defcustom org-babel-load-languages '((emacs-lisp . t))
|
||||
"Languages which can be evaluated in Org buffers.
|
||||
|
@ -1118,63 +1114,6 @@ has been set."
|
|||
:group 'org-startup
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom org-replace-disputed-keys nil
|
||||
"Non-nil means use alternative key bindings for some keys.
|
||||
|
||||
Org mode uses S-<cursor> keys for changing timestamps and priorities.
|
||||
These keys are also used by other packages like Shift Select mode,
|
||||
CUA mode or Windmove. If you want to use Org mode together with
|
||||
one of these other modes, or more generally if you would like to
|
||||
move some Org mode commands to other keys, set this variable and
|
||||
configure the keys with the variable `org-disputed-keys'.
|
||||
|
||||
This option is only relevant at load-time of Org mode, and must be set
|
||||
*before* org.el is loaded. Changing it requires a restart of Emacs to
|
||||
become effective."
|
||||
:group 'org-startup
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom org-use-extra-keys nil
|
||||
"Non-nil means use extra key sequence definitions for certain commands.
|
||||
This happens automatically if `window-system' is nil. This
|
||||
variable lets you do the same manually. You must set it before
|
||||
loading Org."
|
||||
:group 'org-startup
|
||||
:type 'boolean)
|
||||
|
||||
(defvaralias 'org-CUA-compatible 'org-replace-disputed-keys)
|
||||
|
||||
(defcustom org-disputed-keys
|
||||
'(([(shift up)] . [(meta p)])
|
||||
([(shift down)] . [(meta n)])
|
||||
([(shift left)] . [(meta -)])
|
||||
([(shift right)] . [(meta +)])
|
||||
([(control shift right)] . [(meta shift +)])
|
||||
([(control shift left)] . [(meta shift -)]))
|
||||
"Keys for which Org mode and other modes compete.
|
||||
This is an alist, cars are the default keys, second element specifies
|
||||
the alternative to use when `org-replace-disputed-keys' is t.
|
||||
|
||||
Keys can be specified in any syntax supported by `define-key'.
|
||||
The value of this option takes effect only at Org mode startup,
|
||||
therefore you'll have to restart Emacs to apply it after changing."
|
||||
:group 'org-startup
|
||||
:type 'alist)
|
||||
|
||||
(defun org-key (key)
|
||||
"Select key according to `org-replace-disputed-keys' and `org-disputed-keys'.
|
||||
Or return the original if not disputed."
|
||||
(when org-replace-disputed-keys
|
||||
(let* ((nkey (key-description key))
|
||||
(x (cl-find-if (lambda (x) (equal (key-description (car x)) nkey))
|
||||
org-disputed-keys)))
|
||||
(setq key (if x (cdr x) key))))
|
||||
key)
|
||||
|
||||
(defun org-defkey (keymap key def)
|
||||
"Define a key, possibly translated, as returned by `org-key'."
|
||||
(define-key keymap (org-key key) def))
|
||||
|
||||
(defcustom org-ellipsis nil
|
||||
"The ellipsis to use in the Org mode outline.
|
||||
|
||||
|
@ -1312,44 +1251,6 @@ new-frame Make a new frame each time. Note that in this case
|
|||
(const :tag "Each time a new frame" new-frame)
|
||||
(const :tag "One dedicated frame" dedicated-frame)))
|
||||
|
||||
(defcustom org-use-speed-commands nil
|
||||
"Non-nil means activate single letter commands at beginning of a headline.
|
||||
This may also be a function to test for appropriate locations where speed
|
||||
commands should be active.
|
||||
|
||||
For example, to activate speed commands when the point is on any
|
||||
star at the beginning of the headline, you can do this:
|
||||
|
||||
(setq org-use-speed-commands
|
||||
(lambda () (and (looking-at org-outline-regexp) (looking-back \"^\\**\"))))"
|
||||
:group 'org-structure
|
||||
:type '(choice
|
||||
(const :tag "Never" nil)
|
||||
(const :tag "At beginning of headline stars" t)
|
||||
(function)))
|
||||
|
||||
(defcustom org-speed-commands-user nil
|
||||
"Alist of additional speed commands.
|
||||
This list will be checked before `org-speed-commands-default'
|
||||
when the variable `org-use-speed-commands' is non-nil
|
||||
and when the cursor is at the beginning of a headline.
|
||||
The car of each entry is a string with a single letter, which must
|
||||
be assigned to `self-insert-command' in the global map.
|
||||
The cdr is either a command to be called interactively, a function
|
||||
to be called, or a form to be evaluated.
|
||||
An entry that is just a list with a single string will be interpreted
|
||||
as a descriptive headline that will be added when listing the speed
|
||||
commands in the Help buffer using the `?' speed command."
|
||||
:group 'org-structure
|
||||
:type '(repeat :value ("k" . ignore)
|
||||
(choice :value ("k" . ignore)
|
||||
(list :tag "Descriptive Headline" (string :tag "Headline"))
|
||||
(cons :tag "Letter and Command"
|
||||
(string :tag "Command letter")
|
||||
(choice
|
||||
(function)
|
||||
(sexp))))))
|
||||
|
||||
(defcustom org-bookmark-names-plist
|
||||
'(:last-capture "org-capture-last-stored"
|
||||
:last-refile "org-refile-last-stored"
|
||||
|
@ -1971,7 +1872,7 @@ use."
|
|||
:version "24.3"
|
||||
:group 'org-link-store)
|
||||
|
||||
(defcustom org-email-link-description-format "Email %c: %.30s"
|
||||
(defcustom org-email-link-description-format "Email %c: %s"
|
||||
"Format of the description part of a link to an email or usenet message.
|
||||
The following %-escapes will be replaced by corresponding information:
|
||||
|
||||
|
@ -1990,7 +1891,9 @@ This is for example useful to limit the length of the subject.
|
|||
|
||||
Examples: \"%f on: %.30s\", \"Email from %f\", \"Email %c\""
|
||||
:group 'org-link-store
|
||||
:type 'string)
|
||||
:package-version '(Org . 9.3)
|
||||
:type 'string
|
||||
:safe #'stringp)
|
||||
|
||||
(defcustom org-from-is-user-regexp
|
||||
(let (r1 r2)
|
||||
|
@ -2053,38 +1956,6 @@ links created by planner."
|
|||
:group 'org-link-follow
|
||||
:type '(choice (const nil) (function)))
|
||||
|
||||
(defcustom org-follow-link-hook nil
|
||||
"Hook that is run after a link has been followed."
|
||||
:group 'org-link-follow
|
||||
:type 'hook)
|
||||
|
||||
(defcustom org-tab-follows-link nil
|
||||
"Non-nil means on links TAB will follow the link.
|
||||
Needs to be set before org.el is loaded.
|
||||
This really should not be used, it does not make sense, and the
|
||||
implementation is bad."
|
||||
:group 'org-link-follow
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom org-return-follows-link nil
|
||||
"Non-nil means on links RET will follow the link.
|
||||
In tables, the special behavior of RET has precedence."
|
||||
:group 'org-link-follow
|
||||
:type 'boolean)
|
||||
|
||||
(defcustom org-mouse-1-follows-link
|
||||
(if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t)
|
||||
"Non-nil means mouse-1 on a link will follow the link.
|
||||
A longer mouse click will still set point. Needs to be set
|
||||
before org.el is loaded."
|
||||
:group 'org-link-follow
|
||||
:version "26.1"
|
||||
:package-version '(Org . "8.3")
|
||||
:type '(choice
|
||||
(const :tag "A double click follows the link" double)
|
||||
(const :tag "Unconditionally follow the link with mouse-1" t)
|
||||
(integer :tag "mouse-1 click does not follow the link if longer than N ms" 450)))
|
||||
|
||||
(defcustom org-mark-ring-length 4
|
||||
"Number of different positions to be recorded in the ring.
|
||||
Changing this requires a restart of Emacs to work correctly."
|
||||
|
@ -5459,15 +5330,6 @@ can be exported as a structured ASCII or HTML file.
|
|||
The following commands are available:
|
||||
|
||||
\\{org-mode-map}"
|
||||
|
||||
;; Get rid of Outline menus, they are not needed
|
||||
;; Need to do this here because define-derived-mode sets up
|
||||
;; the keymap so late. Still, it is a waste to call this each time
|
||||
;; we switch another buffer into Org mode.
|
||||
(define-key org-mode-map [menu-bar headings] 'undefined)
|
||||
(define-key org-mode-map [menu-bar hide] 'undefined)
|
||||
(define-key org-mode-map [menu-bar show] 'undefined)
|
||||
|
||||
(org-load-modules-maybe)
|
||||
(org-install-agenda-files-menu)
|
||||
(when org-descriptive-links (add-to-invisibility-spec '(org-link)))
|
||||
|
@ -5581,8 +5443,7 @@ The following commands are available:
|
|||
(when org-startup-with-latex-preview (org-toggle-latex-fragment '(16)))
|
||||
(unless org-inhibit-startup-visibility-stuff (org-set-startup-visibility))
|
||||
(when org-startup-truncated (setq truncate-lines t))
|
||||
(when org-startup-indented (require 'org-indent) (org-indent-mode 1))
|
||||
(org-refresh-effort-properties)))
|
||||
(when org-startup-indented (require 'org-indent) (org-indent-mode 1))))
|
||||
;; Try to set `org-hide' face correctly.
|
||||
(let ((foreground (org-find-invisible-foreground)))
|
||||
(when foreground
|
||||
|
@ -5648,15 +5509,6 @@ the rounding returns a past time."
|
|||
|
||||
;;;; Font-Lock stuff, including the activators
|
||||
|
||||
(defvar org-mouse-map (make-sparse-keymap))
|
||||
(org-defkey org-mouse-map [mouse-2] 'org-open-at-mouse)
|
||||
(org-defkey org-mouse-map [mouse-3] 'org-find-file-at-mouse)
|
||||
(when org-mouse-1-follows-link
|
||||
(org-defkey org-mouse-map [follow-link] 'mouse-face))
|
||||
(when org-tab-follows-link
|
||||
(org-defkey org-mouse-map (kbd "<tab>") #'org-open-at-point)
|
||||
(org-defkey org-mouse-map (kbd "TAB") #'org-open-at-point))
|
||||
|
||||
(require 'font-lock)
|
||||
|
||||
(defconst org-non-link-chars "]\t\n\r<>")
|
||||
|
@ -15004,7 +14856,7 @@ variables is set."
|
|||
value)
|
||||
(when (equal (org-get-heading t t t t)
|
||||
(bound-and-true-p org-clock-current-task))
|
||||
(setq org-clock-effort (org-get-at-bol 'effort))
|
||||
(setq org-clock-effort value)
|
||||
(org-clock-update-mode-line))
|
||||
(message "%s is now %s" org-effort-property value)))
|
||||
|
||||
|
@ -16107,78 +15959,6 @@ with the current time without prompting the user."
|
|||
(defvar org-read-date-analyze-futurep nil)
|
||||
(defvar org-read-date-analyze-forced-year nil)
|
||||
(defvar org-read-date-inactive)
|
||||
|
||||
(defvar org-read-date-minibuffer-local-map
|
||||
(let* ((map (make-sparse-keymap)))
|
||||
(set-keymap-parent map minibuffer-local-map)
|
||||
(org-defkey map (kbd ".")
|
||||
(lambda () (interactive)
|
||||
;; Are we at the beginning of the prompt?
|
||||
(if (looking-back "^[^:]+: "
|
||||
(let ((inhibit-field-text-motion t))
|
||||
(line-beginning-position)))
|
||||
(org-eval-in-calendar '(calendar-goto-today))
|
||||
(insert "."))))
|
||||
(org-defkey map (kbd "C-.")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-goto-today))))
|
||||
(org-defkey map (kbd "M-S-<left>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-month 1))))
|
||||
(org-defkey map (kbd "ESC S-<left>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-month 1))))
|
||||
(org-defkey map (kbd "M-S-<right>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-month 1))))
|
||||
(org-defkey map (kbd "ESC S-<right>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-month 1))))
|
||||
(org-defkey map (kbd "M-S-<up>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-year 1))))
|
||||
(org-defkey map (kbd "ESC S-<up>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-year 1))))
|
||||
(org-defkey map (kbd "M-S-<down>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-year 1))))
|
||||
(org-defkey map (kbd "ESC S-<down>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-year 1))))
|
||||
(org-defkey map (kbd "S-<up>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-week 1))))
|
||||
(org-defkey map (kbd "S-<down>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-week 1))))
|
||||
(org-defkey map (kbd "S-<left>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-backward-day 1))))
|
||||
(org-defkey map (kbd "S-<right>")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-forward-day 1))))
|
||||
(org-defkey map (kbd "!")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(diary-view-entries))
|
||||
(message "")))
|
||||
(org-defkey map (kbd ">")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-scroll-left 1))))
|
||||
(org-defkey map (kbd "<")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar '(calendar-scroll-right 1))))
|
||||
(org-defkey map (kbd "C-v")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar
|
||||
'(calendar-scroll-left-three-months 1))))
|
||||
(org-defkey map (kbd "M-v")
|
||||
(lambda () (interactive)
|
||||
(org-eval-in-calendar
|
||||
'(calendar-scroll-right-three-months 1))))
|
||||
map)
|
||||
"Keymap for minibuffer commands when using `org-read-date'.")
|
||||
|
||||
(defvar org-def)
|
||||
(defvar org-defdecode)
|
||||
(defvar org-with-time)
|
||||
|
@ -18842,410 +18622,9 @@ boundaries."
|
|||
(mapc #'delete-overlay org-inline-image-overlays)
|
||||
(setq org-inline-image-overlays nil))
|
||||
|
||||
|
||||
;;; Key bindings
|
||||
|
||||
(defun org-remap (map &rest commands)
|
||||
"In MAP, remap the functions given in COMMANDS.
|
||||
COMMANDS is a list of alternating OLDDEF NEWDEF command names."
|
||||
(let (new old)
|
||||
(while commands
|
||||
(setq old (pop commands) new (pop commands))
|
||||
(org-defkey map (vector 'remap old) new))))
|
||||
|
||||
;;;; Outline functions that can be remapped in Org
|
||||
(define-key org-mode-map [remap outline-mark-subtree] #'org-mark-subtree)
|
||||
(define-key org-mode-map [remap outline-show-subtree] #'org-show-subtree)
|
||||
(define-key org-mode-map [remap outline-forward-same-level]
|
||||
#'org-forward-heading-same-level)
|
||||
(define-key org-mode-map [remap outline-backward-same-level]
|
||||
#'org-backward-heading-same-level)
|
||||
(define-key org-mode-map [remap outline-show-branches]
|
||||
#'org-kill-note-or-show-branches)
|
||||
(define-key org-mode-map [remap outline-promote] #'org-promote-subtree)
|
||||
(define-key org-mode-map [remap outline-demote] #'org-demote-subtree)
|
||||
(define-key org-mode-map [remap outline-insert-heading] #'org-ctrl-c-ret)
|
||||
(define-key org-mode-map [remap outline-next-visible-heading]
|
||||
#'org-next-visible-heading)
|
||||
(define-key org-mode-map [remap outline-previous-visible-heading]
|
||||
#'org-previous-visible-heading)
|
||||
(define-key org-mode-map [remap show-children] #'org-show-children)
|
||||
|
||||
;;;; Make `C-c C-x' a prefix key
|
||||
(org-defkey org-mode-map (kbd "C-c C-x") (make-sparse-keymap))
|
||||
|
||||
;;;; TAB key with modifiers
|
||||
(org-defkey org-mode-map (kbd "C-i") #'org-cycle)
|
||||
(org-defkey org-mode-map (kbd "<tab>") #'org-cycle)
|
||||
(org-defkey org-mode-map (kbd "C-<tab>") #'org-force-cycle-archived)
|
||||
(org-defkey org-mode-map (kbd "M-<tab>") #'pcomplete)
|
||||
(org-defkey org-mode-map (kbd "ESC <tab>") #'pcomplete)
|
||||
|
||||
(org-defkey org-mode-map (kbd "<S-iso-leftab>") #'org-shifttab)
|
||||
(org-defkey org-mode-map (kbd "S-<tab>") #'org-shifttab)
|
||||
(define-key org-mode-map (kbd "<backtab>") #'org-shifttab)
|
||||
|
||||
;;;; RET key with modifiers
|
||||
(org-defkey org-mode-map (kbd "S-<return>") #'org-table-copy-down)
|
||||
(org-defkey org-mode-map (kbd "M-S-<return>") #'org-insert-todo-heading)
|
||||
(org-defkey org-mode-map (kbd "ESC S-<return>") #'org-insert-todo-heading)
|
||||
(org-defkey org-mode-map (kbd "M-RET") #'org-meta-return)
|
||||
(org-defkey org-mode-map (kbd "ESC RET") #'org-meta-return)
|
||||
|
||||
;;;; Cursor keys with modifiers
|
||||
(org-defkey org-mode-map (kbd "M-<left>") #'org-metaleft)
|
||||
(org-defkey org-mode-map (kbd "M-<right>") #'org-metaright)
|
||||
(org-defkey org-mode-map (kbd "ESC <right>") #'org-metaright)
|
||||
(org-defkey org-mode-map (kbd "M-<up>") #'org-metaup)
|
||||
(org-defkey org-mode-map (kbd "ESC <up>") #'org-metaup)
|
||||
(org-defkey org-mode-map (kbd "M-<down>") #'org-metadown)
|
||||
(org-defkey org-mode-map (kbd "ESC <down>") #'org-metadown)
|
||||
|
||||
(org-defkey org-mode-map (kbd "C-M-S-<right>") #'org-increase-number-at-point)
|
||||
(org-defkey org-mode-map (kbd "C-M-S-<left>") #'org-decrease-number-at-point)
|
||||
(org-defkey org-mode-map (kbd "M-S-<left>") #'org-shiftmetaleft)
|
||||
(org-defkey org-mode-map (kbd "ESC S-<left>") #'org-shiftmetaleft)
|
||||
(org-defkey org-mode-map (kbd "M-S-<right>") #'org-shiftmetaright)
|
||||
(org-defkey org-mode-map (kbd "ESC S-<right>") #'org-shiftmetaright)
|
||||
(org-defkey org-mode-map (kbd "M-S-<up>") #'org-shiftmetaup)
|
||||
(org-defkey org-mode-map (kbd "ESC S-<up>") #'org-shiftmetaup)
|
||||
(org-defkey org-mode-map (kbd "M-S-<down>") #'org-shiftmetadown)
|
||||
(org-defkey org-mode-map (kbd "ESC S-<down>") #'org-shiftmetadown)
|
||||
|
||||
(org-defkey org-mode-map (kbd "S-<up>") #'org-shiftup)
|
||||
(org-defkey org-mode-map (kbd "S-<down>") #'org-shiftdown)
|
||||
(org-defkey org-mode-map (kbd "S-<left>") #'org-shiftleft)
|
||||
(org-defkey org-mode-map (kbd "S-<right>") #'org-shiftright)
|
||||
|
||||
(org-defkey org-mode-map (kbd "C-S-<right>") #'org-shiftcontrolright)
|
||||
(org-defkey org-mode-map (kbd "C-S-<left>") #'org-shiftcontrolleft)
|
||||
(org-defkey org-mode-map (kbd "C-S-<up>") #'org-shiftcontrolup)
|
||||
(org-defkey org-mode-map (kbd "C-S-<down>") #'org-shiftcontroldown)
|
||||
|
||||
;;;; Babel keys
|
||||
(define-key org-mode-map org-babel-key-prefix org-babel-map)
|
||||
(pcase-dolist (`(,key . ,def) org-babel-key-bindings)
|
||||
(define-key org-babel-map key def))
|
||||
|
||||
;;;; Extra keys for TTY access.
|
||||
|
||||
;; We only set them when really needed because otherwise the
|
||||
;; menus don't show the simple keys
|
||||
|
||||
(when (or org-use-extra-keys (not window-system))
|
||||
(org-defkey org-mode-map (kbd "C-c C-x c") #'org-table-copy-down)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x m") #'org-meta-return)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x M") #'org-insert-todo-heading)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x RET") #'org-meta-return)
|
||||
(org-defkey org-mode-map (kbd "ESC RET") #'org-meta-return)
|
||||
(org-defkey org-mode-map (kbd "ESC <left>") #'org-metaleft)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x l") #'org-metaleft)
|
||||
(org-defkey org-mode-map (kbd "ESC <right>") #'org-metaright)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x r") #'org-metaright)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x u") #'org-metaup)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x d") #'org-metadown)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x L") #'org-shiftmetaleft)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x R") #'org-shiftmetaright)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x U") #'org-shiftmetaup)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x D") #'org-shiftmetadown)
|
||||
(org-defkey org-mode-map (kbd "C-c <up>") #'org-shiftup)
|
||||
(org-defkey org-mode-map (kbd "C-c <down>") #'org-shiftdown)
|
||||
(org-defkey org-mode-map (kbd "C-c <left>") #'org-shiftleft)
|
||||
(org-defkey org-mode-map (kbd "C-c <right>") #'org-shiftright)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x <right>") #'org-shiftcontrolright)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x <left>") #'org-shiftcontrolleft))
|
||||
|
||||
;;;; Narrow map
|
||||
(org-defkey narrow-map "s" #'org-narrow-to-subtree)
|
||||
(org-defkey narrow-map "b" #'org-narrow-to-block)
|
||||
(org-defkey narrow-map "e" #'org-narrow-to-element)
|
||||
|
||||
;;;; Remap usual Emacs bindings
|
||||
(org-remap org-mode-map
|
||||
'self-insert-command 'org-self-insert-command
|
||||
'delete-char 'org-delete-char
|
||||
'delete-backward-char 'org-delete-backward-char
|
||||
'kill-line 'org-kill-line
|
||||
'open-line 'org-open-line
|
||||
'yank 'org-yank
|
||||
'comment-dwim 'org-comment-dwim
|
||||
'move-beginning-of-line 'org-beginning-of-line
|
||||
'move-end-of-line 'org-end-of-line
|
||||
'forward-paragraph 'org-forward-paragraph
|
||||
'backward-paragraph 'org-backward-paragraph
|
||||
'backward-sentence 'org-backward-sentence
|
||||
'forward-sentence 'org-forward-sentence
|
||||
'fill-paragraph 'org-fill-paragraph
|
||||
'delete-indentation 'org-delete-indentation
|
||||
'transpose-words 'org-transpose-words)
|
||||
|
||||
;;;; All the other keys
|
||||
(org-defkey org-mode-map (kbd "|") #'org-force-self-insert)
|
||||
(org-defkey org-mode-map (kbd "C-c C-r") #'org-reveal)
|
||||
(org-defkey org-mode-map (kbd "C-M-t") #'org-transpose-element)
|
||||
(org-defkey org-mode-map (kbd "M-}") #'org-forward-element)
|
||||
(org-defkey org-mode-map (kbd "ESC }") #'org-forward-element)
|
||||
(org-defkey org-mode-map (kbd "M-{") #'org-backward-element)
|
||||
(org-defkey org-mode-map (kbd "ESC {") #'org-backward-element)
|
||||
(org-defkey org-mode-map (kbd "C-c C-^") #'org-up-element)
|
||||
(org-defkey org-mode-map (kbd "C-c C-_") #'org-down-element)
|
||||
(org-defkey org-mode-map (kbd "C-c C-f") #'org-forward-heading-same-level)
|
||||
(org-defkey org-mode-map (kbd "C-c C-b") #'org-backward-heading-same-level)
|
||||
(org-defkey org-mode-map (kbd "C-c M-f") #'org-next-block)
|
||||
(org-defkey org-mode-map (kbd "C-c M-b") #'org-previous-block)
|
||||
(org-defkey org-mode-map (kbd "C-c $") #'org-archive-subtree)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-s") #'org-archive-subtree)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-a") #'org-archive-subtree-default)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x d") #'org-insert-drawer)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x a") #'org-toggle-archive-tag)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x A") #'org-archive-to-archive-sibling)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x b") #'org-tree-to-indirect-buffer)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x q") #'org-toggle-tags-groups)
|
||||
(org-defkey org-mode-map (kbd "C-c C-j") #'org-goto)
|
||||
(org-defkey org-mode-map (kbd "C-c C-t") #'org-todo)
|
||||
(org-defkey org-mode-map (kbd "C-c C-q") #'org-set-tags-command)
|
||||
(org-defkey org-mode-map (kbd "C-c C-s") #'org-schedule)
|
||||
(org-defkey org-mode-map (kbd "C-c C-d") #'org-deadline)
|
||||
(org-defkey org-mode-map (kbd "C-c ;") #'org-toggle-comment)
|
||||
(org-defkey org-mode-map (kbd "C-c C-w") #'org-refile)
|
||||
(org-defkey org-mode-map (kbd "C-c M-w") #'org-copy)
|
||||
(org-defkey org-mode-map (kbd "C-c /") #'org-sparse-tree) ;minor-mode reserved
|
||||
(org-defkey org-mode-map (kbd "C-c \\") #'org-match-sparse-tree) ;minor-mode r.
|
||||
(org-defkey org-mode-map (kbd "C-c RET") #'org-ctrl-c-ret)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x c") #'org-clone-subtree-with-time-shift)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x v") #'org-copy-visible)
|
||||
(org-defkey org-mode-map (kbd "C-<return>") #'org-insert-heading-respect-content)
|
||||
(org-defkey org-mode-map (kbd "C-S-<return>") #'org-insert-todo-heading-respect-content)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-n") #'org-next-link)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-p") #'org-previous-link)
|
||||
(org-defkey org-mode-map (kbd "C-c C-l") #'org-insert-link)
|
||||
(org-defkey org-mode-map (kbd "C-c M-l") #'org-insert-last-stored-link)
|
||||
(org-defkey org-mode-map (kbd "C-c C-M-l") #'org-insert-all-links)
|
||||
(org-defkey org-mode-map (kbd "C-c C-o") #'org-open-at-point)
|
||||
(org-defkey org-mode-map (kbd "C-c %") #'org-mark-ring-push)
|
||||
(org-defkey org-mode-map (kbd "C-c &") #'org-mark-ring-goto)
|
||||
(org-defkey org-mode-map (kbd "C-c C-z") #'org-add-note) ;alternative binding
|
||||
(org-defkey org-mode-map (kbd "C-c .") #'org-time-stamp) ;minor-mode reserved
|
||||
(org-defkey org-mode-map (kbd "C-c !") #'org-time-stamp-inactive) ;minor-mode r.
|
||||
(org-defkey org-mode-map (kbd "C-c ,") #'org-priority) ;minor-mode reserved
|
||||
(org-defkey org-mode-map (kbd "C-c C-y") #'org-evaluate-time-range)
|
||||
(org-defkey org-mode-map (kbd "C-c >") #'org-goto-calendar)
|
||||
(org-defkey org-mode-map (kbd "C-c <") #'org-date-from-calendar)
|
||||
(org-defkey org-mode-map (kbd "C-,") #'org-cycle-agenda-files)
|
||||
(org-defkey org-mode-map (kbd "C-'") #'org-cycle-agenda-files)
|
||||
(org-defkey org-mode-map (kbd "C-c [") #'org-agenda-file-to-front)
|
||||
(org-defkey org-mode-map (kbd "C-c ]") #'org-remove-file)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x <") #'org-agenda-set-restriction-lock)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x >") #'org-agenda-remove-restriction-lock)
|
||||
(org-defkey org-mode-map (kbd "C-c -") #'org-ctrl-c-minus)
|
||||
(org-defkey org-mode-map (kbd "C-c *") #'org-ctrl-c-star)
|
||||
(org-defkey org-mode-map (kbd "C-c TAB") #'org-ctrl-c-tab)
|
||||
(org-defkey org-mode-map (kbd "C-c ^") #'org-sort)
|
||||
(org-defkey org-mode-map (kbd "C-c C-c") #'org-ctrl-c-ctrl-c)
|
||||
(org-defkey org-mode-map (kbd "C-c C-k") #'org-kill-note-or-show-branches)
|
||||
(org-defkey org-mode-map (kbd "C-c #") #'org-update-statistics-cookies)
|
||||
(org-defkey org-mode-map (kbd "RET") #'org-return)
|
||||
(org-defkey org-mode-map (kbd "C-j") #'org-return-indent)
|
||||
(org-defkey org-mode-map (kbd "C-c ?") #'org-table-field-info)
|
||||
(org-defkey org-mode-map (kbd "C-c SPC") #'org-table-blank-field)
|
||||
(org-defkey org-mode-map (kbd "C-c +") #'org-table-sum)
|
||||
(org-defkey org-mode-map (kbd "C-c =") #'org-table-eval-formula)
|
||||
(org-defkey org-mode-map (kbd "C-c '") #'org-edit-special)
|
||||
(org-defkey org-mode-map (kbd "C-c `") #'org-table-edit-field)
|
||||
(org-defkey org-mode-map (kbd "C-c \" a") #'orgtbl-ascii-plot)
|
||||
(org-defkey org-mode-map (kbd "C-c \" g") #'org-plot/gnuplot)
|
||||
(org-defkey org-mode-map (kbd "C-c |") #'org-table-create-or-convert-from-region)
|
||||
(org-defkey org-mode-map (kbd "C-#") #'org-table-rotate-recalc-marks)
|
||||
(org-defkey org-mode-map (kbd "C-c ~") #'org-table-create-with-table.el)
|
||||
(org-defkey org-mode-map (kbd "C-c C-a") #'org-attach)
|
||||
(org-defkey org-mode-map (kbd "C-c }") #'org-table-toggle-coordinate-overlays)
|
||||
(org-defkey org-mode-map (kbd "C-c {") #'org-table-toggle-formula-debugger)
|
||||
(org-defkey org-mode-map (kbd "C-c C-e") #'org-export-dispatch)
|
||||
(org-defkey org-mode-map (kbd "C-c :") #'org-toggle-fixed-width)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-f") #'org-emphasize)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x f") #'org-footnote-action)
|
||||
(org-defkey org-mode-map (kbd "C-c @") #'org-mark-subtree)
|
||||
(org-defkey org-mode-map (kbd "M-h") #'org-mark-element)
|
||||
(org-defkey org-mode-map (kbd "ESC h") #'org-mark-element)
|
||||
(org-defkey org-mode-map (kbd "C-c C-*") #'org-list-make-subtree)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-w") #'org-cut-special)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x M-w") #'org-copy-special)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-y") #'org-paste-special)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-t") #'org-toggle-time-stamp-overlays)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-i") #'org-clock-in)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-x") #'org-clock-in-last)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-z") #'org-resolve-clocks)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-o") #'org-clock-out)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-j") #'org-clock-goto)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-q") #'org-clock-cancel)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-d") #'org-clock-display)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-r") #'org-clock-report)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-u") #'org-dblock-update)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-l") #'org-toggle-latex-fragment)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-v") #'org-toggle-inline-images)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-M-v") #'org-redisplay-inline-images)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x \\") #'org-toggle-pretty-entities)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-b") #'org-toggle-checkbox)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x p") #'org-set-property)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x P") #'org-set-property-and-value)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x e") #'org-set-effort)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x E") #'org-inc-effort)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x o") #'org-toggle-ordered-property)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x i") #'org-columns-insert-dblock)
|
||||
(org-defkey org-mode-map (kbd "C-c C-,") #'org-insert-structure-template)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x .") #'org-timer)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x -") #'org-timer-item)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x 0") #'org-timer-start)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x _") #'org-timer-stop)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x ;") #'org-timer-set-timer)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x ,") #'org-timer-pause-or-continue)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x C-c") #'org-columns)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x !") #'org-reload)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x g") #'org-feed-update-all)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x G") #'org-feed-goto-inbox)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x [") #'org-reftex-citation)
|
||||
(org-defkey org-mode-map (kbd "C-c C-x I") #'org-info-find-node)
|
||||
|
||||
|
||||
;;; Speed commands
|
||||
|
||||
(defconst org-speed-commands-default
|
||||
'(
|
||||
("Outline Navigation")
|
||||
("n" . (org-speed-move-safe 'org-next-visible-heading))
|
||||
("p" . (org-speed-move-safe 'org-previous-visible-heading))
|
||||
("f" . (org-speed-move-safe 'org-forward-heading-same-level))
|
||||
("b" . (org-speed-move-safe 'org-backward-heading-same-level))
|
||||
("F" . org-next-block)
|
||||
("B" . org-previous-block)
|
||||
("u" . (org-speed-move-safe 'outline-up-heading))
|
||||
("j" . org-goto)
|
||||
("g" . (org-refile t))
|
||||
("Outline Visibility")
|
||||
("c" . org-cycle)
|
||||
("C" . org-shifttab)
|
||||
(" " . org-display-outline-path)
|
||||
("s" . org-toggle-narrow-to-subtree)
|
||||
("k" . org-cut-subtree)
|
||||
("=" . org-columns)
|
||||
("Outline Structure Editing")
|
||||
("U" . org-metaup)
|
||||
("D" . org-metadown)
|
||||
("r" . org-metaright)
|
||||
("l" . org-metaleft)
|
||||
("R" . org-shiftmetaright)
|
||||
("L" . org-shiftmetaleft)
|
||||
("i" . (progn (forward-char 1) (call-interactively
|
||||
'org-insert-heading-respect-content)))
|
||||
("^" . org-sort)
|
||||
("w" . org-refile)
|
||||
("a" . org-archive-subtree-default-with-confirmation)
|
||||
("@" . org-mark-subtree)
|
||||
("#" . org-toggle-comment)
|
||||
("Clock Commands")
|
||||
("I" . org-clock-in)
|
||||
("O" . org-clock-out)
|
||||
("Meta Data Editing")
|
||||
("t" . org-todo)
|
||||
("," . (org-priority))
|
||||
("0" . (org-priority ?\ ))
|
||||
("1" . (org-priority ?A))
|
||||
("2" . (org-priority ?B))
|
||||
("3" . (org-priority ?C))
|
||||
(":" . org-set-tags-command)
|
||||
("e" . org-set-effort)
|
||||
("E" . org-inc-effort)
|
||||
("W" . (lambda(m) (interactive "sMinutes before warning: ")
|
||||
(org-entry-put (point) "APPT_WARNTIME" m)))
|
||||
("Agenda Views etc")
|
||||
("v" . org-agenda)
|
||||
("/" . org-sparse-tree)
|
||||
("Misc")
|
||||
("o" . org-open-at-point)
|
||||
("?" . org-speed-command-help)
|
||||
("<" . (org-agenda-set-restriction-lock 'subtree))
|
||||
(">" . (org-agenda-remove-restriction-lock))
|
||||
)
|
||||
"The default speed commands.")
|
||||
|
||||
(defun org-print-speed-command (e)
|
||||
(if (> (length (car e)) 1)
|
||||
(progn
|
||||
(princ "\n")
|
||||
(princ (car e))
|
||||
(princ "\n")
|
||||
(princ (make-string (length (car e)) ?-))
|
||||
(princ "\n"))
|
||||
(princ (car e))
|
||||
(princ " ")
|
||||
(if (symbolp (cdr e))
|
||||
(princ (symbol-name (cdr e)))
|
||||
(prin1 (cdr e)))
|
||||
(princ "\n")))
|
||||
|
||||
(defun org-speed-command-help ()
|
||||
"Show the available speed commands."
|
||||
(interactive)
|
||||
(if (not org-use-speed-commands)
|
||||
(user-error "Speed commands are not activated, customize `org-use-speed-commands'")
|
||||
(with-output-to-temp-buffer "*Help*"
|
||||
(princ "User-defined Speed commands\n===========================\n")
|
||||
(mapc #'org-print-speed-command org-speed-commands-user)
|
||||
(princ "\n")
|
||||
(princ "Built-in Speed commands\n=======================\n")
|
||||
(mapc #'org-print-speed-command org-speed-commands-default))
|
||||
(with-current-buffer "*Help*"
|
||||
(setq truncate-lines t))))
|
||||
|
||||
(defun org-speed-move-safe (cmd)
|
||||
"Execute CMD, but make sure that the cursor always ends up in a headline.
|
||||
If not, return to the original position and throw an error."
|
||||
(interactive)
|
||||
(let ((pos (point)))
|
||||
(call-interactively cmd)
|
||||
(unless (and (bolp) (org-at-heading-p))
|
||||
(goto-char pos)
|
||||
(error "Boundary reached while executing %s" cmd))))
|
||||
|
||||
(defvar org-self-insert-command-undo-counter 0)
|
||||
|
||||
(defvar org-table-auto-blank-field) ; defined in org-table.el
|
||||
(defvar org-speed-command nil)
|
||||
|
||||
(defun org-speed-command-activate (keys)
|
||||
"Hook for activating single-letter speed commands.
|
||||
`org-speed-commands-default' specifies a minimal command set.
|
||||
Use `org-speed-commands-user' for further customization."
|
||||
(when (or (and (bolp) (looking-at org-outline-regexp))
|
||||
(and (functionp org-use-speed-commands)
|
||||
(funcall org-use-speed-commands)))
|
||||
(cdr (assoc keys (append org-speed-commands-user
|
||||
org-speed-commands-default)))))
|
||||
|
||||
(defun org-babel-speed-command-activate (keys)
|
||||
"Hook for activating single-letter code block commands."
|
||||
(when (and (bolp) (looking-at org-babel-src-block-regexp))
|
||||
(cdr (assoc keys org-babel-key-bindings))))
|
||||
|
||||
(defcustom org-speed-command-hook
|
||||
'(org-speed-command-activate org-babel-speed-command-activate)
|
||||
"Hook for activating speed commands at strategic locations.
|
||||
Hook functions are called in sequence until a valid handler is
|
||||
found.
|
||||
|
||||
Each hook takes a single argument, a user-pressed command key
|
||||
which is also a `self-insert-command' from the global map.
|
||||
|
||||
Within the hook, examine the cursor position and the command key
|
||||
and return nil or a valid handler as appropriate. Handler could
|
||||
be one of an interactive command, a function, or a form.
|
||||
|
||||
Set `org-use-speed-commands' to non-nil value to enable this
|
||||
hook. The default setting is `org-speed-command-activate'."
|
||||
:group 'org-structure
|
||||
:version "24.1"
|
||||
:type 'hook)
|
||||
|
||||
(defun org-self-insert-command (N)
|
||||
"Like `self-insert-command', use overwrite-mode for whitespace in tables.
|
||||
If the cursor is in a table looking at whitespace, the whitespace is
|
||||
|
@ -19839,9 +19218,10 @@ commands for more information."
|
|||
(t (org-drag-element-forward))))
|
||||
|
||||
(defun org-shiftup (&optional arg)
|
||||
"Increase item in timestamp or increase priority of current headline.
|
||||
Calls `org-timestamp-up' or `org-priority-up', or `org-previous-item',
|
||||
depending on context. See the individual commands for more information."
|
||||
"Act on current element according to context.
|
||||
Call `org-timestamp-up' or `org-priority-up', or
|
||||
`org-previous-item', or `org-table-move-cell-up'. See the
|
||||
individual commands for more information."
|
||||
(interactive "P")
|
||||
(cond
|
||||
((run-hook-with-args-until-success 'org-shiftup-hook))
|
||||
|
@ -19857,15 +19237,17 @@ depending on context. See the individual commands for more information."
|
|||
((and (not org-support-shift-select) (org-at-item-p))
|
||||
(call-interactively 'org-previous-item))
|
||||
((org-clocktable-try-shift 'up arg))
|
||||
((org-at-table-p) (org-table-move-cell-up))
|
||||
((run-hook-with-args-until-success 'org-shiftup-final-hook))
|
||||
(org-support-shift-select
|
||||
(org-call-for-shift-select 'previous-line))
|
||||
(t (org-shiftselect-error))))
|
||||
|
||||
(defun org-shiftdown (&optional arg)
|
||||
"Decrease item in timestamp or decrease priority of current headline.
|
||||
Calls `org-timestamp-down' or `org-priority-down', or `org-next-item'
|
||||
depending on context. See the individual commands for more information."
|
||||
"Act on current element according to context.
|
||||
Call `org-timestamp-down' or `org-priority-down', or
|
||||
`org-next-item', or `org-table-move-cell-down'. See the
|
||||
individual commands for more information."
|
||||
(interactive "P")
|
||||
(cond
|
||||
((run-hook-with-args-until-success 'org-shiftdown-hook))
|
||||
|
@ -19881,20 +19263,22 @@ depending on context. See the individual commands for more information."
|
|||
((and (not org-support-shift-select) (org-at-item-p))
|
||||
(call-interactively 'org-next-item))
|
||||
((org-clocktable-try-shift 'down arg))
|
||||
((org-at-table-p) (org-table-move-cell-down))
|
||||
((run-hook-with-args-until-success 'org-shiftdown-final-hook))
|
||||
(org-support-shift-select
|
||||
(org-call-for-shift-select 'next-line))
|
||||
(t (org-shiftselect-error))))
|
||||
|
||||
(defun org-shiftright (&optional arg)
|
||||
"Cycle the thing at point or in the current line, depending on context.
|
||||
Depending on context, this does one of the following:
|
||||
"Act on the current element according to context.
|
||||
This does one of the following:
|
||||
|
||||
- switch a timestamp at point one day into the future
|
||||
- on a headline, switch to the next TODO keyword.
|
||||
- on an item, switch entire list to the next bullet type
|
||||
- on a property line, switch to the next allowed value
|
||||
- on a clocktable definition line, move time block into the future"
|
||||
- on a clocktable definition line, move time block into the future
|
||||
- in a table, move a single cell right"
|
||||
(interactive "P")
|
||||
(cond
|
||||
((run-hook-with-args-until-success 'org-shiftright-hook))
|
||||
|
@ -19917,20 +19301,22 @@ Depending on context, this does one of the following:
|
|||
(org-at-property-p))
|
||||
(call-interactively 'org-property-next-allowed-value))
|
||||
((org-clocktable-try-shift 'right arg))
|
||||
((org-at-table-p) (org-table-move-cell-right))
|
||||
((run-hook-with-args-until-success 'org-shiftright-final-hook))
|
||||
(org-support-shift-select
|
||||
(org-call-for-shift-select 'forward-char))
|
||||
(t (org-shiftselect-error))))
|
||||
|
||||
(defun org-shiftleft (&optional arg)
|
||||
"Cycle the thing at point or in the current line, depending on context.
|
||||
Depending on context, this does one of the following:
|
||||
"Act on current element according to context.
|
||||
This does one of the following:
|
||||
|
||||
- switch a timestamp at point one day into the past
|
||||
- on a headline, switch to the previous TODO keyword.
|
||||
- on an item, switch entire list to the previous bullet type
|
||||
- on a property line, switch to the previous allowed value
|
||||
- on a clocktable definition line, move time block into the past"
|
||||
- on a clocktable definition line, move time block into the past
|
||||
- in a table, move a single cell left"
|
||||
(interactive "P")
|
||||
(cond
|
||||
((run-hook-with-args-until-success 'org-shiftleft-hook))
|
||||
|
@ -19953,6 +19339,7 @@ Depending on context, this does one of the following:
|
|||
(org-at-property-p))
|
||||
(call-interactively 'org-property-previous-allowed-value))
|
||||
((org-clocktable-try-shift 'left arg))
|
||||
((org-at-table-p) (org-table-move-cell-left))
|
||||
((run-hook-with-args-until-success 'org-shiftleft-final-hook))
|
||||
(org-support-shift-select
|
||||
(org-call-for-shift-select 'backward-char))
|
||||
|
@ -22142,20 +21529,27 @@ filling the current element."
|
|||
(interactive (progn
|
||||
(barf-if-buffer-read-only)
|
||||
(list (when current-prefix-arg 'full) t)))
|
||||
(cond
|
||||
((and region transient-mark-mode mark-active
|
||||
(not (eq (region-beginning) (region-end))))
|
||||
(let ((origin (point-marker))
|
||||
(start (region-beginning)))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(goto-char (region-end))
|
||||
(while (> (point) start)
|
||||
(org-backward-paragraph)
|
||||
(org-fill-element justify)))
|
||||
(goto-char origin)
|
||||
(set-marker origin nil))))
|
||||
(t (org-fill-element justify))))
|
||||
(let ((hash (and (not (buffer-modified-p))
|
||||
(org-buffer-hash))))
|
||||
(cond
|
||||
((and region transient-mark-mode mark-active
|
||||
(not (eq (region-beginning) (region-end))))
|
||||
(let ((origin (point-marker))
|
||||
(start (region-beginning)))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(goto-char (region-end))
|
||||
(while (> (point) start)
|
||||
(org-backward-paragraph)
|
||||
(org-fill-element justify)))
|
||||
(goto-char origin)
|
||||
(set-marker origin nil))))
|
||||
(t (org-fill-element justify)))
|
||||
;; If we didn't change anything in the buffer (and the buffer was
|
||||
;; previously unmodified), then flip the modification status back
|
||||
;; to "unchanged".
|
||||
(when (and hash (equal hash (org-buffer-hash)))
|
||||
(set-buffer-modified-p nil))))
|
||||
|
||||
(defun org-auto-fill-function ()
|
||||
"Auto-fill function."
|
||||
|
|
|
@ -2607,7 +2607,10 @@ holding contextual information."
|
|||
(and (org-export-last-sibling-p headline info)
|
||||
(format "</%s>\n" html-type))))
|
||||
;; Standard headline. Export it as a section.
|
||||
(let ((extra-class (org-element-property :HTML_CONTAINER_CLASS headline))
|
||||
(let ((extra-class
|
||||
(org-element-property :HTML_CONTAINER_CLASS headline))
|
||||
(headline-class
|
||||
(org-element-property :HTML_HEADLINE_CLASS headline))
|
||||
(first-content (car (org-element-contents headline))))
|
||||
(format "<%s id=\"%s\" class=\"%s\">%s%s</%s>\n"
|
||||
(org-html--container headline info)
|
||||
|
@ -2616,9 +2619,11 @@ holding contextual information."
|
|||
(concat (format "outline-%d" level)
|
||||
(and extra-class " ")
|
||||
extra-class)
|
||||
(format "\n<h%d id=\"%s\">%s</h%d>\n"
|
||||
(format "\n<h%d id=\"%s\"%s>%s</h%d>\n"
|
||||
level
|
||||
id
|
||||
(if (not headline-class) ""
|
||||
(format " class=\"%s\"" headline-class))
|
||||
(concat
|
||||
(and numberedp
|
||||
(format
|
||||
|
|
|
@ -540,6 +540,10 @@ inlinetask within the section."
|
|||
(org-export-get-node-property
|
||||
:LOCATION entry
|
||||
(org-property-inherit-p "LOCATION"))))
|
||||
(class (org-icalendar-cleanup-string
|
||||
(org-export-get-node-property
|
||||
:CLASS entry
|
||||
(org-property-inherit-p "CLASS"))))
|
||||
;; Build description of the entry from associated section
|
||||
;; (headline) or contents (inlinetask).
|
||||
(desc
|
||||
|
@ -568,14 +572,14 @@ inlinetask within the section."
|
|||
org-icalendar-use-deadline)
|
||||
(org-icalendar--vevent
|
||||
entry deadline (concat "DL-" uid)
|
||||
(concat "DL: " summary) loc desc cat tz)))
|
||||
(concat "DL: " summary) loc desc cat tz class)))
|
||||
(let ((scheduled (org-element-property :scheduled entry)))
|
||||
(and scheduled
|
||||
(memq (if todo-type 'event-if-todo 'event-if-not-todo)
|
||||
org-icalendar-use-scheduled)
|
||||
(org-icalendar--vevent
|
||||
entry scheduled (concat "SC-" uid)
|
||||
(concat "S: " summary) loc desc cat tz)))
|
||||
(concat "S: " summary) loc desc cat tz class)))
|
||||
;; When collecting plain timestamps from a headline and its
|
||||
;; title, skip inlinetasks since collection will happen once
|
||||
;; ENTRY is one of them.
|
||||
|
@ -593,7 +597,7 @@ inlinetask within the section."
|
|||
((t) t)))
|
||||
(let ((uid (format "TS%d-%s" (cl-incf counter) uid)))
|
||||
(org-icalendar--vevent
|
||||
entry ts uid summary loc desc cat tz))))
|
||||
entry ts uid summary loc desc cat tz class))))
|
||||
info nil (and (eq type 'headline) 'inlinetask))
|
||||
""))
|
||||
;; Task: First check if it is appropriate to export it. If
|
||||
|
@ -607,7 +611,7 @@ inlinetask within the section."
|
|||
(not (org-icalendar-blocked-headline-p
|
||||
entry info))))
|
||||
((t) (eq todo-type 'todo))))
|
||||
(org-icalendar--vtodo entry uid summary loc desc cat tz))
|
||||
(org-icalendar--vtodo entry uid summary loc desc cat tz class))
|
||||
;; Diary-sexp: Collect every diary-sexp element within ENTRY
|
||||
;; and its title, and transcode them. If ENTRY is
|
||||
;; a headline, skip inlinetasks: they will be handled
|
||||
|
@ -638,7 +642,7 @@ inlinetask within the section."
|
|||
contents))))
|
||||
|
||||
(defun org-icalendar--vevent
|
||||
(entry timestamp uid summary location description categories timezone)
|
||||
(entry timestamp uid summary location description categories timezone class)
|
||||
"Create a VEVENT component.
|
||||
|
||||
ENTRY is either a headline or an inlinetask element. TIMESTAMP
|
||||
|
@ -648,7 +652,9 @@ summary or subject for the event. LOCATION defines the intended
|
|||
venue for the event. DESCRIPTION provides the complete
|
||||
description of the event. CATEGORIES defines the categories the
|
||||
event belongs to. TIMEZONE specifies a time zone for this event
|
||||
only.
|
||||
only. CLASS contains the visibility attribute. Three of them
|
||||
(\"PUBLIC\", \"CONFIDENTIAL\", and \"PRIVATE\") are predefined, others
|
||||
should be treated as \"PRIVATE\" if they are unknown to the iCalendar server.
|
||||
|
||||
Return VEVENT component as a string."
|
||||
(org-icalendar-fold-string
|
||||
|
@ -669,6 +675,7 @@ Return VEVENT component as a string."
|
|||
(org-element-property :repeater-value timestamp)))
|
||||
"SUMMARY:" summary "\n"
|
||||
(and (org-string-nw-p location) (format "LOCATION:%s\n" location))
|
||||
(and (org-string-nw-p class) (format "CLASS:%s\n" class))
|
||||
(and (org-string-nw-p description)
|
||||
(format "DESCRIPTION:%s\n" description))
|
||||
"CATEGORIES:" categories "\n"
|
||||
|
@ -677,7 +684,7 @@ Return VEVENT component as a string."
|
|||
"END:VEVENT"))))
|
||||
|
||||
(defun org-icalendar--vtodo
|
||||
(entry uid summary location description categories timezone)
|
||||
(entry uid summary location description categories timezone class)
|
||||
"Create a VTODO component.
|
||||
|
||||
ENTRY is either a headline or an inlinetask element. UID is the
|
||||
|
@ -712,6 +719,7 @@ Return VTODO component as a string."
|
|||
"\n"))
|
||||
"SUMMARY:" summary "\n"
|
||||
(and (org-string-nw-p location) (format "LOCATION:%s\n" location))
|
||||
(and (org-string-nw-p class) (format "CLASS:%s\n" class))
|
||||
(and (org-string-nw-p description)
|
||||
(format "DESCRIPTION:%s\n" description))
|
||||
"CATEGORIES:" categories "\n"
|
||||
|
|
214
lisp/ox-latex.el
214
lisp/ox-latex.el
|
@ -3140,6 +3140,58 @@ centered."
|
|||
info)
|
||||
(apply 'concat (nreverse align)))))
|
||||
|
||||
(defun org-latex--decorate-table (table attributes caption above? info)
|
||||
"Decorate TABLE string with caption and float environment.
|
||||
|
||||
ATTRIBUTES is the plist containing is LaTeX attributes. CAPTION
|
||||
is its caption. It is located above the table if ABOVE? is
|
||||
non-nil. INFO is the plist containing current export parameters.
|
||||
|
||||
Return new environment, as a string."
|
||||
(let* ((float-environment
|
||||
(let ((float (plist-get attributes :float)))
|
||||
(cond ((and (not float) (plist-member attributes :float)) nil)
|
||||
((member float '("sidewaystable" "sideways")) "sidewaystable")
|
||||
((equal float "multicolumn") "table*")
|
||||
((or float
|
||||
(org-element-property :caption table)
|
||||
(org-string-nw-p (plist-get attributes :caption)))
|
||||
"table")
|
||||
(t nil))))
|
||||
(placement
|
||||
(or (plist-get attributes :placement)
|
||||
(format "[%s]" (plist-get info :latex-default-figure-position))))
|
||||
(center? (if (plist-member attributes :center)
|
||||
(plist-get attributes :center)
|
||||
(plist-get info :latex-tables-centered)))
|
||||
(fontsize (let ((font (plist-get attributes :font)))
|
||||
(and font (concat font "\n")))))
|
||||
(concat (cond
|
||||
(float-environment
|
||||
(concat (format "\\begin{%s}%s\n" float-environment placement)
|
||||
(if above? caption "")
|
||||
(when center? "\\centering\n")
|
||||
fontsize))
|
||||
(caption
|
||||
(concat (and center? "\\begin{center}\n" )
|
||||
(if above? caption "")
|
||||
(cond ((and fontsize center?) fontsize)
|
||||
(fontsize (concat "{" fontsize))
|
||||
(t nil))))
|
||||
(center? (concat "\\begin{center}\n" fontsize))
|
||||
(fontsize (concat "{" fontsize)))
|
||||
table
|
||||
(cond
|
||||
(float-environment
|
||||
(concat (if above? "" (concat "\n" caption))
|
||||
(format "\n\\end{%s}" float-environment)))
|
||||
(caption
|
||||
(concat (if above? "" (concat "\n" caption))
|
||||
(and center? "\n\\end{center}")
|
||||
(and fontsize (not center?) "}")))
|
||||
(center? "\n\\end{center}")
|
||||
(fontsize "}")))))
|
||||
|
||||
(defun org-latex--org-table (table contents info)
|
||||
"Return appropriate LaTeX code for an Org table.
|
||||
|
||||
|
@ -3149,109 +3201,44 @@ channel.
|
|||
|
||||
This function assumes TABLE has `org' as its `:type' property and
|
||||
`table' as its `:mode' attribute."
|
||||
(let* ((caption (org-latex--caption/label-string table info))
|
||||
(attr (org-export-read-attribute :attr_latex table))
|
||||
;; Determine alignment string.
|
||||
(let* ((attr (org-export-read-attribute :attr_latex table))
|
||||
(alignment (org-latex--align-string table info))
|
||||
;; Determine environment for the table: longtable, tabular...
|
||||
(table-env (or (plist-get attr :environment)
|
||||
(plist-get info :latex-default-table-environment)))
|
||||
;; If table is a float, determine environment: table, table*
|
||||
;; or sidewaystable.
|
||||
(float-env (unless (member table-env '("longtable" "longtabu"))
|
||||
(let ((float (plist-get attr :float)))
|
||||
(cond
|
||||
((and (not float) (plist-member attr :float)) nil)
|
||||
((or (string= float "sidewaystable")
|
||||
(string= float "sideways")) "sidewaystable")
|
||||
((string= float "multicolumn") "table*")
|
||||
((or float
|
||||
(org-element-property :caption table)
|
||||
(org-string-nw-p (plist-get attr :caption)))
|
||||
"table")))))
|
||||
;; Extract others display options.
|
||||
(fontsize (let ((font (plist-get attr :font)))
|
||||
(and font (concat font "\n"))))
|
||||
;; "tabular" environment doesn't allow to define a width.
|
||||
(width (and (not (equal table-env "tabular")) (plist-get attr :width)))
|
||||
(spreadp (plist-get attr :spread))
|
||||
(placement
|
||||
(or (plist-get attr :placement)
|
||||
(format "[%s]" (plist-get info :latex-default-figure-position))))
|
||||
(centerp (if (plist-member attr :center) (plist-get attr :center)
|
||||
(plist-get info :latex-tables-centered)))
|
||||
(caption-above-p (org-latex--caption-above-p table info)))
|
||||
;; Prepare the final format string for the table.
|
||||
(width
|
||||
(let ((w (plist-get attr :width)))
|
||||
(cond ((not w) "")
|
||||
((member table-env '("tabular" "longtable")) "")
|
||||
((member table-env '("tabu" "longtabu"))
|
||||
(format (if (plist-get attr :spread) " spread %s "
|
||||
" to %s ")
|
||||
w))
|
||||
(t (format "{%s}" w)))))
|
||||
(caption (org-latex--caption/label-string table info))
|
||||
(above? (org-latex--caption-above-p table info)))
|
||||
(cond
|
||||
;; Longtable.
|
||||
((equal "longtable" table-env)
|
||||
(concat (and fontsize (concat "{" fontsize))
|
||||
(format "\\begin{longtable}{%s}\n" alignment)
|
||||
(and caption-above-p
|
||||
(org-string-nw-p caption)
|
||||
(concat caption "\\\\\n"))
|
||||
contents
|
||||
(and (not caption-above-p)
|
||||
(org-string-nw-p caption)
|
||||
(concat caption "\\\\\n"))
|
||||
"\\end{longtable}\n"
|
||||
(and fontsize "}")))
|
||||
;; Longtabu
|
||||
((equal "longtabu" table-env)
|
||||
(concat (and fontsize (concat "{" fontsize))
|
||||
(format "\\begin{longtabu}%s{%s}\n"
|
||||
(if width
|
||||
(format " %s %s "
|
||||
(if spreadp "spread" "to") width) "")
|
||||
alignment)
|
||||
(and caption-above-p
|
||||
(org-string-nw-p caption)
|
||||
(concat caption "\\\\\n"))
|
||||
contents
|
||||
(and (not caption-above-p)
|
||||
(org-string-nw-p caption)
|
||||
(concat caption "\\\\\n"))
|
||||
"\\end{longtabu}\n"
|
||||
(and fontsize "}")))
|
||||
;; Others.
|
||||
(t (concat (cond
|
||||
(float-env
|
||||
(concat (format "\\begin{%s}%s\n" float-env placement)
|
||||
(if caption-above-p caption "")
|
||||
(when centerp "\\centering\n")
|
||||
fontsize))
|
||||
((and (not float-env) caption)
|
||||
(concat
|
||||
(and centerp "\\begin{center}\n" )
|
||||
(if caption-above-p caption "")
|
||||
(cond ((and fontsize centerp) fontsize)
|
||||
(fontsize (concat "{" fontsize)))))
|
||||
(centerp (concat "\\begin{center}\n" fontsize))
|
||||
(fontsize (concat "{" fontsize)))
|
||||
(cond ((equal "tabu" table-env)
|
||||
(format "\\begin{tabu}%s{%s}\n%s\\end{tabu}"
|
||||
(if width (format
|
||||
(if spreadp " spread %s " " to %s ")
|
||||
width) "")
|
||||
alignment
|
||||
contents))
|
||||
(t (format "\\begin{%s}%s{%s}\n%s\\end{%s}"
|
||||
table-env
|
||||
(if width (format "{%s}" width) "")
|
||||
alignment
|
||||
contents
|
||||
table-env)))
|
||||
(cond
|
||||
(float-env
|
||||
(concat (if caption-above-p "" (concat "\n" caption))
|
||||
(format "\n\\end{%s}" float-env)))
|
||||
((and (not float-env) caption)
|
||||
(concat
|
||||
(if caption-above-p "" (concat "\n" caption))
|
||||
(and centerp "\n\\end{center}")
|
||||
(and fontsize (not centerp) "}")))
|
||||
(centerp "\n\\end{center}")
|
||||
(fontsize "}")))))))
|
||||
((member table-env '("longtable" "longtabu"))
|
||||
(let ((fontsize (let ((font (plist-get attr :font)))
|
||||
(and font (concat font "\n")))))
|
||||
(concat (and fontsize (concat "{" fontsize))
|
||||
(format "\\begin{%s}%s{%s}\n" table-env width alignment)
|
||||
(and above?
|
||||
(org-string-nw-p caption)
|
||||
(concat caption "\\\\\n"))
|
||||
contents
|
||||
(and (not above?)
|
||||
(org-string-nw-p caption)
|
||||
(concat caption "\\\\\n"))
|
||||
(format "\\end{%s}" table-env)
|
||||
(and fontsize "}"))))
|
||||
(t
|
||||
(let ((output (format "\\begin{%s}%s{%s}\n%s\\end{%s}"
|
||||
table-env
|
||||
width
|
||||
alignment
|
||||
contents
|
||||
table-env)))
|
||||
(org-latex--decorate-table output attr caption above? info))))))
|
||||
|
||||
(defun org-latex--table.el-table (table info)
|
||||
"Return appropriate LaTeX code for a table.el table.
|
||||
|
@ -3265,18 +3252,20 @@ property."
|
|||
;; Ensure "*org-export-table*" buffer is empty.
|
||||
(with-current-buffer (get-buffer-create "*org-export-table*")
|
||||
(erase-buffer))
|
||||
(let ((output (with-temp-buffer
|
||||
(insert (org-element-property :value table))
|
||||
(goto-char 1)
|
||||
(re-search-forward "^[ \t]*|[^|]" nil t)
|
||||
(table-generate-source 'latex "*org-export-table*")
|
||||
(with-current-buffer "*org-export-table*"
|
||||
(org-trim (buffer-string))))))
|
||||
(let ((output
|
||||
(replace-regexp-in-string
|
||||
"^%.*\n" "" ;remove comments
|
||||
(with-temp-buffer
|
||||
(save-excursion (insert (org-element-property :value table)))
|
||||
(re-search-forward "^[ \t]*|[^|]" nil t)
|
||||
(table-generate-source 'latex "*org-export-table*")
|
||||
(with-current-buffer "*org-export-table*"
|
||||
(org-trim (buffer-string))))
|
||||
t t)))
|
||||
(kill-buffer (get-buffer "*org-export-table*"))
|
||||
;; Remove left out comments.
|
||||
(while (string-match "^%.*\n" output)
|
||||
(setq output (replace-match "" t t output)))
|
||||
(let ((attr (org-export-read-attribute :attr_latex table)))
|
||||
(let ((attr (org-export-read-attribute :attr_latex table))
|
||||
(caption (org-latex--caption/label-string table info))
|
||||
(above? (org-latex--caption-above-p table info)))
|
||||
(when (plist-get attr :rmlines)
|
||||
;; When the "rmlines" attribute is provided, remove all hlines
|
||||
;; but the the one separating heading from the table body.
|
||||
|
@ -3285,10 +3274,7 @@ property."
|
|||
(setq pos (string-match "^\\\\hline\n?" output pos)))
|
||||
(cl-incf n)
|
||||
(unless (= n 2) (setq output (replace-match "" nil nil output))))))
|
||||
(let ((centerp (if (plist-member attr :center) (plist-get attr :center)
|
||||
(plist-get info :latex-tables-centered))))
|
||||
(if (not centerp) output
|
||||
(format "\\begin{center}\n%s\n\\end{center}" output))))))
|
||||
(org-latex--decorate-table output attr caption above? info))))
|
||||
|
||||
(defun org-latex--math-table (table info)
|
||||
"Return appropriate LaTeX code for a matrix.
|
||||
|
|
|
@ -1969,10 +1969,12 @@ contextual information."
|
|||
CONTENTS holds the contents of the item. INFO is a plist holding
|
||||
contextual information."
|
||||
(let* ((plain-list (org-export-get-parent item))
|
||||
(count (org-element-property :counter item))
|
||||
(type (org-element-property :type plain-list)))
|
||||
(unless (memq type '(ordered unordered descriptive-1 descriptive-2))
|
||||
(error "Unknown list type: %S" type))
|
||||
(format "\n<text:list-item>\n%s\n%s"
|
||||
(format "\n<text:list-item%s>\n%s\n%s"
|
||||
(if count (format " text:start-value=\"%s\"" count) "")
|
||||
contents
|
||||
(if (org-element-map item 'table #'identity info 'first-match)
|
||||
"</text:list-header>"
|
||||
|
|
|
@ -3279,6 +3279,11 @@ storing and resolving footnotes. It is created automatically."
|
|||
(let* ((value (org-element-property :value element))
|
||||
(ind (current-indentation))
|
||||
location
|
||||
(coding-system-for-read
|
||||
(or (and (string-match ":coding +\\(\\S-+\\)>" value)
|
||||
(prog1 (intern (match-string 1 value))
|
||||
(setq value (replace-match "" nil nil value))))
|
||||
coding-system-for-read))
|
||||
(file
|
||||
(and (string-match "^\\(\".+?\"\\|\\S-+\\)\\(?:\\s-+\\|$\\)"
|
||||
value)
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
;;; test-ob-clojure.el
|
||||
|
||||
;; Copyright (c) 2018-2022 Free Software Foundation, Inc.
|
||||
;; Authors: stardiviner
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Comments:
|
||||
|
||||
;; Org tests for ob-clojure.el live here
|
||||
|
||||
;;; Code:
|
||||
(org-test-for-executable "cider")
|
||||
(unless (featurep 'cider)
|
||||
(signal 'missing-test-dependency "CIDER"))
|
||||
(unless (featurep 'ob-clojure)
|
||||
(signal 'missing-test-dependency "Support for Clojure code blocks"))
|
||||
|
||||
(ert-deftest ob-clojure/simple-session ()
|
||||
(org-test-with-temp-text
|
||||
"#+begin_src clojure :session
|
||||
(print \"hello, world\")
|
||||
#+end_src
|
||||
"
|
||||
(should (string= "hello, world" (org-babel-execute-src-block)))))
|
||||
|
||||
(ert-deftest ob-clojure/initiate-session ()
|
||||
(org-test-with-temp-text
|
||||
"#+begin_src clojure :session :var a=1 :results output
|
||||
(print \"hello, world\")
|
||||
#+end_src
|
||||
|
||||
#+begin_src clojure :session :results output
|
||||
(print a)
|
||||
#+end_src"
|
||||
(goto-char (point-min))
|
||||
(org-babel-switch-to-session)
|
||||
(sleep-for 2)
|
||||
(org-babel-execute-maybe)
|
||||
(org-babel-next-src-block)
|
||||
(goto-char (org-babel-result-end))
|
||||
(forward-line 2)
|
||||
(should (string=
|
||||
": 1"
|
||||
(buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
|
||||
|
||||
(ert-deftest ob-clojure/initiate-session-with-var ()
|
||||
(org-test-with-temp-text
|
||||
"#+begin_src clojure :session :var a=1 :results output
|
||||
(print a)
|
||||
#+end_src"
|
||||
(org-babel-next-src-block)
|
||||
(org-babel-initiate-session)
|
||||
(sleep-for 2)
|
||||
(org-babel-execute-maybe)
|
||||
(goto-char (org-babel-result-end))
|
||||
(forward-line 2)
|
||||
(should (string=
|
||||
": 1"
|
||||
(buffer-substring-no-properties (point-at-bol) (point-at-eol))))))
|
||||
|
||||
(provide 'test-ob-clojure)
|
||||
|
||||
;;; test-ob-clojure.el ends here
|
|
@ -0,0 +1,73 @@
|
|||
;;; test-ob-eshell.el
|
||||
|
||||
;; Copyright (c) 2018 stardiviner
|
||||
;; Authors: stardiviner
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;;; Comment:
|
||||
|
||||
;; Template test file for Org tests
|
||||
|
||||
;;; Code:
|
||||
(unless (featurep 'ob-eshell)
|
||||
(signal 'missing-test-dependency "Support for Eshell code blocks"))
|
||||
|
||||
(ert-deftest ob-eshell/execute ()
|
||||
"Test ob-eshell execute."
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text
|
||||
"#+begin_src eshell
|
||||
echo 2
|
||||
#+end_src"
|
||||
(org-babel-execute-src-block))
|
||||
": 2")))
|
||||
|
||||
(ert-deftest ob-eshell/variables-assignment ()
|
||||
"Test ob-eshell variables assignment."
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text
|
||||
"#+begin_src eshell :var hi=\"hello, world\"
|
||||
echo $hi
|
||||
#+end_src"
|
||||
(org-babel-execute-src-block))
|
||||
": hello, world")))
|
||||
|
||||
(ert-deftest ob-eshell/session ()
|
||||
"Test ob-eshell session."
|
||||
(should
|
||||
(string=
|
||||
(org-test-with-temp-text
|
||||
"#+begin_src eshell :session
|
||||
(setq hi \"hello, world\")
|
||||
#+end_src
|
||||
|
||||
#+begin_src eshell :session
|
||||
echo $hi
|
||||
#+end_src"
|
||||
(org-babel-execute-src-block)
|
||||
(org-babel-next-src-block)
|
||||
(org-babel-execute-src-block)
|
||||
(goto-char (org-babel-where-is-src-block-result))
|
||||
(forward-line)
|
||||
(buffer-substring-no-properties (point) (line-end-position)))
|
||||
": hello, world")))
|
||||
|
||||
(provide 'test-ob-eshell)
|
||||
|
||||
;;; test-ob-eshell.el ends here
|
|
@ -30,7 +30,7 @@ should still return the link."
|
|||
(org-test-with-temp-text
|
||||
"
|
||||
* Test
|
||||
#+<point>BEGIN_SRC emacs-lisp :file test.txt :cache yes
|
||||
#+<point>BEGIN_SRC emacs-lisp :results file :file test.txt :cache yes
|
||||
(message \"test\")
|
||||
#+END_SRC"
|
||||
;; Execute twice as the first time creates the cache.
|
||||
|
@ -1003,30 +1003,48 @@ trying to find the :END: marker."
|
|||
The file is just a link to `:file' value. Inhibit non-empty
|
||||
result write to `:file' value."
|
||||
(org-test-with-temp-text "
|
||||
<point>#+begin_src shell :results value file link :file \"/tmp/test.txt\"
|
||||
echo \"hello\" > /tmp/test.txt
|
||||
echo \"test\"
|
||||
#+end_src"
|
||||
(org-babel-execute-src-block)
|
||||
(should (search-forward "[[file:/tmp/test.txt]]" nil t))
|
||||
(should (with-temp-buffer
|
||||
(insert-file-contents "/tmp/test.txt")
|
||||
(string= "hello\n" (buffer-string)))))
|
||||
;; Without "link" output type, the result is not a file.
|
||||
(should-not
|
||||
(org-test-with-temp-text "
|
||||
<point>#+begin_src shell :results value link :file \"/tmp/test.txt\"
|
||||
echo \"hello\" > /tmp/test.txt
|
||||
echo \"test\"
|
||||
#+end_src"
|
||||
(org-babel-execute-src-block)
|
||||
(should (search-forward "[[file:/tmp/test.txt]]" nil nil))
|
||||
(should (with-temp-buffer
|
||||
(insert-file-contents "/tmp/test.txt")
|
||||
(string= "hello\n" (buffer-string))))))
|
||||
(org-babel-execute-src-block)
|
||||
(search-forward "[[file:/tmp/test.txt]]" nil t))))
|
||||
|
||||
(ert-deftest test-ob/result-graphics-link-type-header-argument ()
|
||||
"Ensure that the result is a link to a file.
|
||||
The file is just a link to `:file' value. Inhibit non-empty
|
||||
result write to `:file' value."
|
||||
(org-test-with-temp-text "
|
||||
<point>#+begin_src shell :results value file graphics :file \"/tmp/test.txt\"
|
||||
echo \"hello\" > /tmp/test.txt
|
||||
echo \"test\"
|
||||
#+end_src"
|
||||
(org-babel-execute-src-block)
|
||||
(should (search-forward "[[file:/tmp/test.txt]]" nil nil))
|
||||
(should (with-temp-buffer
|
||||
(insert-file-contents "/tmp/test.txt")
|
||||
(string= "hello\n" (buffer-string)))))
|
||||
;; Without "link" output type, the result is not a file.
|
||||
(should-not
|
||||
(org-test-with-temp-text "
|
||||
<point>#+begin_src shell :results value graphics :file \"/tmp/test.txt\"
|
||||
echo \"hello\" > /tmp/test.txt
|
||||
echo \"test\"
|
||||
#+end_src"
|
||||
(org-babel-execute-src-block)
|
||||
(should (search-forward "[[file:/tmp/test.txt]]" nil nil))
|
||||
(should (with-temp-buffer
|
||||
(insert-file-contents "/tmp/test.txt")
|
||||
(string= "hello\n" (buffer-string))))))
|
||||
(org-babel-execute-src-block)
|
||||
(search-forward "[[file:/tmp/test.txt]]" nil t))))
|
||||
|
||||
(ert-deftest test-ob/inline-src_blk-preceded-punct-preceded-by-point ()
|
||||
(let ((test-line ".src_emacs-lisp[ :results verbatim ]{ \"x\" }")
|
||||
|
@ -2016,6 +2034,16 @@ abc
|
|||
(let ((org-coderef-label-format "#(ref:%s)"))
|
||||
(org-babel-execute-src-block))))))
|
||||
|
||||
(ert-deftest test-ob/string-to-number ()
|
||||
(should (= 0 (org-babel--string-to-number "0")))
|
||||
(should (= 1 (org-babel--string-to-number "1")))
|
||||
(should (eq nil (org-babel--string-to-number "000")))
|
||||
(should (eq nil (org-babel--string-to-number "001")))
|
||||
(should (eq nil (org-babel--string-to-number "010")))
|
||||
(should (= 100 (org-babel--string-to-number "100")))
|
||||
(should (= 0.1 (org-babel--string-to-number "0.1")))
|
||||
(should (= 1.0 (org-babel--string-to-number "1.0"))))
|
||||
|
||||
(provide 'test-ob)
|
||||
|
||||
;;; test-ob ends here
|
||||
|
|
|
@ -49,8 +49,8 @@ Return the clock line as a string."
|
|||
(let* ((beg (org-test-clock-create-timestamp input1 t t))
|
||||
(end (and input2 (org-test-clock-create-timestamp input2 t t)))
|
||||
(sec-diff (and input2
|
||||
(floor (- (org-time-string-to-seconds end)
|
||||
(org-time-string-to-seconds beg))))))
|
||||
(floor (- (org-time-string-to-seconds end)
|
||||
(org-time-string-to-seconds beg))))))
|
||||
(concat org-clock-string " " beg
|
||||
(when end
|
||||
(concat "--" end " => "
|
||||
|
@ -82,7 +82,7 @@ the buffer."
|
|||
;; Skip caption.
|
||||
(when (looking-at "#\\+CAPTION:") (forward-line))
|
||||
(buffer-substring-no-properties
|
||||
(point) (progn (search-forward "#+END:") (line-end-position 0))))
|
||||
(point) (progn (search-forward "#+END:") (line-end-position 0))))
|
||||
;; Remove clocktable.
|
||||
(delete-region (point) (search-forward "#+END:\n"))))
|
||||
|
||||
|
@ -369,18 +369,18 @@ the buffer."
|
|||
"* Test
|
||||
CLOCK: [2012-03-29 Thu 8:00]--[2012-03-29 Thu 16:40] => 8:40"
|
||||
(test-org-clock-clocktable-contents ":scope file-with-archives"
|
||||
"#+TBLFM: $3=string(\"foo\")"))))
|
||||
"#+TBLFM: $3=string(\"foo\")"))))
|
||||
;; Test "function" scope.
|
||||
(should
|
||||
(string-match-p
|
||||
(regexp-quote "| ALL *Total time* | *1:00* |")
|
||||
(org-test-with-temp-text-in-file
|
||||
"* Test
|
||||
"* Test
|
||||
CLOCK: [2012-03-29 Thu 16:00]--[2012-03-29 Thu 17:00] => 1:00"
|
||||
(let ((the-file (buffer-file-name)))
|
||||
(org-test-with-temp-text-in-file ""
|
||||
(test-org-clock-clocktable-contents
|
||||
(format ":scope (lambda () (list %S))" the-file))))))))
|
||||
(org-test-with-temp-text-in-file ""
|
||||
(test-org-clock-clocktable-contents
|
||||
(format ":scope (lambda () (list %S))" the-file))))))))
|
||||
|
||||
(ert-deftest test-org-clock/clocktable/maxlevel ()
|
||||
"Test \":maxlevel\" parameter in Clock table."
|
||||
|
@ -409,7 +409,7 @@ CLOCK: [2016-12-28 Wed 13:09]--[2016-12-28 Wed 15:09] => 2:00"
|
|||
CLOCK: [2016-12-28 Wed 11:09]--[2016-12-28 Wed 15:09] => 4:00
|
||||
** Bar
|
||||
CLOCK: [2016-12-28 Wed 13:09]--[2016-12-28 Wed 15:09] => 2:00"
|
||||
(test-org-clock-clocktable-contents ":maxlevel 2"))))
|
||||
(test-org-clock-clocktable-contents ":maxlevel 2"))))
|
||||
(should
|
||||
(equal "| Headline | Time |
|
||||
|--------------+--------|
|
||||
|
@ -421,7 +421,7 @@ CLOCK: [2016-12-28 Wed 13:09]--[2016-12-28 Wed 15:09] => 2:00"
|
|||
CLOCK: [2016-12-28 Wed 11:09]--[2016-12-28 Wed 15:09] => 4:00
|
||||
** Bar
|
||||
CLOCK: [2016-12-28 Wed 13:09]--[2016-12-28 Wed 15:09] => 2:00"
|
||||
(test-org-clock-clocktable-contents ":maxlevel 1"))))
|
||||
(test-org-clock-clocktable-contents ":maxlevel 1"))))
|
||||
;; Special ":maxlevel 0" case: only report total file time.
|
||||
(should
|
||||
(equal "| Headline | Time |
|
||||
|
@ -433,7 +433,7 @@ CLOCK: [2016-12-28 Wed 13:09]--[2016-12-28 Wed 15:09] => 2:00"
|
|||
CLOCK: [2016-12-28 Wed 11:09]--[2016-12-28 Wed 15:09] => 4:00
|
||||
** Bar
|
||||
CLOCK: [2016-12-28 Wed 13:09]--[2016-12-28 Wed 15:09] => 2:00"
|
||||
(test-org-clock-clocktable-contents ":maxlevel 0")))))
|
||||
(test-org-clock-clocktable-contents ":maxlevel 0")))))
|
||||
|
||||
(ert-deftest test-org-clock/clocktable/formula ()
|
||||
"Test \":formula\" parameter in Clock table."
|
||||
|
@ -478,8 +478,8 @@ CLOCK: [2016-12-28 Wed 13:09]--[2016-12-28 Wed 15:09] => 2:00"
|
|||
| \\_ sub3 | | 0:30 | | 50.0 |
|
||||
| \\_ subsub1 | | | 0:15 | 25.0 |
|
||||
| \\_ subsub1 | | | 0:15 | 25.0 |"
|
||||
(org-test-with-temp-text
|
||||
"* foo
|
||||
(org-test-with-temp-text
|
||||
"* foo
|
||||
** sub
|
||||
:LOGBOOK:
|
||||
CLOCK: [2017-03-18 Sat 15:00]--[2017-03-18 Sat 15:15] => 0:15
|
||||
|
@ -497,7 +497,7 @@ CLOCK: [2016-12-28 Wed 13:09]--[2016-12-28 Wed 15:09] => 2:00"
|
|||
:LOGBOOK:
|
||||
CLOCK: [2017-03-18 Sat 14:00]--[2017-03-18 Sat 14:15] => 0:15
|
||||
:END:"
|
||||
(test-org-clock-clocktable-contents ":maxlevel 3 :formula %")))))
|
||||
(test-org-clock-clocktable-contents ":maxlevel 3 :formula %")))))
|
||||
|
||||
(ert-deftest test-org-clock/clocktable/lang ()
|
||||
"Test \":lang\" parameter in Clock table."
|
||||
|
@ -560,7 +560,7 @@ CLOCK: [2016-12-28 Wed 13:09]--[2016-12-28 Wed 15:09] => 2:00"
|
|||
|--------------+---------|
|
||||
| [[Foo][Foo]] | 26:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
"* Foo
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
||||
(test-org-clock-clocktable-contents ":link t"))))
|
||||
;; Otherwise, link to the headline in the current file.
|
||||
|
@ -572,12 +572,12 @@ CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
|||
|--------------+---------|
|
||||
| [[file:filename::Foo][Foo]] | 26:00 |"
|
||||
(org-test-with-temp-text-in-file
|
||||
"* Foo
|
||||
"* Foo
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
||||
(let ((file (buffer-file-name)))
|
||||
(replace-regexp-in-string
|
||||
(regexp-quote file) "filename"
|
||||
(test-org-clock-clocktable-contents ":link t"))))))
|
||||
(replace-regexp-in-string
|
||||
(regexp-quote file) "filename"
|
||||
(test-org-clock-clocktable-contents ":link t"))))))
|
||||
;; Ignore TODO keyword, priority cookie, COMMENT and tags in
|
||||
;; headline.
|
||||
(should
|
||||
|
@ -588,7 +588,7 @@ CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
|||
|--------------+---------|
|
||||
| [[Foo][Foo]] | 26:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* TODO Foo
|
||||
"* TODO Foo
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
||||
(test-org-clock-clocktable-contents ":link t"))))
|
||||
(should
|
||||
|
@ -599,7 +599,7 @@ CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
|||
|--------------+---------|
|
||||
| [[Foo][Foo]] | 26:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* [#A] Foo
|
||||
"* [#A] Foo
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
||||
(test-org-clock-clocktable-contents ":link t"))))
|
||||
(should
|
||||
|
@ -610,7 +610,7 @@ CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
|||
|--------------+---------|
|
||||
| [[Foo][Foo]] | 26:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* COMMENT Foo
|
||||
"* COMMENT Foo
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
||||
(test-org-clock-clocktable-contents ":link t"))))
|
||||
(should
|
||||
|
@ -621,7 +621,7 @@ CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
|||
|--------------+---------|
|
||||
| [[Foo][Foo]] | 26:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* Foo :tag:
|
||||
"* Foo :tag:
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
||||
(test-org-clock-clocktable-contents ":link t"))))
|
||||
;; Remove statistics cookie from headline description.
|
||||
|
@ -633,7 +633,7 @@ CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
|||
|--------------+---------|
|
||||
| [[Foo][Foo]] | 26:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* Foo [50%]
|
||||
"* Foo [50%]
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
||||
(test-org-clock-clocktable-contents ":link t"))))
|
||||
(should
|
||||
|
@ -644,7 +644,7 @@ CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
|||
|--------------+---------|
|
||||
| [[Foo][Foo]] | 26:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* Foo [1/2]
|
||||
"* Foo [1/2]
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
||||
(test-org-clock-clocktable-contents ":link t"))))
|
||||
;; Replace links with their description, or turn them into plain
|
||||
|
@ -657,7 +657,7 @@ CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
|||
|--------------+---------|
|
||||
| [[Foo %5B%5Bhttps://orgmode.org%5D%5BOrg mode%5D%5D][Foo Org mode]] | 26:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* Foo [[https://orgmode.org][Org mode]]
|
||||
"* Foo [[https://orgmode.org][Org mode]]
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
||||
(test-org-clock-clocktable-contents ":link t"))))
|
||||
(should
|
||||
|
@ -668,7 +668,7 @@ CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
|||
|-------------------------+---------|
|
||||
| [[Foo %5B%5Bhttps://orgmode.org%5D%5D][Foo https://orgmode.org]] | 26:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* Foo [[https://orgmode.org]]
|
||||
"* Foo [[https://orgmode.org]]
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|
||||
(test-org-clock-clocktable-contents ":link t")))))
|
||||
|
||||
|
@ -855,14 +855,14 @@ Weekly report starting on: [2017-09-25 Mon]
|
|||
| *Total time* | *1:00* |
|
||||
|--------------+--------|
|
||||
| Foo | 1:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2017-09-30 Sat 12:00]--[2017-09-30 Sat 13:00] => 1:00
|
||||
CLOCK: [2017-10-01 Sun 11:00]--[2017-10-01 Sun 13:00] => 2:00
|
||||
CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 14:00] => 3:00"
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":step week :block 2017-09 :stepskip0 t")))))
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":step week :block 2017-09 :stepskip0 t")))))
|
||||
(should
|
||||
(equal "
|
||||
Weekly report starting on: [2017-10-01 Sun]
|
||||
|
@ -886,16 +886,16 @@ Weekly report starting on: [2017-10-09 Mon]
|
|||
|--------------+--------|
|
||||
| Foo | 5:00 |
|
||||
"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2017-09-30 Sat 12:00]--[2017-09-30 Sat 13:00] => 1:00
|
||||
CLOCK: [2017-10-01 Sun 11:00]--[2017-10-01 Sun 13:00] => 2:00
|
||||
CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 14:00] => 3:00
|
||||
CLOCK: [2017-10-08 Sun 09:00]--[2017-10-08 Sun 13:00] => 4:00
|
||||
CLOCK: [2017-10-09 Mon 09:00]--[2017-10-09 Mon 14:00] => 5:00"
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":step week :block 2017-10 :stepskip0 t")))))
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":step week :block 2017-10 :stepskip0 t")))))
|
||||
;; :step day
|
||||
(should
|
||||
(equal "
|
||||
|
@ -937,16 +937,16 @@ Daily report: [2017-10-08 Sun]
|
|||
| *Total time* | *4:00* |
|
||||
|--------------+--------|
|
||||
| Foo | 4:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2017-09-30 Sat 12:00]--[2017-09-30 Sat 13:00] => 1:00
|
||||
CLOCK: [2017-10-01 Sun 11:00]--[2017-10-01 Sun 13:00] => 2:00
|
||||
CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 14:00] => 3:00
|
||||
CLOCK: [2017-10-08 Sun 09:00]--[2017-10-08 Sun 13:00] => 4:00
|
||||
CLOCK: [2017-10-09 Mon 09:00]--[2017-10-09 Mon 14:00] => 5:00"
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":step day :block 2017-W40")))))
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":step day :block 2017-W40")))))
|
||||
;; Regression test: take :tstart and :tend hours into consideration.
|
||||
(should
|
||||
(equal "
|
||||
|
@ -956,13 +956,13 @@ Weekly report starting on: [2017-12-25 Mon]
|
|||
| *Total time* | *8:00* |
|
||||
|--------------+--------|
|
||||
| Foo | 8:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2017-12-27 Wed 08:00]--[2017-12-27 Wed 16:00] => 8:00"
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
(concat ":step week :tstart \"<2017-12-25 Mon>\" "
|
||||
":tend \"<2017-12-27 Wed 23:59>\""))))))
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
(concat ":step week :tstart \"<2017-12-25 Mon>\" "
|
||||
":tend \"<2017-12-27 Wed 23:59>\""))))))
|
||||
(should
|
||||
(equal "
|
||||
Daily report: [2017-12-27 Wed]
|
||||
|
@ -971,13 +971,117 @@ Daily report: [2017-12-27 Wed]
|
|||
| *Total time* | *8:00* |
|
||||
|--------------+--------|
|
||||
| Foo | 8:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2017-12-27 Wed 08:00]--[2017-12-27 Wed 16:00] => 8:00"
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
(concat ":step day :tstart \"<2017-12-25 Mon>\" "
|
||||
":tend \"<2017-12-27 Wed 23:59>\" :stepskip0 t"))))))
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
(concat ":step day :tstart \"<2017-12-25 Mon>\" "
|
||||
":tend \"<2017-12-27 Wed 23:59>\" :stepskip0 t"))))))
|
||||
;; Test :step week", without or with ":wstart" parameter.
|
||||
(should
|
||||
(equal "
|
||||
Weekly report starting on: [2012-03-26 Mon]
|
||||
| Headline | Time |
|
||||
|--------------+--------|
|
||||
| *Total time* | *8:00* |
|
||||
|--------------+--------|
|
||||
| Foo | 8:00 |
|
||||
|
||||
Weekly report starting on: [2012-04-02 Mon]
|
||||
| Headline | Time |
|
||||
|--------------+--------|
|
||||
| *Total time* | *8:00* |
|
||||
|--------------+--------|
|
||||
| Foo | 8:00 |
|
||||
"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2012-03-29 Thu 08:00]--[2012-03-29 Thu 16:00] => 8:00
|
||||
CLOCK: [2012-04-03 Thu 08:00]--[2012-04-03 Thu 16:00] => 8:00"
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":step week :block 2012 :stepskip0 t")))))
|
||||
(should
|
||||
(equal "
|
||||
Weekly report starting on: [2012-03-29 Thu]
|
||||
| Headline | Time |
|
||||
|--------------+---------|
|
||||
| *Total time* | *16:00* |
|
||||
|--------------+---------|
|
||||
| Foo | 16:00 |
|
||||
"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2012-03-29 Thu 08:00]--[2012-03-29 Thu 16:00] => 8:00
|
||||
CLOCK: [2012-04-03 Thu 08:00]--[2012-04-03 Thu 16:00] => 8:00"
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":step week :wstart 4 :block 2012 :stepskip0 t")))))
|
||||
;; Test ":step month" without and with ":mstart".
|
||||
(should
|
||||
(equal "
|
||||
Monthly report starting on: [2014-03-01 Sat]
|
||||
| Headline | Time |
|
||||
|--------------+--------|
|
||||
| *Total time* | *8:00* |
|
||||
|--------------+--------|
|
||||
| Foo | 8:00 |
|
||||
|
||||
Monthly report starting on: [2014-04-01 Tue]
|
||||
| Headline | Time |
|
||||
|--------------+--------|
|
||||
| *Total time* | *8:00* |
|
||||
|--------------+--------|
|
||||
| Foo | 8:00 |
|
||||
"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2014-03-04 Tue 08:00]--[2014-03-04 Tue 16:00] => 8:00
|
||||
CLOCK: [2014-04-03 Thu 08:00]--[2014-04-03 Thu 16:00] => 8:00"
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":step month :block 2014 :stepskip0 t")))))
|
||||
(should
|
||||
(equal "
|
||||
Monthly report starting on: [2014-03-04 Tue]
|
||||
| Headline | Time |
|
||||
|--------------+---------|
|
||||
| *Total time* | *16:00* |
|
||||
|--------------+---------|
|
||||
| Foo | 16:00 |
|
||||
"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2014-03-04 Tue 08:00]--[2014-03-04 Tue 16:00] => 8:00
|
||||
CLOCK: [2014-04-03 Thu 08:00]--[2014-04-03 Thu 16:00] => 8:00"
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":step month :mstart 4 :block 2014 :stepskip0 t")))))
|
||||
;; Test ":step year".
|
||||
(should
|
||||
(equal "
|
||||
Annual report starting on: [2012-01-01 Sun]
|
||||
| Headline | Time |
|
||||
|--------------+--------|
|
||||
| *Total time* | *8:00* |
|
||||
|--------------+--------|
|
||||
| Foo | 8:00 |
|
||||
|
||||
Annual report starting on: [2014-01-01 Wed]
|
||||
| Headline | Time |
|
||||
|--------------+--------|
|
||||
| *Total time* | *8:00* |
|
||||
|--------------+--------|
|
||||
| Foo | 8:00 |
|
||||
"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2012-03-29 Thu 08:00]--[2012-03-29 Thu 16:00] => 8:00
|
||||
CLOCK: [2014-03-04 Tue 08:00]--[2014-03-04 Tue 16:00] => 8:00"
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":step year :block untilnow :stepskip0 t")))))
|
||||
;; Regression test: Respect DST
|
||||
(should
|
||||
(equal "
|
||||
|
@ -988,15 +1092,15 @@ Daily report: [2018-10-29 Mon]
|
|||
|--------------+--------|
|
||||
| Foo | 8:00 |
|
||||
"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2018-10-29 Mon 08:00]--[2018-10-29 Mon 16:00] => 8:00"
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
(concat ":step day "
|
||||
":stepskip0 t "
|
||||
":tstart \"2018-10-01\" "
|
||||
":tend \"2018-11-01\"")))))))
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
(concat ":step day "
|
||||
":stepskip0 t "
|
||||
":tstart \"2018-10-01\" "
|
||||
":tend \"2018-11-01\"")))))))
|
||||
|
||||
(ert-deftest test-org-clock/clocktable/extend-today-until ()
|
||||
"Test assignment of clock time to days in presence of \"org-extend-today-until\"."
|
||||
|
@ -1009,15 +1113,15 @@ CLOCK: [2018-10-29 Mon 08:00]--[2018-10-29 Mon 16:00] => 8:00"
|
|||
| *Total time* | *2:00* |
|
||||
|--------------+--------|
|
||||
| Foo | 2:00 |"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2017-09-30 Sat 12:00]--[2017-09-30 Sat 13:00] => 1:00
|
||||
CLOCK: [2017-10-01 Sun 02:00]--[2017-10-01 Sun 03:00] => 1:00
|
||||
CLOCK: [2017-10-01 Sun 11:00]--[2017-10-01 Sun 13:00] => 2:00"
|
||||
(setq-local org-extend-today-until 4)
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":block 2017-09-30")))))
|
||||
(setq-local org-extend-today-until 4)
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":block 2017-09-30")))))
|
||||
|
||||
;; Week-length block - time on Monday before 04:00 should be
|
||||
;; assigned to previous week.
|
||||
|
@ -1037,15 +1141,15 @@ Weekly report starting on: [2017-10-02 Mon]
|
|||
|--------------+--------|
|
||||
| Foo | 2:00 |
|
||||
"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2017-10-01 Sun 12:00]--[2017-10-01 Sun 13:00] => 1:00
|
||||
CLOCK: [2017-10-02 Mon 02:00]--[2017-10-02 Mon 03:00] => 1:00
|
||||
CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 13:00] => 2:00"
|
||||
(setq-local org-extend-today-until 4)
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":step week :block 2017-10 :stepskip0 t"))))))
|
||||
(setq-local org-extend-today-until 4)
|
||||
(let ((system-time-locale "en_US"))
|
||||
(test-org-clock-clocktable-contents
|
||||
":step week :block 2017-10 :stepskip0 t"))))))
|
||||
|
||||
|
||||
(provide 'test-org-clock)
|
||||
|
|
|
@ -224,7 +224,7 @@
|
|||
:END:"
|
||||
(let ((org-columns-default-format "%A{+;%.1f}")) (org-columns))
|
||||
(get-char-property (point) 'org-columns-value-modified))))
|
||||
;; {:} sums times. Plain numbers are hours.
|
||||
;; {:} sums times. Plain numbers are minutes.
|
||||
(should
|
||||
(equal
|
||||
"4:10"
|
||||
|
@ -242,7 +242,7 @@
|
|||
(get-char-property (point) 'org-columns-value-modified))))
|
||||
(should
|
||||
(equal
|
||||
"3:30"
|
||||
"1:32"
|
||||
(org-test-with-temp-text
|
||||
"* H
|
||||
** S1
|
||||
|
@ -1470,6 +1470,26 @@
|
|||
** H1.1
|
||||
:PROPERTIES:
|
||||
:A: 1
|
||||
:END:"
|
||||
(let ((org-columns-default-format "%ITEM %A")) (org-update-dblock))
|
||||
(buffer-substring-no-properties (point) (outline-next-heading)))))
|
||||
;; Test `:exclude-tags' parameter.
|
||||
(should
|
||||
(equal
|
||||
"#+BEGIN: columnview :exclude-tags (\"excludeme\")
|
||||
| ITEM | A |
|
||||
|------+---|
|
||||
| H1 | |
|
||||
#+END:
|
||||
"
|
||||
(org-test-with-temp-text
|
||||
"
|
||||
* H1
|
||||
<point>#+BEGIN: columnview :exclude-tags (\"excludeme\")
|
||||
#+END:
|
||||
** H1.1 :excludeme:
|
||||
:PROPERTIES:
|
||||
:A: 1
|
||||
:END:"
|
||||
(let ((org-columns-default-format "%ITEM %A")) (org-update-dblock))
|
||||
(buffer-substring-no-properties (point) (outline-next-heading)))))
|
||||
|
|
|
@ -2277,6 +2277,391 @@ See also `test-org-table/copy-field'."
|
|||
(buffer-string)))))
|
||||
|
||||
|
||||
|
||||
;;; Moving single cells
|
||||
(ert-deftest test-org-table/move-cell-down ()
|
||||
"Test `org-table-move-cell-down' specifications."
|
||||
;; Error out when cell cannot be moved due to not in table, in the
|
||||
;; last row of the table, or is on a hline.
|
||||
(should-error
|
||||
(org-test-with-temp-text "not in\na table\n"
|
||||
(org-table-move-cell-down)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| a |"
|
||||
(org-table-move-cell-down)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| a |\n"
|
||||
(org-table-move-cell-down)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| a | <point>b |\n"
|
||||
(org-table-move-cell-down)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| a | b |\n| <point>c | d |\n"
|
||||
(org-table-move-cell-down)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| a | b |\n| c | <point>d |\n"
|
||||
(org-table-move-cell-down)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| <point>a |\n|---|\n"
|
||||
(org-table-move-cell-down)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "|<point>---|\n| a |\n"
|
||||
(org-table-move-cell-down)))
|
||||
;; Check for correct cell movement
|
||||
(should (equal (concat "| c | b |\n"
|
||||
"| a | d |\n"
|
||||
"| e | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| <point>a | b |\n"
|
||||
"| c | d |\n"
|
||||
"| e | f |\n")
|
||||
(org-table-move-cell-down)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | d |\n"
|
||||
"| c | b |\n"
|
||||
"| e | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | <point>b |\n"
|
||||
"| c | d |\n"
|
||||
"| e | f |\n")
|
||||
(org-table-move-cell-down)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | b |\n"
|
||||
"| e | d |\n"
|
||||
"| c | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b |\n"
|
||||
"| <point>c | d |\n"
|
||||
"| e | f |\n")
|
||||
(org-table-move-cell-down)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | d |\n"
|
||||
"| c | f |\n"
|
||||
"| e | b |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a |<point> b |\n"
|
||||
"| c | d |\n"
|
||||
"| e | f |\n")
|
||||
(org-table-move-cell-down)
|
||||
(org-table-move-cell-down)
|
||||
(buffer-string))))
|
||||
;; Check for correct handling of hlines which should not change
|
||||
;; position on single cell moves.
|
||||
(should (equal (concat "| c | b |\n"
|
||||
"|---+---|\n"
|
||||
"| a | d |\n"
|
||||
"| e | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| <point>a | b |\n"
|
||||
"|---+---|\n"
|
||||
"| c | d |\n"
|
||||
"| e | f |\n")
|
||||
(org-table-move-cell-down)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | d |\n"
|
||||
"|---+---|\n"
|
||||
"| c | f |\n"
|
||||
"| e | b |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | <point>b |\n"
|
||||
"|---+---|\n"
|
||||
"| c | d |\n"
|
||||
"| e | f |\n")
|
||||
(org-table-move-cell-down)
|
||||
(org-table-move-cell-down)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | b |\n"
|
||||
"|---+---|\n"
|
||||
"| c | f |\n"
|
||||
"| e | d |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b |\n"
|
||||
"|---+---|\n"
|
||||
"| c | <point>d |\n"
|
||||
"| e | f |\n")
|
||||
(org-table-move-cell-down)
|
||||
(buffer-string))))
|
||||
;; Move single cell even without a final newline.
|
||||
(should (equal (concat "| a | d |\n"
|
||||
"|---+---|\n"
|
||||
"| c | f |\n"
|
||||
"| e | b |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | <point>b |\n"
|
||||
"|---+---|\n"
|
||||
"| c | d |\n"
|
||||
"| e | f |")
|
||||
(org-table-move-cell-down)
|
||||
(org-table-move-cell-down)
|
||||
(buffer-string)))))
|
||||
|
||||
(ert-deftest test-org-table/move-cell-up ()
|
||||
"Test `org-table-move-cell-up' specifications."
|
||||
;; Error out when cell cannot be moved due to not in table, in the
|
||||
;; last row of the table, or is on a hline.
|
||||
(should-error
|
||||
(org-test-with-temp-text "not in\na table\n"
|
||||
(org-table-move-cell-up)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| a |"
|
||||
(org-table-move-cell-up)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| a |\n"
|
||||
(org-table-move-cell-up)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| <point>a | b |\n"
|
||||
(org-table-move-cell-up)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| a | <point>b |\n| c | d |\n"
|
||||
(org-table-move-cell-up)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| <point>a |\n|---|\n"
|
||||
(org-table-move-cell-up)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "|<point>---|\n| a |\n"
|
||||
(org-table-move-cell-up)))
|
||||
;; Check for correct cell movement.
|
||||
(should (equal (concat "| c | b |\n"
|
||||
"| a | d |\n"
|
||||
"| e | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b |\n"
|
||||
"| <point>c | d |\n"
|
||||
"| e | f |\n")
|
||||
(org-table-move-cell-up)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | d |\n"
|
||||
"| c | b |\n"
|
||||
"| e | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b |\n"
|
||||
"| c | <point>d |\n"
|
||||
"| e | f |\n")
|
||||
(org-table-move-cell-up)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | b |\n"
|
||||
"| e | d |\n"
|
||||
"| c | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b |\n"
|
||||
"| c | d |\n"
|
||||
"| <point>e | f |\n")
|
||||
(org-table-move-cell-up)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | f |\n"
|
||||
"| c | b |\n"
|
||||
"| e | d |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b |\n"
|
||||
"| c | d |\n"
|
||||
"| e |<point> f |\n")
|
||||
(org-table-move-cell-up)
|
||||
(org-table-move-cell-up)
|
||||
(buffer-string))))
|
||||
;; Check for correct handling of hlines which should not change
|
||||
;; position on single cell moves.
|
||||
(should (equal (concat "| c | b |\n"
|
||||
"|---+---|\n"
|
||||
"| a | d |\n"
|
||||
"| e | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b |\n"
|
||||
"|---+---|\n"
|
||||
"| <point>c | d |\n"
|
||||
"| e | f |\n")
|
||||
(org-table-move-cell-up)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | f |\n"
|
||||
"|---+---|\n"
|
||||
"| c | b |\n"
|
||||
"| e | d |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b |\n"
|
||||
"|---+---|\n"
|
||||
"| c | d |\n"
|
||||
"| e | <point>f |\n")
|
||||
(org-table-move-cell-up)
|
||||
(org-table-move-cell-up)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | b |\n"
|
||||
"|---+---|\n"
|
||||
"| c | f |\n"
|
||||
"| e | d |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b |\n"
|
||||
"|---+---|\n"
|
||||
"| c | d |\n"
|
||||
"| e | <point>f |\n")
|
||||
(org-table-move-cell-up)
|
||||
(buffer-string))))
|
||||
;; Move single cell even without a final newline.
|
||||
(should (equal (concat "| a | f |\n"
|
||||
"|---+---|\n"
|
||||
"| c | b |\n"
|
||||
"| e | d |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b |\n"
|
||||
"|---+---|\n"
|
||||
"| c | d |\n"
|
||||
"| e | <point>f |")
|
||||
(org-table-move-cell-up)
|
||||
(org-table-move-cell-up)
|
||||
(buffer-string)))))
|
||||
|
||||
(ert-deftest test-org-table/move-cell-right ()
|
||||
"Test `org-table-move-cell-right' specifications."
|
||||
;; Error out when cell cannot be moved due to not in table, in the
|
||||
;; last col of the table, or is on a hline.
|
||||
(should-error
|
||||
(org-test-with-temp-text "not in\na table\n"
|
||||
(org-table-move-cell-right)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| a |"
|
||||
(org-table-move-cell-right)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| a |\n"
|
||||
(org-table-move-cell-right)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| <point>a |\n| b |\n"
|
||||
(org-table-move-cell-right)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| a | <point>b |\n| c | d |\n"
|
||||
(org-table-move-cell-right)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| <point>a |\n|---|\n"
|
||||
(org-table-move-cell-right)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "|<point>---|\n| a |\n"
|
||||
(org-table-move-cell-right)))
|
||||
;; Check for correct cell movement.
|
||||
(should (equal (concat "| b | a | c |\n"
|
||||
"| d | e | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| <point>a | b | c |\n"
|
||||
"| d | e | f |\n")
|
||||
(org-table-move-cell-right)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| b | c | a |\n"
|
||||
"| d | e | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| <point>a | b | c |\n"
|
||||
"| d | e | f |\n")
|
||||
(org-table-move-cell-right)
|
||||
(org-table-move-cell-right)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | b | c |\n"
|
||||
"| e | f | d |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b | c |\n"
|
||||
"| <point> d | e | f |\n")
|
||||
(org-table-move-cell-right)
|
||||
(org-table-move-cell-right)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | b | c |\n"
|
||||
"| d | f | e |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b | c |\n"
|
||||
"| d | <point>e | f |\n")
|
||||
(org-table-move-cell-right)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | b | c |\n"
|
||||
"|---+---+---|\n"
|
||||
"| e | f | d |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b | c |\n"
|
||||
"|---+---+---|\n"
|
||||
"| <point>d | e | f |\n")
|
||||
(org-table-move-cell-right)
|
||||
(org-table-move-cell-right)
|
||||
(buffer-string))))
|
||||
;; Move single cell even without a final newline.
|
||||
(should (equal (concat "| a | b | c |\n"
|
||||
"|---+---+---|\n"
|
||||
"| e | d | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b | c |\n"
|
||||
"|---+---+---|\n"
|
||||
"| <point>d | e | f |")
|
||||
(org-table-move-cell-right)
|
||||
(buffer-string)))))
|
||||
|
||||
(ert-deftest test-org-table/move-cell-left ()
|
||||
"Test `org-table-move-cell-left' specifications."
|
||||
;; Error out when cell cannot be moved due to not in table, in the
|
||||
;; last col of the table, or is on a hline.
|
||||
(should-error
|
||||
(org-test-with-temp-text "not in\na table\n"
|
||||
(org-table-move-cell-left)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| a |"
|
||||
(org-table-move-cell-left)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| a |\n"
|
||||
(org-table-move-cell-left)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| <point>a |\n| b |\n"
|
||||
(org-table-move-cell-left)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| <point>a | b |\n| c | d |\n"
|
||||
(org-table-move-cell-left)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "| <point>a |\n|---|\n"
|
||||
(org-table-move-cell-left)))
|
||||
(should-error
|
||||
(org-test-with-temp-text "|<point>---|\n| a |\n"
|
||||
(org-table-move-cell-left)))
|
||||
;; Check for correct cell movement.
|
||||
(should (equal (concat "| b | a | c |\n"
|
||||
"| d | e | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | <point>b | c |\n"
|
||||
"| d | e | f |\n")
|
||||
(org-table-move-cell-left)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| c | a | b |\n"
|
||||
"| d | e | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b | <point>c |\n"
|
||||
"| d | e | f |\n")
|
||||
(org-table-move-cell-left)
|
||||
(org-table-move-cell-left)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | b | c |\n"
|
||||
"| f | d | e |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b | c |\n"
|
||||
"| d | e | <point>f |\n")
|
||||
(org-table-move-cell-left)
|
||||
(org-table-move-cell-left)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | b | c |\n"
|
||||
"| d | f | e |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b | c |\n"
|
||||
"| d | e | <point>f |\n")
|
||||
(org-table-move-cell-left)
|
||||
(buffer-string))))
|
||||
(should (equal (concat "| a | b | c |\n"
|
||||
"|---+---+---|\n"
|
||||
"| f | d | e |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b | c |\n"
|
||||
"|---+---+---|\n"
|
||||
"| d | e | <point>f |\n")
|
||||
(org-table-move-cell-left)
|
||||
(org-table-move-cell-left)
|
||||
(buffer-string))))
|
||||
;; Move single cell even without a final newline.
|
||||
(should (equal (concat "| a | b | c |\n"
|
||||
"|---+---+---|\n"
|
||||
"| e | d | f |\n")
|
||||
(org-test-with-temp-text
|
||||
(concat "| a | b | c |\n"
|
||||
"|---+---+---|\n"
|
||||
"| d | <point>e | f |")
|
||||
(org-table-move-cell-left)
|
||||
(buffer-string)))))
|
||||
|
||||
|
||||
;;; Moving rows, moving columns
|
||||
|
||||
|
|
Loading…
Reference in New Issue