Re: [O] minimal testing setup for pdf export?
Am 28.08.19 um 01:33 schrieb Matt Price: > huh. that was kinda cool... but the value of default-directory seems to > be correct. However, this helped a bit: > > #+BEGIN_SRC emacs-lisp > (shell-command-to-string "echo $PWD") > > #+END_SRC > > > #+RESULTS: > : /home/matt/src/org-mode > > Not sure what's going on here, but this value is the same in a regular > emacs and "emacs -Q". is this normal? For me, with "emacs -Q", this reliably returns the path from which I started emacs. HTH, Julius
Re: [O] Completely hide the :PROPERTIES: drawer in org-mode.
Apologies for the delay. Is that alright? On Thu, 14 Feb 2019 at 17:15, Nicolas Goaziou wrote: > Michaël Cadilhac writes: > > > Will do. This in particular requires to swap fontifying the drawers > > and the keywords (since :END: and :PROPERTIES: are keywords): > > [...] > > > Agreed? > > Sure. Please do what is necessary ;) > From aebea2663b929f0dbf8e1408c9ddb85f210e2c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Cadilhac?= Date: Wed, 28 Aug 2019 16:26:06 -0500 Subject: [PATCH] Fontify drawers correctly. * lisp/org.el (org-fontify-drawers): Fix face used, fix range of text properties. (org-set-font-lock-defaults): Fontify drawers after keywords. --- lisp/org.el | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index ea2c75130..31faac516 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5356,9 +5356,10 @@ by a #." "Fontify drawers." (when (re-search-forward org-drawer-regexp limit t) (add-text-properties - (match-beginning 0) (match-end 0) - '(font-lock-fontified t face org-special-keyword)) -(org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) + (line-beginning-position) (line-beginning-position 2) + '(font-lock-fontified t face org-drawer)) +(org-remove-flyspell-overlays-in + (line-beginning-position) (line-beginning-position 2)) t)) (defun org-fontify-macros (limit) @@ -5612,12 +5613,12 @@ needs to be inserted at a specific position in the font-lock sequence.") '("^[ \t]*| *\\([#*]\\) *|" (1 'org-formula t)) '("^[ \t]*|\\( *\\([$!_^/]\\) *|.*\\)|" (1 'org-formula t)) '("| *\\(<[lrc]?[0-9]*>\\)" (1 'org-formula t)) - ;; Drawers - '(org-fontify-drawers) ;; Properties (list org-property-re '(1 'org-special-keyword t) '(3 'org-property-value t)) + ;; Drawers + '(org-fontify-drawers) ;; Link related fontification. '(org-activate-links) (when (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend))) -- 2.22.0
Re: [O] org-icalendar: Change dates to today in VEVENT export
Hopefully I didn't miss anything—I've been running the patched version for weeks now, so it should be stable in any case. Patch 0003 above should still be OK. Cheers, M. On Tue, 12 Feb 2019 at 02:34, Nicolas Goaziou wrote: > Hello, > > Michaël Cadilhac writes: > > > Well, certainly. I may not have had the best discipline in writing > > these, so turning them into patches is a bit painful. Let me know if > > I can make things better. (I believe my FSF paperwork is still > > alright, if need be.) > > Thank you! Comments follow. > > > +(defcustom org-icalendar-bump-todos nil > > + "Non-nil means that pending TODO VEVENTs are bumped to today. > > +In addition, if non-nil, the number of late days is indicated in the > summary." > > + :group 'org-export-icalendar > > + :type 'boolean) > > This variable is missing :package-version '(Org . "9.3") and :safe > keywords. This is also true for other defcustom introduced throughout > your patches. > > > +(defun org-icalendar-today-timestamp () > > + "Return a TIMESTAMP object for today, at 00:00." > > + (let ((dt (decode-time))) > > +(list 'timestamp > > + (nconc (list :year-start (nth 5 dt) > > +:year-end (nth 5 dt) > > +:month-start (nth 4 dt) > > +:month-end (nth 4 dt) > > +:day-start (nth 3 dt) > > +:day-end (nth 3 dt)) > > This function already exists: `org-timestamp-from-time'. > > > +(defun org-icalendar-days-until-timestamp (timestamp) > > + "Return the number of days until TIMESTAMP. > > + > > +If TIMESTAMP occurs today, return 0. > > +If TIMESTAMP occurs yesterday, return -1." > > + (floor > > + (/ (float-time > > + (time-subtract (org-timestamp--to-internal-time timestamp) > > + (apply 'encode-time > > + (append '(0 0 0) (nthcdr 3 (decode-time)) > > (time-substract (org-timestamp-to-time timestamp) > (current-time)) > > > + (* 60 60 24 > > > > - (concat "DL: " summary) loc desc cat tz class))) > > +(concat "DL: " summary) loc desc cat tz class)) > > + > > Spurious blank line. > > > + ;; Case 2: pending TODO overdue and should bump. > > + ((and org-icalendar-bump-todos > > +(< days-until-deadline 0)) > > + (org-icalendar--vevent > > +entry (org-icalendar-today-timestamp) (concat "DL-" uid) > > +(concat "DL (" (number-to-string (- > days-until-deadline)) > > +"x): " summary) > > Nitpick: > > (format "DL (%d)x): %s" (- days-until-deadline) summary > > is more readable. > > > +loc desc cat tz class)) > > + ;; Case 3: in the future and should warn. > > + (t > > + (concat > > +;; If in the warning zone. > > +(when (<= days-until-deadline org-deadline-warning-days) > > + (org-icalendar--vevent > > + entry (org-icalendar-today-timestamp) (concat "DL-" > uid) > > + (concat "DL (in " (number-to-string > days-until-deadline) > > + "d.): " summary) > > See above. > > > + ;; Overdue and should bump. > > + (t > > + (org-icalendar--vevent > > +entry (org-icalendar-today-timestamp) (concat "SC-" uid) > > +(concat "S (" (number-to-string (- > days-until-scheduled)) "x): " > > +summary) > > Ditto. > > > Subject: [PATCH 2/6] Include tags in SUMMARY if so desired. > > I'm ignoring this patch since it is superseded by the fifth. Could you > merge them? > > > #+vindex: org-icalendar-categories > > #+vindex: org-icalendar-alarm-time > > +#+vindex: org-icalendar-summary-uses-tags > > For tags on the headline, the iCalendar export back-end makes them > > into iCalendar categories. To tweak the inheritance of tags and TODO > > states, configure the variable ~org-icalendar-categories~. To assign > > clock alarms based on time, configure the ~org-icalendar-alarm-time~ > > -variable. > > +variable. Additionally, the variable > > +~org-icalendar-summary-uses-tags~ can be configured to have tags > > +appear in the title of the event, when SUMMARY is not provided. > > I think this should go near the paragraph about > `org-calendar-include-body'. > > > (defcustom org-icalendar-summary-uses-tags nil > > - "Non-nil means that TITLE+TAGS is used when SUMMARY is not provided. > > -If nil, then TITLE is used alone." > > + "Whether tags should be added to the title to create the summary. > > Nitpick. > > "Non-nil means" > "Whether" because it is more unambiguously informative > > When non-nil, tags are added to ... > > or > > Non-nil means tags are added to ... > > > (let ((tags (apply 'concat > > - (mapcar (lambda (x)
Re: [O] [Patch] Hide the file column in a clock report.
Here attached. Let me know if that's all good! Cheers, M. On Sun, 3 Sep 2017 at 03:15, Nicolas Goaziou wrote: > Hello, > > Michaël Cadilhac writes: > > > From f251bf0fa764e245eabe88e3959e801af5c8fd37 Mon Sep 17 00:00:00 2001 > > From: =?UTF-8?q?Micha=C3=ABl=20Cadilhac?= > > Date: Thu, 31 Aug 2017 19:37:55 +0100 > > Subject: [PATCH] Add the option of hiding the file column in a clock > > report > > Thank you. > > We are in feature-freeze phase, but it can go in master once Org 9.1 is > released. > > Could you provide tests in "test-org-clock.el"? This can be named > "test-org-clock/clocktable/hidefiles". There are examples in the file. > > Regards, > > -- > Nicolas Goaziou > From 77006082d020f26147e9412e10d07a9a2ac50cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Cadilhac?= Date: Sun, 10 Mar 2019 19:05:10 + Subject: [PATCH 1/3] org-clock.el: Add an option to not show the file column in clock report * lisp/org-clock.el (org-clocktable-defaults): Add `hidefiles'. (org-dblock-write:clocktable): Implement not showing files when `hidefiles' is true. * lisp/org-pcomplete.el: Add `hidefiles'. --- lisp/org-clock.el | 5 - lisp/org-pcomplete.el | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index bf9053ec2..8af59e705 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -304,6 +304,7 @@ string as argument." :link nil :narrow '40! :indent t + :hidefiles nil :formula nil :timestamp nil :level nil @@ -2391,6 +2392,7 @@ the currently selected interval size." (ws (plist-get params :wstart)) (ms (plist-get params :mstart)) (step (plist-get params :step)) + (hide-files (plist-get params :hidefiles)) (formatter (or (plist-get params :formatter) org-clock-clocktable-formatter 'org-clocktable-write-default)) @@ -2445,7 +2447,8 @@ the currently selected interval size." ;; Even though `file-with-archives' can consist of ;; multiple files, we consider this is one extended file ;; instead. - (and (consp files) (not (eq scope 'file-with-archives) + (and (not hide-files) + (consp files) (not (eq scope 'file-with-archives) (funcall formatter origin diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el index 70a8173d8..9e68c7dc1 100644 --- a/lisp/org-pcomplete.el +++ b/lisp/org-pcomplete.el @@ -430,8 +430,9 @@ switches." ":tstart" ":tend" ":block" ":step" ":stepskip0" ":fileskip0" ":emphasize" ":link" ":narrow" ":indent" - ":tcolumns" ":level" ":compact" ":timestamp" - ":formula" ":formatter" ":wstart" ":mstart" + ":hidefiles" ":tcolumns" ":level" ":compact" + ":timestamp" ":formula" ":formatter" + ":wstart" ":mstart" ;;; Finish up -- 2.22.0 From a8e4d713e7c9d6a3ad0b5d0e3244c685bbef2163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Cadilhac?= Date: Wed, 28 Aug 2019 18:15:40 -0500 Subject: [PATCH 2/3] Add test for the hidefiles parameter in clocktables. * testing/lisp/test-org-clock.el (test-org-clock/clocktable/hidefiles): Add test. --- testing/lisp/test-org-clock.el | 17 + 1 file changed, 17 insertions(+) diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el index fa336f680..ad75a2ba5 100644 --- a/testing/lisp/test-org-clock.el +++ b/testing/lisp/test-org-clock.el @@ -1175,6 +1175,23 @@ CLOCK: [2017-10-02 Mon 11:00]--[2017-10-02 Mon 13:00] => 2:00" (test-org-clock-clocktable-contents ":step week :block 2017-10 :stepskip0 t")) +(ert-deftest test-org-clock/clocktable/hidefiles () + "Test \":hidefiles\" parameter in Clock table." + ;; Test that hidefiles removes the file column. + (should + (equal +"| Headline | Time | +|--+| +| *Total time* | *1:00* | +|--+| +| Test | 1:00 |" +(org-test-with-temp-text-in-file +"* 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 ":hidefiles t :scope (lambda () (list %S))" the-file (provide 'test-org-clock) ;;; test-org-clock.el end here -- 2.22.0 From cc6744a089199a913cd602539990097c5fe691e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Cadilhac?= Date: Wed, 28 Aug 2019 18:22:46 -0500 Subject: [PATCH 3/3] Document :hidefiles in clocktable * doc/org-manual.org (The clock table): Do it. --- doc/org-manual.org | 5 + 1 file changed, 5 insertions(+) diff --git a/doc/org-manual.org b/doc/org-manual.org index f964b81e2..d81a722ba 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -6638,6 +6638,11 @@ using the =:formatter= parameter. Indent each headline field according to its level. +- =:hidefiles= :: + + Hide the file column when multiple
[O] HTML export with LaTeX babel blocks
My goal is to export SVG files of TikZ drawings in HTML. Now, what follows is a bit of a rant on `org-babel-execute:latex`; let's go through the options: - You're exporting to PNG without imagemagick: This uses `org-create-formula-image` which works really well, but it discards the options of the LaTeX block (fit, width, height, ...), including headers. It also fails to *force* using 'dvipng as processing type, so if `org-preview-latex-default-process` has been changed, it may be confusing. Finally, it uses `in-buffer` to render LaTeX as if it were in the buffer, which is not what the user would want since they are exporting to html (as a result, I get a black background on my pictures, since my buffer background is black). - You're exporting to PNG with imagemagick or to PDF: This may work. Sadly, "#+LATEX_HEADER:" is ignored, though it is in the previous case. - You're exporting to HTML. This uses htlatex—it's very rarely functional, but eh, you asked for TeX to HTML, and pdf2htmlEX seems unmaintained, so expect chaos. - You're exporting to SVG. This… uses htlatex? Why in paradise? org-create-formula-image would do that *brilliantly. *In any case, I can't seem to make it work: my fonts are always disappearing. So what do I do? I use the attached patch, that bypasses `htlatex` and uses the oh-so-working `org-create-formula-image`. This, of course, is not a complete solution—this whole function is messy at best, buggy at worst—but in the meantime, I can finally export my pictures to SVG (end result: https://autoboz.org/open-problems/19.1-ccra/). If anyone has an opinion on what to do with this situation, I'd be happy to help. Cheers, M. From 7f2cbee0e45ba6a57c913ed49690262401e67f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Cadilhac?= Date: Thu, 15 Aug 2019 10:28:27 -0400 Subject: [PATCH] ob-latex: Use org-create-formula-image when generating SVG * lisp/ob-latex.el (org-babel-execute:latex): Remove convoluted and buggy htlatex based SVG generation, and use `org-create-formula-image` --- lisp/ob-latex.el | 37 ++--- 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el index adf83d460..02ddfa2a8 100644 --- a/lisp/ob-latex.el +++ b/lisp/ob-latex.el @@ -114,14 +114,13 @@ This function is called by `org-babel-execute-src-block'." (when (file-exists-p out-file) (delete-file out-file)) (with-temp-file out-file (insert body))) - ((and (or (string= "svg" extension) - (string= "html" extension)) + ;; TODO: this is a very different way of generating the + ;; frame latex document than in the pdf case. Ideally, both + ;; would be unified. This would prevent bugs creeping in + ;; such as the one fixed on Aug 16 2014 whereby :headers was + ;; not included in the SVG/HTML case. + ((and (string= "html" extension) (executable-find org-babel-latex-htlatex)) - ;; TODO: this is a very different way of generating the - ;; frame latex document than in the pdf case. Ideally, both - ;; would be unified. This would prevent bugs creeping in - ;; such as the one fixed on Aug 16 2014 whereby :headers was - ;; not included in the SVG/HTML case. (with-temp-file tex-file (insert (concat "\\documentclass[preview]{standalone} @@ -143,23 +142,14 @@ This function is called by `org-babel-execute-src-block'." (when (file-exists-p out-file) (delete-file out-file)) (let ((default-directory (file-name-directory tex-file))) (shell-command (format "%s %s" org-babel-latex-htlatex tex-file))) - (cond - ((file-exists-p (concat (file-name-sans-extension tex-file) "-1.svg")) - (if (string-suffix-p ".svg" out-file) - (progn - (shell-command "pwd") - (shell-command (format "mv %s %s" - (concat (file-name-sans-extension tex-file) "-1.svg") - out-file))) - (error "SVG file produced but HTML file requested"))) - ((file-exists-p (concat (file-name-sans-extension tex-file) ".html")) - (if (string-suffix-p ".html" out-file) - (shell-command "mv %s %s" - (concat (file-name-sans-extension tex-file) - ".html") - out-file) - (error "HTML file produced but SVG file requested") + (when (file-exists-p (concat (file-name-sans-extension tex-file) ".html")) + (shell-command "mv %s %s" + (concat (file-name-sans-extension tex-file) + ".html") + out-file))) + ((string= "svg" extension) + (org-create-formula-image + body out-file org-format-latex-options nil 'dvisvgm)) ((or (string= "pdf" extension) imagemagick) (with-temp-file tex-file (require 'ox-latex) -- 2.22.0