summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2021-01-24 22:17:01 -0500
committerKyle Meyer <kyle@kyleam.com>2021-01-24 22:17:01 -0500
commit72e368a2e9f126bcc4f3b67ef2d16009e8819127 (patch)
tree24075609b6ac4ae3c0c12b9840bb765da5463239
parenta12449ac19a092efd8023fa0368fc31b7c600082 (diff)
parent13e98e2a13aea7e965dd0a0003f3af7601cbfa8a (diff)
downloadorg-mode-72e368a2e9f126bcc4f3b67ef2d16009e8819127.tar.gz
Merge branch 'maint'
-rw-r--r--doc/org-manual.org14
-rw-r--r--lisp/ob-C.el9
-rw-r--r--lisp/org-macs.el5
-rw-r--r--lisp/ox-latex.el8
-rw-r--r--testing/examples/ob-C-test.org2
-rw-r--r--testing/lisp/test-org-macs.el29
6 files changed, 52 insertions, 15 deletions
diff --git a/doc/org-manual.org b/doc/org-manual.org
index e717f92..20a0d1d 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -6053,15 +6053,17 @@ various inputs are interpreted, the items filled in by Org mode are in
| =2012-w04-5= | \rArr{} Same as above |
Furthermore you can specify a relative date by giving, as the /first/
-thing in the input: a plus/minus sign, a number and a letter---=d=,
-=w=, =m= or =y=---to indicate change in days, weeks, months, or
-years. With a single plus or minus, the date is always relative to
-today. With a double plus or minus, it is relative to the default
-date. If instead of a single letter, you use the abbreviation of day
-name, the date is the Nth such day, e.g.:
+thing in the input: a plus/minus sign, a number and a letter---=h=,
+=d=, =w=, =m= or =y=---to indicate a change in hours, days, weeks,
+months, or years. With =h= the date is relative to the current time,
+with the other letters and a single plus or minus, the date is
+relative to today at 00:00. With a double plus or minus, it is
+relative to the default date. If instead of a single letter, you use
+the abbreviation of day name, the date is the Nth such day, e.g.:
| =+0= | \rArr{} today |
| =.= | \rArr{} today |
+| =+2h= | \rArr{} two hours from now |
| =+4d= | \rArr{} four days from today |
| =+4= | \rArr{} same as +4d |
| =+2w= | \rArr{} two weeks from today |
diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index c45b96f..1dde289 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -426,7 +426,12 @@ of the same value."
into a column number."
(pcase org-babel-c-variant
((or `c `cpp)
- "int get_column_num (int nbcols, const char** header, const char* column)
+ (concat
+ (if (eq org-babel-c-variant 'c)
+ "extern "
+ "extern \"C\" ")
+ "int strcmp (const char *, const char *);
+int get_column_num (int nbcols, const char** header, const char* column)
{
int c;
for (c=0; c<nbcols; c++)
@@ -434,7 +439,7 @@ into a column number."
return c;
return -1;
}
-")
+"))
(`d
"int get_column_num (string[] header, string column)
{
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 56afdf6..d40ed1a 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -1228,10 +1228,11 @@ Return 0. if S is not recognized as a valid value."
((string= s "<tomorrow>") (+ 86400.0 today))
((string= s "<yesterday>") (- today 86400.0))
((string-match "\\`<\\([-+][0-9]+\\)\\([hdwmy]\\)>\\'" s)
- (+ today
+ (+ (if (string= (match-string 2 s) "h") (float-time) today)
(* (string-to-number (match-string 1 s))
(cdr (assoc (match-string 2 s)
- '(("d" . 86400.0) ("w" . 604800.0)
+ '(("h" . 3600.0)
+ ("d" . 86400.0) ("w" . 604800.0)
("m" . 2678400.0) ("y" . 31557600.0)))))))
((string-match org-ts-regexp0 s) (org-2ft s))
(t 0.)))))
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index fb9fc3c..44d83e3 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -3666,12 +3666,12 @@ produced."
(match-string 0)))
"pdflatex"))
(process (if (functionp org-latex-pdf-process) org-latex-pdf-process
- ;; Replace "%latex" and "%bibtex" with,
- ;; respectively, "%L" and "%B" so as to adhere to
- ;; `format-spec' specifications.
+ ;; Replace "%latex" with "%L" and "%bib" and
+ ;; "%bibtex" with "%B" to adhere to `format-spec'
+ ;; specifications.
(mapcar (lambda (command)
(replace-regexp-in-string
- "%\\(?:bib\\|la\\)tex\\>"
+ "%\\(?:\\(?:bib\\|la\\)tex\\|bib\\)\\>"
(lambda (m) (upcase (substring m 0 2)))
command))
org-latex-pdf-process)))
diff --git a/testing/examples/ob-C-test.org b/testing/examples/ob-C-test.org
index 347607c..3b0a41b 100644
--- a/testing/examples/ob-C-test.org
+++ b/testing/examples/ob-C-test.org
@@ -159,6 +159,6 @@ void main()
writef ("%s ", tinomogen[i][j]);
writeln();
}
- writefln ("Friday %s\n", tinomogen_h(4,"day"));
+ writefln ("Friday %s", tinomogen_h(4,"day"));
}
#+end_src
diff --git a/testing/lisp/test-org-macs.el b/testing/lisp/test-org-macs.el
index 7db17cc..efa992a 100644
--- a/testing/lisp/test-org-macs.el
+++ b/testing/lisp/test-org-macs.el
@@ -103,5 +103,34 @@
(org-test-with-temp-text "xx abc<point> xx"
(org-in-regexp "abc" nil t))))
+
+;;; Time
+
+(ert-deftest test-org-matcher-time ()
+ "Test `org-matcher-time'."
+ (let ((system-time-locale "en_US"))
+ (org-test-at-time "<2021-01-11 Mon 13:00>"
+ (should (equal (list 0 0 13 11 1 2021)
+ (butlast (org-decode-time (org-matcher-time "<now>"))
+ 3)))
+ (should (equal (list 0 0 0 14 1 2021)
+ (butlast (org-decode-time (org-matcher-time "<+3d>"))
+ 3)))
+ (should (equal (list 0 0 0 9 1 2021)
+ (butlast (org-decode-time (org-matcher-time "<-2d>"))
+ 3)))
+ (should (equal (list 0 0 0 18 1 2021)
+ (butlast (org-decode-time (org-matcher-time "<+1w>"))
+ 3)))
+ (should (equal (list 0 0 17 11 1 2021)
+ (butlast (org-decode-time (org-matcher-time "<+4h>"))
+ 3)))
+ (should (equal (list 0 0 11 11 1 2021)
+ (butlast (org-decode-time (org-matcher-time "<-2h>"))
+ 3)))
+ (should (equal (list 0 0 3 12 1 2021)
+ (butlast (org-decode-time (org-matcher-time "<+14h>"))
+ 3))))))
+
(provide 'test-org-macs)
;;; test-org-macs.el ends here