Merge branch 'maint'

This commit is contained in:
Kyle Meyer 2021-01-24 22:17:01 -05:00
commit 72e368a2e9
6 changed files with 52 additions and 15 deletions

View File

@ -6053,15 +6053,17 @@ various inputs are interpreted, the items filled in by Org mode are in
| =2012-w04-5= | \rArr{} Same as above | | =2012-w04-5= | \rArr{} Same as above |
Furthermore you can specify a relative date by giving, as the /first/ 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=, thing in the input: a plus/minus sign, a number and a letter---=h=,
=w=, =m= or =y=---to indicate change in days, weeks, months, or =d=, =w=, =m= or =y=---to indicate a change in hours, days, weeks,
years. With a single plus or minus, the date is always relative to months, or years. With =h= the date is relative to the current time,
today. With a double plus or minus, it is relative to the default with the other letters and a single plus or minus, the date is
date. If instead of a single letter, you use the abbreviation of day relative to today at 00:00. With a double plus or minus, it is
name, the date is the Nth such day, e.g.: 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 | | =+0= | \rArr{} today |
| =.= | \rArr{} today | | =.= | \rArr{} today |
| =+2h= | \rArr{} two hours from now |
| =+4d= | \rArr{} four days from today | | =+4d= | \rArr{} four days from today |
| =+4= | \rArr{} same as +4d | | =+4= | \rArr{} same as +4d |
| =+2w= | \rArr{} two weeks from today | | =+2w= | \rArr{} two weeks from today |

View File

@ -426,7 +426,12 @@ of the same value."
into a column number." into a column number."
(pcase org-babel-c-variant (pcase org-babel-c-variant
((or `c `cpp) ((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; int c;
for (c=0; c<nbcols; c++) for (c=0; c<nbcols; c++)
@ -434,7 +439,7 @@ into a column number."
return c; return c;
return -1; return -1;
} }
") "))
(`d (`d
"int get_column_num (string[] header, string column) "int get_column_num (string[] header, string column)
{ {

View File

@ -1228,10 +1228,11 @@ Return 0. if S is not recognized as a valid value."
((string= s "<tomorrow>") (+ 86400.0 today)) ((string= s "<tomorrow>") (+ 86400.0 today))
((string= s "<yesterday>") (- today 86400.0)) ((string= s "<yesterday>") (- today 86400.0))
((string-match "\\`<\\([-+][0-9]+\\)\\([hdwmy]\\)>\\'" s) ((string-match "\\`<\\([-+][0-9]+\\)\\([hdwmy]\\)>\\'" s)
(+ today (+ (if (string= (match-string 2 s) "h") (float-time) today)
(* (string-to-number (match-string 1 s)) (* (string-to-number (match-string 1 s))
(cdr (assoc (match-string 2 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))))))) ("m" . 2678400.0) ("y" . 31557600.0)))))))
((string-match org-ts-regexp0 s) (org-2ft s)) ((string-match org-ts-regexp0 s) (org-2ft s))
(t 0.))))) (t 0.)))))

View File

@ -3666,12 +3666,12 @@ produced."
(match-string 0))) (match-string 0)))
"pdflatex")) "pdflatex"))
(process (if (functionp org-latex-pdf-process) org-latex-pdf-process (process (if (functionp org-latex-pdf-process) org-latex-pdf-process
;; Replace "%latex" and "%bibtex" with, ;; Replace "%latex" with "%L" and "%bib" and
;; respectively, "%L" and "%B" so as to adhere to ;; "%bibtex" with "%B" to adhere to `format-spec'
;; `format-spec' specifications. ;; specifications.
(mapcar (lambda (command) (mapcar (lambda (command)
(replace-regexp-in-string (replace-regexp-in-string
"%\\(?:bib\\|la\\)tex\\>" "%\\(?:\\(?:bib\\|la\\)tex\\|bib\\)\\>"
(lambda (m) (upcase (substring m 0 2))) (lambda (m) (upcase (substring m 0 2)))
command)) command))
org-latex-pdf-process))) org-latex-pdf-process)))

View File

@ -159,6 +159,6 @@ void main()
writef ("%s ", tinomogen[i][j]); writef ("%s ", tinomogen[i][j]);
writeln(); writeln();
} }
writefln ("Friday %s\n", tinomogen_h(4,"day")); writefln ("Friday %s", tinomogen_h(4,"day"));
} }
#+end_src #+end_src

View File

@ -103,5 +103,34 @@
(org-test-with-temp-text "xx abc<point> xx" (org-test-with-temp-text "xx abc<point> xx"
(org-in-regexp "abc" nil t)))) (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) (provide 'test-org-macs)
;;; test-org-macs.el ends here ;;; test-org-macs.el ends here