From 9e8215f4a5df7d03ac787da78d28f69a4c18e7d3 Mon Sep 17 00:00:00 2001 From: "tbanelwebmin@free.fr" Date: Sat, 9 Jan 2021 09:49:04 +0100 Subject: [PATCH 1/4] ob-C.el: Fix missing C, C++ declaration * lisp/ob-C.el (org-babel-C-utility-header-to-C): Add declaration of strcmp() for C and C++. * testing/examples/ob-C-test.org (Simple tests): Remove a spurious \n new line. --- lisp/ob-C.el | 10 ++++++++-- testing/examples/ob-C-test.org | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/ob-C.el b/lisp/ob-C.el index 6e3390179..1dde289a7 100644 --- a/lisp/ob-C.el +++ b/lisp/ob-C.el @@ -4,6 +4,7 @@ ;; Author: Eric Schulte ;; Thierry Banel +;; Maintainer: Thierry Banel ;; Keywords: literate programming, reproducible research ;; Homepage: https://orgmode.org @@ -425,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 Date: Tue, 5 Jan 2021 01:48:55 +0100 Subject: [PATCH 2/4] org-macs: Allow specifying relative time in hours * lisp/org-macs.el (org-matcher-time): Handle hour ("h") time stamp modifier. * doc/org-manual.org (The date/time prompt): Document hour modifier. This adds support for date expressions such as +12h to org-matcher-time. The regexp this function uses to parse such relative expressions already includes the "h" character but doesn't actually handle that case. AFAICT org-mode commit ec921a2a68 ("Support hourly repeat cookies") neglected to add support here. TINYCHANGE --- doc/org-manual.org | 14 ++++++++------ lisp/org-macs.el | 5 +++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index c37170029..a9f254286 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -5987,15 +5987,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/org-macs.el b/lisp/org-macs.el index 56afdf6ef..d40ed1a04 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 "") (+ 86400.0 today)) ((string= s "") (- 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.))))) From b99beaad18f9ec02f626a39ebb1f87b55975b4d5 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 24 Jan 2021 21:13:05 -0500 Subject: [PATCH 3/4] org-macs: Add basic tests for org-matcher-time * testing/lisp/test-org-macs.el (test-org-matcher-time): Add tests. This includes of a test for the missing hour modifier added in the previous commit. --- testing/lisp/test-org-macs.el | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/testing/lisp/test-org-macs.el b/testing/lisp/test-org-macs.el index 7db17cc37..efa992a03 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 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 "")) + 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 From 13e98e2a13aea7e965dd0a0003f3af7601cbfa8a Mon Sep 17 00:00:00 2001 From: Tara Lorenz Date: Fri, 15 Jan 2021 16:47:39 +0100 Subject: [PATCH 4/4] ox-latex.el: fix interpretation of org-latex-pdf-process * ox-latex.el (org-latex-export-to-pdf): The documentation for `org-latex-pdf-process' states that "%bib" will be expanded into the current binding of `org-latex-bibtex-compiler'. However, the `org-latex-export-to-pdf', where the expansion takes place, expects "%bibtex" instead. This fix will accept "%bib" as well as "%bibtex" as markers for `org-latex-bib-compiler'. This fixes a regression from f6187deca (ox-latex: Small refactor, 2015-09-13). TINYCHANGE --- lisp/ox-latex.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 149492fa8..70c4307ec 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -3660,12 +3660,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)))