emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] org-plot abstractions and extension
@ 2020-09-06  5:50 65% TEC
       [not found]     ` <87blijmnv9.fsf@gnu.org>
  0 siblings, 1 reply; 200+ results
From: TEC @ 2020-09-06  5:50 UTC (permalink / raw)
  To: org-mode-email


[-- Attachment #1.1: Type: text/plain, Size: 2607 bytes --]

Hi All,

I think while my org-plot work isn't yet complete, it has reached a
review-able
state.

I see org-plot as a great tool for making it easy to produce
high-quality
graphics from tabular data in Org files. With this in mind, this set of
patches
aims to achieve to overarching goals:
1. improve the flexibility of org-plot by abstracting out some
   hard-coded elements
2. introduce some (hopefully, generally useful) utility functions, and a
   new
   default plot type that makes use of them --- radar

If you are interested in org-plot, or have some time to spare and are
feeling
helpful, please give me your thoughts on the attached patches :)

Timothy.

<#part type="text/x-patch"
filename="/home/tec/.emacs.d/.local/straight/repos/org-mode/0001-org-plot.el-make-indentation-method-consistent.patch"
disposition=attachment>
<#/part>
<#part type="text/x-patch"
filename="/home/tec/.emacs.d/.local/straight/repos/org-mode/0002-org-plot.el-add-new-option-transpose.patch"
disposition=attachment>
<#/part>
<#part type="text/x-patch"
filename="/home/tec/.emacs.d/.local/straight/repos/org-mode/0003-org-plot.el-add-new-custom-gnuplot-preamble.patch"
disposition=attachment>
<#/part>
<#part type="text/x-patch"
filename="/home/tec/.emacs.d/.local/straight/repos/org-mode/0004-org-plot.el-abstract-plot-types-into-custom-var.patch"
disposition=attachment>
<#/part>
<#part type="text/x-patch"
filename="/home/tec/.emacs.d/.local/straight/repos/org-mode/0005-org-plot.el-add-utility-functions-for-range-ticks.patch"
disposition=attachment>
<#/part>
<#part type="text/x-patch"
filename="/home/tec/.emacs.d/.local/straight/repos/org-mode/0006-org-plot.el-add-custom-var-for-affecting-the-term.patch"
disposition=attachment>
<#/part>
<#part type="text/x-patch"
filename="/home/tec/.emacs.d/.local/straight/repos/org-mode/0007-org-plot.el-tweak-term-preamble-custom-vars.patch"
disposition=attachment>
<#/part>
<#part type="text/x-patch"
filename="/home/tec/.emacs.d/.local/straight/repos/org-mode/0008-org-plot.el-add-radar-plot-type.patch"
disposition=attachment>
<#/part>
<#part type="text/x-patch"
filename="/home/tec/.emacs.d/.local/straight/repos/org-mode/0009-org-plot.el-fix-logic-error-in-transposition.patch"
disposition=attachment>
<#/part>
<#part type="text/x-patch"
filename="/home/tec/.emacs.d/.local/straight/repos/org-mode/0010-org-plot.el-complete-transition-to-softcoded-type.patch"
disposition=attachment>
<#/part>
<#part type="text/x-patch"
filename="/home/tec/.emacs.d/.local/straight/repos/org-mode/0011-org-plot.el-avoid-arithmetic-overflow-error.patch"
disposition=attachment>
<#/part>

[-- Attachment #1.2: Type: text/html, Size: 5682 bytes --]

^ permalink raw reply	[relevance 65%]

* Re: [PATCH] org-plot abstractions and extension
       [not found]       ` <CAHNg_jM8sE4a6XvL5D8Gks4dQXfWhZvRBR33BDLkRgEgZ++ZGg@mail.gmail.com>
@ 2020-09-15  3:43 10%     ` TEC
  2020-09-25 17:51 93%       ` TEC
  0 siblings, 1 reply; 200+ results
From: TEC @ 2020-09-15  3:43 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 850 bytes --]


Oooops, I've just noticed my patch attachment re-send was only addressed
to Bastien (maybe this is why I haven't heard anything?).
This is what I get for mixing mail clients and not paying attention
I guess 😅.

If someone would be willing to have a look through my work, and comment
- that would be fantastic.

I'd love to get my code into shape to be merged :)

All the best,

Timothy.

> Bastien <bzg@gnu.org> wrote:
>
>> Can you repost as plain text?  The email is not very readable in HTML
>> and the patches are not readable at all.
>
> Ooops, that shouldn't have happened. Unfortunately, I have yet to find
> a good way of attaching files in mu4e.
> Those should have been converted into attachments in a plaintext
> email, but that didn't work.
>
> Let me know if this attempt works as intended,
>
> Timothy.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-org-plot.el-add-new-option-transpose.patch --]
[-- Type: text/x-patch, Size: 3084 bytes --]

From c62e817b04dfbe624ee8b2090ebcde257bbd3f23 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 8 Jul 2020 19:26:07 +0800
Subject: [PATCH 02/11] org-plot.el: add new option :transpose

* lisp/org-plot.el (org-plot/add-options-to-plist,
org-plot/add-options-to-plist): Add a new option :transpose, and a
shorter alias :trans. Transposition is performed if the argument is yes,
y, or t.  This treats the table as a matrix and performs matrix
transposition on it.  If an hline is present, it is assumed that it is a
marks a separation from a first header row.  The first row is then
treated as the new header by inserting a hline in the transposed data.
This is quite useful for some plots, where across multiple categories,
there are a large number of data points.  Without this, the data points
would be columns and the table can spread irritatingly wide.
---
 lisp/org-plot.el | 44 +++++++++++++++++++++++++++++---------------
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index c08bc144e..6ff633130 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -50,19 +50,21 @@
   "Parse an OPTIONS line and set values in the property list P.
 Returns the resulting property list."
   (when options
-    (let ((op '(("type"    . :plot-type)
-		("script"  . :script)
-		("line"    . :line)
-		("set"     . :set)
-		("title"   . :title)
-		("ind"     . :ind)
-		("deps"    . :deps)
-		("with"    . :with)
-		("file"    . :file)
-		("labels"  . :labels)
-		("map"     . :map)
-		("timeind" . :timeind)
-		("timefmt" . :timefmt)))
+    (let ((op '(("type"      . :plot-type)
+		("script"    . :script)
+		("line"      . :line)
+		("set"       . :set)
+		("title"     . :title)
+		("ind"       . :ind)
+		("deps"      . :deps)
+		("with"      . :with)
+		("file"      . :file)
+		("labels"    . :labels)
+		("map"       . :map)
+		("timeind"   . :timeind)
+		("timefmt"   . :timefmt)
+		("trans"     . :transpose)
+		("transpose" . :transpose)))
 	  (multiples '("set" "line"))
 	  (regexp ":\\([\"][^\"]+?[\"]\\|[(][^)]+?[)]\\|[^ \t\n\r;,.]*\\)")
 	  (start 0))
@@ -289,8 +291,20 @@ line directly before or after the table."
 	(setf params (plist-put params (car pair) (cdr pair)))))
     ;; collect table and table information
     (let* ((data-file (make-temp-file "org-plot"))
-	   (table (org-table-collapse-header (org-table-to-lisp)))
-	   (num-cols (length (car table))))
+	   (table (let ((tbl (org-table-to-lisp)))
+		    (when (pcase (plist-get params :transpose)
+			    ('y   t)
+			    ('yes t)
+			    ('t   t))
+		      (if (memq 'hline tbl)
+			  (setq tbl (apply #'cl-mapcar #'list tbl))
+			;; When present, remove hlines as they can't (currentily) be easily transposed.
+			(setq tbl (apply #'cl-mapcar #'list
+					 (remove 'hline tbl)))
+			(push 'hline (cdr tbl))))
+		    tbl))
+	   (num-cols (length (if (eq (nth 0 table) 'hline) (nth 1 table)
+			       (nth 0 table)))))
       (run-with-idle-timer 0.1 nil #'delete-file data-file)
       (when (eq (cadr table) 'hline)
 	(setf params
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0003-org-plot.el-add-new-custom-gnuplot-preamble.patch --]
[-- Type: text/x-patch, Size: 2013 bytes --]

From fc7f4015c726e4a685002e8d69fad1eb1d605790 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 8 Jul 2020 22:26:21 +0800
Subject: [PATCH 03/11] org-plot.el: add new custom gnuplot preamble

* lisp/org-plot.el: Define new custom variable
`org-plot/gnuplot-script-preamble' which can be either a string or a
function.  The value of this (when executed, in the case of the
function) is inserted near the top of the generated gnuplot script.
(org-plot/gnuplot-script): Use the new variable
`org-plot/gnuplot-script-preamble' in the manner described.

This allows for the user to set the font/colour-scheme, default
precision, and much more.
---
 lisp/org-plot.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 6ff633130..f8db45273 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -181,6 +181,13 @@ and dependent variables."
 	  (setf back-edge "") (setf front-edge ""))))
     row-vals))
 
+(defcustom org-plot/gnuplot-script-preamble ""
+  "String or function which provides content to be inserted into the GNUPlot
+script before the plot command. Not that this is in addition to, not instead of
+other content generated in `org-plot/gnuplot-script'."
+  :group 'org-plot
+  :type '(choice string function))
+
 (defun org-plot/gnuplot-script (data-file num-cols params &optional preface)
   "Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
 NUM-COLS controls the number of columns plotted in a 2-d plot.
@@ -213,6 +220,12 @@ manner suitable for prepending to a user-specified script."
     (when file				; output file
       (funcall ats (format "set term %s" (file-name-extension file)))
       (funcall ats (format "set output '%s'" file)))
+
+    (funcall ats
+	     (if (stringp org-plot/gnuplot-script-preamble)
+		 org-plot/gnuplot-script-preamble
+	       (org-plot/gnuplot-script-preamble)))
+
     (pcase type				; type
       (`2d ())
       (`3d (when map (funcall ats "set map")))
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0005-org-plot.el-add-utility-functions-for-range-ticks.patch --]
[-- Type: text/x-patch, Size: 6285 bytes --]

From d99a61170bb0ff10b9fc7b99cdc957ec574c1e51 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 9 Jul 2020 04:47:40 +0800
Subject: [PATCH 05/11] org-plot.el: add utility functions for range,ticks

* lisp/org-plot.el (org-plot/add-options-to-plist): Add the options :ymin
:ymax :xmin :xmax, as well as :min and :max as aliases to the y{min,max}
options.  The :ticks option is also added, for specifying how many ticks
should be used.
(org--plot/values-stats, org--plot/sensible-tick-num,
org--plot/nice-frequency-pick, org--plot/merge-alists,
org--plot/item-frequencies, org--plot/prime-factors): New utility
functions added to allow for somewhat sensible determination of a :ticks
value when none is provided.  This turns out to be harder than expected,
and so a number of functions are used to attempt to do so.  The essence
of the method used, is to round values and find their prime
decompositions.  From this we try to select the most common components
to give a reasonable step size.  We also add a 'ticks' parameter for
manually setting the number of ticks, and (y)min/max parameters
similarly.
---
 lisp/org-plot.el | 100 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 207f5d4af..2a9c0f5bd 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -63,6 +63,11 @@ Returns the resulting property list."
 		("map"       . :map)
 		("timeind"   . :timeind)
 		("timefmt"   . :timefmt)
+		("min"       . :ymin)
+		("max"       . :ymax)
+		("ymin"      . :ymin)
+		("xmax"      . :xmax)
+		("ticks"     . :ticks)
 		("trans"     . :transpose)
 		("transpose" . :transpose)))
 	  (multiples '("set" "line"))
@@ -181,6 +186,101 @@ and dependent variables."
 	  (setf back-edge "") (setf front-edge ""))))
     row-vals))
 
+(defun org--plot/values-stats (nums &optional hard-min hard-max)
+  "From a list of NUMS return a plist containing some rudamentry statistics on the
+values, namely regarding the range."
+  (let* ((minimum (or hard-min (apply #'min nums)))
+	 (maximum (or hard-max (apply #'max nums)))
+	 (range (- maximum minimum))
+	 (rangeOrder (ceiling (- 1 (log10 range))))
+	 (range-factor (expt 10 rangeOrder))
+	 (nice-min (/ (float (floor (* minimum range-factor))) range-factor))
+	 (nice-max (/ (float (ceiling (* maximum range-factor))) range-factor)))
+    `(:min ,minimum :max ,maximum :range ,range
+      :range-factor ,range-factor
+      :nice-min ,nice-min :nice-max ,nice-max :nice-range ,(- nice-max nice-min))))
+
+(defun org--plot/sensible-tick-num (table &optional hard-min hard-max)
+  "From a the values in a TABLE of data, attempt to guess an appropriate number of ticks."
+  (let* ((row-data
+	  (mapcar (lambda (row) (org--plot/values-stats
+			    (mapcar #'string-to-number (cdr row))
+			    hard-min
+			    hard-max)) table))
+	 (row-normalised-ranges (mapcar (lambda (r-data)
+					  (let ((val (round (*
+							     (plist-get r-data :range-factor)
+							     (plist-get r-data :nice-range)))))
+					    (if (= (% val 10) 0) (/ val 10) val)))
+					row-data))
+	 (range-prime-decomposition (mapcar #'org--plot/prime-factors row-normalised-ranges))
+	 (weighted-factors (sort (apply #'org--plot/merge-alists #'+ 0
+					(mapcar (lambda (factors) (org--plot/item-frequencies factors t))
+						range-prime-decomposition))
+				 (lambda (a b) (> (cdr a) (cdr b))))))
+    (apply #'* (org--plot/nice-frequency-pick weighted-factors))))
+
+(defun org--plot/nice-frequency-pick (frequencies)
+  "From a list of frequences, try to sensibly pick a sample of the most frequent."
+  ;; TODO this mosly works decently, but counld do with some tweaking to work more consistently.
+  (case (length frequencies)
+    (1 (list (car (nth 0 frequencies))))
+    (2 (if (<= 3 (/ (cdr (nth 0 frequencies))
+		    (cdr (nth 1 frequencies))))
+	   (make-list 2
+		      (car (nth 0 frequencies)))
+	 (list (car (nth 0 frequencies))
+	       (car (nth 1 frequencies)))))
+    (t
+     (let* ((total-count (apply #'+ (mapcar #'cdr frequencies)))
+	    (n-freq (mapcar (lambda (freq) `(,(car freq) . ,(/ (float (cdr freq)) total-count))) frequencies))
+	    (f-pick (list (car (car n-freq))))
+	    (1-2-ratio (/ (cdr (nth 0 n-freq))
+			  (cdr (nth 1 n-freq))))
+	    (2-3-ratio (/ (cdr (nth 1 n-freq))
+			  (cdr (nth 2 n-freq))))
+	    (1-3-ratio (* 1-2-ratio 2-3-ratio))
+	    (1-val (car (nth 0 n-freq)))
+	    (2-val (car (nth 1 n-freq)))
+	    (3-val (car (nth 2 n-freq))))
+       (when (> 1-2-ratio 4) (push 1-val f-pick))
+       (when (and (< 1-2-ratio 2-val)
+		  (< (* (apply #'* f-pick) 2-val) 30))
+	 (push 2-val f-pick))
+       (when (and (< 1-3-ratio 3-val)
+		  (< (* (apply #'* f-pick) 3-val) 30))
+	 (push 3-val f-pick))
+       f-pick))))
+
+(defun org--plot/merge-alists (function default alist1 alist2 &rest alists)
+  "Using FUNCTION, combine the elements of all given ALISTS. When an element is
+only present in one alist, DEFAULT is used as the second argument for the FUNCTION."
+  (when (> (length alists) 0)
+    (setq alist2 (apply #'org--plot/merge-alists function default alist2 alists)))
+  (flet ((keys (alist) (mapcar #'car alist))
+	 (lookup (key alist) (or (cdr (assoc key alist)) default)))
+    (loop with keys = (union (keys alist1) (keys alist2) :test 'equal)
+	  for k in keys collect
+	  (cons k (funcall function (lookup k alist1) (lookup k alist2))))))
+
+(defun org--plot/item-frequencies (values &optional normalise)
+  "Return an alist indicating the frequency of values in VALUES list."
+  (let ((normaliser (if normalise (float (length values)) 1)))
+    (cl-loop for (n . m) in (seq-group-by #'identity values)
+	     collect (cons n (/ (length m) normaliser)))))
+
+(defun org--plot/prime-factors (value)
+  "Return the prime decomposition of VALUE, e.g. for 12, '(3 2 2)"
+  (let ((factors '(1)) (i 1))
+    (while (/= 1 value)
+      (setq i (1+ i))
+      (when (eq 0 (% value i))
+	(push i factors)
+	(setq value (/ value i))
+	(setq i (1- i))
+	))
+    (subseq factors 0 -1)))
+
 (defcustom org-plot/gnuplot-script-preamble ""
   "String or function which provides content to be inserted into the GNUPlot
 script before the plot command. Not that this is in addition to, not instead of
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-org-plot.el-abstract-plot-types-into-custom-var.patch --]
[-- Type: text/x-patch, Size: 4470 bytes --]

From fc1ecf42cd8d0d27cda98ced2c2be365ad305df7 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 9 Jul 2020 04:27:18 +0800
Subject: [PATCH 04/11] org-plot.el: abstract plot types into custom var

* lisp/org-plot.el (org-plot/gnuplot-script): Abstract the generation of
gnuplot commands from the three hardcoded types: 2d, 3d, and grid.
A new custom variable `org-plot/preset-plot-types' is defined to declare
plot types and provide a lambda which is called with a fixed signature
to generate associated gnuplot code.  The previously hardcoded types are
implemented as the default value.

By extracting these types to a custom variable, users are able to create
their own presets for frequently used setups. Note that while this moves
the most significant hardcoding of the 2d, 3d, and grid types in
`org-plot/gnuplot-script', there are still a few minor fragments that I
am not sure how to best address --- yet.
---
 lisp/org-plot.el | 71 ++++++++++++++++++++++++++++++++----------------
 1 file changed, 48 insertions(+), 23 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index f8db45273..207f5d4af 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -188,6 +188,49 @@ other content generated in `org-plot/gnuplot-script'."
   :group 'org-plot
   :type '(choice string function))
 
+(defcustom org-plot/preset-plot-types
+  '((2d (lambda (data-file num-cols params plot-str)
+	  (let* ((type (plist-get params :plot-type))
+		 (with (if (eq type 'grid) 'pm3d (plist-get params :with)))
+		 (ind (plist-get params :ind))
+		 (deps (if (plist-member params :deps) (plist-get params :deps)))
+		 (text-ind (plist-get params :textind))
+		 (col-labels (plist-get params :labels))
+		 res)
+	    (dotimes (col num-cols res)
+	      (unless (and (eq type '2d)
+			   (or (and ind (equal (1+ col) ind))
+			       (and deps (not (member (1+ col) deps)))))
+		(setf res
+		      (cons
+		       (format plot-str data-file
+			       (or (and ind (> ind 0)
+					(not text-ind)
+					(format "%d:" ind)) "")
+			       (1+ col)
+			       (if text-ind (format ":xticlabel(%d)" ind) "")
+			       with
+			       (or (nth col col-labels)
+				   (format "%d" (1+ col))))
+		       res)))))))
+    (3d (lambda (data-file num-cols params plot-str)
+	  (let* ((type (plist-get params :plot-type))
+		 (with (if (eq type 'grid) 'pm3d (plist-get params :with))))
+	    (list (format "'%s' matrix with %s title ''"
+			  data-file with)))))
+    (grid (lambda (data-file num-cols params plot-str)
+	    (let* ((type (plist-get params :plot-type))
+		   (with (if (eq type 'grid) 'pm3d (plist-get params :with))))
+	    (list (format "'%s' with %s title ''"
+			  data-file with))))))
+  "List of plot presets with the type name as the car, and a function
+which yeilds plot-lines (a list of strings) as the cdr.
+The parameters of `org-plot/gnuplot-script' and PLOT-STR are passed to
+that function. i.e. it is called with the following arguments:
+  DATA-FILE NUM-COLS PARAMS PLOT-STR"
+  :group 'org-plot
+  :type '(alist :value-type (symbol group)))
+
 (defun org-plot/gnuplot-script (data-file num-cols params &optional preface)
   "Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
 NUM-COLS controls the number of columns plotted in a 2-d plot.
@@ -254,29 +297,11 @@ manner suitable for prepending to a user-specified script."
 			   (or timefmt	; timefmt passed to gnuplot
 			       "%Y-%m-%d-%H:%M:%S") "\"")))
     (unless preface
-      (pcase type			; plot command
-	(`2d (dotimes (col num-cols)
-	       (unless (and (eq type '2d)
-			    (or (and ind (equal (1+ col) ind))
-				(and deps (not (member (1+ col) deps)))))
-		 (setf plot-lines
-		       (cons
-			(format plot-str data-file
-				(or (and ind (> ind 0)
-					 (not text-ind)
-					 (format "%d:" ind)) "")
-				(1+ col)
-				(if text-ind (format ":xticlabel(%d)" ind) "")
-				with
-				(or (nth col col-labels)
-				    (format "%d" (1+ col))))
-			plot-lines)))))
-	(`3d
-	 (setq plot-lines (list (format "'%s' matrix with %s title ''"
-					data-file with))))
-	(`grid
-	 (setq plot-lines (list (format "'%s' with %s title ''"
-					data-file with)))))
+      (let ((type-func (cadr (assoc type org-plot/preset-plot-types))))
+	(when type-func
+	  (setq plot-lines
+		(funcall type-func data-file num-cols params plot-str))))
+
       (funcall ats
 	       (concat plot-cmd " " (mapconcat #'identity
 					       (reverse plot-lines)
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0006-org-plot.el-add-custom-var-for-affecting-the-term.patch --]
[-- Type: text/x-patch, Size: 2034 bytes --]

From 26c09d431030bacfc5a4ce84103b2eca186b2229 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 9 Jul 2020 05:00:03 +0800
Subject: [PATCH 06/11] org-plot.el: add custom var for affecting the term

* lisp/org-plot.el (org-plot/gnuplot-script): Allow for customisation of
org-plot's term by adding a custom variable
`org-plot/gnuplot-term-extra' which allows the user to tweak the gnuplot
term settings.  This allows for setting characteristics such as default
size, or background colour.
---
 lisp/org-plot.el | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 2a9c0f5bd..ed4cea195 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -331,6 +331,13 @@ that function. i.e. it is called with the following arguments:
   :group 'org-plot
   :type '(alist :value-type (symbol group)))
 
+(defcustom org-plot/gnuplot-term-extra ""
+  "String or function which provides the extra term options.
+E.g. a value of \"size 1050,650\" would cause
+\"set term ... size 1050,650\" to be used."
+  :group 'org-plot
+  :type '(choice string function))
+
 (defun org-plot/gnuplot-script (data-file num-cols params &optional preface)
   "Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
 NUM-COLS controls the number of columns plotted in a 2-d plot.
@@ -360,8 +367,15 @@ manner suitable for prepending to a user-specified script."
 	 ;; ats = add-to-script
 	 (ats (lambda (line) (setf script (concat script "\n" line))))
 	 plot-lines)
-    (when file				; output file
-      (funcall ats (format "set term %s" (file-name-extension file)))
+
+
+    ;; handle output file, background, and size
+    (funcall ats (format "set term %s %s"
+			 (if file (file-name-extension file) "GNUTERM")
+			 (if (stringp org-plot/gnuplot-term-extra)
+			     org-plot/gnuplot-term-extra
+			   (org-plot/gnuplot-term-extra))))
+    (when file ; output file
       (funcall ats (format "set output '%s'" file)))
 
     (funcall ats
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0007-org-plot.el-tweak-term-preamble-custom-vars.patch --]
[-- Type: text/x-patch, Size: 2287 bytes --]

From 5a1b9ff8f3ba5be565828137460023cd39194b6c Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 9 Jul 2020 05:05:20 +0800
Subject: [PATCH 07/11] org-plot.el: tweak term, preamble custom vars

* lisp/org-plot.el (org-plot/gnuplot-script): Call the term and preamble
functions (mentioned below) with the plot type as the argument.
(org-plot/gnuplot-script-preamble, org-plot/gnuplot-term-extra): update
docstring.
---
 lisp/org-plot.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index ed4cea195..52422ea2f 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -284,7 +284,8 @@ only present in one alist, DEFAULT is used as the second argument for the FUNCTI
 (defcustom org-plot/gnuplot-script-preamble ""
   "String or function which provides content to be inserted into the GNUPlot
 script before the plot command. Not that this is in addition to, not instead of
-other content generated in `org-plot/gnuplot-script'."
+other content generated in `org-plot/gnuplot-script'.
+If a function, it is called with the plot type as the argument."
   :group 'org-plot
   :type '(choice string function))
 
@@ -334,7 +335,8 @@ that function. i.e. it is called with the following arguments:
 (defcustom org-plot/gnuplot-term-extra ""
   "String or function which provides the extra term options.
 E.g. a value of \"size 1050,650\" would cause
-\"set term ... size 1050,650\" to be used."
+\"set term ... size 1050,650\" to be used.
+If a function, it is called with the plot type as the argument."
   :group 'org-plot
   :type '(choice string function))
 
@@ -374,14 +376,14 @@ manner suitable for prepending to a user-specified script."
 			 (if file (file-name-extension file) "GNUTERM")
 			 (if (stringp org-plot/gnuplot-term-extra)
 			     org-plot/gnuplot-term-extra
-			   (org-plot/gnuplot-term-extra))))
+			   (org-plot/gnuplot-term-extra type))))
     (when file ; output file
       (funcall ats (format "set output '%s'" file)))
 
     (funcall ats
 	     (if (stringp org-plot/gnuplot-script-preamble)
 		 org-plot/gnuplot-script-preamble
-	       (org-plot/gnuplot-script-preamble)))
+	       (org-plot/gnuplot-script-preamble type)))
 
     (pcase type				; type
       (`2d ())
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0008-org-plot.el-add-radar-plot-type.patch --]
[-- Type: text/x-patch, Size: 6388 bytes --]

From 3e9338962a4af033bd56e8ab7a1abe5e636d71c5 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 9 Jul 2020 05:21:44 +0800
Subject: [PATCH 08/11] org-plot.el: add radar plot type

* lisp/org-plot.el (org--plot/radar): Implement a new plot type "radar".
(org--plot/radar-template): A huge template sting for `org-plot/radar'.
(org--plot/radar-ticks, org--plot/radar-setup-template): Smaller
template strings for use in `org-plot/radar'.
(org-plot/preset-plot-types): Add the new "radar" type to the list of
default types.

The radar type has a long and complex implementation, but that's exactly
what makes it perfect for something like this. A complex plot can be
produced with a simple keyword in the #+PLOT options. There are still a
few kinks that would benefit from being ironed out, but the current
state is fully-functional.
---
 lisp/org-plot.el | 138 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 137 insertions(+), 1 deletion(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 52422ea2f..fd92a12a1 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -323,7 +323,9 @@ If a function, it is called with the plot type as the argument."
 	    (let* ((type (plist-get params :plot-type))
 		   (with (if (eq type 'grid) 'pm3d (plist-get params :with))))
 	    (list (format "'%s' with %s title ''"
-			  data-file with))))))
+			  data-file with)))))
+    (radar (lambda (data-file num-cols params plot-str)
+	     (list (org--plot/radar table params)))))
   "List of plot presets with the type name as the car, and a function
 which yeilds plot-lines (a list of strings) as the cdr.
 The parameters of `org-plot/gnuplot-script' and PLOT-STR are passed to
@@ -332,6 +334,140 @@ that function. i.e. it is called with the following arguments:
   :group 'org-plot
   :type '(alist :value-type (symbol group)))
 
+(defvar org--plot/radar-template
+  "### spider plot/chart with gnuplot
+# also known as: radar chart, web chart, star chart, cobweb chart,
+#                radar plot,  web plot,  star plot,  cobweb plot,  etc. ...
+set datafile separator ' '
+set size square
+unset tics
+set angles degree
+set key bmargin center horizontal
+unset border
+
+# Load data and settup
+load \"%s\"
+
+# General settings
+DataColCount = words($Data[1])-1
+AxesCount = |$Data|-HeaderLines
+AngleOffset = 90
+Max = 1
+d=0.1*Max
+Direction = -1   # counterclockwise=1, clockwise = -1
+
+# Tic settings
+TicCount = %s
+TicOffset = 0.1
+TicValue(axis,i) = real(i)*(word($Settings[axis],3)-word($Settings[axis],2)) \\
+	  / word($Settings[axis],4)+word($Settings[axis],2)
+TicLabelPosX(axis,i) = PosX(axis,i/TicCount) + PosY(axis, TicOffset)
+TicLabelPosY(axis,i) = PosY(axis,i/TicCount) - PosX(axis, TicOffset)
+TicLen = 0.03
+TicdX(axis,i) = 0.5*TicLen*cos(alpha(axis)-90)
+TicdY(axis,i) = 0.5*TicLen*sin(alpha(axis)-90)
+
+# Label
+LabOffset = 0.10
+LabX(axis) = PosX(axis+1,Max+2*d) + PosY(axis, LabOffset)
+LabY(axis) = PosY($0+1,Max+2*d)
+
+# Functions
+alpha(axis) = (axis-1)*Direction*360.0/AxesCount+AngleOffset
+PosX(axis,R) = R*cos(alpha(axis))
+PosY(axis,R) = R*sin(alpha(axis))
+Scale(axis,value) = real(value-word($Settings[axis],2))/(word($Settings[axis],3)-word($Settings[axis],2))
+
+# Spider settings
+set style arrow 1 dt 1 lw 1.0 @fgal head filled size 0.06,25     # style for axes
+set style arrow 2 dt 2 lw 0.5 @fgal nohead   # style for weblines
+set style arrow 3 dt 1 lw 1 @fgal nohead     # style for axis tics
+set samples AxesCount
+set isosamples TicCount
+set urange[1:AxesCount]
+set vrange[1:TicCount]
+set style fill transparent solid 0.2
+
+set xrange[-Max-4*d:Max+4*d]
+set yrange[-Max-4*d:Max+4*d]
+plot \\
+    '+' u (0):(0):(PosX($0,Max+d)):(PosY($0,Max+d)) w vec as 1 not, \\
+    $Data u (LabX($0)): \\
+	(LabY($0)):1 every ::HeaderLines w labels center enhanced @fgt not, \\
+    for [i=1:DataColCount] $Data u (PosX($0+1,Scale($0+1,column(i+1)))): \\
+	(PosY($0+1,Scale($0+1,column(i+1)))) every ::HeaderLines w filledcurves lt i title word($Data[1],i+1), \\
+%s
+#    '++' u (PosX($1,$2/TicCount)-TicdX($1,$2/TicCount)): \\
+#        (PosY($1,$2/TicCount)-TicdY($1,$2/TicCount)): \\
+#        (2*TicdX($1,$2/TicCount)):(2*TicdY($1,$2/TicCount)) \\
+#        w vec as 3 not, \\
+### end of code
+")
+
+(defvar org--plot/radar-ticks
+  "    '++' u (PosX($1,$2/TicCount)):(PosY($1,$2/TicCount)): \\
+	(PosX($1+1,$2/TicCount)-PosX($1,$2/TicCount)):  \\
+	(PosY($1+1,$2/TicCount)-PosY($1,$2/TicCount)) w vec as 2 not, \\
+    '++' u (TicLabelPosX(%s,$2)):(TicLabelPosY(%s,$2)): \\
+	(sprintf('%%g',TicValue(%s,$2))) w labels font ',8' @fgat not")
+
+(defvar org--plot/radar-setup-template
+  "# Data
+$Data <<HEREHAVESOMEDATA
+%s
+HEREHAVESOMEDATA
+HeaderLines = 1
+
+# Settings for scale and offset adjustments
+# axis min max tics axisLabelXoff axisLabelYoff
+$Settings <<EOD
+%s
+EOD
+")
+
+(defun org--plot/radar (table params)
+  (let* ((data
+	  (concat "\"" (s-join "\" \"" (plist-get params :labels)) "\""
+		  "\n"
+		  (s-join "\n"
+			  (mapcar (lambda (row)
+				    (format
+				     "\"%s\" %s"
+				     (car row)
+				     (s-join " " (cdr row))))
+				  table))))
+	 (ticks (or (plist-get params :ticks)
+		    (org--plot/sensible-tick-num table
+						 (plist-get params :ymin)
+						 (plist-get params :ymax))))
+	 (settings
+	  (s-join "\n"
+		  (mapcar (lambda (row)
+			    (let ((data (org--plot/values-stats
+					 (mapcar #'string-to-number (cdr row)))))
+			      (format
+			       "\"%s\" %s %s %s"
+			       (car row)
+			       (or (plist-get params :ymin)
+				   (plist-get data :nice-min))
+			       (or (plist-get params :ymax)
+				   (plist-get data :nice-max))
+			       (if (eq ticks 0) 2 ticks)
+			       )))
+			  table)))
+	 (setup-file (make-temp-file "org-plot-setup")))
+    (f-write-text (format org--plot/radar-setup-template data settings)
+		  'utf-8 setup-file)
+    (format org--plot/radar-template
+	    setup-file
+	    (if (eq ticks 0) 2 ticks)
+	    (if (eq ticks 0) ""
+	      (apply #'format org--plot/radar-ticks
+		     (make-list 3 (if (and (plist-get params :ymin)
+					   (plist-get params :ymax))
+				      ;; FIXME multi-drawing of tick labels with "1"
+				      "1" "$1")))))))
+
 (defcustom org-plot/gnuplot-term-extra ""
   "String or function which provides the extra term options.
 E.g. a value of \"size 1050,650\" would cause
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #9: 0001-org-plot.el-make-indentation-method-consistent.patch --]
[-- Type: text/x-patch, Size: 1467 bytes --]

From 3743e507775b446f5f8188958c20f65861fac3fb Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 8 Jul 2020 18:34:46 +0800
Subject: [PATCH 01/11] org-plot.el: make indentation method consistent

* lisp/org-plot.el (org-plot/gnuplot): Make indentation consistent, by
replacing a few spaces with tabs.

Only 6 of 347 lines used spaces instead of tabs.
---
 lisp/org-plot.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 0ff96af67..c08bc144e 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -325,12 +325,12 @@ line directly before or after the table."
       (with-temp-buffer
 	(if (plist-get params :script)	; user script
 	    (progn (insert
-                    (org-plot/gnuplot-script data-file num-cols params t))
-                   (insert "\n")
-                   (insert-file-contents (plist-get params :script))
-                   (goto-char (point-min))
-                   (while (re-search-forward "\\$datafile" nil t)
-                     (replace-match data-file nil nil)))
+		    (org-plot/gnuplot-script data-file num-cols params t))
+		   (insert "\n")
+		   (insert-file-contents (plist-get params :script))
+		   (goto-char (point-min))
+		   (while (re-search-forward "\\$datafile" nil t)
+		     (replace-match data-file nil nil)))
 	  (insert (org-plot/gnuplot-script data-file num-cols params)))
 	;; Graph table.
 	(gnuplot-mode)
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #10: 0009-org-plot.el-fix-logic-error-in-transposition.patch --]
[-- Type: text/x-patch, Size: 1668 bytes --]

From 8b1ed7fb3cc418bb90fe48d3c4c8cb711decfded Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 30 Jul 2020 18:25:19 +0800
Subject: [PATCH 09/11] org-plot.el: fix logic error in transposition

* lisp/org-plot.el (org-plot/gnuplot): If statement in transposition
treated condition as its negative, to fix this the condition was
inverted.
It was also noticed that the code could not operate as expected as the
user-supplied #+plot options were not fetched. Resolved by re-inserting
relevant code from an older version of org-plot.
---
 lisp/org-plot.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index fd92a12a1..1b227d698 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -579,6 +579,10 @@ line directly before or after the table."
     (dolist (pair org-plot/gnuplot-default-options)
       (unless (plist-member params (car pair))
 	(setf params (plist-put params (car pair) (cdr pair)))))
+    ;; Collect options.
+    (save-excursion (while (and (equal 0 (forward-line -1))
+				(looking-at "[[:space:]]*#\\+"))
+		      (setf params (org-plot/collect-options params))))
     ;; collect table and table information
     (let* ((data-file (make-temp-file "org-plot"))
 	   (table (let ((tbl (org-table-to-lisp)))
@@ -586,7 +590,7 @@ line directly before or after the table."
 			    ('y   t)
 			    ('yes t)
 			    ('t   t))
-		      (if (memq 'hline tbl)
+		      (if (not (memq 'hline tbl))
 			  (setq tbl (apply #'cl-mapcar #'list tbl))
 			;; When present, remove hlines as they can't (currentily) be easily transposed.
 			(setq tbl (apply #'cl-mapcar #'list
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #11: 0010-org-plot.el-complete-transition-to-softcoded-type.patch --]
[-- Type: text/x-patch, Size: 13498 bytes --]

From bcd45c562966a893449d2412b363f31368ee5983 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 30 Jul 2020 18:36:11 +0800
Subject: [PATCH 10/11] org-plot.el: complete transition to softcoded type

* lisp/org-plot.el (org-plot/preset-plot-types): Adapt structure to
cover all type-specific logic within org-plot.
(org-plot/gnuplot-script, org-plot/gnuplot): Replace type-specific logic
with references to properties of the type from
`org-plot/preset-plot-types'.
---
 lisp/org-plot.el | 242 ++++++++++++++++++++++++++++-------------------
 1 file changed, 143 insertions(+), 99 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 1b227d698..53186bb75 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -290,7 +290,10 @@ If a function, it is called with the plot type as the argument."
   :type '(choice string function))
 
 (defcustom org-plot/preset-plot-types
-  '((2d (lambda (data-file num-cols params plot-str)
+  '((2d :plot-cmd "plot"
+	:check-ind-type t
+	:plot-func
+	(lambda (_table data-file num-cols params plot-str)
 	  (let* ((type (plist-get params :plot-type))
 		 (with (if (eq type 'grid) 'pm3d (plist-get params :with)))
 		 (ind (plist-get params :ind))
@@ -314,23 +317,60 @@ If a function, it is called with the plot type as the argument."
 			       (or (nth col col-labels)
 				   (format "%d" (1+ col))))
 		       res)))))))
-    (3d (lambda (data-file num-cols params plot-str)
+    (3d :plot-cmd "splot"
+	:plot-pre (lambda (_table _data-file _num-cols params _plot-str)
+		    (if (plist-get params :map) "set map"))
+	:plot-func
+	(lambda (_table data-file _num-cols params _plot-str)
 	  (let* ((type (plist-get params :plot-type))
 		 (with (if (eq type 'grid) 'pm3d (plist-get params :with))))
 	    (list (format "'%s' matrix with %s title ''"
 			  data-file with)))))
-    (grid (lambda (data-file num-cols params plot-str)
+    (grid :plot-cmd "splot"
+	  :plot-pre (lambda (_table _data-file _num-cols params _plot-str)
+		      (if (plist-get params :map) "set pm3d map" "set map"))
+	  :data-dump (lambda (table data-file params _num-cols)
+		       (let ((y-labels (org-plot/gnuplot-to-grid-data
+					table data-file params)))
+			 (when y-labels (plist-put params :ylabels y-labels))))
+	  :plot-func
+	  (lambda (table data-file _num-cols params _plot-str)
 	    (let* ((type (plist-get params :plot-type))
 		   (with (if (eq type 'grid) 'pm3d (plist-get params :with))))
-	    (list (format "'%s' with %s title ''"
-			  data-file with)))))
-    (radar (lambda (data-file num-cols params plot-str)
+	      (list (format "'%s' with %s title ''"
+			    data-file with)))))
+    (radar :plot-func
+	   (lambda (table _data-file _num-cols params plot-str)
 	     (list (org--plot/radar table params)))))
-  "List of plot presets with the type name as the car, and a function
-which yeilds plot-lines (a list of strings) as the cdr.
-The parameters of `org-plot/gnuplot-script' and PLOT-STR are passed to
-that function. i.e. it is called with the following arguments:
-  DATA-FILE NUM-COLS PARAMS PLOT-STR"
+  "List of plists describing the avalible plot types.
+The car is the type name, and the property :plot-func must be set.
+The value of :plot-func is a lambda which yields plot-lines
+(a list of strings) as the cdr.
+
+All lambda functions have the parameters of `org-plot/gnuplot-script' and PLOT-STR passed to them.
+i.e. they are called with the following signature: (TABLE DATA-FILE NUM-COLS PARAMS PLOT-STR)
+
+Potentially useful parameters in PARAMS include:
+ :set :line :map :title :file :ind :timeind :timefmt :textind
+ :deps :labels :xlabels :ylabels :xmin :xmax :ymin :ymax :ticks
+
+In addition to :plot-func, the following optional properties may be set.
+
+- :plot-cmd - A gnuplot command appended to each plot-line.
+  Accepts string or nil. Default value: nil.
+
+- :check-ind-type - Whether the types of ind values should be checked.
+  Accepts boolean.
+
+- :plot-str - the formula string passed to :plot-func as PLOT-STR
+  Accepts string. Default value: \"'%s' using %s%d%s with %s title '%s'\"
+
+- :data-dump - Function to dump the table to a datafile for ease of use.
+  Accepts lambda function. Default lambda body: (org-plot/gnuplot-to-data table data-file params)
+
+- :plot-pre - Gnuplot code to be inserted early into the script, just after term and output have been set.
+   Accepts string, nil, or lambda function which returns string or nil. Defaults to nil.
+"
   :group 'org-plot
   :type '(alist :value-type (symbol group)))
 
@@ -476,89 +516,90 @@ If a function, it is called with the plot type as the argument."
   :group 'org-plot
   :type '(choice string function))
 
-(defun org-plot/gnuplot-script (data-file num-cols params &optional preface)
+(defun org-plot/gnuplot-script (table data-file num-cols params &optional preface)
   "Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
 NUM-COLS controls the number of columns plotted in a 2-d plot.
 Optional argument PREFACE returns only option parameters in a
 manner suitable for prepending to a user-specified script."
-  (let* ((type (plist-get params :plot-type))
-	 (with (if (eq type 'grid) 'pm3d (plist-get params :with)))
-	 (sets (plist-get params :set))
-	 (lines (plist-get params :line))
-	 (map (plist-get params :map))
-	 (title (plist-get params :title))
-	 (file (plist-get params :file))
-	 (ind (plist-get params :ind))
-	 (time-ind (plist-get params :timeind))
-	 (timefmt (plist-get params :timefmt))
-	 (text-ind (plist-get params :textind))
-	 (deps (if (plist-member params :deps) (plist-get params :deps)))
-	 (col-labels (plist-get params :labels))
-	 (x-labels (plist-get params :xlabels))
-	 (y-labels (plist-get params :ylabels))
-	 (plot-str "'%s' using %s%d%s with %s title '%s'")
-	 (plot-cmd (pcase type
-		     (`2d "plot")
-		     (`3d "splot")
-		     (`grid "splot")))
-	 (script "reset")
-	 ;; ats = add-to-script
-	 (ats (lambda (line) (setf script (concat script "\n" line))))
-	 plot-lines)
-
-
-    ;; handle output file, background, and size
-    (funcall ats (format "set term %s %s"
-			 (if file (file-name-extension file) "GNUTERM")
-			 (if (stringp org-plot/gnuplot-term-extra)
-			     org-plot/gnuplot-term-extra
-			   (org-plot/gnuplot-term-extra type))))
-    (when file ; output file
-      (funcall ats (format "set output '%s'" file)))
-
-    (funcall ats
-	     (if (stringp org-plot/gnuplot-script-preamble)
-		 org-plot/gnuplot-script-preamble
-	       (org-plot/gnuplot-script-preamble type)))
-
-    (pcase type				; type
-      (`2d ())
-      (`3d (when map (funcall ats "set map")))
-      (`grid (funcall ats (if map "set pm3d map" "set pm3d"))))
-    (when title (funcall ats (format "set title '%s'" title))) ; title
-    (mapc ats lines)					       ; line
-    (dolist (el sets) (funcall ats (format "set %s" el)))      ; set
-    ;; Unless specified otherwise, values are TAB separated.
-    (unless (string-match-p "^set datafile separator" script)
-      (funcall ats "set datafile separator \"\\t\""))
-    (when x-labels			; x labels (xtics)
-      (funcall ats
-	       (format "set xtics (%s)"
-		       (mapconcat (lambda (pair)
-				    (format "\"%s\" %d" (cdr pair) (car pair)))
-				  x-labels ", "))))
-    (when y-labels			; y labels (ytics)
-      (funcall ats
-	       (format "set ytics (%s)"
-		       (mapconcat (lambda (pair)
-				    (format "\"%s\" %d" (cdr pair) (car pair)))
-				  y-labels ", "))))
-    (when time-ind			; timestamp index
-      (funcall ats "set xdata time")
-      (funcall ats (concat "set timefmt \""
-			   (or timefmt	; timefmt passed to gnuplot
-			       "%Y-%m-%d-%H:%M:%S") "\"")))
-    (unless preface
-      (let ((type-func (cadr (assoc type org-plot/preset-plot-types))))
-	(when type-func
-	  (setq plot-lines
-		(funcall type-func data-file num-cols params plot-str))))
+  (let* ((type-name (plist-get params :plot-type))
+	 (type (cdr (assoc type-name org-plot/preset-plot-types))))
+    (unless type
+      (user-error "Org-plot type `%s' is undefined." type-name))
+    (let* ((sets (plist-get params :set))
+	   (lines (plist-get params :line))
+	   (map (plist-get params :map))
+	   (title (plist-get params :title))
+	   (file (plist-get params :file))
+	   (ind (plist-get params :ind))
+	   (time-ind (plist-get params :timeind))
+	   (timefmt (plist-get params :timefmt))
+	   (text-ind (plist-get params :textind))
+	   (deps (if (plist-member params :deps) (plist-get params :deps)))
+	   (col-labels (plist-get params :labels))
+	   (x-labels (plist-get params :xlabels))
+	   (y-labels (plist-get params :ylabels))
+	   (plot-str (or (plist-get type :plot-str)
+			 "'%s' using %s%d%s with %s title '%s'"))
+	   (plot-cmd (plist-get type :plot-cmd))
+	   (plot-pre (plist-get type :plot-pre))
+	   (script "reset")
+	   ;; ats = add-to-script
+	   (ats (lambda (line) (when line (setf script (concat script "\n" line)))))
+	   plot-lines)
+
+
+      ;; handle output file, background, and size
+      (funcall ats (format "set term %s %s"
+			   (if file (file-name-extension file) "GNUTERM")
+			   (if (stringp org-plot/gnuplot-term-extra)
+			       org-plot/gnuplot-term-extra
+			     (funcall org-plot/gnuplot-term-extra type))))
+      (when file ; output file
+	(funcall ats (format "set output '%s'" file)))
+
+      (when plot-pre
+	(funcall ats (funcall plot-pre table data-file num-cols params plot-str)))
 
       (funcall ats
-	       (concat plot-cmd " " (mapconcat #'identity
-					       (reverse plot-lines)
-					       ",\\\n    "))))
-    script))
+	       (if (stringp org-plot/gnuplot-script-preamble)
+		   org-plot/gnuplot-script-preamble
+		 (funcall org-plot/gnuplot-script-preamble type)))
+
+      (when title (funcall ats (format "set title '%s'" title))) ; title
+      (mapc ats lines)					       ; line
+      (dolist (el sets) (funcall ats (format "set %s" el)))      ; set
+      ;; Unless specified otherwise, values are TAB separated.
+      (unless (string-match-p "^set datafile separator" script)
+	(funcall ats "set datafile separator \"\\t\""))
+      (when x-labels			; x labels (xtics)
+	(funcall ats
+		 (format "set xtics (%s)"
+			 (mapconcat (lambda (pair)
+				      (format "\"%s\" %d" (cdr pair) (car pair)))
+				    x-labels ", "))))
+      (when y-labels			; y labels (ytics)
+	(funcall ats
+		 (format "set ytics (%s)"
+			 (mapconcat (lambda (pair)
+				      (format "\"%s\" %d" (cdr pair) (car pair)))
+				    y-labels ", "))))
+      (when time-ind			; timestamp index
+	(funcall ats "set xdata time")
+	(funcall ats (concat "set timefmt \""
+			     (or timefmt	; timefmt passed to gnuplot
+				 "%Y-%m-%d-%H:%M:%S") "\"")))
+      (unless preface
+	(let ((type-func (plist-get type :plot-func)))
+	  (when type-func
+	    (setq plot-lines
+		  (funcall type-func table data-file num-cols params plot-str))))
+	(funcall ats
+		 (concat plot-cmd
+			 (when plot-cmd " ")
+			 (mapconcat #'identity
+				    (reverse plot-lines)
+				    ",\\\n    "))))
+      script)))
 
 ;;-----------------------------------------------------------------------------
 ;; facade functions
@@ -598,7 +639,13 @@ line directly before or after the table."
 			(push 'hline (cdr tbl))))
 		    tbl))
 	   (num-cols (length (if (eq (nth 0 table) 'hline) (nth 1 table)
-			       (nth 0 table)))))
+			       (nth 0 table))))
+	   (type (assoc (plist-get params :plot-type)
+			org-plot/preset-plot-types)))
+
+      (unless type
+	(user-error "Org-plot type `%s' is undefined." type-name))
+
       (run-with-idle-timer 0.1 nil #'delete-file data-file)
       (when (eq (cadr table) 'hline)
 	(setf params
@@ -608,15 +655,12 @@ line directly before or after the table."
       (save-excursion (while (and (equal 0 (forward-line -1))
 				  (looking-at "[[:space:]]*#\\+"))
 			(setf params (org-plot/collect-options params))))
-      ;; Dump table to datafile (very different for grid).
-      (pcase (plist-get params :plot-type)
-	(`2d   (org-plot/gnuplot-to-data table data-file params))
-	(`3d   (org-plot/gnuplot-to-data table data-file params))
-	(`grid (let ((y-labels (org-plot/gnuplot-to-grid-data
-				table data-file params)))
-		 (when y-labels (plist-put params :ylabels y-labels)))))
+      ;; Dump table to datafile
+      (if-let ((dump-func (plist-get type :data-dump)))
+	  (funcall dump-func table data-file num-cols params)
+	(org-plot/gnuplot-to-data table data-file params))
       ;; Check type of ind column (timestamp? text?)
-      (when (eq `2d (plist-get params :plot-type))
+      (when (plist-get params :check-ind-type)
 	(let* ((ind (1- (plist-get params :ind)))
 	       (ind-column (mapcar (lambda (row) (nth ind row)) table)))
 	  (cond ((< ind 0) nil) ; ind is implicit
@@ -633,13 +677,13 @@ line directly before or after the table."
       (with-temp-buffer
 	(if (plist-get params :script)	; user script
 	    (progn (insert
-		    (org-plot/gnuplot-script data-file num-cols params t))
+		    (org-plot/gnuplot-script table data-file num-cols params t))
 		   (insert "\n")
 		   (insert-file-contents (plist-get params :script))
 		   (goto-char (point-min))
 		   (while (re-search-forward "\\$datafile" nil t)
 		     (replace-match data-file nil nil)))
-	  (insert (org-plot/gnuplot-script data-file num-cols params)))
+	  (insert (org-plot/gnuplot-script table data-file num-cols params)))
 	;; Graph table.
 	(gnuplot-mode)
 	(gnuplot-send-buffer-to-gnuplot))
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #12: 0011-org-plot.el-avoid-arithmetic-overflow-error.patch --]
[-- Type: text/x-patch, Size: 1584 bytes --]

From a299ec63c91260b68237da3a6c19e8ed8523fd6d Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Sat, 5 Sep 2020 21:05:36 +0800
Subject: [PATCH 11/11] org-plot.el: avoid arithmetic overflow error

* lisp/org-plot.el (org--plot/values-stats): A set of numbers with the
same value (i.e. 0 range) should not produce an arithmetic overflow
error. This error was caused by taking the log of 0 (when the range is
0). This is mitigated by explicit checking against this case.
---
 lisp/org-plot.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 53186bb75..0a9694263 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -192,10 +192,13 @@ values, namely regarding the range."
   (let* ((minimum (or hard-min (apply #'min nums)))
 	 (maximum (or hard-max (apply #'max nums)))
 	 (range (- maximum minimum))
-	 (rangeOrder (ceiling (- 1 (log10 range))))
+	 (rangeOrder (if (= range 0) 0
+			 (ceiling (- 1 (log10 range)))))
 	 (range-factor (expt 10 rangeOrder))
-	 (nice-min (/ (float (floor (* minimum range-factor))) range-factor))
-	 (nice-max (/ (float (ceiling (* maximum range-factor))) range-factor)))
+	 (nice-min (if (= range 0) (car nums)
+		     (/ (float (floor (* minimum range-factor))) range-factor)))
+	 (nice-max (if (= range 0) (car nums)
+		     (/ (float (ceiling (* maximum range-factor))) range-factor))))
     `(:min ,minimum :max ,maximum :range ,range
       :range-factor ,range-factor
       :nice-min ,nice-min :nice-max ,nice-max :nice-range ,(- nice-max nice-min))))
-- 
2.28.0


^ permalink raw reply related	[relevance 10%]

* [PATCH] Enhance org-html--build-meta-info
@ 2020-09-17 13:50 93% TEC
  2020-09-17 14:21 48% ` TEC
    0 siblings, 2 replies; 200+ results
From: TEC @ 2020-09-17 13:50 UTC (permalink / raw)
  To: org-mode-email


[-- Attachment #1.1: Type: text/plain, Size: 374 bytes --]

Hi All,

This just replaces the current `org-html--build-meta-info' with a
cleaner, more
extensible (I also added a new variable) version. Please give it a look
and let
me know what you think!

Timothy.

<#part type="text/x-patch"
filename="/home/tec/.emacs.d/.local/straight/repos/org-mode/0001-lisp-ox-html.el-make-html-meta-func-nicer.patch"
disposition=inline>
<#/part>

[-- Attachment #1.2: Type: text/html, Size: 2250 bytes --]

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Enhance org-html--build-meta-info
  2020-09-17 13:50 93% [PATCH] Enhance org-html--build-meta-info TEC
@ 2020-09-17 14:21 48% ` TEC
    1 sibling, 0 replies; 200+ results
From: TEC @ 2020-09-17 14:21 UTC (permalink / raw)
  To: org-mode-email


TEC <tecosaur@gmail.com> writes:

> <#part type=“text/x-patch” filename=“home/tec.emacs.d/.local/straight/repos/org-mode/0001-lisp-ox-html.el-make-html-meta-func-nicer.patch”
> disposition=inline>
> <#/part>

I have no idea what I need to do to get Mu4e to attach files, but I'm
clearly not doing it right. Here's the patch inline:

From ae830f0be92c0b5ac3a9fb3d967a24d4292a1a4d Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Subject: [PATCH] lisp/ox-html.el: make html meta func nicer

* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The opportunity was taken to extract most metadata info to custom
variable `org-html-meta-tags', allowing for easy end-user modification.
---
 lisp/ox-html.el | 111 ++++++++++++++++++++++++++----------------------
 1 file changed, 61 insertions(+), 50 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index d2f24f5c6..901f1a379 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1425,6 +1425,28 @@ not be modified."

 ;;;; Template :: Styles

+(defcustom org-html-meta-tags
+  '((lambda (_title author _info)
+      (when (org-string-nw-p author)
+	(org-html--build-meta-entry "name" "author" author)))
+    (lambda (_title _author info)
+      (when (org-string-nw-p (plist-get info :description))
+	(org-html--build-meta-entry "name" "description"
+				    (plist-get info :description))))
+    ("name" "generator" "Org Mode"))
+  "A list of arguments to be passed to `org-html--build-meta-entry'.
+Each argument can either be an list which is applied, or a function which
+generates such a list with signature (TITLE AUTHOR INFO) where TITLE and AUTHOR
+are strings, and INFO a communication plist."
+  :group 'org-export-html
+  :package-version '(Org . "9.5")
+  :type '(repeat
+	  (choice
+	   (list (string :tag "Meta label")
+		 (string :tag "label value")
+		 (string :tag "Content value"))
+	   function)))
+
 (defcustom org-html-head-include-default-style t
   "Non-nil means include the default style in exported HTML files.
 The actual style is defined in `org-html-style-default' and
@@ -1835,23 +1857,31 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template

+(defun org-html--build-meta-entry (label identity &optional content-format &rest content-formatters)
+  "Construct <meta> tag with LABEL=\"IDENTITY\" and content from CONTENT-FORMAT and CONTENT-FORMATTER."
+  (concat "<meta "
+	  (format "%s=\"%s" label identity)
+	  (when content-format
+	    (concat "\" content=\""
+		    (replace-regexp-in-string
+		     "\"" "&quot;"
+		     (org-html-encode-plain-text
+		      (if content-formatters
+			  (apply #'format content-format content-formatters)
+			content-format)))))
+	  "\" />\n"))
+
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
-  (let* ((protect-string
-          (lambda (str)
-            (replace-regexp-in-string
-             "\"" "&quot;" (org-html-encode-plain-text str))))
-         (title (org-export-data (plist-get info :title) info))
+  (let* ((title (org-export-data (plist-get info :title) info))
          ;; Set title to an invisible character instead of leaving it
          ;; empty, which is invalid.
          (title (if (org-string-nw-p title) title "&lrm;"))
          (author (and (plist-get info :with-author)
                       (let ((auth (plist-get info :author)))
-			;; Return raw Org syntax.
+         ;; Return raw Org syntax.
                         (and auth (org-element-interpret-data auth)))))
-         (description (plist-get info :description))
-         (keywords (plist-get info :keywords))
          (charset (or (and org-html-coding-system
                            (fboundp 'coding-system-get)
                            (coding-system-get org-html-coding-system
@@ -1863,50 +1893,31 @@ INFO is a plist used as a communication channel."
 	(concat "<!-- "
 		(plist-get info :html-metadata-timestamp-format)
 		" -->\n")))
-     (format
-      (if (org-html-html5-p info)
-	  (org-html-close-tag "meta" "charset=\"%s\"" info)
-	(org-html-close-tag
-	 "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
-	 info))
-      charset) "\n"
+
+     (if (org-html-html5-p info)
+	 (org-html--build-meta-entry "charset" charset)
+       (org-html--build-meta-entry "http-equiv" "Content-Type"
+				   (concat "text/html;charset=" charset)))
+
      (let ((viewport-options
-	    (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
-			      (plist-get info :html-viewport))))
-       (and viewport-options
-	    (concat
-	     (org-html-close-tag
-	      "meta"
-	      (format "name=\"viewport\" content=\"%s\""
-		      (mapconcat
-		       (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
-		       viewport-options ", "))
-	      info)
-	     "\n")))
+            (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
+                              (plist-get info :html-viewport))))
+       (if viewport-options
+           (org-html--build-meta-entry "name" "viewport"
+                                       (mapconcat
+                                        (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
+                                        viewport-options ", "))))
+
      (format "<title>%s</title>\n" title)
-     (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\"" info)
-     "\n"
-     (and (org-string-nw-p author)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"author\" content=\"%s\""
-				       (funcall protect-string author))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p description)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"description\" content=\"%s\"\n"
-				       (funcall protect-string description))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p keywords)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"keywords\" content=\"%s\""
-				       (funcall protect-string keywords))
-			       info)
-	   "\n")))))
+
+     (apply #'concat
+	    (mapcar
+	     (lambda (form)
+	       (when (functionp form)
+		 (setq form (funcall form title author info)))
+	       (when form
+		 (apply #'org-html--build-meta-entry form)))
+	     org-html-meta-tags)))))

 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
--
2.28.0


^ permalink raw reply related	[relevance 48%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2020-09-17 16:14 45%   ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2020-09-17 16:14 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: org-mode-email


Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

> Hi Timothy,

Hi Jens! Thanks for responding.

> yes, I agree that org-html--build-meta-info needs work, and the HTML
> backend would benefit from more documentation.  Back then [1], I
> wondered which parts of meta data need to be treated how.  That was
> continued in thread [2].

I haven't really considered changing the output of the function (other
than removing keywords).

Reading the email you've linked to, it looks like a change to
`org-html-encode-plain-text' would be a good idea though.

> As pointed out back then, using org-export-data on the title is
> wrong as it creates nested elements, leading to invalid HTML.
>
> Currently, org-element-interpret-data is applied for author
> information, while description and keywords are treated differently.

> Your patch goes for org-html-encode-plain-text in the new function
> org-html--build-meta-entry, which (if I’m not mistaken) produces
> author and description.  Did you think about using
> org-element-interpret-data instead?  What if that was used?
> I believe this to be an important question as it might affect
> backward compatibility and should be documented.

I was not aware of org-element-interpret-data, and I can't say I can
really tell what it does. If you'd care to elaborate that would be
helpful.

> Does this really work for you?  For the author, first
> org-html--build-meta-entry gets called from the new defcustom.  The
> result is assigned with setq to form, which then is non-nil so that
> org-html--build-meta-entry is applied again, leading to an error
> here.

Ooops, I forgot to remove org-html--build-meta-entry from the defcustom.
(I didn't notice because I overwrite it anyway in my personal config).

> Besides, did you forget keywords or remove them on purpose?

This is a deliberate omission. My impression is that the value of
keywords in HTML documents has evaporated over the past decade, see:
https://yoast.com/meta-keywords/

Let me know if you know otherwise.

> Best wishes
> Jens

Thanks for your feedback!

Timothy.

-----

Updated patch:

From 3a02e4d3bce5f7f0cbdb34c98f4267cea40eec3e Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Subject: [PATCH] lisp/ox-html.el: make html meta func nicer

* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The opportunity was taken to extract most metadata info to custom
variable `org-html-meta-tags', allowing for easy end-user modification.
---
 lisp/ox-html.el | 111 ++++++++++++++++++++++++++----------------------
 1 file changed, 61 insertions(+), 50 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index d2f24f5c6..df7da1a68 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1425,6 +1425,28 @@ not be modified."

 ;;;; Template :: Styles

+(defcustom org-html-meta-tags
+  '((lambda (_title author _info)
+      (when (org-string-nw-p author)
+	(list "name" "author" author)))
+    (lambda (_title _author info)
+      (when (org-string-nw-p (plist-get info :description))
+	(list "name" "description"
+				    (plist-get info :description))))
+    ("name" "generator" "Org Mode"))
+  "A list of arguments to be passed to `org-html--build-meta-entry'.
+Each argument can either be an list which is applied, or a function which
+generates such a list with signature (TITLE AUTHOR INFO) where TITLE and AUTHOR
+are strings, and INFO a communication plist."
+  :group 'org-export-html
+  :package-version '(Org . "9.5")
+  :type '(repeat
+	  (choice
+	   (list (string :tag "Meta label")
+		 (string :tag "label value")
+		 (string :tag "Content value"))
+	   function)))
+
 (defcustom org-html-head-include-default-style t
   "Non-nil means include the default style in exported HTML files.
 The actual style is defined in `org-html-style-default' and
@@ -1835,23 +1857,31 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template

+(defun org-html--build-meta-entry (label identity &optional content-format &rest content-formatters)
+  "Construct <meta> tag with LABEL=\"IDENTITY\" and content from CONTENT-FORMAT and CONTENT-FORMATTER."
+  (concat "<meta "
+	  (format "%s=\"%s" label identity)
+	  (when content-format
+	    (concat "\" content=\""
+		    (replace-regexp-in-string
+		     "\"" "&quot;"
+		     (org-html-encode-plain-text
+		      (if content-formatters
+			  (apply #'format content-format content-formatters)
+			content-format)))))
+	  "\" />\n"))
+
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
-  (let* ((protect-string
-          (lambda (str)
-            (replace-regexp-in-string
-             "\"" "&quot;" (org-html-encode-plain-text str))))
-         (title (org-export-data (plist-get info :title) info))
+  (let* ((title (org-html-encode-plain-text (plist-get info :title) info))
          ;; Set title to an invisible character instead of leaving it
          ;; empty, which is invalid.
          (title (if (org-string-nw-p title) title "&lrm;"))
          (author (and (plist-get info :with-author)
                       (let ((auth (plist-get info :author)))
-			;; Return raw Org syntax.
+         ;; Return raw Org syntax.
                         (and auth (org-element-interpret-data auth)))))
-         (description (plist-get info :description))
-         (keywords (plist-get info :keywords))
          (charset (or (and org-html-coding-system
                            (fboundp 'coding-system-get)
                            (coding-system-get org-html-coding-system
@@ -1863,50 +1893,31 @@ INFO is a plist used as a communication channel."
 	(concat "<!-- "
 		(plist-get info :html-metadata-timestamp-format)
 		" -->\n")))
-     (format
-      (if (org-html-html5-p info)
-	  (org-html-close-tag "meta" "charset=\"%s\"" info)
-	(org-html-close-tag
-	 "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
-	 info))
-      charset) "\n"
+
+     (if (org-html-html5-p info)
+	 (org-html--build-meta-entry "charset" charset)
+       (org-html--build-meta-entry "http-equiv" "Content-Type"
+				   (concat "text/html;charset=" charset)))
+
      (let ((viewport-options
-	    (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
-			      (plist-get info :html-viewport))))
-       (and viewport-options
-	    (concat
-	     (org-html-close-tag
-	      "meta"
-	      (format "name=\"viewport\" content=\"%s\""
-		      (mapconcat
-		       (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
-		       viewport-options ", "))
-	      info)
-	     "\n")))
+            (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
+                              (plist-get info :html-viewport))))
+       (if viewport-options
+           (org-html--build-meta-entry "name" "viewport"
+                                       (mapconcat
+                                        (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
+                                        viewport-options ", "))))
+
      (format "<title>%s</title>\n" title)
-     (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\"" info)
-     "\n"
-     (and (org-string-nw-p author)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"author\" content=\"%s\""
-				       (funcall protect-string author))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p description)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"description\" content=\"%s\"\n"
-				       (funcall protect-string description))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p keywords)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"keywords\" content=\"%s\""
-				       (funcall protect-string keywords))
-			       info)
-	   "\n")))))
+
+     (apply #'concat
+	    (mapcar
+	     (lambda (form)
+	       (when (functionp form)
+		 (setq form (funcall form title author info)))
+	       (when form
+		 (apply #'org-html--build-meta-entry form)))
+	     org-html-meta-tags)))))

 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
--
2.28.0


^ permalink raw reply related	[relevance 45%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2020-09-25 17:48 47%       ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2020-09-25 17:48 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: org-mode-email


@Maintainers I think this is ready for a review.

Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

> My suggestion would be to go with the handling of description in all
> cases, including the title.

Currently the only element handled differently to
`org-html-encode-plain-text' is "author". I don't know why so I don't
want to touch it.

> I added keywords to my OER presentations because some crawlers use
> them to extract topics for classification of documents.  I’d like to
> keep that.

Re-added.

Let me know if there's anything else,

Timothy.

-----
Updated patch below:


From da3878493a8c7097bf44add925696ede86ede661 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Subject: [PATCH] lisp/ox-html.el: make html meta func nicer

* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The opportunity was taken to extract most metadata info to custom
variable `org-html-meta-tags', allowing for easy end-user modification.
---
 lisp/ox-html.el | 115 +++++++++++++++++++++++++++---------------------
 1 file changed, 65 insertions(+), 50 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index d2f24f5c6..6efb76e12 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1425,6 +1425,28 @@ not be modified."
 
 ;;;; Template :: Styles
 
+(defcustom org-html-meta-tags
+  '((lambda (_title author _info)
+      (when (org-string-nw-p author)
+	(list "name" "author" author)))
+    (lambda (_title _author info)
+      (when (org-string-nw-p (plist-get info :description))
+	(list "name" "description"
+				    (plist-get info :description))))
+    ("name" "generator" "Org Mode"))
+  "A list of arguments to be passed to `org-html--build-meta-entry'.
+Each argument can either be an list which is applied, or a function which
+generates such a list with signature (TITLE AUTHOR INFO) where TITLE and AUTHOR
+are strings, and INFO a communication plist."
+  :group 'org-export-html
+  :package-version '(Org . "9.5")
+  :type '(repeat
+	  (choice
+	   (list (string :tag "Meta label")
+		 (string :tag "label value")
+		 (string :tag "Content value"))
+	   function)))
+
 (defcustom org-html-head-include-default-style t
   "Non-nil means include the default style in exported HTML files.
 The actual style is defined in `org-html-style-default' and
@@ -1835,23 +1857,32 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html--build-meta-entry (label identity &optional content-format &rest content-formatters)
+  "Construct <meta> tag with LABEL=\"IDENTITY\" and content from CONTENT-FORMAT and CONTENT-FORMATTER."
+  (concat "<meta "
+	  (format "%s=\"%s" label identity)
+	  (when content-format
+	    (concat "\" content=\""
+		    (replace-regexp-in-string
+		     "\"" "&quot;"
+		     (org-html-encode-plain-text
+		      (if content-formatters
+			  (apply #'format content-format content-formatters)
+			content-format)))))
+	  "\" />\n"))
+
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
-  (let* ((protect-string
-          (lambda (str)
-            (replace-regexp-in-string
-             "\"" "&quot;" (org-html-encode-plain-text str))))
-         (title (org-export-data (plist-get info :title) info))
+  (let* ((title (org-html-encode-plain-text (plist-get info :title) info))
          ;; Set title to an invisible character instead of leaving it
          ;; empty, which is invalid.
          (title (if (org-string-nw-p title) title "&lrm;"))
          (author (and (plist-get info :with-author)
                       (let ((auth (plist-get info :author)))
-			;; Return raw Org syntax.
+         ;; Return raw Org syntax.
                         (and auth (org-element-interpret-data auth)))))
-         (description (plist-get info :description))
-         (keywords (plist-get info :keywords))
+	 (keywords (plist-get info :keywords))
          (charset (or (and org-html-coding-system
                            (fboundp 'coding-system-get)
                            (coding-system-get org-html-coding-system
@@ -1863,50 +1894,34 @@ INFO is a plist used as a communication channel."
 	(concat "<!-- "
 		(plist-get info :html-metadata-timestamp-format)
 		" -->\n")))
-     (format
-      (if (org-html-html5-p info)
-	  (org-html-close-tag "meta" "charset=\"%s\"" info)
-	(org-html-close-tag
-	 "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
-	 info))
-      charset) "\n"
+
+     (if (org-html-html5-p info)
+	 (org-html--build-meta-entry "charset" charset)
+       (org-html--build-meta-entry "http-equiv" "Content-Type"
+				   (concat "text/html;charset=" charset)))
+
      (let ((viewport-options
-	    (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
-			      (plist-get info :html-viewport))))
-       (and viewport-options
-	    (concat
-	     (org-html-close-tag
-	      "meta"
-	      (format "name=\"viewport\" content=\"%s\""
-		      (mapconcat
-		       (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
-		       viewport-options ", "))
-	      info)
-	     "\n")))
+            (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
+                              (plist-get info :html-viewport))))
+       (if viewport-options
+           (org-html--build-meta-entry "name" "viewport"
+                                       (mapconcat
+                                        (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
+                                        viewport-options ", "))))
+
      (format "<title>%s</title>\n" title)
-     (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\"" info)
-     "\n"
-     (and (org-string-nw-p author)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"author\" content=\"%s\""
-				       (funcall protect-string author))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p description)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"description\" content=\"%s\"\n"
-				       (funcall protect-string description))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p keywords)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"keywords\" content=\"%s\""
-				       (funcall protect-string keywords))
-			       info)
-	   "\n")))))
+
+     (when keywords
+       (org-html--build-meta-entry "keywords" keywords))
+
+     (apply #'concat
+	    (mapcar
+	     (lambda (form)
+	       (when (functionp form)
+		 (setq form (funcall form title author info)))
+	       (when form
+		 (apply #'org-html--build-meta-entry form)))
+	     org-html-meta-tags)))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.28.0


^ permalink raw reply related	[relevance 47%]

* Re: [PATCH] org-plot abstractions and extension
  2020-09-15  3:43 10%     ` TEC
@ 2020-09-25 17:51 93%       ` TEC
  2020-10-17  2:12 93%         ` TEC
  0 siblings, 1 reply; 200+ results
From: TEC @ 2020-09-25 17:51 UTC (permalink / raw)
  To: org-mode-email


Hello everyone. Just in case this has slipped through the cracks /
fallen under the radar --- here's a little bump.

Timothy.

TEC <tecosaur@gmail.com> writes:

> Oooops, I've just noticed my patch attachment re-send was only addressed
> to Bastien (maybe this is why I haven't heard anything?).
> This is what I get for mixing mail clients and not paying attention
> I guess 😅.
>
> If someone would be willing to have a look through my work, and comment
> - that would be fantastic.
>
> I'd love to get my code into shape to be merged :)
>
> All the best,
>
> Timothy.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2020-09-27 17:39 46%           ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2020-09-27 17:39 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: org-mode-email


Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

>> Currently the only element handled differently to
>> `org-html-encode-plain-text' is "author". I don't know why so I 
>> don't
>> want to touch it.
>
> I believe that was also the previous conclusion.  However, as 
> this
> is not documented, maybe now could be the chance to change this?

Hmm. Maybe, it sounds like some tests may be in order.

> I must I admit that I do not fully understand your approach.
>
> Why do you treat keywords and description differently (with
> description in org-html-meta-tags and keywords in
> org-html--build-meta-info)?

Ooops, that should have been in org-html-meta-tags as the rest 
are.
[Fixed]

> Why do you pass _title into the lambda expressions in
> org-html-meta-tags when it is never used?  Currently, the 
> variable
> org-html-meta-tags does not seem user-friendly to me.

Title and author just seemed like the most likely useful 
information for
customisation. It would be nice if it looked less boiler-plate-y, 
but
I'm not sure what the best approach for that would be, and it's 
already
miles better than the current.
If you have any ideas, please let me know.

> Also, in org-html--build-meta-info you call
> org-html-encode-plain-text with two arguments, but it just 
> accepts
> one.

? No I don't.

> Best wishes
> Jens

Hope that clarifies things a bit,

Timothy.


------
Moved the keyword in with the rest.



From 889ae918aed267417825d565df9135221dae16b1 Mon Sep 17 00:00:00 
2001
From: TEC <tec@tecosaur.com>
Subject: [PATCH] lisp/ox-html.el: make html meta func nicer

* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The opportunity was taken to extract most metadata info to custom
variable `org-html-meta-tags', allowing for easy end-user 
modification.
---
 lisp/ox-html.el | 114 
 +++++++++++++++++++++++++++---------------------
 1 file changed, 64 insertions(+), 50 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index d2f24f5c6..46195b0e0 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1425,6 +1425,31 @@ not be modified."

 ;;;; Template :: Styles

+(defcustom org-html-meta-tags
+  '((lambda (_title author _info)
+      (when (org-string-nw-p author)
+	(list "name" "author" author)))
+    (lambda (_title _author info)
+      (when (org-string-nw-p (plist-get info :description))
+	(list "name" "description"
+	      (plist-get info :description))))
+    (lambda (_title _author info)
+      (when (org-string-nw-p (plist-get info :keywords))
+	(list "keywords" (plist-get info :keywords))))
+    ("name" "generator" "Org Mode"))
+  "A list of arguments to be passed to 
`org-html--build-meta-entry'.
+Each argument can either be an list which is applied, or a 
function which
+generates such a list with signature (TITLE AUTHOR INFO) where 
TITLE and AUTHOR
+are strings, and INFO a communication plist."
+  :group 'org-export-html
+  :package-version '(Org . "9.5")
+  :type '(repeat
+	  (choice
+	   (list (string :tag "Meta label")
+		 (string :tag "label value")
+		 (string :tag "Content value"))
+	   function)))
+
 (defcustom org-html-head-include-default-style t
   "Non-nil means include the default style in exported HTML 
   files.
 The actual style is defined in `org-html-style-default' and
@@ -1835,23 +1860,31 @@ INFO is a plist used as a communication 
channel."
 \f
 ;;; Template

+(defun org-html--build-meta-entry (label identity &optional 
content-format &rest content-formatters)
+  "Construct <meta> tag with LABEL=\"IDENTITY\" and content from 
CONTENT-FORMAT and CONTENT-FORMATTER."
+  (concat "<meta "
+	  (format "%s=\"%s" label identity)
+	  (when content-format
+	    (concat "\" content=\""
+		    (replace-regexp-in-string
+		     "\"" "&quot;"
+		     (org-html-encode-plain-text
+		      (if content-formatters
+			  (apply #'format content-format content-formatters)
+			content-format)))))
+	  "\" />\n"))
+
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
-  (let* ((protect-string
-          (lambda (str)
-            (replace-regexp-in-string
-             "\"" "&quot;" (org-html-encode-plain-text str))))
-         (title (org-export-data (plist-get info :title) info))
+  (let* ((title (org-html-encode-plain-text (plist-get info 
:title) info))
          ;; Set title to an invisible character instead of 
          leaving it
          ;; empty, which is invalid.
          (title (if (org-string-nw-p title) title "&lrm;"))
          (author (and (plist-get info :with-author)
                       (let ((auth (plist-get info :author)))
-			;; Return raw Org syntax.
+         ;; Return raw Org syntax.
                         (and auth (org-element-interpret-data 
                         auth)))))
-         (description (plist-get info :description))
-         (keywords (plist-get info :keywords))
          (charset (or (and org-html-coding-system
                            (fboundp 'coding-system-get)
                            (coding-system-get 
                            org-html-coding-system
@@ -1863,50 +1896,31 @@ INFO is a plist used as a communication 
channel."
 	(concat "<!-- "
 		(plist-get info :html-metadata-timestamp-format)
 		" -->\n")))
-     (format
-      (if (org-html-html5-p info)
-	  (org-html-close-tag "meta" "charset=\"%s\"" info)
-	(org-html-close-tag
-	 "meta" "http-equiv=\"Content-Type\" 
      content=\"text/html;charset=%s\""
-	 info))
-      charset) "\n"
+
+     (if (org-html-html5-p info)
+	 (org-html--build-meta-entry "charset" charset)
+       (org-html--build-meta-entry "http-equiv" "Content-Type"
+				   (concat "text/html;charset=" charset)))
+
      (let ((viewport-options
-	    (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr 
         cell)))
-			      (plist-get info :html-viewport))))
-       (and viewport-options
-	    (concat
-	     (org-html-close-tag
-	      "meta"
-	      (format "name=\"viewport\" content=\"%s\""
-		      (mapconcat
-		       (lambda (elm) (format "%s=%s" (car elm) (cadr 
                elm)))
-		       viewport-options ", "))
-	      info)
-	     "\n")))
+            (cl-remove-if-not (lambda (cell) (org-string-nw-p 
(cadr cell)))
+                              (plist-get info :html-viewport))))
+       (if viewport-options
+           (org-html--build-meta-entry "name" "viewport"
+                                       (mapconcat
+                                        (lambda (elm) (format 
"%s=%s" (car elm) (cadr elm)))
+                                        viewport-options ", "))))
+
      (format "<title>%s</title>\n" title)
-     (org-html-close-tag "meta" "name=\"generator\" content=\"Org 
      mode\"" info)
-     "\n"
-     (and (org-string-nw-p author)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"author\" content=\"%s\""
-				       (funcall protect-string author))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p description)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"description\" content=\"%s\"\n"
-				       (funcall protect-string description))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p keywords)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"keywords\" content=\"%s\""
-				       (funcall protect-string keywords))
-			       info)
-	   "\n")))))
+
+     (apply #'concat
+	    (mapcar
+	     (lambda (form)
+	       (when (functionp form)
+		 (setq form (funcall form title author info)))
+	       (when form
+		 (apply #'org-html--build-meta-entry form)))
+	     org-html-meta-tags)))))

 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
--
2.28.0


^ permalink raw reply related	[relevance 46%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2020-09-27 18:35 93%               ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2020-09-27 18:35 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: org-mode-email


Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

> On 2020-09-28, TEC wrote:
>
>> Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:
>>> Also, in org-html--build-meta-info you call
>>> org-html-encode-plain-text with two arguments, but it just 
>>> accepts
>>> one.
>>
>> ? No I don't.
>
> Your patch contains this:
>
> +  (let* ((title (org-html-encode-plain-text (plist-get info 
> :title)
> info))

Ohhhh, that's the bit you were referring to. That's just copied 
from the
current state (iirc). Anyway, I dropped the second argument.

Thanks,

Timothy.


^ permalink raw reply	[relevance 93%]

* Re: PATCH: Display point of code block point when confirming evaluation
  @ 2020-09-30  4:57 93%   ` TEC
  0 siblings, 0 replies; 200+ results
From: TEC @ 2020-09-30  4:57 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Jarmo Hurri, emacs-orgmode


Kyle Meyer <kyle@kyleam.com> writes:

> That sounds reasonable to me, and the change looks fine to me. 
> My only
> thought is that perhaps the line number would be friendlier to 
> report,
> but I don't feel strongly about that.

+1 for line numbers

Assuming the current format is something like:
  "Do you want to eval <lang> block at <pos> y/n:"
I'd be in favour of:
  "Do you want to eval <lang> block at <pos> (line <line>) y/n:"
or similar.

All the best,

Timothy.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] org-plot abstractions and extension
  2020-09-25 17:51 93%       ` TEC
@ 2020-10-17  2:12 93%         ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2020-10-17  2:12 UTC (permalink / raw)
  To: org-mode-email


Hello all,

I'm still hoping that someone might get back to me ... eventually,
so here's another bump.

Timothy.

TEC <tecosaur@gmail.com> writes:

> Hello everyone. Just in case this has slipped through the cracks 
> /
> fallen under the radar --- here's a little bump.
>
> Timothy.
>
> TEC <tecosaur@gmail.com> writes:
>
>> Oooops, I've just noticed my patch attachment re-send was only 
>> addressed
>> to Bastien (maybe this is why I haven't heard anything?).
>> This is what I get for mixing mail clients and not paying 
>> attention
>> I guess 😅.
>>
>> If someone would be willing to have a look through my work, and 
>> comment
>> - that would be fantastic.
>>
>> I'd love to get my code into shape to be merged :)
>>
>> All the best,
>>
>> Timothy.



^ permalink raw reply	[relevance 93%]

* Re: [PATCH] org-plot abstractions and extension
  @ 2020-10-24 18:16  8%             ` TEC
  2020-12-09  2:58 93%               ` TEC
    0 siblings, 2 replies; 200+ results
From: TEC @ 2020-10-24 18:16 UTC (permalink / raw)
  To: Bastien; +Cc: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 581 bytes --]


Bastien <bzg@gnu.org> writes:

> I'm not an org-plot.el user so I cannot test, but by reading the
> patches, they look okay.
>
> Let's go in "optimistic merging" mode and commit your patches?

Sounds good then. I don't expect the changes to compromise any 
existing
functionality.

> Is https://orgmode.org/list/87lfhbhfhe.fsf@gmail.com/ the latest
> version I should use?

I've smoothed a rough edge or two, and added a documentation 
entry.

I'll attach all the patches to this email, so there's no 
ambiguity.
(crosses fingers for attachments working as expected)

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-plot.el-make-indentation-method-consistent.patch --]
[-- Type: text/x-patch, Size: 1467 bytes --]

From 3743e507775b446f5f8188958c20f65861fac3fb Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 8 Jul 2020 18:34:46 +0800
Subject: [PATCH 01/15] org-plot.el: make indentation method consistent

* lisp/org-plot.el (org-plot/gnuplot): Make indentation consistent, by
replacing a few spaces with tabs.

Only 6 of 347 lines used spaces instead of tabs.
---
 lisp/org-plot.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 0ff96af67..c08bc144e 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -325,12 +325,12 @@ line directly before or after the table."
       (with-temp-buffer
 	(if (plist-get params :script)	; user script
 	    (progn (insert
-                    (org-plot/gnuplot-script data-file num-cols params t))
-                   (insert "\n")
-                   (insert-file-contents (plist-get params :script))
-                   (goto-char (point-min))
-                   (while (re-search-forward "\\$datafile" nil t)
-                     (replace-match data-file nil nil)))
+		    (org-plot/gnuplot-script data-file num-cols params t))
+		   (insert "\n")
+		   (insert-file-contents (plist-get params :script))
+		   (goto-char (point-min))
+		   (while (re-search-forward "\\$datafile" nil t)
+		     (replace-match data-file nil nil)))
 	  (insert (org-plot/gnuplot-script data-file num-cols params)))
 	;; Graph table.
 	(gnuplot-mode)
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-org-plot.el-add-new-option-transpose.patch --]
[-- Type: text/x-patch, Size: 3084 bytes --]

From c62e817b04dfbe624ee8b2090ebcde257bbd3f23 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 8 Jul 2020 19:26:07 +0800
Subject: [PATCH 02/15] org-plot.el: add new option :transpose

* lisp/org-plot.el (org-plot/add-options-to-plist,
org-plot/add-options-to-plist): Add a new option :transpose, and a
shorter alias :trans. Transposition is performed if the argument is yes,
y, or t.  This treats the table as a matrix and performs matrix
transposition on it.  If an hline is present, it is assumed that it is a
marks a separation from a first header row.  The first row is then
treated as the new header by inserting a hline in the transposed data.
This is quite useful for some plots, where across multiple categories,
there are a large number of data points.  Without this, the data points
would be columns and the table can spread irritatingly wide.
---
 lisp/org-plot.el | 44 +++++++++++++++++++++++++++++---------------
 1 file changed, 29 insertions(+), 15 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index c08bc144e..6ff633130 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -50,19 +50,21 @@
   "Parse an OPTIONS line and set values in the property list P.
 Returns the resulting property list."
   (when options
-    (let ((op '(("type"    . :plot-type)
-		("script"  . :script)
-		("line"    . :line)
-		("set"     . :set)
-		("title"   . :title)
-		("ind"     . :ind)
-		("deps"    . :deps)
-		("with"    . :with)
-		("file"    . :file)
-		("labels"  . :labels)
-		("map"     . :map)
-		("timeind" . :timeind)
-		("timefmt" . :timefmt)))
+    (let ((op '(("type"      . :plot-type)
+		("script"    . :script)
+		("line"      . :line)
+		("set"       . :set)
+		("title"     . :title)
+		("ind"       . :ind)
+		("deps"      . :deps)
+		("with"      . :with)
+		("file"      . :file)
+		("labels"    . :labels)
+		("map"       . :map)
+		("timeind"   . :timeind)
+		("timefmt"   . :timefmt)
+		("trans"     . :transpose)
+		("transpose" . :transpose)))
 	  (multiples '("set" "line"))
 	  (regexp ":\\([\"][^\"]+?[\"]\\|[(][^)]+?[)]\\|[^ \t\n\r;,.]*\\)")
 	  (start 0))
@@ -289,8 +291,20 @@ line directly before or after the table."
 	(setf params (plist-put params (car pair) (cdr pair)))))
     ;; collect table and table information
     (let* ((data-file (make-temp-file "org-plot"))
-	   (table (org-table-collapse-header (org-table-to-lisp)))
-	   (num-cols (length (car table))))
+	   (table (let ((tbl (org-table-to-lisp)))
+		    (when (pcase (plist-get params :transpose)
+			    ('y   t)
+			    ('yes t)
+			    ('t   t))
+		      (if (memq 'hline tbl)
+			  (setq tbl (apply #'cl-mapcar #'list tbl))
+			;; When present, remove hlines as they can't (currentily) be easily transposed.
+			(setq tbl (apply #'cl-mapcar #'list
+					 (remove 'hline tbl)))
+			(push 'hline (cdr tbl))))
+		    tbl))
+	   (num-cols (length (if (eq (nth 0 table) 'hline) (nth 1 table)
+			       (nth 0 table)))))
       (run-with-idle-timer 0.1 nil #'delete-file data-file)
       (when (eq (cadr table) 'hline)
 	(setf params
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-org-plot.el-add-new-custom-gnuplot-preamble.patch --]
[-- Type: text/x-patch, Size: 2013 bytes --]

From fc7f4015c726e4a685002e8d69fad1eb1d605790 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 8 Jul 2020 22:26:21 +0800
Subject: [PATCH 03/15] org-plot.el: add new custom gnuplot preamble

* lisp/org-plot.el: Define new custom variable
`org-plot/gnuplot-script-preamble' which can be either a string or a
function.  The value of this (when executed, in the case of the
function) is inserted near the top of the generated gnuplot script.
(org-plot/gnuplot-script): Use the new variable
`org-plot/gnuplot-script-preamble' in the manner described.

This allows for the user to set the font/colour-scheme, default
precision, and much more.
---
 lisp/org-plot.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 6ff633130..f8db45273 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -181,6 +181,13 @@ and dependent variables."
 	  (setf back-edge "") (setf front-edge ""))))
     row-vals))
 
+(defcustom org-plot/gnuplot-script-preamble ""
+  "String or function which provides content to be inserted into the GNUPlot
+script before the plot command. Not that this is in addition to, not instead of
+other content generated in `org-plot/gnuplot-script'."
+  :group 'org-plot
+  :type '(choice string function))
+
 (defun org-plot/gnuplot-script (data-file num-cols params &optional preface)
   "Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
 NUM-COLS controls the number of columns plotted in a 2-d plot.
@@ -213,6 +220,12 @@ manner suitable for prepending to a user-specified script."
     (when file				; output file
       (funcall ats (format "set term %s" (file-name-extension file)))
       (funcall ats (format "set output '%s'" file)))
+
+    (funcall ats
+	     (if (stringp org-plot/gnuplot-script-preamble)
+		 org-plot/gnuplot-script-preamble
+	       (org-plot/gnuplot-script-preamble)))
+
     (pcase type				; type
       (`2d ())
       (`3d (when map (funcall ats "set map")))
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-org-plot.el-abstract-plot-types-into-custom-var.patch --]
[-- Type: text/x-patch, Size: 4470 bytes --]

From fc1ecf42cd8d0d27cda98ced2c2be365ad305df7 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 9 Jul 2020 04:27:18 +0800
Subject: [PATCH 04/15] org-plot.el: abstract plot types into custom var

* lisp/org-plot.el (org-plot/gnuplot-script): Abstract the generation of
gnuplot commands from the three hardcoded types: 2d, 3d, and grid.
A new custom variable `org-plot/preset-plot-types' is defined to declare
plot types and provide a lambda which is called with a fixed signature
to generate associated gnuplot code.  The previously hardcoded types are
implemented as the default value.

By extracting these types to a custom variable, users are able to create
their own presets for frequently used setups. Note that while this moves
the most significant hardcoding of the 2d, 3d, and grid types in
`org-plot/gnuplot-script', there are still a few minor fragments that I
am not sure how to best address --- yet.
---
 lisp/org-plot.el | 71 ++++++++++++++++++++++++++++++++----------------
 1 file changed, 48 insertions(+), 23 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index f8db45273..207f5d4af 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -188,6 +188,49 @@ other content generated in `org-plot/gnuplot-script'."
   :group 'org-plot
   :type '(choice string function))
 
+(defcustom org-plot/preset-plot-types
+  '((2d (lambda (data-file num-cols params plot-str)
+	  (let* ((type (plist-get params :plot-type))
+		 (with (if (eq type 'grid) 'pm3d (plist-get params :with)))
+		 (ind (plist-get params :ind))
+		 (deps (if (plist-member params :deps) (plist-get params :deps)))
+		 (text-ind (plist-get params :textind))
+		 (col-labels (plist-get params :labels))
+		 res)
+	    (dotimes (col num-cols res)
+	      (unless (and (eq type '2d)
+			   (or (and ind (equal (1+ col) ind))
+			       (and deps (not (member (1+ col) deps)))))
+		(setf res
+		      (cons
+		       (format plot-str data-file
+			       (or (and ind (> ind 0)
+					(not text-ind)
+					(format "%d:" ind)) "")
+			       (1+ col)
+			       (if text-ind (format ":xticlabel(%d)" ind) "")
+			       with
+			       (or (nth col col-labels)
+				   (format "%d" (1+ col))))
+		       res)))))))
+    (3d (lambda (data-file num-cols params plot-str)
+	  (let* ((type (plist-get params :plot-type))
+		 (with (if (eq type 'grid) 'pm3d (plist-get params :with))))
+	    (list (format "'%s' matrix with %s title ''"
+			  data-file with)))))
+    (grid (lambda (data-file num-cols params plot-str)
+	    (let* ((type (plist-get params :plot-type))
+		   (with (if (eq type 'grid) 'pm3d (plist-get params :with))))
+	    (list (format "'%s' with %s title ''"
+			  data-file with))))))
+  "List of plot presets with the type name as the car, and a function
+which yeilds plot-lines (a list of strings) as the cdr.
+The parameters of `org-plot/gnuplot-script' and PLOT-STR are passed to
+that function. i.e. it is called with the following arguments:
+  DATA-FILE NUM-COLS PARAMS PLOT-STR"
+  :group 'org-plot
+  :type '(alist :value-type (symbol group)))
+
 (defun org-plot/gnuplot-script (data-file num-cols params &optional preface)
   "Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
 NUM-COLS controls the number of columns plotted in a 2-d plot.
@@ -254,29 +297,11 @@ manner suitable for prepending to a user-specified script."
 			   (or timefmt	; timefmt passed to gnuplot
 			       "%Y-%m-%d-%H:%M:%S") "\"")))
     (unless preface
-      (pcase type			; plot command
-	(`2d (dotimes (col num-cols)
-	       (unless (and (eq type '2d)
-			    (or (and ind (equal (1+ col) ind))
-				(and deps (not (member (1+ col) deps)))))
-		 (setf plot-lines
-		       (cons
-			(format plot-str data-file
-				(or (and ind (> ind 0)
-					 (not text-ind)
-					 (format "%d:" ind)) "")
-				(1+ col)
-				(if text-ind (format ":xticlabel(%d)" ind) "")
-				with
-				(or (nth col col-labels)
-				    (format "%d" (1+ col))))
-			plot-lines)))))
-	(`3d
-	 (setq plot-lines (list (format "'%s' matrix with %s title ''"
-					data-file with))))
-	(`grid
-	 (setq plot-lines (list (format "'%s' with %s title ''"
-					data-file with)))))
+      (let ((type-func (cadr (assoc type org-plot/preset-plot-types))))
+	(when type-func
+	  (setq plot-lines
+		(funcall type-func data-file num-cols params plot-str))))
+
       (funcall ats
 	       (concat plot-cmd " " (mapconcat #'identity
 					       (reverse plot-lines)
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-org-plot.el-add-utility-functions-for-range-ticks.patch --]
[-- Type: text/x-patch, Size: 6285 bytes --]

From d99a61170bb0ff10b9fc7b99cdc957ec574c1e51 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 9 Jul 2020 04:47:40 +0800
Subject: [PATCH 05/15] org-plot.el: add utility functions for range,ticks

* lisp/org-plot.el (org-plot/add-options-to-plist): Add the options :ymin
:ymax :xmin :xmax, as well as :min and :max as aliases to the y{min,max}
options.  The :ticks option is also added, for specifying how many ticks
should be used.
(org--plot/values-stats, org--plot/sensible-tick-num,
org--plot/nice-frequency-pick, org--plot/merge-alists,
org--plot/item-frequencies, org--plot/prime-factors): New utility
functions added to allow for somewhat sensible determination of a :ticks
value when none is provided.  This turns out to be harder than expected,
and so a number of functions are used to attempt to do so.  The essence
of the method used, is to round values and find their prime
decompositions.  From this we try to select the most common components
to give a reasonable step size.  We also add a 'ticks' parameter for
manually setting the number of ticks, and (y)min/max parameters
similarly.
---
 lisp/org-plot.el | 100 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 100 insertions(+)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 207f5d4af..2a9c0f5bd 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -63,6 +63,11 @@ Returns the resulting property list."
 		("map"       . :map)
 		("timeind"   . :timeind)
 		("timefmt"   . :timefmt)
+		("min"       . :ymin)
+		("max"       . :ymax)
+		("ymin"      . :ymin)
+		("xmax"      . :xmax)
+		("ticks"     . :ticks)
 		("trans"     . :transpose)
 		("transpose" . :transpose)))
 	  (multiples '("set" "line"))
@@ -181,6 +186,101 @@ and dependent variables."
 	  (setf back-edge "") (setf front-edge ""))))
     row-vals))
 
+(defun org--plot/values-stats (nums &optional hard-min hard-max)
+  "From a list of NUMS return a plist containing some rudamentry statistics on the
+values, namely regarding the range."
+  (let* ((minimum (or hard-min (apply #'min nums)))
+	 (maximum (or hard-max (apply #'max nums)))
+	 (range (- maximum minimum))
+	 (rangeOrder (ceiling (- 1 (log10 range))))
+	 (range-factor (expt 10 rangeOrder))
+	 (nice-min (/ (float (floor (* minimum range-factor))) range-factor))
+	 (nice-max (/ (float (ceiling (* maximum range-factor))) range-factor)))
+    `(:min ,minimum :max ,maximum :range ,range
+      :range-factor ,range-factor
+      :nice-min ,nice-min :nice-max ,nice-max :nice-range ,(- nice-max nice-min))))
+
+(defun org--plot/sensible-tick-num (table &optional hard-min hard-max)
+  "From a the values in a TABLE of data, attempt to guess an appropriate number of ticks."
+  (let* ((row-data
+	  (mapcar (lambda (row) (org--plot/values-stats
+			    (mapcar #'string-to-number (cdr row))
+			    hard-min
+			    hard-max)) table))
+	 (row-normalised-ranges (mapcar (lambda (r-data)
+					  (let ((val (round (*
+							     (plist-get r-data :range-factor)
+							     (plist-get r-data :nice-range)))))
+					    (if (= (% val 10) 0) (/ val 10) val)))
+					row-data))
+	 (range-prime-decomposition (mapcar #'org--plot/prime-factors row-normalised-ranges))
+	 (weighted-factors (sort (apply #'org--plot/merge-alists #'+ 0
+					(mapcar (lambda (factors) (org--plot/item-frequencies factors t))
+						range-prime-decomposition))
+				 (lambda (a b) (> (cdr a) (cdr b))))))
+    (apply #'* (org--plot/nice-frequency-pick weighted-factors))))
+
+(defun org--plot/nice-frequency-pick (frequencies)
+  "From a list of frequences, try to sensibly pick a sample of the most frequent."
+  ;; TODO this mosly works decently, but counld do with some tweaking to work more consistently.
+  (case (length frequencies)
+    (1 (list (car (nth 0 frequencies))))
+    (2 (if (<= 3 (/ (cdr (nth 0 frequencies))
+		    (cdr (nth 1 frequencies))))
+	   (make-list 2
+		      (car (nth 0 frequencies)))
+	 (list (car (nth 0 frequencies))
+	       (car (nth 1 frequencies)))))
+    (t
+     (let* ((total-count (apply #'+ (mapcar #'cdr frequencies)))
+	    (n-freq (mapcar (lambda (freq) `(,(car freq) . ,(/ (float (cdr freq)) total-count))) frequencies))
+	    (f-pick (list (car (car n-freq))))
+	    (1-2-ratio (/ (cdr (nth 0 n-freq))
+			  (cdr (nth 1 n-freq))))
+	    (2-3-ratio (/ (cdr (nth 1 n-freq))
+			  (cdr (nth 2 n-freq))))
+	    (1-3-ratio (* 1-2-ratio 2-3-ratio))
+	    (1-val (car (nth 0 n-freq)))
+	    (2-val (car (nth 1 n-freq)))
+	    (3-val (car (nth 2 n-freq))))
+       (when (> 1-2-ratio 4) (push 1-val f-pick))
+       (when (and (< 1-2-ratio 2-val)
+		  (< (* (apply #'* f-pick) 2-val) 30))
+	 (push 2-val f-pick))
+       (when (and (< 1-3-ratio 3-val)
+		  (< (* (apply #'* f-pick) 3-val) 30))
+	 (push 3-val f-pick))
+       f-pick))))
+
+(defun org--plot/merge-alists (function default alist1 alist2 &rest alists)
+  "Using FUNCTION, combine the elements of all given ALISTS. When an element is
+only present in one alist, DEFAULT is used as the second argument for the FUNCTION."
+  (when (> (length alists) 0)
+    (setq alist2 (apply #'org--plot/merge-alists function default alist2 alists)))
+  (flet ((keys (alist) (mapcar #'car alist))
+	 (lookup (key alist) (or (cdr (assoc key alist)) default)))
+    (loop with keys = (union (keys alist1) (keys alist2) :test 'equal)
+	  for k in keys collect
+	  (cons k (funcall function (lookup k alist1) (lookup k alist2))))))
+
+(defun org--plot/item-frequencies (values &optional normalise)
+  "Return an alist indicating the frequency of values in VALUES list."
+  (let ((normaliser (if normalise (float (length values)) 1)))
+    (cl-loop for (n . m) in (seq-group-by #'identity values)
+	     collect (cons n (/ (length m) normaliser)))))
+
+(defun org--plot/prime-factors (value)
+  "Return the prime decomposition of VALUE, e.g. for 12, '(3 2 2)"
+  (let ((factors '(1)) (i 1))
+    (while (/= 1 value)
+      (setq i (1+ i))
+      (when (eq 0 (% value i))
+	(push i factors)
+	(setq value (/ value i))
+	(setq i (1- i))
+	))
+    (subseq factors 0 -1)))
+
 (defcustom org-plot/gnuplot-script-preamble ""
   "String or function which provides content to be inserted into the GNUPlot
 script before the plot command. Not that this is in addition to, not instead of
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-org-plot.el-add-custom-var-for-affecting-the-term.patch --]
[-- Type: text/x-patch, Size: 2034 bytes --]

From 26c09d431030bacfc5a4ce84103b2eca186b2229 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 9 Jul 2020 05:00:03 +0800
Subject: [PATCH 06/15] org-plot.el: add custom var for affecting the term

* lisp/org-plot.el (org-plot/gnuplot-script): Allow for customisation of
org-plot's term by adding a custom variable
`org-plot/gnuplot-term-extra' which allows the user to tweak the gnuplot
term settings.  This allows for setting characteristics such as default
size, or background colour.
---
 lisp/org-plot.el | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 2a9c0f5bd..ed4cea195 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -331,6 +331,13 @@ that function. i.e. it is called with the following arguments:
   :group 'org-plot
   :type '(alist :value-type (symbol group)))
 
+(defcustom org-plot/gnuplot-term-extra ""
+  "String or function which provides the extra term options.
+E.g. a value of \"size 1050,650\" would cause
+\"set term ... size 1050,650\" to be used."
+  :group 'org-plot
+  :type '(choice string function))
+
 (defun org-plot/gnuplot-script (data-file num-cols params &optional preface)
   "Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
 NUM-COLS controls the number of columns plotted in a 2-d plot.
@@ -360,8 +367,15 @@ manner suitable for prepending to a user-specified script."
 	 ;; ats = add-to-script
 	 (ats (lambda (line) (setf script (concat script "\n" line))))
 	 plot-lines)
-    (when file				; output file
-      (funcall ats (format "set term %s" (file-name-extension file)))
+
+
+    ;; handle output file, background, and size
+    (funcall ats (format "set term %s %s"
+			 (if file (file-name-extension file) "GNUTERM")
+			 (if (stringp org-plot/gnuplot-term-extra)
+			     org-plot/gnuplot-term-extra
+			   (org-plot/gnuplot-term-extra))))
+    (when file ; output file
       (funcall ats (format "set output '%s'" file)))
 
     (funcall ats
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0007-org-plot.el-tweak-term-preamble-custom-vars.patch --]
[-- Type: text/x-patch, Size: 2287 bytes --]

From 5a1b9ff8f3ba5be565828137460023cd39194b6c Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 9 Jul 2020 05:05:20 +0800
Subject: [PATCH 07/15] org-plot.el: tweak term, preamble custom vars

* lisp/org-plot.el (org-plot/gnuplot-script): Call the term and preamble
functions (mentioned below) with the plot type as the argument.
(org-plot/gnuplot-script-preamble, org-plot/gnuplot-term-extra): update
docstring.
---
 lisp/org-plot.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index ed4cea195..52422ea2f 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -284,7 +284,8 @@ only present in one alist, DEFAULT is used as the second argument for the FUNCTI
 (defcustom org-plot/gnuplot-script-preamble ""
   "String or function which provides content to be inserted into the GNUPlot
 script before the plot command. Not that this is in addition to, not instead of
-other content generated in `org-plot/gnuplot-script'."
+other content generated in `org-plot/gnuplot-script'.
+If a function, it is called with the plot type as the argument."
   :group 'org-plot
   :type '(choice string function))
 
@@ -334,7 +335,8 @@ that function. i.e. it is called with the following arguments:
 (defcustom org-plot/gnuplot-term-extra ""
   "String or function which provides the extra term options.
 E.g. a value of \"size 1050,650\" would cause
-\"set term ... size 1050,650\" to be used."
+\"set term ... size 1050,650\" to be used.
+If a function, it is called with the plot type as the argument."
   :group 'org-plot
   :type '(choice string function))
 
@@ -374,14 +376,14 @@ manner suitable for prepending to a user-specified script."
 			 (if file (file-name-extension file) "GNUTERM")
 			 (if (stringp org-plot/gnuplot-term-extra)
 			     org-plot/gnuplot-term-extra
-			   (org-plot/gnuplot-term-extra))))
+			   (org-plot/gnuplot-term-extra type))))
     (when file ; output file
       (funcall ats (format "set output '%s'" file)))
 
     (funcall ats
 	     (if (stringp org-plot/gnuplot-script-preamble)
 		 org-plot/gnuplot-script-preamble
-	       (org-plot/gnuplot-script-preamble)))
+	       (org-plot/gnuplot-script-preamble type)))
 
     (pcase type				; type
       (`2d ())
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #9: 0008-org-plot.el-add-radar-plot-type.patch --]
[-- Type: text/x-patch, Size: 6388 bytes --]

From 3e9338962a4af033bd56e8ab7a1abe5e636d71c5 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 9 Jul 2020 05:21:44 +0800
Subject: [PATCH 08/15] org-plot.el: add radar plot type

* lisp/org-plot.el (org--plot/radar): Implement a new plot type "radar".
(org--plot/radar-template): A huge template sting for `org-plot/radar'.
(org--plot/radar-ticks, org--plot/radar-setup-template): Smaller
template strings for use in `org-plot/radar'.
(org-plot/preset-plot-types): Add the new "radar" type to the list of
default types.

The radar type has a long and complex implementation, but that's exactly
what makes it perfect for something like this. A complex plot can be
produced with a simple keyword in the #+PLOT options. There are still a
few kinks that would benefit from being ironed out, but the current
state is fully-functional.
---
 lisp/org-plot.el | 138 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 137 insertions(+), 1 deletion(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 52422ea2f..fd92a12a1 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -323,7 +323,9 @@ If a function, it is called with the plot type as the argument."
 	    (let* ((type (plist-get params :plot-type))
 		   (with (if (eq type 'grid) 'pm3d (plist-get params :with))))
 	    (list (format "'%s' with %s title ''"
-			  data-file with))))))
+			  data-file with)))))
+    (radar (lambda (data-file num-cols params plot-str)
+	     (list (org--plot/radar table params)))))
   "List of plot presets with the type name as the car, and a function
 which yeilds plot-lines (a list of strings) as the cdr.
 The parameters of `org-plot/gnuplot-script' and PLOT-STR are passed to
@@ -332,6 +334,140 @@ that function. i.e. it is called with the following arguments:
   :group 'org-plot
   :type '(alist :value-type (symbol group)))
 
+(defvar org--plot/radar-template
+  "### spider plot/chart with gnuplot
+# also known as: radar chart, web chart, star chart, cobweb chart,
+#                radar plot,  web plot,  star plot,  cobweb plot,  etc. ...
+set datafile separator ' '
+set size square
+unset tics
+set angles degree
+set key bmargin center horizontal
+unset border
+
+# Load data and settup
+load \"%s\"
+
+# General settings
+DataColCount = words($Data[1])-1
+AxesCount = |$Data|-HeaderLines
+AngleOffset = 90
+Max = 1
+d=0.1*Max
+Direction = -1   # counterclockwise=1, clockwise = -1
+
+# Tic settings
+TicCount = %s
+TicOffset = 0.1
+TicValue(axis,i) = real(i)*(word($Settings[axis],3)-word($Settings[axis],2)) \\
+	  / word($Settings[axis],4)+word($Settings[axis],2)
+TicLabelPosX(axis,i) = PosX(axis,i/TicCount) + PosY(axis, TicOffset)
+TicLabelPosY(axis,i) = PosY(axis,i/TicCount) - PosX(axis, TicOffset)
+TicLen = 0.03
+TicdX(axis,i) = 0.5*TicLen*cos(alpha(axis)-90)
+TicdY(axis,i) = 0.5*TicLen*sin(alpha(axis)-90)
+
+# Label
+LabOffset = 0.10
+LabX(axis) = PosX(axis+1,Max+2*d) + PosY(axis, LabOffset)
+LabY(axis) = PosY($0+1,Max+2*d)
+
+# Functions
+alpha(axis) = (axis-1)*Direction*360.0/AxesCount+AngleOffset
+PosX(axis,R) = R*cos(alpha(axis))
+PosY(axis,R) = R*sin(alpha(axis))
+Scale(axis,value) = real(value-word($Settings[axis],2))/(word($Settings[axis],3)-word($Settings[axis],2))
+
+# Spider settings
+set style arrow 1 dt 1 lw 1.0 @fgal head filled size 0.06,25     # style for axes
+set style arrow 2 dt 2 lw 0.5 @fgal nohead   # style for weblines
+set style arrow 3 dt 1 lw 1 @fgal nohead     # style for axis tics
+set samples AxesCount
+set isosamples TicCount
+set urange[1:AxesCount]
+set vrange[1:TicCount]
+set style fill transparent solid 0.2
+
+set xrange[-Max-4*d:Max+4*d]
+set yrange[-Max-4*d:Max+4*d]
+plot \\
+    '+' u (0):(0):(PosX($0,Max+d)):(PosY($0,Max+d)) w vec as 1 not, \\
+    $Data u (LabX($0)): \\
+	(LabY($0)):1 every ::HeaderLines w labels center enhanced @fgt not, \\
+    for [i=1:DataColCount] $Data u (PosX($0+1,Scale($0+1,column(i+1)))): \\
+	(PosY($0+1,Scale($0+1,column(i+1)))) every ::HeaderLines w filledcurves lt i title word($Data[1],i+1), \\
+%s
+#    '++' u (PosX($1,$2/TicCount)-TicdX($1,$2/TicCount)): \\
+#        (PosY($1,$2/TicCount)-TicdY($1,$2/TicCount)): \\
+#        (2*TicdX($1,$2/TicCount)):(2*TicdY($1,$2/TicCount)) \\
+#        w vec as 3 not, \\
+### end of code
+")
+
+(defvar org--plot/radar-ticks
+  "    '++' u (PosX($1,$2/TicCount)):(PosY($1,$2/TicCount)): \\
+	(PosX($1+1,$2/TicCount)-PosX($1,$2/TicCount)):  \\
+	(PosY($1+1,$2/TicCount)-PosY($1,$2/TicCount)) w vec as 2 not, \\
+    '++' u (TicLabelPosX(%s,$2)):(TicLabelPosY(%s,$2)): \\
+	(sprintf('%%g',TicValue(%s,$2))) w labels font ',8' @fgat not")
+
+(defvar org--plot/radar-setup-template
+  "# Data
+$Data <<HEREHAVESOMEDATA
+%s
+HEREHAVESOMEDATA
+HeaderLines = 1
+
+# Settings for scale and offset adjustments
+# axis min max tics axisLabelXoff axisLabelYoff
+$Settings <<EOD
+%s
+EOD
+")
+
+(defun org--plot/radar (table params)
+  (let* ((data
+	  (concat "\"" (s-join "\" \"" (plist-get params :labels)) "\""
+		  "\n"
+		  (s-join "\n"
+			  (mapcar (lambda (row)
+				    (format
+				     "\"%s\" %s"
+				     (car row)
+				     (s-join " " (cdr row))))
+				  table))))
+	 (ticks (or (plist-get params :ticks)
+		    (org--plot/sensible-tick-num table
+						 (plist-get params :ymin)
+						 (plist-get params :ymax))))
+	 (settings
+	  (s-join "\n"
+		  (mapcar (lambda (row)
+			    (let ((data (org--plot/values-stats
+					 (mapcar #'string-to-number (cdr row)))))
+			      (format
+			       "\"%s\" %s %s %s"
+			       (car row)
+			       (or (plist-get params :ymin)
+				   (plist-get data :nice-min))
+			       (or (plist-get params :ymax)
+				   (plist-get data :nice-max))
+			       (if (eq ticks 0) 2 ticks)
+			       )))
+			  table)))
+	 (setup-file (make-temp-file "org-plot-setup")))
+    (f-write-text (format org--plot/radar-setup-template data settings)
+		  'utf-8 setup-file)
+    (format org--plot/radar-template
+	    setup-file
+	    (if (eq ticks 0) 2 ticks)
+	    (if (eq ticks 0) ""
+	      (apply #'format org--plot/radar-ticks
+		     (make-list 3 (if (and (plist-get params :ymin)
+					   (plist-get params :ymax))
+				      ;; FIXME multi-drawing of tick labels with "1"
+				      "1" "$1")))))))
+
 (defcustom org-plot/gnuplot-term-extra ""
   "String or function which provides the extra term options.
 E.g. a value of \"size 1050,650\" would cause
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #10: 0009-org-plot.el-fix-logic-error-in-transposition.patch --]
[-- Type: text/x-patch, Size: 1668 bytes --]

From 8b1ed7fb3cc418bb90fe48d3c4c8cb711decfded Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 30 Jul 2020 18:25:19 +0800
Subject: [PATCH 09/15] org-plot.el: fix logic error in transposition

* lisp/org-plot.el (org-plot/gnuplot): If statement in transposition
treated condition as its negative, to fix this the condition was
inverted.
It was also noticed that the code could not operate as expected as the
user-supplied #+plot options were not fetched. Resolved by re-inserting
relevant code from an older version of org-plot.
---
 lisp/org-plot.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index fd92a12a1..1b227d698 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -579,6 +579,10 @@ line directly before or after the table."
     (dolist (pair org-plot/gnuplot-default-options)
       (unless (plist-member params (car pair))
 	(setf params (plist-put params (car pair) (cdr pair)))))
+    ;; Collect options.
+    (save-excursion (while (and (equal 0 (forward-line -1))
+				(looking-at "[[:space:]]*#\\+"))
+		      (setf params (org-plot/collect-options params))))
     ;; collect table and table information
     (let* ((data-file (make-temp-file "org-plot"))
 	   (table (let ((tbl (org-table-to-lisp)))
@@ -586,7 +590,7 @@ line directly before or after the table."
 			    ('y   t)
 			    ('yes t)
 			    ('t   t))
-		      (if (memq 'hline tbl)
+		      (if (not (memq 'hline tbl))
 			  (setq tbl (apply #'cl-mapcar #'list tbl))
 			;; When present, remove hlines as they can't (currentily) be easily transposed.
 			(setq tbl (apply #'cl-mapcar #'list
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #11: 0010-org-plot.el-complete-transition-to-softcoded-type.patch --]
[-- Type: text/x-patch, Size: 13498 bytes --]

From bcd45c562966a893449d2412b363f31368ee5983 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 30 Jul 2020 18:36:11 +0800
Subject: [PATCH 10/15] org-plot.el: complete transition to softcoded type

* lisp/org-plot.el (org-plot/preset-plot-types): Adapt structure to
cover all type-specific logic within org-plot.
(org-plot/gnuplot-script, org-plot/gnuplot): Replace type-specific logic
with references to properties of the type from
`org-plot/preset-plot-types'.
---
 lisp/org-plot.el | 242 ++++++++++++++++++++++++++++-------------------
 1 file changed, 143 insertions(+), 99 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 1b227d698..53186bb75 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -290,7 +290,10 @@ If a function, it is called with the plot type as the argument."
   :type '(choice string function))
 
 (defcustom org-plot/preset-plot-types
-  '((2d (lambda (data-file num-cols params plot-str)
+  '((2d :plot-cmd "plot"
+	:check-ind-type t
+	:plot-func
+	(lambda (_table data-file num-cols params plot-str)
 	  (let* ((type (plist-get params :plot-type))
 		 (with (if (eq type 'grid) 'pm3d (plist-get params :with)))
 		 (ind (plist-get params :ind))
@@ -314,23 +317,60 @@ If a function, it is called with the plot type as the argument."
 			       (or (nth col col-labels)
 				   (format "%d" (1+ col))))
 		       res)))))))
-    (3d (lambda (data-file num-cols params plot-str)
+    (3d :plot-cmd "splot"
+	:plot-pre (lambda (_table _data-file _num-cols params _plot-str)
+		    (if (plist-get params :map) "set map"))
+	:plot-func
+	(lambda (_table data-file _num-cols params _plot-str)
 	  (let* ((type (plist-get params :plot-type))
 		 (with (if (eq type 'grid) 'pm3d (plist-get params :with))))
 	    (list (format "'%s' matrix with %s title ''"
 			  data-file with)))))
-    (grid (lambda (data-file num-cols params plot-str)
+    (grid :plot-cmd "splot"
+	  :plot-pre (lambda (_table _data-file _num-cols params _plot-str)
+		      (if (plist-get params :map) "set pm3d map" "set map"))
+	  :data-dump (lambda (table data-file params _num-cols)
+		       (let ((y-labels (org-plot/gnuplot-to-grid-data
+					table data-file params)))
+			 (when y-labels (plist-put params :ylabels y-labels))))
+	  :plot-func
+	  (lambda (table data-file _num-cols params _plot-str)
 	    (let* ((type (plist-get params :plot-type))
 		   (with (if (eq type 'grid) 'pm3d (plist-get params :with))))
-	    (list (format "'%s' with %s title ''"
-			  data-file with)))))
-    (radar (lambda (data-file num-cols params plot-str)
+	      (list (format "'%s' with %s title ''"
+			    data-file with)))))
+    (radar :plot-func
+	   (lambda (table _data-file _num-cols params plot-str)
 	     (list (org--plot/radar table params)))))
-  "List of plot presets with the type name as the car, and a function
-which yeilds plot-lines (a list of strings) as the cdr.
-The parameters of `org-plot/gnuplot-script' and PLOT-STR are passed to
-that function. i.e. it is called with the following arguments:
-  DATA-FILE NUM-COLS PARAMS PLOT-STR"
+  "List of plists describing the avalible plot types.
+The car is the type name, and the property :plot-func must be set.
+The value of :plot-func is a lambda which yields plot-lines
+(a list of strings) as the cdr.
+
+All lambda functions have the parameters of `org-plot/gnuplot-script' and PLOT-STR passed to them.
+i.e. they are called with the following signature: (TABLE DATA-FILE NUM-COLS PARAMS PLOT-STR)
+
+Potentially useful parameters in PARAMS include:
+ :set :line :map :title :file :ind :timeind :timefmt :textind
+ :deps :labels :xlabels :ylabels :xmin :xmax :ymin :ymax :ticks
+
+In addition to :plot-func, the following optional properties may be set.
+
+- :plot-cmd - A gnuplot command appended to each plot-line.
+  Accepts string or nil. Default value: nil.
+
+- :check-ind-type - Whether the types of ind values should be checked.
+  Accepts boolean.
+
+- :plot-str - the formula string passed to :plot-func as PLOT-STR
+  Accepts string. Default value: \"'%s' using %s%d%s with %s title '%s'\"
+
+- :data-dump - Function to dump the table to a datafile for ease of use.
+  Accepts lambda function. Default lambda body: (org-plot/gnuplot-to-data table data-file params)
+
+- :plot-pre - Gnuplot code to be inserted early into the script, just after term and output have been set.
+   Accepts string, nil, or lambda function which returns string or nil. Defaults to nil.
+"
   :group 'org-plot
   :type '(alist :value-type (symbol group)))
 
@@ -476,89 +516,90 @@ If a function, it is called with the plot type as the argument."
   :group 'org-plot
   :type '(choice string function))
 
-(defun org-plot/gnuplot-script (data-file num-cols params &optional preface)
+(defun org-plot/gnuplot-script (table data-file num-cols params &optional preface)
   "Write a gnuplot script to DATA-FILE respecting the options set in PARAMS.
 NUM-COLS controls the number of columns plotted in a 2-d plot.
 Optional argument PREFACE returns only option parameters in a
 manner suitable for prepending to a user-specified script."
-  (let* ((type (plist-get params :plot-type))
-	 (with (if (eq type 'grid) 'pm3d (plist-get params :with)))
-	 (sets (plist-get params :set))
-	 (lines (plist-get params :line))
-	 (map (plist-get params :map))
-	 (title (plist-get params :title))
-	 (file (plist-get params :file))
-	 (ind (plist-get params :ind))
-	 (time-ind (plist-get params :timeind))
-	 (timefmt (plist-get params :timefmt))
-	 (text-ind (plist-get params :textind))
-	 (deps (if (plist-member params :deps) (plist-get params :deps)))
-	 (col-labels (plist-get params :labels))
-	 (x-labels (plist-get params :xlabels))
-	 (y-labels (plist-get params :ylabels))
-	 (plot-str "'%s' using %s%d%s with %s title '%s'")
-	 (plot-cmd (pcase type
-		     (`2d "plot")
-		     (`3d "splot")
-		     (`grid "splot")))
-	 (script "reset")
-	 ;; ats = add-to-script
-	 (ats (lambda (line) (setf script (concat script "\n" line))))
-	 plot-lines)
-
-
-    ;; handle output file, background, and size
-    (funcall ats (format "set term %s %s"
-			 (if file (file-name-extension file) "GNUTERM")
-			 (if (stringp org-plot/gnuplot-term-extra)
-			     org-plot/gnuplot-term-extra
-			   (org-plot/gnuplot-term-extra type))))
-    (when file ; output file
-      (funcall ats (format "set output '%s'" file)))
-
-    (funcall ats
-	     (if (stringp org-plot/gnuplot-script-preamble)
-		 org-plot/gnuplot-script-preamble
-	       (org-plot/gnuplot-script-preamble type)))
-
-    (pcase type				; type
-      (`2d ())
-      (`3d (when map (funcall ats "set map")))
-      (`grid (funcall ats (if map "set pm3d map" "set pm3d"))))
-    (when title (funcall ats (format "set title '%s'" title))) ; title
-    (mapc ats lines)					       ; line
-    (dolist (el sets) (funcall ats (format "set %s" el)))      ; set
-    ;; Unless specified otherwise, values are TAB separated.
-    (unless (string-match-p "^set datafile separator" script)
-      (funcall ats "set datafile separator \"\\t\""))
-    (when x-labels			; x labels (xtics)
-      (funcall ats
-	       (format "set xtics (%s)"
-		       (mapconcat (lambda (pair)
-				    (format "\"%s\" %d" (cdr pair) (car pair)))
-				  x-labels ", "))))
-    (when y-labels			; y labels (ytics)
-      (funcall ats
-	       (format "set ytics (%s)"
-		       (mapconcat (lambda (pair)
-				    (format "\"%s\" %d" (cdr pair) (car pair)))
-				  y-labels ", "))))
-    (when time-ind			; timestamp index
-      (funcall ats "set xdata time")
-      (funcall ats (concat "set timefmt \""
-			   (or timefmt	; timefmt passed to gnuplot
-			       "%Y-%m-%d-%H:%M:%S") "\"")))
-    (unless preface
-      (let ((type-func (cadr (assoc type org-plot/preset-plot-types))))
-	(when type-func
-	  (setq plot-lines
-		(funcall type-func data-file num-cols params plot-str))))
+  (let* ((type-name (plist-get params :plot-type))
+	 (type (cdr (assoc type-name org-plot/preset-plot-types))))
+    (unless type
+      (user-error "Org-plot type `%s' is undefined." type-name))
+    (let* ((sets (plist-get params :set))
+	   (lines (plist-get params :line))
+	   (map (plist-get params :map))
+	   (title (plist-get params :title))
+	   (file (plist-get params :file))
+	   (ind (plist-get params :ind))
+	   (time-ind (plist-get params :timeind))
+	   (timefmt (plist-get params :timefmt))
+	   (text-ind (plist-get params :textind))
+	   (deps (if (plist-member params :deps) (plist-get params :deps)))
+	   (col-labels (plist-get params :labels))
+	   (x-labels (plist-get params :xlabels))
+	   (y-labels (plist-get params :ylabels))
+	   (plot-str (or (plist-get type :plot-str)
+			 "'%s' using %s%d%s with %s title '%s'"))
+	   (plot-cmd (plist-get type :plot-cmd))
+	   (plot-pre (plist-get type :plot-pre))
+	   (script "reset")
+	   ;; ats = add-to-script
+	   (ats (lambda (line) (when line (setf script (concat script "\n" line)))))
+	   plot-lines)
+
+
+      ;; handle output file, background, and size
+      (funcall ats (format "set term %s %s"
+			   (if file (file-name-extension file) "GNUTERM")
+			   (if (stringp org-plot/gnuplot-term-extra)
+			       org-plot/gnuplot-term-extra
+			     (funcall org-plot/gnuplot-term-extra type))))
+      (when file ; output file
+	(funcall ats (format "set output '%s'" file)))
+
+      (when plot-pre
+	(funcall ats (funcall plot-pre table data-file num-cols params plot-str)))
 
       (funcall ats
-	       (concat plot-cmd " " (mapconcat #'identity
-					       (reverse plot-lines)
-					       ",\\\n    "))))
-    script))
+	       (if (stringp org-plot/gnuplot-script-preamble)
+		   org-plot/gnuplot-script-preamble
+		 (funcall org-plot/gnuplot-script-preamble type)))
+
+      (when title (funcall ats (format "set title '%s'" title))) ; title
+      (mapc ats lines)					       ; line
+      (dolist (el sets) (funcall ats (format "set %s" el)))      ; set
+      ;; Unless specified otherwise, values are TAB separated.
+      (unless (string-match-p "^set datafile separator" script)
+	(funcall ats "set datafile separator \"\\t\""))
+      (when x-labels			; x labels (xtics)
+	(funcall ats
+		 (format "set xtics (%s)"
+			 (mapconcat (lambda (pair)
+				      (format "\"%s\" %d" (cdr pair) (car pair)))
+				    x-labels ", "))))
+      (when y-labels			; y labels (ytics)
+	(funcall ats
+		 (format "set ytics (%s)"
+			 (mapconcat (lambda (pair)
+				      (format "\"%s\" %d" (cdr pair) (car pair)))
+				    y-labels ", "))))
+      (when time-ind			; timestamp index
+	(funcall ats "set xdata time")
+	(funcall ats (concat "set timefmt \""
+			     (or timefmt	; timefmt passed to gnuplot
+				 "%Y-%m-%d-%H:%M:%S") "\"")))
+      (unless preface
+	(let ((type-func (plist-get type :plot-func)))
+	  (when type-func
+	    (setq plot-lines
+		  (funcall type-func table data-file num-cols params plot-str))))
+	(funcall ats
+		 (concat plot-cmd
+			 (when plot-cmd " ")
+			 (mapconcat #'identity
+				    (reverse plot-lines)
+				    ",\\\n    "))))
+      script)))
 
 ;;-----------------------------------------------------------------------------
 ;; facade functions
@@ -598,7 +639,13 @@ line directly before or after the table."
 			(push 'hline (cdr tbl))))
 		    tbl))
 	   (num-cols (length (if (eq (nth 0 table) 'hline) (nth 1 table)
-			       (nth 0 table)))))
+			       (nth 0 table))))
+	   (type (assoc (plist-get params :plot-type)
+			org-plot/preset-plot-types)))
+
+      (unless type
+	(user-error "Org-plot type `%s' is undefined." type-name))
+
       (run-with-idle-timer 0.1 nil #'delete-file data-file)
       (when (eq (cadr table) 'hline)
 	(setf params
@@ -608,15 +655,12 @@ line directly before or after the table."
       (save-excursion (while (and (equal 0 (forward-line -1))
 				  (looking-at "[[:space:]]*#\\+"))
 			(setf params (org-plot/collect-options params))))
-      ;; Dump table to datafile (very different for grid).
-      (pcase (plist-get params :plot-type)
-	(`2d   (org-plot/gnuplot-to-data table data-file params))
-	(`3d   (org-plot/gnuplot-to-data table data-file params))
-	(`grid (let ((y-labels (org-plot/gnuplot-to-grid-data
-				table data-file params)))
-		 (when y-labels (plist-put params :ylabels y-labels)))))
+      ;; Dump table to datafile
+      (if-let ((dump-func (plist-get type :data-dump)))
+	  (funcall dump-func table data-file num-cols params)
+	(org-plot/gnuplot-to-data table data-file params))
       ;; Check type of ind column (timestamp? text?)
-      (when (eq `2d (plist-get params :plot-type))
+      (when (plist-get params :check-ind-type)
 	(let* ((ind (1- (plist-get params :ind)))
 	       (ind-column (mapcar (lambda (row) (nth ind row)) table)))
 	  (cond ((< ind 0) nil) ; ind is implicit
@@ -633,13 +677,13 @@ line directly before or after the table."
       (with-temp-buffer
 	(if (plist-get params :script)	; user script
 	    (progn (insert
-		    (org-plot/gnuplot-script data-file num-cols params t))
+		    (org-plot/gnuplot-script table data-file num-cols params t))
 		   (insert "\n")
 		   (insert-file-contents (plist-get params :script))
 		   (goto-char (point-min))
 		   (while (re-search-forward "\\$datafile" nil t)
 		     (replace-match data-file nil nil)))
-	  (insert (org-plot/gnuplot-script data-file num-cols params)))
+	  (insert (org-plot/gnuplot-script table data-file num-cols params)))
 	;; Graph table.
 	(gnuplot-mode)
 	(gnuplot-send-buffer-to-gnuplot))
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #12: 0011-org-plot.el-avoid-arithmetic-overflow-error.patch --]
[-- Type: text/x-patch, Size: 1584 bytes --]

From a299ec63c91260b68237da3a6c19e8ed8523fd6d Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Sat, 5 Sep 2020 21:05:36 +0800
Subject: [PATCH 11/15] org-plot.el: avoid arithmetic overflow error

* lisp/org-plot.el (org--plot/values-stats): A set of numbers with the
same value (i.e. 0 range) should not produce an arithmetic overflow
error. This error was caused by taking the log of 0 (when the range is
0). This is mitigated by explicit checking against this case.
---
 lisp/org-plot.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 53186bb75..0a9694263 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -192,10 +192,13 @@ values, namely regarding the range."
   (let* ((minimum (or hard-min (apply #'min nums)))
 	 (maximum (or hard-max (apply #'max nums)))
 	 (range (- maximum minimum))
-	 (rangeOrder (ceiling (- 1 (log10 range))))
+	 (rangeOrder (if (= range 0) 0
+			 (ceiling (- 1 (log10 range)))))
 	 (range-factor (expt 10 rangeOrder))
-	 (nice-min (/ (float (floor (* minimum range-factor))) range-factor))
-	 (nice-max (/ (float (ceiling (* maximum range-factor))) range-factor)))
+	 (nice-min (if (= range 0) (car nums)
+		     (/ (float (floor (* minimum range-factor))) range-factor)))
+	 (nice-max (if (= range 0) (car nums)
+		     (/ (float (ceiling (* maximum range-factor))) range-factor))))
     `(:min ,minimum :max ,maximum :range ,range
       :range-factor ,range-factor
       :nice-min ,nice-min :nice-max ,nice-max :nice-range ,(- nice-max nice-min))))
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #13: 0012-org-plot.el-add-missing-cl-prefixes.patch --]
[-- Type: text/x-patch, Size: 5319 bytes --]

From 2076b9ea3c7d5459b6b7eca1d1c876518b75cba0 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Sun, 25 Oct 2020 01:43:01 +0800
Subject: [PATCH 12/15] org-plot.el: add missing cl- prefixes

* lisp/org-plot.el ( org--plot/merge-alists, org--plot/item-frequencies,
org--plot/prime-factors): Add missing cl- prefic to cl-lib functions
called.
(org--plot/radar): refactor f function to remove dependency.
(org--plot/values-stats, org--plot/nice-frequency-pick): autoformatting.
---
 lisp/org-plot.el | 72 ++++++++++++++++++++++++------------------------
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 0a9694263..449edff20 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -193,7 +193,7 @@ values, namely regarding the range."
 	 (maximum (or hard-max (apply #'max nums)))
 	 (range (- maximum minimum))
 	 (rangeOrder (if (= range 0) 0
-			 (ceiling (- 1 (log10 range)))))
+		       (ceiling (- 1 (log10 range)))))
 	 (range-factor (expt 10 rangeOrder))
 	 (nice-min (if (= range 0) (car nums)
 		     (/ (float (floor (* minimum range-factor))) range-factor)))
@@ -227,44 +227,44 @@ values, namely regarding the range."
   "From a list of frequences, try to sensibly pick a sample of the most frequent."
   ;; TODO this mosly works decently, but counld do with some tweaking to work more consistently.
   (case (length frequencies)
-    (1 (list (car (nth 0 frequencies))))
-    (2 (if (<= 3 (/ (cdr (nth 0 frequencies))
-		    (cdr (nth 1 frequencies))))
-	   (make-list 2
-		      (car (nth 0 frequencies)))
-	 (list (car (nth 0 frequencies))
-	       (car (nth 1 frequencies)))))
-    (t
-     (let* ((total-count (apply #'+ (mapcar #'cdr frequencies)))
-	    (n-freq (mapcar (lambda (freq) `(,(car freq) . ,(/ (float (cdr freq)) total-count))) frequencies))
-	    (f-pick (list (car (car n-freq))))
-	    (1-2-ratio (/ (cdr (nth 0 n-freq))
-			  (cdr (nth 1 n-freq))))
-	    (2-3-ratio (/ (cdr (nth 1 n-freq))
-			  (cdr (nth 2 n-freq))))
-	    (1-3-ratio (* 1-2-ratio 2-3-ratio))
-	    (1-val (car (nth 0 n-freq)))
-	    (2-val (car (nth 1 n-freq)))
-	    (3-val (car (nth 2 n-freq))))
-       (when (> 1-2-ratio 4) (push 1-val f-pick))
-       (when (and (< 1-2-ratio 2-val)
-		  (< (* (apply #'* f-pick) 2-val) 30))
-	 (push 2-val f-pick))
-       (when (and (< 1-3-ratio 3-val)
-		  (< (* (apply #'* f-pick) 3-val) 30))
-	 (push 3-val f-pick))
-       f-pick))))
+	(1 (list (car (nth 0 frequencies))))
+	(2 (if (<= 3 (/ (cdr (nth 0 frequencies))
+			(cdr (nth 1 frequencies))))
+	       (make-list 2
+			  (car (nth 0 frequencies)))
+	     (list (car (nth 0 frequencies))
+		   (car (nth 1 frequencies)))))
+	(t
+	 (let* ((total-count (apply #'+ (mapcar #'cdr frequencies)))
+		(n-freq (mapcar (lambda (freq) `(,(car freq) . ,(/ (float (cdr freq)) total-count))) frequencies))
+		(f-pick (list (car (car n-freq))))
+		(1-2-ratio (/ (cdr (nth 0 n-freq))
+			      (cdr (nth 1 n-freq))))
+		(2-3-ratio (/ (cdr (nth 1 n-freq))
+			      (cdr (nth 2 n-freq))))
+		(1-3-ratio (* 1-2-ratio 2-3-ratio))
+		(1-val (car (nth 0 n-freq)))
+		(2-val (car (nth 1 n-freq)))
+		(3-val (car (nth 2 n-freq))))
+	   (when (> 1-2-ratio 4) (push 1-val f-pick))
+	   (when (and (< 1-2-ratio 2-val)
+		      (< (* (apply #'* f-pick) 2-val) 30))
+	     (push 2-val f-pick))
+	   (when (and (< 1-3-ratio 3-val)
+		      (< (* (apply #'* f-pick) 3-val) 30))
+	     (push 3-val f-pick))
+	   f-pick))))
 
 (defun org--plot/merge-alists (function default alist1 alist2 &rest alists)
   "Using FUNCTION, combine the elements of all given ALISTS. When an element is
 only present in one alist, DEFAULT is used as the second argument for the FUNCTION."
   (when (> (length alists) 0)
     (setq alist2 (apply #'org--plot/merge-alists function default alist2 alists)))
-  (flet ((keys (alist) (mapcar #'car alist))
-	 (lookup (key alist) (or (cdr (assoc key alist)) default)))
-    (loop with keys = (union (keys alist1) (keys alist2) :test 'equal)
-	  for k in keys collect
-	  (cons k (funcall function (lookup k alist1) (lookup k alist2))))))
+  (cl-flet ((keys (alist) (mapcar #'car alist))
+	    (lookup (key alist) (or (cdr (assoc key alist)) default)))
+    (cl-loop with keys = (cl-union (keys alist1) (keys alist2) :test 'equal)
+	     for k in keys collect
+	     (cons k (funcall function (lookup k alist1) (lookup k alist2))))))
 
 (defun org--plot/item-frequencies (values &optional normalise)
   "Return an alist indicating the frequency of values in VALUES list."
@@ -282,7 +282,7 @@ only present in one alist, DEFAULT is used as the second argument for the FUNCTI
 	(setq value (/ value i))
 	(setq i (1- i))
 	))
-    (subseq factors 0 -1)))
+    (cl-subseq factors 0 -1)))
 
 (defcustom org-plot/gnuplot-script-preamble ""
   "String or function which provides content to be inserted into the GNUPlot
@@ -499,8 +499,8 @@ EOD
 			       )))
 			  table)))
 	 (setup-file (make-temp-file "org-plot-setup")))
-    (f-write-text (format org--plot/radar-setup-template data settings)
-		  'utf-8 setup-file)
+    (let ((coding-system-for-write 'utf-8))
+      (write-region (format org--plot/radar-setup-template data settings) nil setup-file nil :silent))
     (format org--plot/radar-template
 	    setup-file
 	    (if (eq ticks 0) 2 ticks)
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #14: 0013-org-plot.el-radar-plot-join-last-points-to-first.patch --]
[-- Type: text/x-patch, Size: 1415 bytes --]

From 4ee4089848816fd0afedfe3f030912041bffece3 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Sun, 25 Oct 2020 01:47:57 +0800
Subject: [PATCH 13/15] org-plot.el: radar plot, join last points to first

* lisp/org-plot.el (org--plot/radar-template, org--plot/radar):
Duplicate first points at the end so that a line is drawn between them.
---
 lisp/org-plot.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 449edff20..da9f6ea74 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -393,7 +393,7 @@ load \"%s\"
 
 # General settings
 DataColCount = words($Data[1])-1
-AxesCount = |$Data|-HeaderLines
+AxesCount = |$Data|-HeaderLines-1
 AngleOffset = 90
 Max = 1
 d=0.1*Max
@@ -478,7 +478,7 @@ EOD
 				     "\"%s\" %s"
 				     (car row)
 				     (s-join " " (cdr row))))
-				  table))))
+				  (append table (list (car table)))))))
 	 (ticks (or (plist-get params :ticks)
 		    (org--plot/sensible-tick-num table
 						 (plist-get params :ymin)
@@ -497,7 +497,7 @@ EOD
 				   (plist-get data :nice-max))
 			       (if (eq ticks 0) 2 ticks)
 			       )))
-			  table)))
+			  (append table (list (car table))))))
 	 (setup-file (make-temp-file "org-plot-setup")))
     (let ((coding-system-for-write 'utf-8))
       (write-region (format org--plot/radar-setup-template data settings) nil setup-file nil :silent))
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #15: 0014-org-plot.el-Make-min-max-keywords-consistent.patch --]
[-- Type: text/x-patch, Size: 897 bytes --]

From 66540fd5f4f2c7e11d70f572814daa90ec22f92b Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Sun, 25 Oct 2020 02:10:53 +0800
Subject: [PATCH 14/15] org-plot.el: Make min/max keywords consistent

* lisp/org-plot.el: (org-plot/add-options-to-plist): Have both x/y
min/max, but have min/max aliased to the y-axis options.
---
 lisp/org-plot.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index da9f6ea74..f6348907f 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -64,8 +64,10 @@ Returns the resulting property list."
 		("timeind"   . :timeind)
 		("timefmt"   . :timefmt)
 		("min"       . :ymin)
-		("max"       . :ymax)
 		("ymin"      . :ymin)
+		("max"       . :ymax)
+		("ymax"      . :ymax)
+		("xmin"      . :xmin)
 		("xmax"      . :xmax)
 		("ticks"     . :ticks)
 		("trans"     . :transpose)
-- 
2.28.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #16: 0015-org-manual.org-document-org-plot-changes.patch --]
[-- Type: text/x-patch, Size: 3730 bytes --]

From 373bf71d6b108a638c6ba2ec6937d055c1d0f7dd Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Sun, 25 Oct 2020 02:14:37 +0800
Subject: [PATCH 15/15] org-manual.org: document org-plot changes

* doc/org-manual.org: Document changes to org-plot.el.
---
 doc/org-manual.org | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 066092238..7eff42aee 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -2809,6 +2809,19 @@ following table.
 | Morelia   |    257.56 |   17.67 |
 #+end_example
 
+Org Plot supports a range of plot types, and provides the ability to add more.
+For example, a radar plot can be generated like so:
+#+begin_example
+,#+PLOT: title:"An evaluation of plaintext document formats" transpose:yes type:radar min:0 max:4
+| Format            | Fine-grained-control | Initial Effort | Syntax simplicity | Editor Support | Integrations | Ease-of-referencing | Versatility |
+|-------------------+----------------------+----------------+-------------------+----------------+--------------+---------------------+-------------|
+| Word              |                    2 |              4 |                 4 |              2 |            3 |                   2 |           2 |
+| LaTeX             |                    4 |              1 |                 1 |              3 |            2 |                   4 |           3 |
+| Org Mode          |                    4 |              2 |               3.5 |              1 |            4 |                   4 |           4 |
+| Markdown          |                    1 |              3 |                 3 |              4 |            3 |                   3 |           1 |
+| Markdown + Pandoc |                  2.5 |            2.5 |               2.5 |              3 |            3 |                   3 |           2 |
+#+end_example
+
 Notice that Org Plot is smart enough to apply the table's headers as
 labels.  Further control over the labels, type, content, and
 appearance of plots can be exercised through the =PLOT= keyword
@@ -2839,9 +2852,15 @@ For more information and examples see the [[https://orgmode.org/worg/org-tutoria
   the third and fourth columns.  Defaults to graphing all other
   columns aside from the =ind= column.
 
+- transpose ::
+
+  When =y=, =yes=, or =t= attempt to transpose the table data before plotting. Also
+  recognises the shorthand option =trans=.
+
 - =type= ::
 
-  Specify whether the plot is =2d=, =3d=, or =grid=.
+  Specify the type of the plot, by default one of  =2d=, =3d=, =radar=, or =grid=.
+  Available types can be customised with ~org-plot/preset-plot-types~.
 
 - =with= ::
 
@@ -2868,6 +2887,24 @@ For more information and examples see the [[https://orgmode.org/worg/org-tutoria
   When plotting =3d= or =grid= types, set this to =t= to graph a flat
   mapping rather than a =3d= slope.
 
+- min ::
+
+  Provides a minimum axis value that may be used by a plot type. Implicitly
+  assumes the =y= axis is being referred to. Can explicitly provide a value for a
+  either the =x= or =y= axis with =xmin= and =ymin=.
+
+- max ::
+
+  Provides a maximum axis value that may be used by a plot type. Implicitly
+  assumes the =y= axis is being referred to. Can explicitly provide a value for a
+  either the =x= or =y= axis with =xmax= and =ymax=.
+
+- ticks ::
+
+  Provides a desired number of axis ticks to display, that may be used by a plot
+  type. If none is given a plot type that requires ticks will use
+  ~org--plot/sensible-tick-num~ to try to determine a good value.
+
 - =timefmt= ::
 
   Specify format of Org mode timestamps as they will be parsed by
-- 
2.28.0


^ permalink raw reply related	[relevance 8%]

* Re: [PATCH] doc/org-manual.org: Extend table formulas Lisp form documentation
  @ 2020-11-18 19:42 71%       ` TEC
  0 siblings, 0 replies; 200+ results
From: TEC @ 2020-11-18 19:42 UTC (permalink / raw)
  To: emacs-orgmode


I have 2c on the use of "interpolated".

1. I tend to think of "interpolated" in terms of it's mathematical
   meaning
2. The other denotations relate to insertion and renewing, which 
simply
   doesn't fit.

I appreciate that other people may have used this too, but as I 
see it
that just means that other people have engaged in strange word 
choices.

Suggested alternatives: Substituted, transpiled, or translated.

Timothy.

-----

For context, here's the definition, etymology, and symonyms.

Definition
  Intransitive Verb
​​​​   1. To renew; to carry on with intermission. [Obs.] 
​​​​   2. To alter or corrupt by the insertion of new or foreign 
      matter; especially, to change, as a book or text, by the
      insertion of matter that is new, or foreign to the purpose
      of the author.
​​​​   3. (Mathematics) To fill up intermediate terms of, as of a 
series, 
      according to the law of the series; to introduce, as a
      number or quantity, in a partial series, according to the
      law of that part of the series.
  Adjective
​​​​   1. Inserted in, or added to, the original; introduced; 
      foisted in; changed by the insertion of new or spurious
      matter.

​​​​   2. (Math.) 
​​​​​      (a) Provided with necessary interpolations; as, an 
          interpolated table.
​​​​​      (b) Introduced or determined by interpolation; as, 
          interpolated quantities or numbers.

​​Etymology
 
​​​interpolate verb 

1610s, "to alter or enlarge (a writing) by inserting new 
material," from Latin 
interpolatus, past participle of interpolare "alter, freshen up, 
polish;" of 
writing, "falsify," from inter "among, between" (see inter-) + 
polare, which is 
related to polire "to smoothe, polish," from PIE root *pel- ( 5) 
"to thrust, 
strike, drive," the connecting notion being "to full cloth" 
[Watkins].

Sense evolved in Latin from "refurbish," to "alter appearance of," 
to "falsify 
(especially by adding new material)." Middle English had 
interpolen (early 15c.) 
in a similar sense. Related: Interpolated; interpolating.

​​Synonyms
 
​​​verb adjective 
​​​​1. Insert (wrongfully),  foist in.
​​​​2. (Math .) Introduce, intercalate (terms to complete a series).


Tim Cross <theophilusx@gmail.com> writes:

> Daniele Nicolodi <daniele@grinta.net> writes:
>
>> On 16/11/2020 11:25, Eric S Fraga wrote:
>>> Daniele,
>>>
>>> this looks good.  One minor pedantic point: I think you mean
>>> "interpreted" when you say "interpolated" (several times in 
>>> the
>>> text).  Otherwise, this is a very useful addition to the 
>>> manual.
>>
>> Thank you for reading and for the comment.
>>
>> "interpolated" looks strange to me in this context too, but it 
>> is the
>> word that is currently used in the manual. I decided to stick 
>> to this
>> term for consistency, however, I haven't check if it is used 
>> with the
>> same meaning elsewhere.
>>
>> I don't think it is wrong to use "interpolated", but if you 
>> thing it
>> should be changed I can change it and check the manual for 
>> consistency.
>> However, I don't think "interpreted" is the right word either. 
>> Probably
>> "replaced" or "substituted" are better choices in this context.
>>
>
> I agree. Interpolated is consistent with manuals for other 
> programming
> languages which have similar functionality. However, org is also 
> used by
> a more diverse community than typical programming languages, so 
> perhaps
> 'replaced' or 'substituted' would be a better choice?



^ permalink raw reply	[relevance 71%]

* Re: [PATCH] org-plot abstractions and extension
  2020-10-24 18:16  8%             ` TEC
@ 2020-12-09  2:58 93%               ` TEC
    1 sibling, 0 replies; 200+ results
From: TEC @ 2020-12-09  2:58 UTC (permalink / raw)
  To: Bastien; +Cc: org-mode-email


It's now been 1.5 months, so I'm going to bump this thread.

--
Timothy

TEC <tecosaur@gmail.com> writes:

> Bastien <bzg@gnu.org> writes:
>
>> I'm not an org-plot.el user so I cannot test, but by reading the
>> patches, they look okay.
>>
>> Let's go in "optimistic merging" mode and commit your patches?
>
> Sounds good then. I don't expect the changes to compromise any 
> existing
> functionality.
>
>> Is https://orgmode.org/list/87lfhbhfhe.fsf@gmail.com/ the latest
>> version I should use?
>
> I've smoothed a rough edge or two, and added a documentation 
> entry.
>
> I'll attach all the patches to this email, so there's no 
> ambiguity.
> (crosses fingers for attachments working as expected)



^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2020-12-13 16:12 46%                   ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2020-12-13 16:12 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 600 bytes --]


Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

> Without the second argument I get an error “Wrong type argument:
> stringp,” when evaluating regular expressions against the cons cell
> that is returned as title.
>
> As I see now, author and title are cons cells, which is why
> org-element-interpret-data is necessary to produce strings with Org
> syntax.
>
> Also, after fixing the title, I get “wrong-type-argument sequencep
> utf-8” for “(concat "text/html;charset=" charset)”.

Thanks for testing this :) I haven't forgotten about this.

Next version!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox-html.el-make-html-meta-func-nicer.patch --]
[-- Type: text/x-patch, Size: 6662 bytes --]

From 1289e381aff7562df96945aa58838ad966aa9211 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 17 Sep 2020 21:27:18 +0800
Subject: [PATCH] lisp/ox-html.el: make html meta func nicer

* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The opportunity was taken to extract most metadata info to custom
variable `org-html-meta-tags', allowing for easy end-user modification.
---
 lisp/ox-html.el | 131 +++++++++++++++++++++++++++---------------------
 1 file changed, 73 insertions(+), 58 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index d2f24f5c6..93014e9c7 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1425,6 +1425,31 @@ not be modified."
 
 ;;;; Template :: Styles
 
+(defcustom org-html-meta-tags
+  '((lambda (_title author _info)
+      (when (org-string-nw-p author)
+	(list "name" "author" author)))
+    (lambda (_title _author info)
+      (when (org-string-nw-p (plist-get info :description))
+	(list "name" "description"
+	      (plist-get info :description))))
+    (lambda (_title _author info)
+      (when (org-string-nw-p (plist-get info :keywords))
+	(list "keywords" (plist-get info :keywords))))
+    ("name" "generator" "Org Mode"))
+  "A list of arguments to be passed to `org-html--build-meta-entry'.
+Each argument can either be an list which is applied, or a function which
+generates such a list with signature (TITLE AUTHOR INFO) where TITLE and AUTHOR
+are strings, and INFO a communication plist."
+  :group 'org-export-html
+  :package-version '(Org . "9.5")
+  :type '(repeat
+	  (choice
+	   (list (string :tag "Meta label")
+		 (string :tag "label value")
+		 (string :tag "Content value"))
+	   function)))
+
 (defcustom org-html-head-include-default-style t
   "Non-nil means include the default style in exported HTML files.
 The actual style is defined in `org-html-style-default' and
@@ -1835,78 +1860,68 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html--build-meta-entry (label identity &optional content-format &rest content-formatters)
+  "Construct <meta> tag with LABEL=\"IDENTITY\" and content from CONTENT-FORMAT and CONTENT-FORMATTER."
+  (concat "<meta "
+	  (format "%s=\"%s" label identity)
+	  (when content-format
+	    (concat "\" content=\""
+		    (replace-regexp-in-string
+		     "\"" "&quot;"
+		     (org-html-encode-plain-text
+		      (if content-formatters
+			  (apply #'format content-format content-formatters)
+			content-format)))))
+	  "\" />\n"))
+
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
-  (let* ((protect-string
-          (lambda (str)
-            (replace-regexp-in-string
-             "\"" "&quot;" (org-html-encode-plain-text str))))
-         (title (org-export-data (plist-get info :title) info))
-         ;; Set title to an invisible character instead of leaving it
-         ;; empty, which is invalid.
-         (title (if (org-string-nw-p title) title "&lrm;"))
-         (author (and (plist-get info :with-author)
-                      (let ((auth (plist-get info :author)))
+  (let* ((title (org-html-encode-plain-text (or (car (plist-get info :title)) "Org Export")))
+	 ;; Set title to an invisible character instead of leaving it
+	 ;; empty, which is invalid.
+	 (title (if (org-string-nw-p title) title "&lrm;"))
+	 (author (and (plist-get info :with-author)
+		      (let ((auth (plist-get info :author)))
 			;; Return raw Org syntax.
-                        (and auth (org-element-interpret-data auth)))))
-         (description (plist-get info :description))
-         (keywords (plist-get info :keywords))
-         (charset (or (and org-html-coding-system
-                           (fboundp 'coding-system-get)
-                           (coding-system-get org-html-coding-system
-                                              'mime-charset))
-                      "iso-8859-1")))
+			(and auth (org-element-interpret-data auth)))))
+	 (charset (or (and org-html-coding-system
+			   (fboundp 'coding-system-get)
+			   (symbol-name
+			    (coding-system-get org-html-coding-system
+					       'mime-charset)))
+		      "iso-8859-1")))
     (concat
      (when (plist-get info :time-stamp-file)
        (format-time-string
 	(concat "<!-- "
 		(plist-get info :html-metadata-timestamp-format)
 		" -->\n")))
-     (format
-      (if (org-html-html5-p info)
-	  (org-html-close-tag "meta" "charset=\"%s\"" info)
-	(org-html-close-tag
-	 "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
-	 info))
-      charset) "\n"
+
+     (if (org-html-html5-p info)
+	 (org-html--build-meta-entry "charset" charset)
+       (org-html--build-meta-entry "http-equiv" "Content-Type"
+				   (concat "text/html;charset=" charset)))
+
      (let ((viewport-options
 	    (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
 			      (plist-get info :html-viewport))))
-       (and viewport-options
-	    (concat
-	     (org-html-close-tag
-	      "meta"
-	      (format "name=\"viewport\" content=\"%s\""
-		      (mapconcat
-		       (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
-		       viewport-options ", "))
-	      info)
-	     "\n")))
+       (if viewport-options
+	   (org-html--build-meta-entry "name" "viewport"
+				       (mapconcat
+					(lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
+					viewport-options ", "))))
+
      (format "<title>%s</title>\n" title)
-     (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\"" info)
-     "\n"
-     (and (org-string-nw-p author)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"author\" content=\"%s\""
-				       (funcall protect-string author))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p description)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"description\" content=\"%s\"\n"
-				       (funcall protect-string description))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p keywords)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"keywords\" content=\"%s\""
-				       (funcall protect-string keywords))
-			       info)
-	   "\n")))))
+
+     (apply #'concat
+	    (mapcar
+	     (lambda (form)
+	       (when (functionp form)
+		 (setq form (funcall form title author info)))
+	       (when form
+		 (apply #'org-html--build-meta-entry form)))
+	     org-html-meta-tags)))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


^ permalink raw reply related	[relevance 46%]

* Re: [PATCH] org-plot abstractions and extension
  @ 2020-12-14  6:30 93%                 ` TEC
    1 sibling, 0 replies; 200+ results
From: TEC @ 2020-12-14  6:30 UTC (permalink / raw)
  To: Bastien; +Cc: org-mode-email


Bastien <bzg@gnu.org> writes:

> Applied, with minor modifications of the changelog entries:
>
> - You need to add an entry when creating a new custom variable.
>
> - I suggest saying "option" instead of "custom variable".
>
> - Sentences should be separated by two spaces and start with an
>   uppercase letter.
>
> Also, the convention in Emacs is to avoid whitespaces-only commits,
> you need to fix whitespaces within other non-whitespaces changes in
> a commit.

Thanks for the feedback on the patches! I tried to get it right after my
previous (and first) attempt, but it looks like there are a few things I
still need to take note of. Big improvement though, nonetheless,
hopefully next time they'll be nothing to change :)

All the best,

Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2020-12-14  6:34 66%                       ` TEC
      1 sibling, 1 reply; 200+ results
From: TEC @ 2020-12-14  6:34 UTC (permalink / raw)
  To: Bastien; +Cc: Jens Lechtenboerger, org-mode-email


Bastien <bzg@gnu.org> writes:

> Let's wait for Jens feedback on this patch, since he took care of
> testing it so far.

Assuming Jens responds as he usually has (relatively promptly), this
sounds good to me :)

> In a nutshell, can you restate what problem is this patch fixing?

There are two things I intend to achieve with this patch:
1. DRY* out the existing code. The existing code is quite repetitive in
   structure, and easily lends itself to being extracted to a function.
   This is easier to read, and work with IMO.
2. Make use of the DRYer code in (1) to provide a make the meta building
    function more versatile, and then add in the ability for user
    customisation at low-cost (again, thanks to (1)).

*DRY is an acronym for "Don't Repeat Yourself", in case there's a french
 equivalent you're more familiar with.

> Is a new option really necessary here?

Necessary? Not really, I mean the export /works/ without it. I'd argue
that it's desirable though, as it provides an easy way for a user (such
as myself) to add useful meta tags not included by default. For example
I currently make use of this to add information that parsed by a large
number of services/apps to create rich embeds for exported Org files I
link to (see
https://tecosaur.github.io/emacs-config/config.html#extra-header-content,code--2
).

Furthermore, I consider it to be very low cost, since it's basically
just taking advantage of the restructuring already performed for code
QOL reasons.

I expect most users not to have any reason to touch this, but for some
to find it handy.

> Are there backward compatibility considerations we should take care of?

None AFAIK. Barring this errors that Jens raised, and now have hopefully
been addressed, this should function /exactly/ as the current
implementation does, with a minor (beneficial) caveat, mentioned below.
Just with nicer-to-work-with code and a bit more versatility (IMO, of
course).

These are the two changes to be mentioned:
1. The (or {title} "Org Export") bit I added.
   I believe the current behaviour when no #+title is given is to have a
   blank one (""). I think "Org Export" is preferable, as it's more
   informative than ... nothing.
2. Using org-html-encode-plain-text for formatting the content of the
   meta tags. From Jens, I take it that the current org-export-data can
   cause nested HTML tags, which are invalid in this context. Plain text
   should be safer.

>> +(defun org-html--build-meta-entry (label identity &optional content-format &rest content-formatters)
>> +  "Construct <meta> tag with LABEL=\"IDENTITY\" and content from CONTENT-FORMAT and CONTENT-FORMATTER."
>
> The first line of this defun is too long.  You can try M-x checkdoc
> RET on your elisp files to catch those issues.
>
> Thanks,

I see, I'm guessing I'll just need to add a line break.

I hope that clarifies things!

Timothy


^ permalink raw reply	[relevance 66%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2020-12-14  7:27 90%                           ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2020-12-14  7:27 UTC (permalink / raw)
  To: Bastien; +Cc: Jens Lechtenboerger, org-mode-email


Bastien <bzg@gnu.org> writes:

> Can we approach this with two patches, one with the refactoring and
> one with the added functionality?

Sure :) I'll take care of this when I get home in a few hours.

> This sounds useful.

Glad to hear!

> I think "Org Export" as the default is counter-intuitive, let's stick
> to the empty string.  (Also, this kind of "small" changes should be
> made with consideration of all exporters.)

In case of confusion, this isn't replacing the #+title in the document,
just the <title>...</title> which is used as the tab content.
I just find blank tabs to be quite unhelpful, particularly when nestled
among others.

I'm not really aware of anything analogous in other exporters. Maybe the
metadata in exported PDFs ... but that doesn't exactly show up in
browser tabs :P

> Nope, the first line of a docstring should be a sentence.  You'll have
> to reformulate the beginning of the docstring...

I'll take care of this with the patch separation.

Thanks for the feedback!

Timothy.


^ permalink raw reply	[relevance 90%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2020-12-14 10:01 37%                               ` TEC
  0 siblings, 0 replies; 200+ results
From: TEC @ 2020-12-14 10:01 UTC (permalink / raw)
  To: Bastien; +Cc: Jens Lechtenboerger, org-mode-email

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]


Bastien <bzg@gnu.org> writes:

> TEC <tecosaur@gmail.com> writes:
>
>> In case of confusion, this isn't replacing the #+title in the document,
>> just the <title>...</title> which is used as the tab content.
>
> Fine then.

😅 as it so happens I've revised my thoughts, and I'm just leaving it
blank as it currently is.

Anyway, here are the revised patches. Let me know if there's anything
else you'd like to see tweaked :)

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox-html.el-make-html-meta-tag-builder-nicer.patch --]
[-- Type: text/x-patch, Size: 5882 bytes --]

From 92b2ab771a1f90f269f20727903c9f42596d32e6 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:41:33 +0800
Subject: [PATCH 1/2] lisp/ox-html.el: make html meta tag builder nicer

* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The keyword value formatting is changed from `org-export-data' to
`org-html-encode-plain-text' to avoid potentially nesting HTML tags in
meta tags and the <title> element, which would violate W3C.
---
 lisp/ox-html.el | 112 +++++++++++++++++++++++-------------------------
 1 file changed, 54 insertions(+), 58 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index d2f24f5c6..e774b53ac 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1835,78 +1835,74 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html--build-meta-entry (label identity &optional content-format &rest content-formatters)
+  "Construct <meta> tag of form <meta LABEL=\"IDENTITY\" />, or when CONTENT-FORMAT is present:
+<meta LABEL=\"IDENTITY\" content=\"{content}\" />
+
+Here {content} is determined by applying any CONTENT-FORMATTERS to the CONTENT-FORMAT and encoding
+the result as plain text."
+  (concat "<meta "
+	  (format "%s=\"%s" label identity)
+	  (when content-format
+	    (concat "\" content=\""
+		    (replace-regexp-in-string
+		     "\"" "&quot;"
+		     (org-html-encode-plain-text
+		      (if content-formatters
+			  (apply #'format content-format content-formatters)
+			content-format)))))
+	  "\" />\n"))
+
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
-  (let* ((protect-string
-          (lambda (str)
-            (replace-regexp-in-string
-             "\"" "&quot;" (org-html-encode-plain-text str))))
-         (title (org-export-data (plist-get info :title) info))
-         ;; Set title to an invisible character instead of leaving it
-         ;; empty, which is invalid.
-         (title (if (org-string-nw-p title) title "&lrm;"))
-         (author (and (plist-get info :with-author)
-                      (let ((auth (plist-get info :author)))
+  (let* ((title (org-html-encode-plain-text (or (car (plist-get info :title)) "")))
+	 ;; Set title to an invisible character instead of leaving it
+	 ;; empty, which is invalid.
+	 (title (if (org-string-nw-p title) title "&lrm;"))
+	 (author (and (plist-get info :with-author)
+		      (let ((auth (plist-get info :author)))
 			;; Return raw Org syntax.
-                        (and auth (org-element-interpret-data auth)))))
-         (description (plist-get info :description))
-         (keywords (plist-get info :keywords))
-         (charset (or (and org-html-coding-system
-                           (fboundp 'coding-system-get)
-                           (coding-system-get org-html-coding-system
-                                              'mime-charset))
-                      "iso-8859-1")))
+			(and auth (org-element-interpret-data auth)))))
+	 (charset (or (and org-html-coding-system
+			   (fboundp 'coding-system-get)
+			   (symbol-name
+			    (coding-system-get org-html-coding-system
+					       'mime-charset)))
+		      "iso-8859-1")))
     (concat
      (when (plist-get info :time-stamp-file)
        (format-time-string
 	(concat "<!-- "
 		(plist-get info :html-metadata-timestamp-format)
 		" -->\n")))
-     (format
-      (if (org-html-html5-p info)
-	  (org-html-close-tag "meta" "charset=\"%s\"" info)
-	(org-html-close-tag
-	 "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
-	 info))
-      charset) "\n"
+
+     (if (org-html-html5-p info)
+	 (org-html--build-meta-entry "charset" charset)
+       (org-html--build-meta-entry "http-equiv" "Content-Type"
+				   (concat "text/html;charset=" charset)))
+
      (let ((viewport-options
 	    (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
 			      (plist-get info :html-viewport))))
-       (and viewport-options
-	    (concat
-	     (org-html-close-tag
-	      "meta"
-	      (format "name=\"viewport\" content=\"%s\""
-		      (mapconcat
-		       (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
-		       viewport-options ", "))
-	      info)
-	     "\n")))
+       (if viewport-options
+	   (org-html--build-meta-entry "name" "viewport"
+				       (mapconcat
+					(lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
+					viewport-options ", "))))
+
      (format "<title>%s</title>\n" title)
-     (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\"" info)
-     "\n"
-     (and (org-string-nw-p author)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"author\" content=\"%s\""
-				       (funcall protect-string author))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p description)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"description\" content=\"%s\"\n"
-				       (funcall protect-string description))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p keywords)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"keywords\" content=\"%s\""
-				       (funcall protect-string keywords))
-			       info)
-	   "\n")))))
+
+     (when (org-string-nw-p author)
+       (org-html--build-meta-entry "name" "author" author))
+
+     (when (org-string-nw-p (plist-get info :description))
+       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
+
+     (when (org-string-nw-p (plist-get info :keywords))
+	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
+
+     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-lisp-ox-html.el-make-html-meta-tags-customizable.patch --]
[-- Type: text/x-patch, Size: 3019 bytes --]

From a2fae2c3c7f38ee8d22a4fedbce25d046c8a818d Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:50:15 +0800
Subject: [PATCH 2/2] lisp/ox-html.el: make html meta tags customizable

* lisp/ox-html.el (org-html-meta-tags): Introduce this as a new option
which can be modified to set the meta tags added in HTML exports.
(org-html--build-meta-info): Make use of `org-html-meta-tags' instead of
hardcoded meta tags.  This is leveraging the earlier restructuring of
`org-html--build-meta-info' into a much DRYer form, such that this
modification has a negligible impact on complexity and readability.
---
 lisp/ox-html.el | 43 +++++++++++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 10 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index e774b53ac..35e056557 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1425,6 +1425,31 @@ not be modified."
 
 ;;;; Template :: Styles
 
+(defcustom org-html-meta-tags
+  '((lambda (_title author _info)
+      (when (org-string-nw-p author)
+	(list "name" "author" author)))
+    (lambda (_title _author info)
+      (when (org-string-nw-p (plist-get info :description))
+	(list "name" "description"
+	      (plist-get info :description))))
+    (lambda (_title _author info)
+      (when (org-string-nw-p (plist-get info :keywords))
+	(list "keywords" (plist-get info :keywords))))
+    ("name" "generator" "Org Mode"))
+  "A list of arguments to be passed to `org-html--build-meta-entry'.
+Each argument can either be an list which is applied, or a function which
+generates such a list with signature (TITLE AUTHOR INFO) where TITLE and AUTHOR
+are strings, and INFO a communication plist."
+  :group 'org-export-html
+  :package-version '(Org . "9.5")
+  :type '(repeat
+	  (choice
+	   (list (string :tag "Meta label")
+		 (string :tag "label value")
+		 (string :tag "Content value"))
+	   function)))
+
 (defcustom org-html-head-include-default-style t
   "Non-nil means include the default style in exported HTML files.
 The actual style is defined in `org-html-style-default' and
@@ -1893,16 +1918,14 @@ INFO is a plist used as a communication channel."
 
      (format "<title>%s</title>\n" title)
 
-     (when (org-string-nw-p author)
-       (org-html--build-meta-entry "name" "author" author))
-
-     (when (org-string-nw-p (plist-get info :description))
-       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
-
-     (when (org-string-nw-p (plist-get info :keywords))
-	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
-
-     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
+     (apply #'concat
+	    (mapcar
+	     (lambda (form)
+	       (when (functionp form)
+		 (setq form (funcall form title author info)))
+	       (when form
+		 (apply #'org-html--build-meta-entry form)))
+	     org-html-meta-tags)))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


^ permalink raw reply related	[relevance 37%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2020-12-15 11:39 34%                         ` TEC
      0 siblings, 2 replies; 200+ results
From: TEC @ 2020-12-15 11:39 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Bastien, org-mode-email

[-- Attachment #1: Type: text/plain, Size: 1351 bytes --]


Thanks for testing Jens. I think I've managed to resolve the issues
you've raised.

Jens, Bastien, you can find the latest revision of the patches attached :)

Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

> [title export being dodgy, how about treating like author?]

Yep, ~org-element-interpret-data~ is necessary. I found that wrapping it
in ~org-html-plain-text~ seems better again though, as it encodes
entities like "---" (org) to "&#x2014;", and doesn't seem to introduce
any nested tags. I've also applied this to the author field as a result.

Maybe it should be applied to the rest (in ~org-html--build-meta-info~)?
I'm not sure.

> The keywords export as follows, where the name attribute is missing:
> <meta keywords="key, wörd, *bold*, sub_script" />

Fixed.

> The current lambda functions in org-html-meta-tags all accept three
> arguments, where the first one is ignored in all cases.  The second
> one is used in exactly one case.  Why not add four calls to
> org-html--build-meta-entry (for author, description, keywords,
> generator) in org-html--build-meta-info?

I had an idea on this, I think the new form is cleaner.
Either have a list where each item generates a meta entry, or a function
that generates such a list. No more mixing of the two.

How does this look?

Timothy.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox-html.el-make-html-meta-tag-builder-nicer.patch --]
[-- Type: text/x-patch, Size: 5934 bytes --]

From 9848af808752bc03404befaab7ab5ebb902aa1d0 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:41:33 +0800
Subject: [PATCH 1/2] lisp/ox-html.el: make html meta tag builder nicer

* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The keyword value formatting is changed from `org-export-data' to
`org-html-encode-plain-text' to avoid potentially nesting HTML tags in
meta tags and the <title> element, which would violate W3C.
---
 lisp/ox-html.el | 114 ++++++++++++++++++++++++------------------------
 1 file changed, 56 insertions(+), 58 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index d2f24f5c6..005703f60 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1835,78 +1835,76 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html--build-meta-entry (label identity &optional content-format &rest content-formatters)
+  "Construct <meta> tag of form <meta LABEL=\"IDENTITY\" />, or when CONTENT-FORMAT is present:
+<meta LABEL=\"IDENTITY\" content=\"{content}\" />
+
+Here {content} is determined by applying any CONTENT-FORMATTERS to the CONTENT-FORMAT and encoding
+the result as plain text."
+  (concat "<meta "
+	  (format "%s=\"%s" label identity)
+	  (when content-format
+	    (concat "\" content=\""
+		    (replace-regexp-in-string
+		     "\"" "&quot;"
+		     (org-html-encode-plain-text
+		      (if content-formatters
+			  (apply #'format content-format content-formatters)
+			content-format)))))
+	  "\" />\n"))
+
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
-  (let* ((protect-string
-          (lambda (str)
-            (replace-regexp-in-string
-             "\"" "&quot;" (org-html-encode-plain-text str))))
-         (title (org-export-data (plist-get info :title) info))
-         ;; Set title to an invisible character instead of leaving it
-         ;; empty, which is invalid.
-         (title (if (org-string-nw-p title) title "&lrm;"))
-         (author (and (plist-get info :with-author)
-                      (let ((auth (plist-get info :author)))
+  (let* ((title (org-html-plain-text
+		 (org-element-interpret-data (plist-get info :title)) info))
+	 ;; Set title to an invisible character instead of leaving it
+	 ;; empty, which is invalid.
+	 (title (if (org-string-nw-p title) title "&lrm;"))
+	 (author (and (plist-get info :with-author)
+		      (let ((auth (plist-get info :author)))
 			;; Return raw Org syntax.
-                        (and auth (org-element-interpret-data auth)))))
-         (description (plist-get info :description))
-         (keywords (plist-get info :keywords))
-         (charset (or (and org-html-coding-system
-                           (fboundp 'coding-system-get)
-                           (coding-system-get org-html-coding-system
-                                              'mime-charset))
-                      "iso-8859-1")))
+			(and auth (org-html-plain-text
+				   (org-element-interpret-data auth) info)))))
+	 (charset (or (and org-html-coding-system
+			   (fboundp 'coding-system-get)
+			   (symbol-name
+			    (coding-system-get org-html-coding-system
+					       'mime-charset)))
+		      "iso-8859-1")))
     (concat
      (when (plist-get info :time-stamp-file)
        (format-time-string
 	(concat "<!-- "
 		(plist-get info :html-metadata-timestamp-format)
 		" -->\n")))
-     (format
-      (if (org-html-html5-p info)
-	  (org-html-close-tag "meta" "charset=\"%s\"" info)
-	(org-html-close-tag
-	 "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
-	 info))
-      charset) "\n"
+
+     (if (org-html-html5-p info)
+	 (org-html--build-meta-entry "charset" charset)
+       (org-html--build-meta-entry "http-equiv" "Content-Type"
+				   (concat "text/html;charset=" charset)))
+
      (let ((viewport-options
 	    (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
 			      (plist-get info :html-viewport))))
-       (and viewport-options
-	    (concat
-	     (org-html-close-tag
-	      "meta"
-	      (format "name=\"viewport\" content=\"%s\""
-		      (mapconcat
-		       (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
-		       viewport-options ", "))
-	      info)
-	     "\n")))
+       (if viewport-options
+	   (org-html--build-meta-entry "name" "viewport"
+				       (mapconcat
+					(lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
+					viewport-options ", "))))
+
      (format "<title>%s</title>\n" title)
-     (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\"" info)
-     "\n"
-     (and (org-string-nw-p author)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"author\" content=\"%s\""
-				       (funcall protect-string author))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p description)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"description\" content=\"%s\"\n"
-				       (funcall protect-string description))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p keywords)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"keywords\" content=\"%s\""
-				       (funcall protect-string keywords))
-			       info)
-	   "\n")))))
+
+     (when (org-string-nw-p author)
+       (org-html--build-meta-entry "name" "author" author))
+
+     (when (org-string-nw-p (plist-get info :description))
+       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
+
+     (when (org-string-nw-p (plist-get info :keywords))
+	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
+
+     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-lisp-ox-html.el-make-html-meta-tags-customizable.patch --]
[-- Type: text/x-patch, Size: 3616 bytes --]

From 3fdc205a549fe315b3096afb72a87868ef9c57d5 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:50:15 +0800
Subject: [PATCH 2/2] lisp/ox-html.el: make html meta tags customizable

* lisp/ox-html.el (org-html-meta-tags): Introduce this as a new option
which can be modified to set the meta tags added in HTML exports.
(org-html--build-meta-info): Make use of `org-html-meta-tags' instead of
hardcoded meta tags.  This is leveraging the earlier restructuring of
`org-html--build-meta-info' into a much DRYer form, such that this
modification has a negligible impact on complexity and readability.
---
 lisp/ox-html.el | 47 +++++++++++++++++++++++++++++++++++++----------
 1 file changed, 37 insertions(+), 10 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 005703f60..6a74cdca8 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1425,6 +1425,22 @@ not be modified."
 
 ;;;; Template :: Styles
 
+(defcustom org-html-meta-tags #'org-html-meta-tags-default
+  "A list where each item is a list of arguments to be passed
+to `org-html--build-meta-entry'. Any nil items are ignored.
+
+Also accept a function which gives such a list when called with with
+signature (TITLE AUTHOR INFO) where TITLE and AUTHOR are strings,
+and INFO a communication plist."
+  :group 'org-export-html
+  :package-version '(Org . "9.5")
+  :type '(choice
+	  (repeat
+	   (list (string :tag "Meta label")
+		 (string :tag "label value")
+		 (string :tag "Content value")))
+	  function))
+
 (defcustom org-html-head-include-default-style t
   "Non-nil means include the default style in exported HTML files.
 The actual style is defined in `org-html-style-default' and
@@ -1835,6 +1851,22 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html-meta-tags-default (_title author info)
+  "Generate a list items, each of which is a list of arguments that can
+be passed to `org-html--build-meta-entry', to generate meta tags to be
+included in the HTML head.
+
+The documents's TITLE, AUTHOR, and communication plist INFO may be used."
+  (list
+   (when (org-string-nw-p author)
+     (list "name" "author" author))
+   (when (org-string-nw-p (plist-get info :description))
+     (list "name" "description"
+	   (plist-get info :description)))
+   (when (org-string-nw-p (plist-get info :keywords))
+     (list "name" "keywords" (plist-get info :keywords)))
+   '("name" "generator" "Org Mode")))
+
 (defun org-html--build-meta-entry (label identity &optional content-format &rest content-formatters)
   "Construct <meta> tag of form <meta LABEL=\"IDENTITY\" />, or when CONTENT-FORMAT is present:
 <meta LABEL=\"IDENTITY\" content=\"{content}\" />
@@ -1895,16 +1927,11 @@ INFO is a plist used as a communication channel."
 
      (format "<title>%s</title>\n" title)
 
-     (when (org-string-nw-p author)
-       (org-html--build-meta-entry "name" "author" author))
-
-     (when (org-string-nw-p (plist-get info :description))
-       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
-
-     (when (org-string-nw-p (plist-get info :keywords))
-	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
-
-     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
+     (mapconcat
+      (lambda (args) (apply #'org-html--build-meta-entry args))
+      (delq nil (if (functionp org-html-meta-tags)
+		    (funcall org-html-meta-tags title author info)
+		  org-html-meta-tags)) ""))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


^ permalink raw reply related	[relevance 34%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2020-12-16  5:04 73%                             ` Timothy E Chapman
  0 siblings, 0 replies; 200+ results
From: Timothy E Chapman @ 2020-12-16  5:04 UTC (permalink / raw)
  To: Tom Gillespie; +Cc: Jens Lechtenboerger, Bastien, org-mode-email

Hi Tom,

> Why not just use #+html_head:
> possibly with a macro to fill in variable values? That is fully
> extensible and doesn't overload keywords. For title, date, author,
> etc. those can have clearly defined mappings to the html, but
> everything else seems to be handled more sanely with #+html_head:. Am
> I missing something?

I doubt the use case that prompted me to make this an option is the
only one that would benefit, but it should give you an example of the
potential utility of this.

There's some metadata I /always/ want added to my exported documents.
Some of it is static (e.g. ("name" "theme-color" "#77aa99")), but I
also have opengraph metadata which is based on the title/author/etc.
See https://tecosaur.github.io/emacs-config/config.html#extra-header-content,code--2

I can't imagine any non-irritating way to have this occur without
making use of this exposed functionality, and I doubt I'm the only one
who has something they'd like to do which makes use of this.

Thanks to the code cleanup / refactoring in the first commit, this
option is pretty trivial to expose, so I thought why not!

Does this help clarify the purpose to you?

Timothy.

p.s.I'd rather not have to copy-paste (evern by template expansion)
several lines like this into every file I export :cry:

#+HTML_HEAD: {{{meta_maybe_description}}}
#+MACRO: meta_maybe_description (eval (let ((description (delq nil
(org-element-map (org-element-parse-buffer) 'keyword (lambda (kw)
(when (string= "SUBTITLE" (org-element-property :key kw))
(org-element-property :value kw))))))) (if description (format "<meta
name=\"description\" content=\"%s\" />" (replace-regexp-in-string "\""
"&quot;" (org-html-encode-plain-text description)))) ""))

When I could just have this in my config:

(when (org-string-nw-p (plist-get info :description))
       (list "name" "description"
             (plist-get info :description))

Timothy E Chapman
tecosaur@gmail.com
tecosaur.com


On Wed, 16 Dec 2020 at 12:13, Tom Gillespie <tgbugs@gmail.com> wrote:
>
> A question from the slightly uninformed. Why not just use #+html_head:
> possibly with a macro to fill in variable values? That is fully
> extensible and doesn't overload keywords. For title, date, author,
> etc. those can have clearly defined mappings to the html, but
> everything else seems to be handled more sanely with #+html_head:. Am
> I missing something? Best,
> Tom


^ permalink raw reply	[relevance 73%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2020-12-16  7:22 86%                             ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2020-12-16  7:22 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Bastien, org-mode-email


Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

> I like this!

:)

>> Maybe it should be applied to the rest (in ~org-html--build-meta-info~)?
>> I'm not sure.
>
> I’m not sure either.  Maybe people expect their typed characters,
> maybe not.  This might call for a new variable.

I'm tempted to leave the current behaviour as-is, and then we can
introduce a new variable if we want later :)

> I like the new variant much better.  However, I still do not
> understand why you pass the title into org-html-meta-tags-default
> just to ignore it.  The title is already dealt with elsewhere, isn’t
> it?

For people who want to customise this to add metadata, the page title is
something they're probably interested in. If so, I think it's work
giving the title processed by org-html--build-meta-info as it's not so
simple as (plist-get info :title). Worst case, the argument just sits
there and is ignored :P

> Some comments raise complaints by checkdoc (lines too long, no
> sentence in fist line).  (Actually, the file has more problems in
> that regard.)

Ooops, I thought I took care of that. Looks like I'll be taking another
look...

Would be nice my issues weren't one of dozens throughout the file, it
makes it a bit harder to notice errors coming from /my/ section.

> Many thanks for your continued work!

Thanks for your testing and feedback!

--
Timothy


^ permalink raw reply	[relevance 86%]

* Re: [PATCH] Enhance org-html--build-meta-info
    2020-12-20  5:08 93%                                 ` TEC
@ 2020-12-20  5:08 93%                                 ` TEC
  1 sibling, 0 replies; 200+ results
From: TEC @ 2020-12-20  5:08 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Bastien, org-mode-email


Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

>> For people who want to customise this to add metadata, the page title is
>> something they're probably interested in.
>
> What metadata would you derive from the title?

In my earlier example, I use the "og:title" property.

>> If so, I think it's work giving the title processed by
>> org-html--build-meta-info as it's not so simple as
>> (plist-get info :title).
>
> Extracting it from ~info~ might be more flexible as it would not be
> tied to the current implementation.

My thoughts are just that its seems like title/author may be handy, and
we've already worked those out, so why not just pass them along?

Could probably reduce to just info, not sure what's best though.

Other than this, is there anything else you think might be worth
considering before merging?

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2020-12-20  5:08 93%                                 ` TEC
    2020-12-20  5:08 93%                                 ` TEC
  1 sibling, 1 reply; 200+ results
From: TEC @ 2020-12-20  5:08 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Bastien, org-mode-email


Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

>> For people who want to customise this to add metadata, the page title is
>> something they're probably interested in.
>
> What metadata would you derive from the title?

In my earlier example, I use the "og:title" property.

>> If so, I think it's work giving the title processed by
>> org-html--build-meta-info as it's not so simple as
>> (plist-get info :title).
>
> Extracting it from ~info~ might be more flexible as it would not be
> tied to the current implementation.

My thoughts are just that its seems like title/author may be handy, and
we've already worked those out, so why not just pass them along?

Could probably reduce to just info, not sure what's best though.

Other than this, is there anything else you think might be worth
considering before merging?

--
Timothy


^ permalink raw reply	[relevance 93%]

* [PATCH] Apply emacs manual css to org pages
@ 2020-12-23  2:35 82% TEC
                     ` (2 more replies)
  0 siblings, 3 replies; 200+ results
From: TEC @ 2020-12-23  2:35 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]

Hi all,

This is a quick patch to use the Emacs manual CSS with our generated Org
manual.

You can see what the single-page version of this looks like here:
https://tecosaur.com/resources/org/doc/manual.html and the multi-page
here: https://tecosaur.com/resources/org/doc/manual/

This should be an easy upgrade to our online documentation :)

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-mk-default.mk-use-same-html-doc-style-as-emacs.patch --]
[-- Type: text/x-patch, Size: 826 bytes --]

From fc57ea88432ea119d063906cc29cc51ee591031d Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 23 Dec 2020 10:30:09 +0800
Subject: [PATCH] mk/default.mk: use same html doc style as emacs

* mk/default.mk: Add CSS stylesheet ref to HTML generated by TEXI2HTML,
specifically the stylesheet used with the online Emacs manual.
---
 mk/default.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mk/default.mk b/mk/default.mk
index fbfdaf5..e92d58c 100644
--- a/mk/default.mk
+++ b/mk/default.mk
@@ -139,7 +139,7 @@ MKDIR	= install -m 755 -d
 MAKEINFO = makeinfo
 
 # How to create the HTML file
-TEXI2HTML = makeinfo --html --number-sections
+TEXI2HTML = makeinfo --html --number-sections --css-ref "https://www.gnu.org/software/emacs/manual.css"
 
 # How to find files
 FIND	= find
-- 
2.29.2


^ permalink raw reply related	[relevance 82%]

* Re: [PATCH] org-plot abstractions and extension
  @ 2020-12-23  5:10 93%                   ` TEC
  2020-12-23  6:19 43%                     ` TEC
  0 siblings, 1 reply; 200+ results
From: TEC @ 2020-12-23  5:10 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Bastien, org-mode-email


Kyle Meyer <kyle@kyleam.com> writes:

> This series introduced some compiler warnings.
>
> Timothy, could you please submit a follow-up patch to address these?

Absolutely. Thanks for raising this, I'll take a look shortly.

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] org-plot abstractions and extension
  2020-12-23  5:10 93%                   ` TEC
@ 2020-12-23  6:19 43%                     ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2020-12-23  6:19 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Bastien, org-mode-email

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]


TEC <tecosaur@gmail.com> writes:

> Kyle Meyer <kyle@kyleam.com> writes:
>
>> This series introduced some compiler warnings.
>>
>> Timothy, could you please submit a follow-up patch to address these?
>
> Absolutely. Thanks for raising this, I'll take a look shortly.

Here we go :)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-plot.el-fix-compiler-warnings.patch --]
[-- Type: text/x-patch, Size: 7357 bytes --]

From 309907af5e76818753b85af84b3e304d8cb4568c Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 23 Dec 2020 14:13:24 +0800
Subject: [PATCH] org-plot.el: fix compiler warnings

* (org--plot/values-stats): Replace `log10' with `log'.
(org--plot/nice-frequency-pick): Replace obsolete `case' with `pcase`.
(org--plot/radar): Replace `s-join' with `mapconcat', removing the
implicit dependency on s.el.
(org-plot/gnuplot-script): Remove unused let bindings.
(org-plot/gnuplot-script): Replace free variable refence with expression
only using given variables.
---
 lisp/org-plot.el | 117 +++++++++++++++++++++++------------------------
 1 file changed, 57 insertions(+), 60 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 4aa8276..80700e0 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -196,7 +196,7 @@ values, namely regarding the range."
 	 (maximum (or hard-max (apply #'max nums)))
 	 (range (- maximum minimum))
 	 (rangeOrder (if (= range 0) 0
-		       (ceiling (- 1 (log10 range)))))
+		       (ceiling (- 1 (log range 10)))))
 	 (range-factor (expt 10 rangeOrder))
 	 (nice-min (if (= range 0) (car nums)
 		     (/ (float (floor (* minimum range-factor))) range-factor)))
@@ -210,9 +210,9 @@ values, namely regarding the range."
   "From a the values in a TABLE of data, attempt to guess an appropriate number of ticks."
   (let* ((row-data
 	  (mapcar (lambda (row) (org--plot/values-stats
-			    (mapcar #'string-to-number (cdr row))
-			    hard-min
-			    hard-max)) table))
+				 (mapcar #'string-to-number (cdr row))
+				 hard-min
+				 hard-max)) table))
 	 (row-normalised-ranges (mapcar (lambda (r-data)
 					  (let ((val (round (*
 							     (plist-get r-data :range-factor)
@@ -229,34 +229,34 @@ values, namely regarding the range."
 (defun org--plot/nice-frequency-pick (frequencies)
   "From a list of frequences, try to sensibly pick a sample of the most frequent."
   ;; TODO this mosly works decently, but counld do with some tweaking to work more consistently.
-  (case (length frequencies)
-	(1 (list (car (nth 0 frequencies))))
-	(2 (if (<= 3 (/ (cdr (nth 0 frequencies))
-			(cdr (nth 1 frequencies))))
-	       (make-list 2
-			  (car (nth 0 frequencies)))
-	     (list (car (nth 0 frequencies))
-		   (car (nth 1 frequencies)))))
-	(t
-	 (let* ((total-count (apply #'+ (mapcar #'cdr frequencies)))
-		(n-freq (mapcar (lambda (freq) `(,(car freq) . ,(/ (float (cdr freq)) total-count))) frequencies))
-		(f-pick (list (car (car n-freq))))
-		(1-2-ratio (/ (cdr (nth 0 n-freq))
-			      (cdr (nth 1 n-freq))))
-		(2-3-ratio (/ (cdr (nth 1 n-freq))
-			      (cdr (nth 2 n-freq))))
-		(1-3-ratio (* 1-2-ratio 2-3-ratio))
-		(1-val (car (nth 0 n-freq)))
-		(2-val (car (nth 1 n-freq)))
-		(3-val (car (nth 2 n-freq))))
-	   (when (> 1-2-ratio 4) (push 1-val f-pick))
-	   (when (and (< 1-2-ratio 2-val)
-		      (< (* (apply #'* f-pick) 2-val) 30))
-	     (push 2-val f-pick))
-	   (when (and (< 1-3-ratio 3-val)
-		      (< (* (apply #'* f-pick) 3-val) 30))
-	     (push 3-val f-pick))
-	   f-pick))))
+  (pcase (length frequencies)
+    (1 (list (car (nth 0 frequencies))))
+    (2 (if (<= 3 (/ (cdr (nth 0 frequencies))
+		    (cdr (nth 1 frequencies))))
+	   (make-list 2
+		      (car (nth 0 frequencies)))
+	 (list (car (nth 0 frequencies))
+	       (car (nth 1 frequencies)))))
+    (_
+     (let* ((total-count (apply #'+ (mapcar #'cdr frequencies)))
+	    (n-freq (mapcar (lambda (freq) `(,(car freq) . ,(/ (float (cdr freq)) total-count))) frequencies))
+	    (f-pick (list (car (car n-freq))))
+	    (1-2-ratio (/ (cdr (nth 0 n-freq))
+			  (cdr (nth 1 n-freq))))
+	    (2-3-ratio (/ (cdr (nth 1 n-freq))
+			  (cdr (nth 2 n-freq))))
+	    (1-3-ratio (* 1-2-ratio 2-3-ratio))
+	    (1-val (car (nth 0 n-freq)))
+	    (2-val (car (nth 1 n-freq)))
+	    (3-val (car (nth 2 n-freq))))
+       (when (> 1-2-ratio 4) (push 1-val f-pick))
+       (when (and (< 1-2-ratio 2-val)
+		  (< (* (apply #'* f-pick) 2-val) 30))
+	 (push 2-val f-pick))
+       (when (and (< 1-3-ratio 3-val)
+		  (< (* (apply #'* f-pick) 3-val) 30))
+	 (push 3-val f-pick))
+       f-pick))))
 
 (defun org--plot/merge-alists (function default alist1 alist2 &rest alists)
   "Using FUNCTION, combine the elements of all given ALISTS. When an element is
@@ -473,34 +473,36 @@ EOD
 
 (defun org--plot/radar (table params)
   (let* ((data
-	  (concat "\"" (s-join "\" \"" (plist-get params :labels)) "\""
+	  (concat "\"" (mapconcat #'identity (plist-get params :labels) "\" \"") "\""
 		  "\n"
-		  (s-join "\n"
-			  (mapcar (lambda (row)
-				    (format
-				     "\"%s\" %s"
-				     (car row)
-				     (s-join " " (cdr row))))
-				  (append table (list (car table)))))))
+		  (mapconcat #'identity
+			     (mapcar (lambda (row)
+				       (format
+					"\"%s\" %s"
+					(car row)
+					(mapconcat #'identity (cdr row) " ")))
+				     (append table (list (car table))))
+			     "\n")))
 	 (ticks (or (plist-get params :ticks)
 		    (org--plot/sensible-tick-num table
 						 (plist-get params :ymin)
 						 (plist-get params :ymax))))
 	 (settings
-	  (s-join "\n"
-		  (mapcar (lambda (row)
-			    (let ((data (org--plot/values-stats
-					 (mapcar #'string-to-number (cdr row)))))
-			      (format
-			       "\"%s\" %s %s %s"
-			       (car row)
-			       (or (plist-get params :ymin)
-				   (plist-get data :nice-min))
-			       (or (plist-get params :ymax)
-				   (plist-get data :nice-max))
-			       (if (eq ticks 0) 2 ticks)
-			       )))
-			  (append table (list (car table))))))
+	  (mapconcat #'identity
+		     (mapcar (lambda (row)
+			       (let ((data (org--plot/values-stats
+					    (mapcar #'string-to-number (cdr row)))))
+				 (format
+				  "\"%s\" %s %s %s"
+				  (car row)
+				  (or (plist-get params :ymin)
+				      (plist-get data :nice-min))
+				  (or (plist-get params :ymax)
+				      (plist-get data :nice-max))
+				  (if (eq ticks 0) 2 ticks)
+				  )))
+			     (append table (list (car table))))
+		     "\n"))
 	 (setup-file (make-temp-file "org-plot-setup")))
     (let ((coding-system-for-write 'utf-8))
       (write-region (format org--plot/radar-setup-template data settings) nil setup-file nil :silent))
@@ -533,15 +535,10 @@ manner suitable for prepending to a user-specified script."
       (user-error "Org-plot type `%s' is undefined." type-name))
     (let* ((sets (plist-get params :set))
 	   (lines (plist-get params :line))
-	   (map (plist-get params :map))
 	   (title (plist-get params :title))
 	   (file (plist-get params :file))
-	   (ind (plist-get params :ind))
 	   (time-ind (plist-get params :timeind))
 	   (timefmt (plist-get params :timefmt))
-	   (text-ind (plist-get params :textind))
-	   (deps (if (plist-member params :deps) (plist-get params :deps)))
-	   (col-labels (plist-get params :labels))
 	   (x-labels (plist-get params :xlabels))
 	   (y-labels (plist-get params :ylabels))
 	   (plot-str (or (plist-get type :plot-str)
@@ -650,7 +647,7 @@ line directly before or after the table."
 			org-plot/preset-plot-types)))
 
       (unless type
-	(user-error "Org-plot type `%s' is undefined." type-name))
+	(user-error "Org-plot type `%s' is undefined." (plist-get params :plot-type)))
 
       (run-with-idle-timer 0.1 nil #'delete-file data-file)
       (when (eq (cadr table) 'hline)
-- 
2.29.2


^ permalink raw reply related	[relevance 43%]

* Re: [PATCH] org-plot abstractions and extension
  @ 2020-12-23  8:38 41%                         ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2020-12-23  8:38 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Bastien, org-mode-email

[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]


Kyle Meyer <kyle@kyleam.com> writes:

> case is still available under the cl- prefix.  If you wanted to use it
> in 73c99bf42 (org-plot.el: add utility functions for range,ticks), I
> don't see a reason not to use it now.

I tend to use pcase over cl-case (since it's completely built in, i.e.
no (require 'cl-lib) required). I'm not sure if there's any argument for
cl-case over pcase, let me know if so.

> s/refence/reference/

Done

>> @@ -210,9 +210,9 @@ values, namely regarding the range."
>>    "From a the values in a TABLE of data, attempt to guess an appropriate number of ticks."
>>    (let* ((row-data
>>  	  (mapcar (lambda (row) (org--plot/values-stats
>> -			    (mapcar #'string-to-number (cdr row))
>> -			    hard-min
>> -			    hard-max)) table))
>> +				 (mapcar #'string-to-number (cdr row))
>> +				 hard-min
>> +				 hard-max)) table))
>
> Please drop this unrelated space change.

Erm, this isn't unrelated. As the function being called changed length,
the indentation of the arguments is thus also changed.

> The mapcar is unnecessary; you can reposition (lambda ...) as
> mapconcat's FUNCTION argument.

Thanks for spotting that. Resolved.

Updated patch attached. Let me know how it looks to you :)

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-plot.el-fix-compiler-warnings.patch --]
[-- Type: text/x-patch, Size: 7285 bytes --]

From 22717d0750e2c001003b45f1d4834571f21287ef Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 23 Dec 2020 14:13:24 +0800
Subject: [PATCH] org-plot.el: fix compiler warnings

* (org--plot/values-stats): Replace `log10' with `log'.
(org--plot/nice-frequency-pick): Replace obsolete `case' with `pcase`.
(org--plot/radar): Replace `s-join' with `mapconcat', removing the
implicit dependency on s.el.
(org-plot/gnuplot-script): Remove unused let bindings.
(org-plot/gnuplot-script): Replace free variable reference with expression
only using given variables.
---
 lisp/org-plot.el | 115 +++++++++++++++++++++++------------------------
 1 file changed, 55 insertions(+), 60 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 4aa8276..1c7ee43 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -196,7 +196,7 @@ values, namely regarding the range."
 	 (maximum (or hard-max (apply #'max nums)))
 	 (range (- maximum minimum))
 	 (rangeOrder (if (= range 0) 0
-		       (ceiling (- 1 (log10 range)))))
+		       (ceiling (- 1 (log range 10)))))
 	 (range-factor (expt 10 rangeOrder))
 	 (nice-min (if (= range 0) (car nums)
 		     (/ (float (floor (* minimum range-factor))) range-factor)))
@@ -210,9 +210,9 @@ values, namely regarding the range."
   "From a the values in a TABLE of data, attempt to guess an appropriate number of ticks."
   (let* ((row-data
 	  (mapcar (lambda (row) (org--plot/values-stats
-			    (mapcar #'string-to-number (cdr row))
-			    hard-min
-			    hard-max)) table))
+				 (mapcar #'string-to-number (cdr row))
+				 hard-min
+				 hard-max)) table))
 	 (row-normalised-ranges (mapcar (lambda (r-data)
 					  (let ((val (round (*
 							     (plist-get r-data :range-factor)
@@ -229,34 +229,34 @@ values, namely regarding the range."
 (defun org--plot/nice-frequency-pick (frequencies)
   "From a list of frequences, try to sensibly pick a sample of the most frequent."
   ;; TODO this mosly works decently, but counld do with some tweaking to work more consistently.
-  (case (length frequencies)
-	(1 (list (car (nth 0 frequencies))))
-	(2 (if (<= 3 (/ (cdr (nth 0 frequencies))
-			(cdr (nth 1 frequencies))))
-	       (make-list 2
-			  (car (nth 0 frequencies)))
-	     (list (car (nth 0 frequencies))
-		   (car (nth 1 frequencies)))))
-	(t
-	 (let* ((total-count (apply #'+ (mapcar #'cdr frequencies)))
-		(n-freq (mapcar (lambda (freq) `(,(car freq) . ,(/ (float (cdr freq)) total-count))) frequencies))
-		(f-pick (list (car (car n-freq))))
-		(1-2-ratio (/ (cdr (nth 0 n-freq))
-			      (cdr (nth 1 n-freq))))
-		(2-3-ratio (/ (cdr (nth 1 n-freq))
-			      (cdr (nth 2 n-freq))))
-		(1-3-ratio (* 1-2-ratio 2-3-ratio))
-		(1-val (car (nth 0 n-freq)))
-		(2-val (car (nth 1 n-freq)))
-		(3-val (car (nth 2 n-freq))))
-	   (when (> 1-2-ratio 4) (push 1-val f-pick))
-	   (when (and (< 1-2-ratio 2-val)
-		      (< (* (apply #'* f-pick) 2-val) 30))
-	     (push 2-val f-pick))
-	   (when (and (< 1-3-ratio 3-val)
-		      (< (* (apply #'* f-pick) 3-val) 30))
-	     (push 3-val f-pick))
-	   f-pick))))
+  (pcase (length frequencies)
+    (1 (list (car (nth 0 frequencies))))
+    (2 (if (<= 3 (/ (cdr (nth 0 frequencies))
+		    (cdr (nth 1 frequencies))))
+	   (make-list 2
+		      (car (nth 0 frequencies)))
+	 (list (car (nth 0 frequencies))
+	       (car (nth 1 frequencies)))))
+    (_
+     (let* ((total-count (apply #'+ (mapcar #'cdr frequencies)))
+	    (n-freq (mapcar (lambda (freq) `(,(car freq) . ,(/ (float (cdr freq)) total-count))) frequencies))
+	    (f-pick (list (car (car n-freq))))
+	    (1-2-ratio (/ (cdr (nth 0 n-freq))
+			  (cdr (nth 1 n-freq))))
+	    (2-3-ratio (/ (cdr (nth 1 n-freq))
+			  (cdr (nth 2 n-freq))))
+	    (1-3-ratio (* 1-2-ratio 2-3-ratio))
+	    (1-val (car (nth 0 n-freq)))
+	    (2-val (car (nth 1 n-freq)))
+	    (3-val (car (nth 2 n-freq))))
+       (when (> 1-2-ratio 4) (push 1-val f-pick))
+       (when (and (< 1-2-ratio 2-val)
+		  (< (* (apply #'* f-pick) 2-val) 30))
+	 (push 2-val f-pick))
+       (when (and (< 1-3-ratio 3-val)
+		  (< (* (apply #'* f-pick) 3-val) 30))
+	 (push 3-val f-pick))
+       f-pick))))
 
 (defun org--plot/merge-alists (function default alist1 alist2 &rest alists)
   "Using FUNCTION, combine the elements of all given ALISTS. When an element is
@@ -473,34 +473,34 @@ EOD
 
 (defun org--plot/radar (table params)
   (let* ((data
-	  (concat "\"" (s-join "\" \"" (plist-get params :labels)) "\""
+	  (concat "\"" (mapconcat #'identity (plist-get params :labels) "\" \"") "\""
 		  "\n"
-		  (s-join "\n"
-			  (mapcar (lambda (row)
-				    (format
-				     "\"%s\" %s"
-				     (car row)
-				     (s-join " " (cdr row))))
-				  (append table (list (car table)))))))
+		  (mapconcat (lambda (row)
+			       (format
+				"\"%s\" %s"
+				(car row)
+				(mapconcat #'identity (cdr row) " ")))
+			     (append table (list (car table)))
+			     "\n")))
 	 (ticks (or (plist-get params :ticks)
 		    (org--plot/sensible-tick-num table
 						 (plist-get params :ymin)
 						 (plist-get params :ymax))))
 	 (settings
-	  (s-join "\n"
-		  (mapcar (lambda (row)
-			    (let ((data (org--plot/values-stats
-					 (mapcar #'string-to-number (cdr row)))))
-			      (format
-			       "\"%s\" %s %s %s"
-			       (car row)
-			       (or (plist-get params :ymin)
-				   (plist-get data :nice-min))
-			       (or (plist-get params :ymax)
-				   (plist-get data :nice-max))
-			       (if (eq ticks 0) 2 ticks)
-			       )))
-			  (append table (list (car table))))))
+	  (mapconcat (lambda (row)
+		       (let ((data (org--plot/values-stats
+				    (mapcar #'string-to-number (cdr row)))))
+			 (format
+			  "\"%s\" %s %s %s"
+			  (car row)
+			  (or (plist-get params :ymin)
+			      (plist-get data :nice-min))
+			  (or (plist-get params :ymax)
+			      (plist-get data :nice-max))
+			  (if (eq ticks 0) 2 ticks)
+			  )))
+		     (append table (list (car table)))
+		     "\n"))
 	 (setup-file (make-temp-file "org-plot-setup")))
     (let ((coding-system-for-write 'utf-8))
       (write-region (format org--plot/radar-setup-template data settings) nil setup-file nil :silent))
@@ -533,15 +533,10 @@ manner suitable for prepending to a user-specified script."
       (user-error "Org-plot type `%s' is undefined." type-name))
     (let* ((sets (plist-get params :set))
 	   (lines (plist-get params :line))
-	   (map (plist-get params :map))
 	   (title (plist-get params :title))
 	   (file (plist-get params :file))
-	   (ind (plist-get params :ind))
 	   (time-ind (plist-get params :timeind))
 	   (timefmt (plist-get params :timefmt))
-	   (text-ind (plist-get params :textind))
-	   (deps (if (plist-member params :deps) (plist-get params :deps)))
-	   (col-labels (plist-get params :labels))
 	   (x-labels (plist-get params :xlabels))
 	   (y-labels (plist-get params :ylabels))
 	   (plot-str (or (plist-get type :plot-str)
@@ -650,7 +645,7 @@ line directly before or after the table."
 			org-plot/preset-plot-types)))
 
       (unless type
-	(user-error "Org-plot type `%s' is undefined." type-name))
+	(user-error "Org-plot type `%s' is undefined." (plist-get params :plot-type)))
 
       (run-with-idle-timer 0.1 nil #'delete-file data-file)
       (when (eq (cadr table) 'hline)
-- 
2.29.2


^ permalink raw reply related	[relevance 41%]

* Re: [PATCH] org-plot abstractions and extension
  @ 2020-12-23 18:19 43%                             ` TEC
  0 siblings, 0 replies; 200+ results
From: TEC @ 2020-12-23 18:19 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Bastien, org-mode-email

[-- Attachment #1: Type: text/plain, Size: 1988 bytes --]


Kyle Meyer <kyle@kyleam.com> writes:

> Regardless of what you tend to use, you used "case" here in 73c99bf42;
> the minimal fix is to add a cl- prefix, and any other switch with the
> justification that "case is obsolete" is likely to raise a reviewer's
> eyebrow.

This makes sense.

> cl-case isn't in cl-lib, and there is no need to load anything.

Huh, interesting.

> recent org-plot example from 8d5122fc5:
> [...]
> That could be rewritten as [...]

Would you like me to bundle that change in somewhere?

>>>> @@ -210,9 +210,9 @@ values, namely regarding the range."
>>>>    "From a the values in a TABLE of data, attempt to guess an appropriate number of ticks."
>>>>    (let* ((row-data
>>>>  	  (mapcar (lambda (row) (org--plot/values-stats
>>>> -			    (mapcar #'string-to-number (cdr row))
>>>> -			    hard-min
>>>> -			    hard-max)) table))
>>>> +				 (mapcar #'string-to-number (cdr row))
>>>> +				 hard-min
>>>> +				 hard-max)) table))
>>>
>>> Please drop this unrelated space change.
>>
>> Erm, this isn't unrelated. As the function being called changed length,
>> the indentation of the arguments is thus also changed.
>
> This change is in org--plot/sensible-tick-num.  I don't spot any
> non-whitespace changes there.  Git appears to agree with me:
>
>   $ git show | grep '@@ -210,9'
>   @@ -210,9 +210,9 @@ (defun org--plot/sensible-tick-num (table &optional hard-min hard-max)
>   $ git show -w | grep '@@ -210,9'

Ooops, I thought you were referring to one of the other regions (I saw
the "let" and "mapcar" and my brain pattern-matched the rest :P)

One question, I saw Bastien say that we didn't want whitespace-only
commits, so how should whitespace-fixups be done?

>> Subject: [PATCH] org-plot.el: fix compiler warnings
>>
>> * (org--plot/values-stats): Replace `log10' with `log'.
>
> Please add a file name ("lisp/org-plot.el") to the start of the
> changelog entry.

Ah, forgot I needed that. Sorted :)

(final?) patch revision attached.

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-plot.el-fix-compiler-warnings.patch --]
[-- Type: text/x-patch, Size: 6785 bytes --]

From c4c7b835f27b65111859d030af58a8317a82b0a0 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 24 Dec 2020 02:26:17 +0800
Subject: [PATCH] org-plot.el: fix compiler warnings

* lisp/org-plot.el (org--plot/values-stats): Replace `log10' with
`log'.
(org--plot/nice-frequency-pick): Replace obsolete `case' with `pcase`.
(org--plot/radar): Replace `s-join' with `mapconcat', removing the
implicit dependency on s.el.
(org-plot/gnuplot-script): Remove unused let bindings.
(org-plot/gnuplot-script): Replace free variable reference with
expression only using given variables.
---
 lisp/org-plot.el | 109 ++++++++++++++++++++++-------------------------
 1 file changed, 52 insertions(+), 57 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 4aa8276..5c6c834 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -196,7 +196,7 @@ values, namely regarding the range."
 	 (maximum (or hard-max (apply #'max nums)))
 	 (range (- maximum minimum))
 	 (rangeOrder (if (= range 0) 0
-		       (ceiling (- 1 (log10 range)))))
+		       (ceiling (- 1 (log range 10)))))
 	 (range-factor (expt 10 rangeOrder))
 	 (nice-min (if (= range 0) (car nums)
 		     (/ (float (floor (* minimum range-factor))) range-factor)))
@@ -229,34 +229,34 @@ values, namely regarding the range."
 (defun org--plot/nice-frequency-pick (frequencies)
   "From a list of frequences, try to sensibly pick a sample of the most frequent."
   ;; TODO this mosly works decently, but counld do with some tweaking to work more consistently.
-  (case (length frequencies)
-	(1 (list (car (nth 0 frequencies))))
-	(2 (if (<= 3 (/ (cdr (nth 0 frequencies))
-			(cdr (nth 1 frequencies))))
-	       (make-list 2
-			  (car (nth 0 frequencies)))
-	     (list (car (nth 0 frequencies))
-		   (car (nth 1 frequencies)))))
-	(t
-	 (let* ((total-count (apply #'+ (mapcar #'cdr frequencies)))
-		(n-freq (mapcar (lambda (freq) `(,(car freq) . ,(/ (float (cdr freq)) total-count))) frequencies))
-		(f-pick (list (car (car n-freq))))
-		(1-2-ratio (/ (cdr (nth 0 n-freq))
-			      (cdr (nth 1 n-freq))))
-		(2-3-ratio (/ (cdr (nth 1 n-freq))
-			      (cdr (nth 2 n-freq))))
-		(1-3-ratio (* 1-2-ratio 2-3-ratio))
-		(1-val (car (nth 0 n-freq)))
-		(2-val (car (nth 1 n-freq)))
-		(3-val (car (nth 2 n-freq))))
-	   (when (> 1-2-ratio 4) (push 1-val f-pick))
-	   (when (and (< 1-2-ratio 2-val)
-		      (< (* (apply #'* f-pick) 2-val) 30))
-	     (push 2-val f-pick))
-	   (when (and (< 1-3-ratio 3-val)
-		      (< (* (apply #'* f-pick) 3-val) 30))
-	     (push 3-val f-pick))
-	   f-pick))))
+  (cl-case (length frequencies)
+    (1 (list (car (nth 0 frequencies))))
+    (2 (if (<= 3 (/ (cdr (nth 0 frequencies))
+		    (cdr (nth 1 frequencies))))
+	   (make-list 2
+		      (car (nth 0 frequencies)))
+	 (list (car (nth 0 frequencies))
+	       (car (nth 1 frequencies)))))
+    (t
+     (let* ((total-count (apply #'+ (mapcar #'cdr frequencies)))
+	    (n-freq (mapcar (lambda (freq) `(,(car freq) . ,(/ (float (cdr freq)) total-count))) frequencies))
+	    (f-pick (list (car (car n-freq))))
+	    (1-2-ratio (/ (cdr (nth 0 n-freq))
+			  (cdr (nth 1 n-freq))))
+	    (2-3-ratio (/ (cdr (nth 1 n-freq))
+			  (cdr (nth 2 n-freq))))
+	    (1-3-ratio (* 1-2-ratio 2-3-ratio))
+	    (1-val (car (nth 0 n-freq)))
+	    (2-val (car (nth 1 n-freq)))
+	    (3-val (car (nth 2 n-freq))))
+       (when (> 1-2-ratio 4) (push 1-val f-pick))
+       (when (and (< 1-2-ratio 2-val)
+		  (< (* (apply #'* f-pick) 2-val) 30))
+	 (push 2-val f-pick))
+       (when (and (< 1-3-ratio 3-val)
+		  (< (* (apply #'* f-pick) 3-val) 30))
+	 (push 3-val f-pick))
+       f-pick))))
 
 (defun org--plot/merge-alists (function default alist1 alist2 &rest alists)
   "Using FUNCTION, combine the elements of all given ALISTS. When an element is
@@ -473,34 +473,34 @@ EOD
 
 (defun org--plot/radar (table params)
   (let* ((data
-	  (concat "\"" (s-join "\" \"" (plist-get params :labels)) "\""
+	  (concat "\"" (mapconcat #'identity (plist-get params :labels) "\" \"") "\""
 		  "\n"
-		  (s-join "\n"
-			  (mapcar (lambda (row)
-				    (format
-				     "\"%s\" %s"
-				     (car row)
-				     (s-join " " (cdr row))))
-				  (append table (list (car table)))))))
+		  (mapconcat (lambda (row)
+			       (format
+				"\"%s\" %s"
+				(car row)
+				(mapconcat #'identity (cdr row) " ")))
+			     (append table (list (car table)))
+			     "\n")))
 	 (ticks (or (plist-get params :ticks)
 		    (org--plot/sensible-tick-num table
 						 (plist-get params :ymin)
 						 (plist-get params :ymax))))
 	 (settings
-	  (s-join "\n"
-		  (mapcar (lambda (row)
-			    (let ((data (org--plot/values-stats
-					 (mapcar #'string-to-number (cdr row)))))
-			      (format
-			       "\"%s\" %s %s %s"
-			       (car row)
-			       (or (plist-get params :ymin)
-				   (plist-get data :nice-min))
-			       (or (plist-get params :ymax)
-				   (plist-get data :nice-max))
-			       (if (eq ticks 0) 2 ticks)
-			       )))
-			  (append table (list (car table))))))
+	  (mapconcat (lambda (row)
+		       (let ((data (org--plot/values-stats
+				    (mapcar #'string-to-number (cdr row)))))
+			 (format
+			  "\"%s\" %s %s %s"
+			  (car row)
+			  (or (plist-get params :ymin)
+			      (plist-get data :nice-min))
+			  (or (plist-get params :ymax)
+			      (plist-get data :nice-max))
+			  (if (eq ticks 0) 2 ticks)
+			  )))
+		     (append table (list (car table)))
+		     "\n"))
 	 (setup-file (make-temp-file "org-plot-setup")))
     (let ((coding-system-for-write 'utf-8))
       (write-region (format org--plot/radar-setup-template data settings) nil setup-file nil :silent))
@@ -533,15 +533,10 @@ manner suitable for prepending to a user-specified script."
       (user-error "Org-plot type `%s' is undefined." type-name))
     (let* ((sets (plist-get params :set))
 	   (lines (plist-get params :line))
-	   (map (plist-get params :map))
 	   (title (plist-get params :title))
 	   (file (plist-get params :file))
-	   (ind (plist-get params :ind))
 	   (time-ind (plist-get params :timeind))
 	   (timefmt (plist-get params :timefmt))
-	   (text-ind (plist-get params :textind))
-	   (deps (if (plist-member params :deps) (plist-get params :deps)))
-	   (col-labels (plist-get params :labels))
 	   (x-labels (plist-get params :xlabels))
 	   (y-labels (plist-get params :ylabels))
 	   (plot-str (or (plist-get type :plot-str)
@@ -650,7 +645,7 @@ line directly before or after the table."
 			org-plot/preset-plot-types)))
 
       (unless type
-	(user-error "Org-plot type `%s' is undefined." type-name))
+	(user-error "Org-plot type `%s' is undefined." (plist-get params :plot-type)))
 
       (run-with-idle-timer 0.1 nil #'delete-file data-file)
       (when (eq (cadr table) 'hline)
-- 
2.29.2


^ permalink raw reply related	[relevance 43%]

* Re: [PATCH] Apply emacs manual css to org pages
  @ 2020-12-28  4:04 93%       ` TEC
  0 siblings, 0 replies; 200+ results
From: TEC @ 2020-12-28  4:04 UTC (permalink / raw)
  To: Samuel Wales; +Cc: org-mode-email


Hi Samuel,

We could add some of our own CSS, but that would have us deviate from
the Emacs manual. It's worth asking if we want to do that IMO.

--
Timothy

Samuel Wales <samologist@gmail.com> writes:

> i wonder if css makes it possible to have wider margins /except/ for
> tables and stuch.  or perhaps that is consiedered bad style.  but it
> would be accessible/functional.  but i am just glad that it is only
> tables that need horizontal scrolling.
>
> On 12/27/20, Samuel Wales <samologist@gmail.com> wrote:
>> if i were to make any /tiny nit-level/ suggestions from my pov it
>> would be somewhat wider margins, not pure white but slightly [so still
>> /very/ high contrast] warmer for fg, and some less-blue for links [but
>> i realize blue is common].
>>
>> i would also do [ha ha, as if i knew what to do or even whether it is
>> possible] wrapping for left columns that go under text rather than
>> bullet for e.g this line: "• Extracting Agenda Information	
>> 	Post-processing agenda information."  set fonts large.
>>
>> these are without regard for emacs manual as i have not seen that
>> online recently.  great job.  thank you.
>>
>>
>> On 12/27/20, Samuel Wales <samologist@gmail.com> wrote:
>>> i like the black bg, the no issues with paragraph width.
>>>
>>>
>>> On 12/22/20, TEC <tecosaur@gmail.com> wrote:
>>>> Hi all,
>>>>
>>>> This is a quick patch to use the Emacs manual CSS with our generated Org
>>>> manual.
>>>>
>>>> You can see what the single-page version of this looks like here:
>>>> https://tecosaur.com/resources/org/doc/manual.html and the multi-page
>>>> here: https://tecosaur.com/resources/org/doc/manual/
>>>>
>>>> This should be an easy upgrade to our online documentation :)
>>>>
>>>> --
>>>> Timothy
>>>>
>>>>
>>>
>>>
>>> --
>>> The Kafka Pandemic
>>>
>>> Please learn what misopathy is.
>>> https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
>>>
>>
>>
>> --
>> The Kafka Pandemic
>>
>> Please learn what misopathy is.
>> https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
>>



^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2021-01-02 18:51 34%                                     ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2021-01-02 18:51 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Bastien, org-mode-email

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]


After considering the information passed to a meta info generation
function, I'm now in agreement with you that just passing `info' is the
most sensible way forward.

Attached is a (final?) set of patches, which is as described.

--
Timothy.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox-html.el-make-html-meta-tag-builder-nicer.patch --]
[-- Type: text/x-patch, Size: 5930 bytes --]

From e8c9646ae6c5083417a927bd2b23bb0f837930d2 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:41:33 +0800
Subject: [PATCH 1/2] lisp/ox-html.el: make html meta tag builder nicer

* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The keyword value formatting is changed from `org-export-data' to
`org-html-encode-plain-text' to avoid potentially nesting HTML tags in
meta tags and the <title> element, which would violate W3C.
---
 lisp/ox-html.el | 114 ++++++++++++++++++++++++------------------------
 1 file changed, 56 insertions(+), 58 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 03145e3..f74c6a4 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1835,78 +1835,76 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html--build-meta-entry (label identity &optional content-format &rest content-formatters)
+  "Construct <meta> tag of form <meta LABEL=\"IDENTITY\" />, or when CONTENT-FORMAT is present:
+<meta LABEL=\"IDENTITY\" content=\"{content}\" />
+
+Here {content} is determined by applying any CONTENT-FORMATTERS to the CONTENT-FORMAT and encoding
+the result as plain text."
+  (concat "<meta "
+	  (format "%s=\"%s" label identity)
+	  (when content-format
+	    (concat "\" content=\""
+		    (replace-regexp-in-string
+		     "\"" "&quot;"
+		     (org-html-encode-plain-text
+		      (if content-formatters
+			  (apply #'format content-format content-formatters)
+			content-format)))))
+	  "\" />\n"))
+
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
-  (let* ((protect-string
-          (lambda (str)
-            (replace-regexp-in-string
-             "\"" "&quot;" (org-html-encode-plain-text str))))
-         (title (org-export-data (plist-get info :title) info))
-         ;; Set title to an invisible character instead of leaving it
-         ;; empty, which is invalid.
-         (title (if (org-string-nw-p title) title "&lrm;"))
-         (author (and (plist-get info :with-author)
-                      (let ((auth (plist-get info :author)))
+  (let* ((title (org-html-plain-text
+		 (org-element-interpret-data (plist-get info :title)) info))
+	 ;; Set title to an invisible character instead of leaving it
+	 ;; empty, which is invalid.
+	 (title (if (org-string-nw-p title) title "&lrm;"))
+	 (author (and (plist-get info :with-author)
+		      (let ((auth (plist-get info :author)))
 			;; Return raw Org syntax.
-                        (and auth (org-element-interpret-data auth)))))
-         (description (plist-get info :description))
-         (keywords (plist-get info :keywords))
-         (charset (or (and org-html-coding-system
-                           (fboundp 'coding-system-get)
-                           (coding-system-get org-html-coding-system
-                                              'mime-charset))
-                      "iso-8859-1")))
+			(and auth (org-html-plain-text
+				   (org-element-interpret-data auth) info)))))
+	 (charset (or (and org-html-coding-system
+			   (fboundp 'coding-system-get)
+			   (symbol-name
+			    (coding-system-get org-html-coding-system
+					       'mime-charset)))
+		      "iso-8859-1")))
     (concat
      (when (plist-get info :time-stamp-file)
        (format-time-string
 	(concat "<!-- "
 		(plist-get info :html-metadata-timestamp-format)
 		" -->\n")))
-     (format
-      (if (org-html-html5-p info)
-	  (org-html-close-tag "meta" "charset=\"%s\"" info)
-	(org-html-close-tag
-	 "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
-	 info))
-      charset) "\n"
+
+     (if (org-html-html5-p info)
+	 (org-html--build-meta-entry "charset" charset)
+       (org-html--build-meta-entry "http-equiv" "Content-Type"
+				   (concat "text/html;charset=" charset)))
+
      (let ((viewport-options
 	    (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
 			      (plist-get info :html-viewport))))
-       (and viewport-options
-	    (concat
-	     (org-html-close-tag
-	      "meta"
-	      (format "name=\"viewport\" content=\"%s\""
-		      (mapconcat
-		       (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
-		       viewport-options ", "))
-	      info)
-	     "\n")))
+       (if viewport-options
+	   (org-html--build-meta-entry "name" "viewport"
+				       (mapconcat
+					(lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
+					viewport-options ", "))))
+
      (format "<title>%s</title>\n" title)
-     (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\"" info)
-     "\n"
-     (and (org-string-nw-p author)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"author\" content=\"%s\""
-				       (funcall protect-string author))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p description)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"description\" content=\"%s\"\n"
-				       (funcall protect-string description))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p keywords)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"keywords\" content=\"%s\""
-				       (funcall protect-string keywords))
-			       info)
-	   "\n")))))
+
+     (when (org-string-nw-p author)
+       (org-html--build-meta-entry "name" "author" author))
+
+     (when (org-string-nw-p (plist-get info :description))
+       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
+
+     (when (org-string-nw-p (plist-get info :keywords))
+	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
+
+     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-lisp-ox-html.el-make-html-meta-tags-customizable.patch --]
[-- Type: text/x-patch, Size: 4444 bytes --]

From ddb0f73a9e60cdd9fd83a01e8bd0f72716f2bb06 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:50:15 +0800
Subject: [PATCH 2/2] lisp/ox-html.el: make html meta tags customizable

* lisp/ox-html.el (org-html-meta-tags): Introduce this as a new option
which can be modified to set the meta tags added in HTML exports.
(org-html--build-meta-info): Make use of `org-html-meta-tags' instead of
hardcoded meta tags.  This is leveraging the earlier restructuring of
`org-html--build-meta-info' into a much DRYer form, such that this
modification has a negligible impact on complexity and readability.
---
 lisp/ox-html.el | 57 ++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 42 insertions(+), 15 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index f74c6a4..9446f54 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1425,6 +1425,22 @@ not be modified."
 
 ;;;; Template :: Styles
 
+(defcustom org-html-meta-tags #'org-html-meta-tags-default
+  "A list where each item is a list of arguments to be passed
+to `org-html--build-meta-entry'. Any nil items are ignored.
+
+Also accept a function which gives such a list when called with with
+signature (TITLE AUTHOR INFO) where TITLE and AUTHOR are strings,
+and INFO a communication plist."
+  :group 'org-export-html
+  :package-version '(Org . "9.5")
+  :type '(choice
+	  (repeat
+	   (list (string :tag "Meta label")
+		 (string :tag "label value")
+		 (string :tag "Content value")))
+	  function))
+
 (defcustom org-html-head-include-default-style t
   "Non-nil means include the default style in exported HTML files.
 The actual style is defined in `org-html-style-default' and
@@ -1835,6 +1851,27 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html-meta-tags-default (info)
+  "Generate a list items, each of which is a list of arguments that can
+be passed to `org-html--build-meta-entry', to generate meta tags to be
+included in the HTML head.
+
+The documents's TITLE, AUTHOR, and communication plist INFO may be used."
+  (let ((author (and (plist-get info :with-author)
+                     (let ((auth (plist-get info :author)))
+                       ;; Return raw Org syntax.
+                       (and auth (org-html-plain-text
+                                  (org-element-interpret-data auth) info))))))
+    (list
+     (when (org-string-nw-p author)
+       (list "name" "author" author))
+     (when (org-string-nw-p (plist-get info :description))
+       (list "name" "description"
+             (plist-get info :description)))
+     (when (org-string-nw-p (plist-get info :keywords))
+       (list "name" "keywords" (plist-get info :keywords)))
+     '("name" "generator" "Org Mode"))))
+
 (defun org-html--build-meta-entry (label identity &optional content-format &rest content-formatters)
   "Construct <meta> tag of form <meta LABEL=\"IDENTITY\" />, or when CONTENT-FORMAT is present:
 <meta LABEL=\"IDENTITY\" content=\"{content}\" />
@@ -1861,11 +1898,6 @@ INFO is a plist used as a communication channel."
 	 ;; Set title to an invisible character instead of leaving it
 	 ;; empty, which is invalid.
 	 (title (if (org-string-nw-p title) title "&lrm;"))
-	 (author (and (plist-get info :with-author)
-		      (let ((auth (plist-get info :author)))
-			;; Return raw Org syntax.
-			(and auth (org-html-plain-text
-				   (org-element-interpret-data auth) info)))))
 	 (charset (or (and org-html-coding-system
 			   (fboundp 'coding-system-get)
 			   (symbol-name
@@ -1895,16 +1927,11 @@ INFO is a plist used as a communication channel."
 
      (format "<title>%s</title>\n" title)
 
-     (when (org-string-nw-p author)
-       (org-html--build-meta-entry "name" "author" author))
-
-     (when (org-string-nw-p (plist-get info :description))
-       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
-
-     (when (org-string-nw-p (plist-get info :keywords))
-	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
-
-     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
+     (mapconcat
+      (lambda (args) (apply #'org-html--build-meta-entry args))
+      (delq nil (if (functionp org-html-meta-tags)
+		    (funcall org-html-meta-tags info)
+		  org-html-meta-tags)) ""))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


^ permalink raw reply related	[relevance 34%]

* Re: [PATCH] Async session eval (2nd attempt)
  @ 2021-01-03  8:51 70% ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2021-01-03  8:51 UTC (permalink / raw)
  To: Jack Kamm; +Cc: emacs-orgmode


Hi Jack,

I love the look of this! Thanks for submitting a patch.

Sorry it's taken so long for someone to take a look at it, I think a lot
of the 'main' Org people have been pretty busy over the last few months.

I just tried to give this a shot.
First up, I had to remove the ORG-NEWS part of the patch to be able to
provide it. It would be nice if you could update the patch so this
applies cleanly.

#+begin_example
error: patch failed: etc/ORG-NEWS:88
error: etc/ORG-NEWS: patch does not apply
#+end_example

To test this, after applying your patch (with ORG-NEWS removed), I
started emacs -Q, loaded Org, and opened a new file.

I was initially unable to get this to seem to work, until I changed the
:results type to "output".

See a excerpt from my test file below:

----- excerpt start -----

#+begin_src python :async :session blah :results output
from time import sleep

a=2

sleep(2)
print("Hi")
#+end_src

#+RESULTS:
: Hi

#+begin_src python :async :session blah
return(a)
#+end_src

#+RESULTS:
: /tmp/babel-62cQRX/python-EfJ4o4

#+begin_src python :async :session blah :results output
print(a)
#+end_src

#+RESULTS:
: 2

----- excerpt end -----


I'm surprised this didn't work with the non-output block though.

Other than this, I'm rather happy to see that when I tried to execute
two long running blocks at once, the second one was not executed until
the first completed :)

Finally, I see that this requires :session to be set in order to work.
Might it be possible to have this work for non-session blocks too? It
seems odd that what I'd imagine is the harder case (session blocks) is
supported, but one-shot (non-session) blocks aren't.

Thanks again for your work, and I look forward to seeing what else you
have in the future!

--
Timothy

p.s. After this is merged, it would be great to see support for other
languages grow :)

Jack Kamm <jackkamm@gmail.com> writes:

> This patch adds asynchronous evaluation for session blocks in
> Python. It also adds functionality to implement async session eval for
> other languages using ob-comint.el.
>
> To test the attached patch, add ":async" to a Python session block
> with a long computation (or "time.sleep") in it. Upon evaluation, your
> Emacs won't freeze to wait for the result -- instead, a placeholder
> will be inserted, and replaced with the true result when it's ready.
>
> I'll note how this is different from some related projects. ob-async
> implements asynchronous evaluation for Babel, but it doesn't work with
> sessions. emacs-jupyter, ein, and ob-ipython all implement
> asynchronous session evaluation, but only for Jupyter kernels. Jupyter
> is great for some cases, but sometimes I prefer to use the built-in
> org-babel languages without jupyter.
>
> The new functionality is mainly implemented in
> `org-babel-comint-async-filter', which I've defined in ob-comint.el,
> and added as a hook to `comint-output-filter-functions'.  Whenever new
> output is added to the comint buffer, the filter scans for an
> indicator token (this is inspired by
> `org-babel-comint-with-output'). Upon encountering the token, the
> filter uses a regular expression to extract a UUID or temp-file
> associated with the result, then searches for the appropriate location
> to add the result to.
>
> This is my 2nd attempt at this patch [0]. I have also ported it to an
> external package [1], but would like to have this functionality in Org
> proper, to permit better code reuse between async and sync
> implementations. The external package also includes an R
> implementation that I regularly use, as well as a Ruby implementation,
> but I've left these out to keep this initial patch smaller, and also I
> need to confirm copyright assignment on the Ruby implementation which
> was externally contributed.
>
> [0] https://orgmode.org/list/87muj04xim.fsf@jaheira.i-did-not-set--mail-host-address--so-tickle-me/
> [1] https://github.com/jackkamm/ob-session-async


^ permalink raw reply	[relevance 70%]

* Re: [PATCH] ox-md.el/markdown-hyperlink
  @ 2021-01-03 10:06 93% ` TEC
  0 siblings, 0 replies; 200+ results
From: TEC @ 2021-01-03 10:06 UTC (permalink / raw)
  To: turbo.cafe@clovermail.net; +Cc: emacs-orgmode


Thanks for the patch turbo.

I was able to test this with a simple Org file, and both observed the
issue with radio targets in generated markdown files, and observed the
patch fixing it, as intended.

--
Timothy

turbo.cafe@clovermail.net <turbo.cafe@clovermail.net> writes:

> exporting to markdown loses radio target hyperlinks.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] ox-md.el/preserve radio target hyperlink
  @ 2021-01-03 10:11 93% ` TEC
  0 siblings, 0 replies; 200+ results
From: TEC @ 2021-01-03 10:11 UTC (permalink / raw)
  To: nazar.stasiv@atk.sk; +Cc: emacs-orgmode


Hi turbo.

As this appears to be an exact duplicate of your other email, I'm going
to mark this as closed and hope that any/all conversation on your patch
happens there.

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [patch] A proposal to add LaTeX attributes to verse blocks
  @ 2021-01-03 10:22 93% ` TEC
  0 siblings, 0 replies; 200+ results
From: TEC @ 2021-01-03 10:22 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: emacs-orgmode


Hi Juan,

Since you've resent this in a second email, let's discuss this patch
there.

As such, I'm marking this patch as closed.

--
Timothy.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] A proposal to add LaTeX attributes to verse blocks
  @ 2021-01-03 10:25 92% ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2021-01-03 10:25 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: emacs-orgmode


Hi Juan,

Thanks for your patch. 

This looks like a fairly sensible addition. Two comments from me:

1. I'm not sure that "options" is a good name for arbitrary LaTeX which
   is included inside the verse block. Perhaps something like "insert"
   or "include", etc. may be a better fit.
2. It's considered generally nice to document features like this :) The
   two documents which I'd think to note this in are ORG-NEWS and the
   manual (docs/manual.org).

All the best,

Timothy.

Juan Manuel Macías <maciaschain@posteo.net> writes:

> (Sorry, due to a mistake, the text of my message did not appear in my previous email)
>
> Hi,
>
> I would like to propose this patch to add some LaTeX attributes to the verse block,
> especially to be able to apply certain features from the verse.sty package, which is an
> extension (widely used in Humanities) of the standard LaTeX 'verse' environment.
>
> These attributes would be:
>
> - `:lines' to add verse numbers, according to any numbering sequence
> - `:center' to apply the optical centering of the poem, which is a typographic convention
>   whereby a poem or a group of verses is centered on the page, taking the width of the
>   longest verse as a reference. In fact, optical centering is the correct arrangement of
>   verses in a document.
> - `:versewidth' which expects a text string that is the longest verse of the poem,
>   required when applying the `:center' attribute.
>
> As I said, these three attributes require the LateX package verse.sty. A fourth `:options'
> attribute would be used to add arbitrary code within the verse environment.
>
> Consider this complete example with Shakespeare's first sonnet:
>
> #+begin_src org
>   ,#+ATTR_LaTeX: :center t :options \small :lines 5
>   ,#+ATTR_LaTeX: :versewidth Feed’st thy light’st flame with self-substantial fuel,
>   ,#+begin_verse
>   From fairest creatures we desire increase,
>   That thereby beauty’s rose might never die,
>   But as the riper should by time decrease,
>   His tender heir mught bear his memeory:
>   But thou, contracted to thine own bright eyes,
>   Feed’st thy light’st flame with self-substantial fuel,
>   Making a famine where abundance lies,
>   Thyself thy foe, to thy sweet self too cruel.
>   Thou that art now the world’s fresh ornament
>   And only herald to the gaudy spring,
>   Within thine own bud buriest thy content
>   And, tender churl, makest waste in niggarding.
>   Pity the world, or else this glutton be,
>   To eat the world’s due, by the grave and thee.
>   ,#+end_verse
> #+end_src
>
> when exporting to LaTeX we get:
>
> #+begin_src latex
> \settowidth{\versewidth}{Feed’st thy light’st flame with self-substantial fuel,}
> \begin{verse}[\versewidth]
> \poemlines{5}
> \small
> From fairest creatures we desire increase,\\
> That thereby beauty’s rose might never die,\\
> But as the riper should by time decrease,\\
> His tender heir mught bear his memeory:\\
> But thou, contracted to thine own bright eyes,\\
> Feed’st thy light’st flame with self-substantial fuel,\\
> Making a famine where abundance lies,\\
> Thyself thy foe, to thy sweet self too cruel.\\
> Thou that art now the world’s fresh ornament\\
> And only herald to the gaudy spring,\\
> Within thine own bud buriest thy content\\
> And, tender churl, makest waste in niggarding.\\
> Pity the world, or else this glutton be,\\
> To eat the world’s due, by the grave and thee.\\
> \end{verse}
> #+end_src
>
> In an attached image I send a screenshot with the typographic result
>
> And finally, this is the patch I would propose
>
> #+begin_src diff
> diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
> index 2a14b25d5..bc6b64e78 100644
> --- a/lisp/ox-latex.el
> +++ b/lisp/ox-latex.el
> @@ -3506,6 +3506,16 @@ channel."
>    "Transcode a VERSE-BLOCK element from Org to LaTeX.
>  CONTENTS is verse block contents.  INFO is a plist holding
>  contextual information."
> +(let*
> +      ((lin (org-export-read-attribute :attr_latex verse-block :lines))
> +       (opt (org-export-read-attribute :attr_latex verse-block :options))
> +       (cent (org-export-read-attribute :attr_latex verse-block :center))
> +       (attr (concat
> +	      (if cent "[\\versewidth]" "")
> +	      (if lin (format "\n\\poemlines{%s}" lin) "")
> +	      (if opt (format "\n%s" opt) "")))
> +       (versewidth (org-export-read-attribute :attr_latex verse-block :versewidth))
> +       (vwidth-attr (if versewidth (format "\\settowidth{\\versewidth}{%s}\n" versewidth) "")))
>    (concat
>     (org-latex--wrap-label
>      verse-block
> @@ -3513,7 +3523,9 @@ contextual information."
>      ;; character and change each white space at beginning of a line
>      ;; into a space of 1 em.  Also change each blank line with
>      ;; a vertical space of 1 em.
> -    (format "\\begin{verse}\n%s\\end{verse}"
> +    (format "%s\\begin{verse}%s\n%s\\end{verse}"
> +	      vwidth-attr
> +	      attr
> 	    (replace-regexp-in-string
> 	     "^[ \t]+" (lambda (m) (format "\\hspace*{%dem}" (length m)))
> 	     (replace-regexp-in-string
> @@ -3524,7 +3536,7 @@ contextual information."
>      info)
>     ;; Insert footnote definitions, if any, after the environment, so
>     ;; the special formatting above is not applied to them.
> -   (org-latex--delayed-footnotes-definitions verse-block info)))
> +   (org-latex--delayed-footnotes-definitions verse-block info))))
> #+end_src
>
> Regards,
>
> Juan Manuel



^ permalink raw reply	[relevance 92%]

* Re: [PATCH] A proposal to add LaTeX attributes to verse blocks
  @ 2021-01-03 13:08 79%     ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2021-01-03 13:08 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode


Juan Manuel Macías <maciaschain@posteo.net> writes:

> Thank you very much for your response and your comments.

Seriously, thanks for the patch. I think the ML is usually a bit more
responsive, but it seems to be a bit quiet at the moment.

> I agree to name "Insert, include, etc." the attribute to include
> arbitrary LaTeX code, better than "options".

Glad my feedback seems to have gone down well :). If the only likely use
of this is adjusting the font, perhaps for the sake of consistency we
can match the behaviour of tables, which take a :font LaTeX attribute?

> Of course, I can add the necessary documentation to the files you tell
> me. As I am new to submitting patches, I don't really know how to
> proceed: do I have to send you the new version of the patch, with the
> documentation? Should I send a new email with all of it to this list?

Thanks for asking. Sometimes it seems the maintainers take the trouble of
adding an ORG-NEWS entry or minor touching ups to the patch, but I think
it's nice to leave as little for them to do as possible :)

Announce changes in: etc/ORG-NEWS
Document new/different behaviour in: doc/org-manual.org

I think Markup for /Rich Contents > Paragraphs/ may be the right place
to add a description of this functionality --- verse blocks are
discussed around line 10750.

Regarding how patches on this ML work, this is what I've observed:
- Initial version of patch submitted, with justification/explanation
- Feedback may be given
- Revisions of the patch are attached in replies to feedback
- Process repeats until everyone's happy
- Patch is merged

i.e. it all tends to happen in the same thread.

Hope this helps,

Timothy.


^ permalink raw reply	[relevance 79%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2021-01-03 14:48 33%                                         ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2021-01-03 14:48 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Bastien, org-mode-email

[-- Attachment #1: Type: text/plain, Size: 638 bytes --]


Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

> The doc strings of org-html-meta-tags and org-html-meta-tags-default
> need to be updated, they still mention author and title.

Ah, yep. Fixed.

> Also, please try checkdoc ;)

Ahhh yes. Checkdoc, my old ~enemy~ /friend/.

I may have shied away from using this because of the litany of issues it
raises for the file.  How I'd love to see a PR making the Org codebase
more consistently follow these guidelines.  Then we could potentially do
something like integrate CI into the patch acception workflow.

Enough of that digression, as before: patches attached :)

--
Timothy.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox-html.el-make-html-meta-tag-builder-nicer.patch --]
[-- Type: text/x-patch, Size: 5982 bytes --]

From de74dcbd51703439faafe96cbc1c60965f064eaa Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:41:33 +0800
Subject: [PATCH 1/2] lisp/ox-html.el: make html meta tag builder nicer

* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The keyword value formatting is changed from `org-export-data' to
`org-html-encode-plain-text' to avoid potentially nesting HTML tags in
meta tags and the <title> element, which would violate W3C.
---
 lisp/ox-html.el | 116 ++++++++++++++++++++++++------------------------
 1 file changed, 58 insertions(+), 58 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 03145e3..4d277a2 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1835,78 +1835,78 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html--build-meta-entry (label identity &optional content-format &rest content-formatters)
+  "Build a meta tag using the provided information.
+
+Construct <meta> tag of form <meta LABEL=\"IDENTITY\" />, or when CONTENT-FORMAT is present:
+<meta LABEL=\"IDENTITY\" content=\"{content}\" />
+
+Here {content} is determined by applying any CONTENT-FORMATTERS to the CONTENT-FORMAT and encoding
+the result as plain text."
+  (concat "<meta "
+	  (format "%s=\"%s" label identity)
+	  (when content-format
+	    (concat "\" content=\""
+		    (replace-regexp-in-string
+		     "\"" "&quot;"
+		     (org-html-encode-plain-text
+		      (if content-formatters
+			  (apply #'format content-format content-formatters)
+			content-format)))))
+	  "\" />\n"))
+
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
-  (let* ((protect-string
-          (lambda (str)
-            (replace-regexp-in-string
-             "\"" "&quot;" (org-html-encode-plain-text str))))
-         (title (org-export-data (plist-get info :title) info))
-         ;; Set title to an invisible character instead of leaving it
-         ;; empty, which is invalid.
-         (title (if (org-string-nw-p title) title "&lrm;"))
-         (author (and (plist-get info :with-author)
-                      (let ((auth (plist-get info :author)))
+  (let* ((title (org-html-plain-text
+		 (org-element-interpret-data (plist-get info :title)) info))
+	 ;; Set title to an invisible character instead of leaving it
+	 ;; empty, which is invalid.
+	 (title (if (org-string-nw-p title) title "&lrm;"))
+	 (author (and (plist-get info :with-author)
+		      (let ((auth (plist-get info :author)))
 			;; Return raw Org syntax.
-                        (and auth (org-element-interpret-data auth)))))
-         (description (plist-get info :description))
-         (keywords (plist-get info :keywords))
-         (charset (or (and org-html-coding-system
-                           (fboundp 'coding-system-get)
-                           (coding-system-get org-html-coding-system
-                                              'mime-charset))
-                      "iso-8859-1")))
+			(and auth (org-html-plain-text
+				   (org-element-interpret-data auth) info)))))
+	 (charset (or (and org-html-coding-system
+			   (fboundp 'coding-system-get)
+			   (symbol-name
+			    (coding-system-get org-html-coding-system
+					       'mime-charset)))
+		      "iso-8859-1")))
     (concat
      (when (plist-get info :time-stamp-file)
        (format-time-string
 	(concat "<!-- "
 		(plist-get info :html-metadata-timestamp-format)
 		" -->\n")))
-     (format
-      (if (org-html-html5-p info)
-	  (org-html-close-tag "meta" "charset=\"%s\"" info)
-	(org-html-close-tag
-	 "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
-	 info))
-      charset) "\n"
+
+     (if (org-html-html5-p info)
+	 (org-html--build-meta-entry "charset" charset)
+       (org-html--build-meta-entry "http-equiv" "Content-Type"
+				   (concat "text/html;charset=" charset)))
+
      (let ((viewport-options
 	    (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
 			      (plist-get info :html-viewport))))
-       (and viewport-options
-	    (concat
-	     (org-html-close-tag
-	      "meta"
-	      (format "name=\"viewport\" content=\"%s\""
-		      (mapconcat
-		       (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
-		       viewport-options ", "))
-	      info)
-	     "\n")))
+       (if viewport-options
+	   (org-html--build-meta-entry "name" "viewport"
+				       (mapconcat
+					(lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
+					viewport-options ", "))))
+
      (format "<title>%s</title>\n" title)
-     (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\"" info)
-     "\n"
-     (and (org-string-nw-p author)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"author\" content=\"%s\""
-				       (funcall protect-string author))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p description)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"description\" content=\"%s\"\n"
-				       (funcall protect-string description))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p keywords)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"keywords\" content=\"%s\""
-				       (funcall protect-string keywords))
-			       info)
-	   "\n")))))
+
+     (when (org-string-nw-p author)
+       (org-html--build-meta-entry "name" "author" author))
+
+     (when (org-string-nw-p (plist-get info :description))
+       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
+
+     (when (org-string-nw-p (plist-get info :keywords))
+	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
+
+     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-lisp-ox-html.el-make-html-meta-tags-customizable.patch --]
[-- Type: text/x-patch, Size: 4420 bytes --]

From 50e8aacca5c92dcf8b2044cdaf70738e1ba757a5 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:50:15 +0800
Subject: [PATCH 2/2] lisp/ox-html.el: make html meta tags customizable

* lisp/ox-html.el (org-html-meta-tags): Introduce this as a new option
which can be modified to set the meta tags added in HTML exports.
(org-html--build-meta-info): Make use of `org-html-meta-tags' instead of
hardcoded meta tags.  This is leveraging the earlier restructuring of
`org-html--build-meta-info' into a much DRYer form, such that this
modification has a negligible impact on complexity and readability.
---
 lisp/ox-html.el | 60 ++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 45 insertions(+), 15 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 4d277a2..483ef4f 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1425,6 +1425,23 @@ not be modified."
 
 ;;;; Template :: Styles
 
+(defcustom org-html-meta-tags #'org-html-meta-tags-default
+  "Form that is used to produce meta tags in the HTML head.
+
+Can be a list where each item is a list of arguments to be passed
+to `org-html--build-meta-entry'. Any nil items are ignored.
+
+Also accept a function which gives such a list when called with with
+a single argument (INFO, a communication plist)."
+  :group 'org-export-html
+  :package-version '(Org . "9.5")
+  :type '(choice
+	  (repeat
+	   (list (string :tag "Meta label")
+		 (string :tag "label value")
+		 (string :tag "Content value")))
+	  function))
+
 (defcustom org-html-head-include-default-style t
   "Non-nil means include the default style in exported HTML files.
 The actual style is defined in `org-html-style-default' and
@@ -1835,6 +1852,29 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html-meta-tags-default (info)
+  "A default value for `org-html-meta-tags'.
+
+Generate a list items, each of which is a list of arguments that can
+be passed to `org-html--build-meta-entry', to generate meta tags to be
+included in the HTML head.
+
+The documents's plist INFO is used to derive relevent information for the tags."
+  (let ((author (and (plist-get info :with-author)
+                     (let ((auth (plist-get info :author)))
+                       ;; Return raw Org syntax.
+                       (and auth (org-html-plain-text
+                                  (org-element-interpret-data auth) info))))))
+    (list
+     (when (org-string-nw-p author)
+       (list "name" "author" author))
+     (when (org-string-nw-p (plist-get info :description))
+       (list "name" "description"
+             (plist-get info :description)))
+     (when (org-string-nw-p (plist-get info :keywords))
+       (list "name" "keywords" (plist-get info :keywords)))
+     '("name" "generator" "Org Mode"))))
+
 (defun org-html--build-meta-entry (label identity &optional content-format &rest content-formatters)
   "Build a meta tag using the provided information.
 
@@ -1863,11 +1903,6 @@ INFO is a plist used as a communication channel."
 	 ;; Set title to an invisible character instead of leaving it
 	 ;; empty, which is invalid.
 	 (title (if (org-string-nw-p title) title "&lrm;"))
-	 (author (and (plist-get info :with-author)
-		      (let ((auth (plist-get info :author)))
-			;; Return raw Org syntax.
-			(and auth (org-html-plain-text
-				   (org-element-interpret-data auth) info)))))
 	 (charset (or (and org-html-coding-system
 			   (fboundp 'coding-system-get)
 			   (symbol-name
@@ -1897,16 +1932,11 @@ INFO is a plist used as a communication channel."
 
      (format "<title>%s</title>\n" title)
 
-     (when (org-string-nw-p author)
-       (org-html--build-meta-entry "name" "author" author))
-
-     (when (org-string-nw-p (plist-get info :description))
-       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
-
-     (when (org-string-nw-p (plist-get info :keywords))
-	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
-
-     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
+     (mapconcat
+      (lambda (args) (apply #'org-html--build-meta-entry args))
+      (delq nil (if (functionp org-html-meta-tags)
+		    (funcall org-html-meta-tags info)
+		  org-html-meta-tags)) ""))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


^ permalink raw reply related	[relevance 33%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2021-01-03 17:17 34%                                             ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2021-01-03 17:17 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Bastien, org-mode-email

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]


Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

> org-html--build-meta-entry and org-html--build-meta-info include some long lines.

Hehe. We've had a lot of back-and-forth haven't we.
At least it feels like it's coming to a close now.

> For org-html-meta-tags-default, I suggest this as last line for the doc
> string (typos, active voice):
> Use document's plist INFO to derive relevant information for the tags.

Sounds good. Done.

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox-html.el-make-html-meta-tag-builder-nicer.patch --]
[-- Type: text/x-patch, Size: 6030 bytes --]

From f3f7325ea77cc443387e69f65e899a9537606d80 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:41:33 +0800
Subject: [PATCH 1/2] lisp/ox-html.el: make html meta tag builder nicer

* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The keyword value formatting is changed from `org-export-data' to
`org-html-encode-plain-text' to avoid potentially nesting HTML tags in
meta tags and the <title> element, which would violate W3C.
---
 lisp/ox-html.el | 118 ++++++++++++++++++++++++------------------------
 1 file changed, 60 insertions(+), 58 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 03145e3..f18f8a2 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1835,78 +1835,80 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html--build-meta-entry
+    (label identity &optional content-format &rest content-formatters)
+  "Build a meta tag using the provided information.
+
+Construct <meta> tag of form <meta LABEL=\"IDENTITY\" />, or when CONTENT-FORMAT
+is present: <meta LABEL=\"IDENTITY\" content=\"{content}\" />
+
+Here {content} is determined by applying any CONTENT-FORMATTERS to the
+CONTENT-FORMAT and encoding the result as plain text."
+  (concat "<meta "
+	  (format "%s=\"%s" label identity)
+	  (when content-format
+	    (concat "\" content=\""
+		    (replace-regexp-in-string
+		     "\"" "&quot;"
+		     (org-html-encode-plain-text
+		      (if content-formatters
+			  (apply #'format content-format content-formatters)
+			content-format)))))
+	  "\" />\n"))
+
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
-  (let* ((protect-string
-          (lambda (str)
-            (replace-regexp-in-string
-             "\"" "&quot;" (org-html-encode-plain-text str))))
-         (title (org-export-data (plist-get info :title) info))
-         ;; Set title to an invisible character instead of leaving it
-         ;; empty, which is invalid.
-         (title (if (org-string-nw-p title) title "&lrm;"))
-         (author (and (plist-get info :with-author)
-                      (let ((auth (plist-get info :author)))
+  (let* ((title (org-html-plain-text
+		 (org-element-interpret-data (plist-get info :title)) info))
+	 ;; Set title to an invisible character instead of leaving it
+	 ;; empty, which is invalid.
+	 (title (if (org-string-nw-p title) title "&lrm;"))
+	 (author (and (plist-get info :with-author)
+		      (let ((auth (plist-get info :author)))
 			;; Return raw Org syntax.
-                        (and auth (org-element-interpret-data auth)))))
-         (description (plist-get info :description))
-         (keywords (plist-get info :keywords))
-         (charset (or (and org-html-coding-system
-                           (fboundp 'coding-system-get)
-                           (coding-system-get org-html-coding-system
-                                              'mime-charset))
-                      "iso-8859-1")))
+			(and auth (org-html-plain-text
+				   (org-element-interpret-data auth) info)))))
+	 (charset (or (and org-html-coding-system
+			   (fboundp 'coding-system-get)
+			   (symbol-name
+			    (coding-system-get org-html-coding-system
+					       'mime-charset)))
+		      "iso-8859-1")))
     (concat
      (when (plist-get info :time-stamp-file)
        (format-time-string
 	(concat "<!-- "
 		(plist-get info :html-metadata-timestamp-format)
 		" -->\n")))
-     (format
-      (if (org-html-html5-p info)
-	  (org-html-close-tag "meta" "charset=\"%s\"" info)
-	(org-html-close-tag
-	 "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
-	 info))
-      charset) "\n"
+
+     (if (org-html-html5-p info)
+	 (org-html--build-meta-entry "charset" charset)
+       (org-html--build-meta-entry "http-equiv" "Content-Type"
+				   (concat "text/html;charset=" charset)))
+
      (let ((viewport-options
 	    (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
 			      (plist-get info :html-viewport))))
-       (and viewport-options
-	    (concat
-	     (org-html-close-tag
-	      "meta"
-	      (format "name=\"viewport\" content=\"%s\""
-		      (mapconcat
-		       (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
-		       viewport-options ", "))
-	      info)
-	     "\n")))
+       (if viewport-options
+	   (org-html--build-meta-entry "name" "viewport"
+				       (mapconcat
+					(lambda (elm)
+                                          (format "%s=%s" (car elm) (cadr elm)))
+					viewport-options ", "))))
+
      (format "<title>%s</title>\n" title)
-     (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\"" info)
-     "\n"
-     (and (org-string-nw-p author)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"author\" content=\"%s\""
-				       (funcall protect-string author))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p description)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"description\" content=\"%s\"\n"
-				       (funcall protect-string description))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p keywords)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"keywords\" content=\"%s\""
-				       (funcall protect-string keywords))
-			       info)
-	   "\n")))))
+
+     (when (org-string-nw-p author)
+       (org-html--build-meta-entry "name" "author" author))
+
+     (when (org-string-nw-p (plist-get info :description))
+       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
+
+     (when (org-string-nw-p (plist-get info :keywords))
+	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
+
+     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-lisp-ox-html.el-make-html-meta-tags-customizable.patch --]
[-- Type: text/x-patch, Size: 4414 bytes --]

From 7389693850ceb7a20eb38b563e6770ef68fd1196 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:50:15 +0800
Subject: [PATCH 2/2] lisp/ox-html.el: make html meta tags customizable

* lisp/ox-html.el (org-html-meta-tags): Introduce this as a new option
which can be modified to set the meta tags added in HTML exports.
(org-html--build-meta-info): Make use of `org-html-meta-tags' instead of
hardcoded meta tags.  This is leveraging the earlier restructuring of
`org-html--build-meta-info' into a much DRYer form, such that this
modification has a negligible impact on complexity and readability.
---
 lisp/ox-html.el | 60 ++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 45 insertions(+), 15 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index f18f8a2..ab03046 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1425,6 +1425,23 @@ not be modified."
 
 ;;;; Template :: Styles
 
+(defcustom org-html-meta-tags #'org-html-meta-tags-default
+  "Form that is used to produce meta tags in the HTML head.
+
+Can be a list where each item is a list of arguments to be passed
+to `org-html--build-meta-entry'. Any nil items are ignored.
+
+Also accept a function which gives such a list when called with with
+a single argument (INFO, a communication plist)."
+  :group 'org-export-html
+  :package-version '(Org . "9.5")
+  :type '(choice
+	  (repeat
+	   (list (string :tag "Meta label")
+		 (string :tag "label value")
+		 (string :tag "Content value")))
+	  function))
+
 (defcustom org-html-head-include-default-style t
   "Non-nil means include the default style in exported HTML files.
 The actual style is defined in `org-html-style-default' and
@@ -1835,6 +1852,29 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html-meta-tags-default (info)
+  "A default value for `org-html-meta-tags'.
+
+Generate a list items, each of which is a list of arguments that can
+be passed to `org-html--build-meta-entry', to generate meta tags to be
+included in the HTML head.
+
+Use document's plist INFO to derive relevant information for the tags."
+  (let ((author (and (plist-get info :with-author)
+                     (let ((auth (plist-get info :author)))
+                       ;; Return raw Org syntax.
+                       (and auth (org-html-plain-text
+                                  (org-element-interpret-data auth) info))))))
+    (list
+     (when (org-string-nw-p author)
+       (list "name" "author" author))
+     (when (org-string-nw-p (plist-get info :description))
+       (list "name" "description"
+             (plist-get info :description)))
+     (when (org-string-nw-p (plist-get info :keywords))
+       (list "name" "keywords" (plist-get info :keywords)))
+     '("name" "generator" "Org Mode"))))
+
 (defun org-html--build-meta-entry
     (label identity &optional content-format &rest content-formatters)
   "Build a meta tag using the provided information.
@@ -1864,11 +1904,6 @@ INFO is a plist used as a communication channel."
 	 ;; Set title to an invisible character instead of leaving it
 	 ;; empty, which is invalid.
 	 (title (if (org-string-nw-p title) title "&lrm;"))
-	 (author (and (plist-get info :with-author)
-		      (let ((auth (plist-get info :author)))
-			;; Return raw Org syntax.
-			(and auth (org-html-plain-text
-				   (org-element-interpret-data auth) info)))))
 	 (charset (or (and org-html-coding-system
 			   (fboundp 'coding-system-get)
 			   (symbol-name
@@ -1899,16 +1934,11 @@ INFO is a plist used as a communication channel."
 
      (format "<title>%s</title>\n" title)
 
-     (when (org-string-nw-p author)
-       (org-html--build-meta-entry "name" "author" author))
-
-     (when (org-string-nw-p (plist-get info :description))
-       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
-
-     (when (org-string-nw-p (plist-get info :keywords))
-	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
-
-     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
+     (mapconcat
+      (lambda (args) (apply #'org-html--build-meta-entry args))
+      (delq nil (if (functionp org-html-meta-tags)
+		    (funcall org-html-meta-tags info)
+		  org-html-meta-tags)) ""))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


^ permalink raw reply related	[relevance 34%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2021-01-10 15:52 34%                                                 ` TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2021-01-10 15:52 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Bastien, org-mode-email

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]


Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

> On line 1432 I get this suggestion from flycheck:
> There should be two spaces after a period (emacs-lisp-checkdoc)
>
> More importantly, I just realized that for author information,
> org-html-plain-text is applied twice, leading to "&amp;amp;" when
> translating "&".  (Once inside org-html-meta-tags-default, then in
> org-html--build-meta-entry.)  This should not happen.
>
> Best wishes
> Jens

Fixed. [exhales]

Thanks for consistently getting back to me on this patch Jens :)

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox-html.el-make-html-meta-tag-builder-nicer.patch --]
[-- Type: text/x-patch, Size: 6030 bytes --]

From 3ab8b4f108c8cfa4b0bf11842907c31846832f1a Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:41:33 +0800
Subject: [PATCH 1/2] lisp/ox-html.el: make html meta tag builder nicer

* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The keyword value formatting is changed from `org-export-data' to
`org-html-encode-plain-text' to avoid potentially nesting HTML tags in
meta tags and the <title> element, which would violate W3C.
---
 lisp/ox-html.el | 118 ++++++++++++++++++++++++------------------------
 1 file changed, 60 insertions(+), 58 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 03145e3..f18f8a2 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1835,78 +1835,80 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html--build-meta-entry
+    (label identity &optional content-format &rest content-formatters)
+  "Build a meta tag using the provided information.
+
+Construct <meta> tag of form <meta LABEL=\"IDENTITY\" />, or when CONTENT-FORMAT
+is present: <meta LABEL=\"IDENTITY\" content=\"{content}\" />
+
+Here {content} is determined by applying any CONTENT-FORMATTERS to the
+CONTENT-FORMAT and encoding the result as plain text."
+  (concat "<meta "
+	  (format "%s=\"%s" label identity)
+	  (when content-format
+	    (concat "\" content=\""
+		    (replace-regexp-in-string
+		     "\"" "&quot;"
+		     (org-html-encode-plain-text
+		      (if content-formatters
+			  (apply #'format content-format content-formatters)
+			content-format)))))
+	  "\" />\n"))
+
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
-  (let* ((protect-string
-          (lambda (str)
-            (replace-regexp-in-string
-             "\"" "&quot;" (org-html-encode-plain-text str))))
-         (title (org-export-data (plist-get info :title) info))
-         ;; Set title to an invisible character instead of leaving it
-         ;; empty, which is invalid.
-         (title (if (org-string-nw-p title) title "&lrm;"))
-         (author (and (plist-get info :with-author)
-                      (let ((auth (plist-get info :author)))
+  (let* ((title (org-html-plain-text
+		 (org-element-interpret-data (plist-get info :title)) info))
+	 ;; Set title to an invisible character instead of leaving it
+	 ;; empty, which is invalid.
+	 (title (if (org-string-nw-p title) title "&lrm;"))
+	 (author (and (plist-get info :with-author)
+		      (let ((auth (plist-get info :author)))
 			;; Return raw Org syntax.
-                        (and auth (org-element-interpret-data auth)))))
-         (description (plist-get info :description))
-         (keywords (plist-get info :keywords))
-         (charset (or (and org-html-coding-system
-                           (fboundp 'coding-system-get)
-                           (coding-system-get org-html-coding-system
-                                              'mime-charset))
-                      "iso-8859-1")))
+			(and auth (org-html-plain-text
+				   (org-element-interpret-data auth) info)))))
+	 (charset (or (and org-html-coding-system
+			   (fboundp 'coding-system-get)
+			   (symbol-name
+			    (coding-system-get org-html-coding-system
+					       'mime-charset)))
+		      "iso-8859-1")))
     (concat
      (when (plist-get info :time-stamp-file)
        (format-time-string
 	(concat "<!-- "
 		(plist-get info :html-metadata-timestamp-format)
 		" -->\n")))
-     (format
-      (if (org-html-html5-p info)
-	  (org-html-close-tag "meta" "charset=\"%s\"" info)
-	(org-html-close-tag
-	 "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
-	 info))
-      charset) "\n"
+
+     (if (org-html-html5-p info)
+	 (org-html--build-meta-entry "charset" charset)
+       (org-html--build-meta-entry "http-equiv" "Content-Type"
+				   (concat "text/html;charset=" charset)))
+
      (let ((viewport-options
 	    (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
 			      (plist-get info :html-viewport))))
-       (and viewport-options
-	    (concat
-	     (org-html-close-tag
-	      "meta"
-	      (format "name=\"viewport\" content=\"%s\""
-		      (mapconcat
-		       (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
-		       viewport-options ", "))
-	      info)
-	     "\n")))
+       (if viewport-options
+	   (org-html--build-meta-entry "name" "viewport"
+				       (mapconcat
+					(lambda (elm)
+                                          (format "%s=%s" (car elm) (cadr elm)))
+					viewport-options ", "))))
+
      (format "<title>%s</title>\n" title)
-     (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\"" info)
-     "\n"
-     (and (org-string-nw-p author)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"author\" content=\"%s\""
-				       (funcall protect-string author))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p description)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"description\" content=\"%s\"\n"
-				       (funcall protect-string description))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p keywords)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"keywords\" content=\"%s\""
-				       (funcall protect-string keywords))
-			       info)
-	   "\n")))))
+
+     (when (org-string-nw-p author)
+       (org-html--build-meta-entry "name" "author" author))
+
+     (when (org-string-nw-p (plist-get info :description))
+       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
+
+     (when (org-string-nw-p (plist-get info :keywords))
+	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
+
+     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-lisp-ox-html.el-make-html-meta-tags-customizable.patch --]
[-- Type: text/x-patch, Size: 4414 bytes --]

From f3cecaa0db74665a8fe971f3103b2d40874d97c7 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:50:15 +0800
Subject: [PATCH 2/2] lisp/ox-html.el: make html meta tags customizable

* lisp/ox-html.el (org-html-meta-tags): Introduce this as a new option
which can be modified to set the meta tags added in HTML exports.
(org-html--build-meta-info): Make use of `org-html-meta-tags' instead of
hardcoded meta tags.  This is leveraging the earlier restructuring of
`org-html--build-meta-info' into a much DRYer form, such that this
modification has a negligible impact on complexity and readability.
---
 lisp/ox-html.el | 60 ++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 45 insertions(+), 15 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index f18f8a2..ab03046 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1425,6 +1425,23 @@ not be modified."
 
 ;;;; Template :: Styles
 
+(defcustom org-html-meta-tags #'org-html-meta-tags-default
+  "Form that is used to produce meta tags in the HTML head.
+
+Can be a list where each item is a list of arguments to be passed
+to `org-html--build-meta-entry'. Any nil items are ignored.
+
+Also accept a function which gives such a list when called with with
+a single argument (INFO, a communication plist)."
+  :group 'org-export-html
+  :package-version '(Org . "9.5")
+  :type '(choice
+	  (repeat
+	   (list (string :tag "Meta label")
+		 (string :tag "label value")
+		 (string :tag "Content value")))
+	  function))
+
 (defcustom org-html-head-include-default-style t
   "Non-nil means include the default style in exported HTML files.
 The actual style is defined in `org-html-style-default' and
@@ -1835,6 +1852,29 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html-meta-tags-default (info)
+  "A default value for `org-html-meta-tags'.
+
+Generate a list items, each of which is a list of arguments that can
+be passed to `org-html--build-meta-entry', to generate meta tags to be
+included in the HTML head.
+
+Use document's plist INFO to derive relevant information for the tags."
+  (let ((author (and (plist-get info :with-author)
+                     (let ((auth (plist-get info :author)))
+                       ;; Return raw Org syntax.
+                       (and auth (org-html-plain-text
+                                  (org-element-interpret-data auth) info))))))
+    (list
+     (when (org-string-nw-p author)
+       (list "name" "author" author))
+     (when (org-string-nw-p (plist-get info :description))
+       (list "name" "description"
+             (plist-get info :description)))
+     (when (org-string-nw-p (plist-get info :keywords))
+       (list "name" "keywords" (plist-get info :keywords)))
+     '("name" "generator" "Org Mode"))))
+
 (defun org-html--build-meta-entry
     (label identity &optional content-format &rest content-formatters)
   "Build a meta tag using the provided information.
@@ -1864,11 +1904,6 @@ INFO is a plist used as a communication channel."
 	 ;; Set title to an invisible character instead of leaving it
 	 ;; empty, which is invalid.
 	 (title (if (org-string-nw-p title) title "&lrm;"))
-	 (author (and (plist-get info :with-author)
-		      (let ((auth (plist-get info :author)))
-			;; Return raw Org syntax.
-			(and auth (org-html-plain-text
-				   (org-element-interpret-data auth) info)))))
 	 (charset (or (and org-html-coding-system
 			   (fboundp 'coding-system-get)
 			   (symbol-name
@@ -1899,16 +1934,11 @@ INFO is a plist used as a communication channel."
 
      (format "<title>%s</title>\n" title)
 
-     (when (org-string-nw-p author)
-       (org-html--build-meta-entry "name" "author" author))
-
-     (when (org-string-nw-p (plist-get info :description))
-       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
-
-     (when (org-string-nw-p (plist-get info :keywords))
-	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
-
-     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
+     (mapconcat
+      (lambda (args) (apply #'org-html--build-meta-entry args))
+      (delq nil (if (functionp org-html-meta-tags)
+		    (funcall org-html-meta-tags info)
+		  org-html-meta-tags)) ""))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


^ permalink raw reply related	[relevance 34%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2021-01-10 20:36 93%                                                     ` TEC
  2021-01-14 10:36 34%                                                       ` TEC
  0 siblings, 1 reply; 200+ results
From: TEC @ 2021-01-10 20:36 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Bastien, org-mode-email


Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

> Sorry, I still see the flycheck warning and "&amp;amp;" for "&".

Maybe I accidently sent you the old patches? I'll check tomorrow.

--
Timothy.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Enhance org-html--build-meta-info
  2021-01-10 20:36 93%                                                     ` TEC
@ 2021-01-14 10:36 34%                                                       ` TEC
      0 siblings, 2 replies; 200+ results
From: TEC @ 2021-01-14 10:36 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Bastien, org-mode-email

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]


TEC <tecosaur@gmail.com> writes:

>> Sorry, I still see the flycheck warning and "&amp;amp;" for "&".
> Maybe I accidently sent you the old patches? I'll check tomorrow.

Hah, I check and guess what I see? The changes were unstaged 😂.

Sorry about that, here's an actual revision.

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox-html.el-make-html-meta-tag-builder-nicer.patch --]
[-- Type: text/x-patch, Size: 6034 bytes --]

From 3ab8b4f108c8cfa4b0bf11842907c31846832f1a Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:41:33 +0800
Subject: [PATCH 1/2] lisp/ox-html.el: make html meta tag builder nicer

* lisp/ox-html.el (org-html--build-meta-info): Multi-line repeated
structure extracted to new function `org-html--build-meta-entry'.
The keyword value formatting is changed from `org-export-data' to
`org-html-encode-plain-text' to avoid potentially nesting HTML tags in
meta tags and the <title> element, which would violate W3C.
---
 lisp/ox-html.el | 118 ++++++++++++++++++++++++------------------------
 1 file changed, 60 insertions(+), 58 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 03145e35c..f18f8a2ef 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1835,78 +1835,80 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html--build-meta-entry
+    (label identity &optional content-format &rest content-formatters)
+  "Build a meta tag using the provided information.
+
+Construct <meta> tag of form <meta LABEL=\"IDENTITY\" />, or when CONTENT-FORMAT
+is present: <meta LABEL=\"IDENTITY\" content=\"{content}\" />
+
+Here {content} is determined by applying any CONTENT-FORMATTERS to the
+CONTENT-FORMAT and encoding the result as plain text."
+  (concat "<meta "
+	  (format "%s=\"%s" label identity)
+	  (when content-format
+	    (concat "\" content=\""
+		    (replace-regexp-in-string
+		     "\"" "&quot;"
+		     (org-html-encode-plain-text
+		      (if content-formatters
+			  (apply #'format content-format content-formatters)
+			content-format)))))
+	  "\" />\n"))
+
 (defun org-html--build-meta-info (info)
   "Return meta tags for exported document.
 INFO is a plist used as a communication channel."
-  (let* ((protect-string
-          (lambda (str)
-            (replace-regexp-in-string
-             "\"" "&quot;" (org-html-encode-plain-text str))))
-         (title (org-export-data (plist-get info :title) info))
-         ;; Set title to an invisible character instead of leaving it
-         ;; empty, which is invalid.
-         (title (if (org-string-nw-p title) title "&lrm;"))
-         (author (and (plist-get info :with-author)
-                      (let ((auth (plist-get info :author)))
+  (let* ((title (org-html-plain-text
+		 (org-element-interpret-data (plist-get info :title)) info))
+	 ;; Set title to an invisible character instead of leaving it
+	 ;; empty, which is invalid.
+	 (title (if (org-string-nw-p title) title "&lrm;"))
+	 (author (and (plist-get info :with-author)
+		      (let ((auth (plist-get info :author)))
 			;; Return raw Org syntax.
-                        (and auth (org-element-interpret-data auth)))))
-         (description (plist-get info :description))
-         (keywords (plist-get info :keywords))
-         (charset (or (and org-html-coding-system
-                           (fboundp 'coding-system-get)
-                           (coding-system-get org-html-coding-system
-                                              'mime-charset))
-                      "iso-8859-1")))
+			(and auth (org-html-plain-text
+				   (org-element-interpret-data auth) info)))))
+	 (charset (or (and org-html-coding-system
+			   (fboundp 'coding-system-get)
+			   (symbol-name
+			    (coding-system-get org-html-coding-system
+					       'mime-charset)))
+		      "iso-8859-1")))
     (concat
      (when (plist-get info :time-stamp-file)
        (format-time-string
 	(concat "<!-- "
 		(plist-get info :html-metadata-timestamp-format)
 		" -->\n")))
-     (format
-      (if (org-html-html5-p info)
-	  (org-html-close-tag "meta" "charset=\"%s\"" info)
-	(org-html-close-tag
-	 "meta" "http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
-	 info))
-      charset) "\n"
+
+     (if (org-html-html5-p info)
+	 (org-html--build-meta-entry "charset" charset)
+       (org-html--build-meta-entry "http-equiv" "Content-Type"
+				   (concat "text/html;charset=" charset)))
+
      (let ((viewport-options
 	    (cl-remove-if-not (lambda (cell) (org-string-nw-p (cadr cell)))
 			      (plist-get info :html-viewport))))
-       (and viewport-options
-	    (concat
-	     (org-html-close-tag
-	      "meta"
-	      (format "name=\"viewport\" content=\"%s\""
-		      (mapconcat
-		       (lambda (elm) (format "%s=%s" (car elm) (cadr elm)))
-		       viewport-options ", "))
-	      info)
-	     "\n")))
+       (if viewport-options
+	   (org-html--build-meta-entry "name" "viewport"
+				       (mapconcat
+					(lambda (elm)
+                                          (format "%s=%s" (car elm) (cadr elm)))
+					viewport-options ", "))))
+
      (format "<title>%s</title>\n" title)
-     (org-html-close-tag "meta" "name=\"generator\" content=\"Org mode\"" info)
-     "\n"
-     (and (org-string-nw-p author)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"author\" content=\"%s\""
-				       (funcall protect-string author))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p description)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"description\" content=\"%s\"\n"
-				       (funcall protect-string description))
-			       info)
-	   "\n"))
-     (and (org-string-nw-p keywords)
-	  (concat
-	   (org-html-close-tag "meta"
-			       (format "name=\"keywords\" content=\"%s\""
-				       (funcall protect-string keywords))
-			       info)
-	   "\n")))))
+
+     (when (org-string-nw-p author)
+       (org-html--build-meta-entry "name" "author" author))
+
+     (when (org-string-nw-p (plist-get info :description))
+       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
+
+     (when (org-string-nw-p (plist-get info :keywords))
+	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
+
+     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-lisp-ox-html.el-make-html-meta-tags-customizable.patch --]
[-- Type: text/x-patch, Size: 4357 bytes --]

From 6fa5075b04f6996571f8ac5fc19ef8780e9272da Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 14 Dec 2020 17:50:15 +0800
Subject: [PATCH 2/2] lisp/ox-html.el: make html meta tags customizable

* lisp/ox-html.el (org-html-meta-tags): Introduce this as a new option
which can be modified to set the meta tags added in HTML exports.
(org-html--build-meta-info): Make use of `org-html-meta-tags' instead of
hardcoded meta tags.  This is leveraging the earlier restructuring of
`org-html--build-meta-info' into a much DRYer form, such that this
modification has a negligible impact on complexity and readability.
---
 lisp/ox-html.el | 59 ++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 44 insertions(+), 15 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index f18f8a2ef..bd2ca1753 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1425,6 +1425,23 @@ not be modified."
 
 ;;;; Template :: Styles
 
+(defcustom org-html-meta-tags #'org-html-meta-tags-default
+  "Form that is used to produce meta tags in the HTML head.
+
+Can be a list where each item is a list of arguments to be passed
+to `org-html--build-meta-entry'.  Any nil items are ignored.
+
+Also accept a function which gives such a list when called with with
+a single argument (INFO, a communication plist)."
+  :group 'org-export-html
+  :package-version '(Org . "9.5")
+  :type '(choice
+	  (repeat
+	   (list (string :tag "Meta label")
+		 (string :tag "label value")
+		 (string :tag "Content value")))
+	  function))
+
 (defcustom org-html-head-include-default-style t
   "Non-nil means include the default style in exported HTML files.
 The actual style is defined in `org-html-style-default' and
@@ -1835,6 +1852,28 @@ INFO is a plist used as a communication channel."
 \f
 ;;; Template
 
+(defun org-html-meta-tags-default (info)
+  "A default value for `org-html-meta-tags'.
+
+Generate a list items, each of which is a list of arguments that can
+be passed to `org-html--build-meta-entry', to generate meta tags to be
+included in the HTML head.
+
+Use document's plist INFO to derive relevant information for the tags."
+  (let ((author (and (plist-get info :with-author)
+                     (let ((auth (plist-get info :author)))
+                       ;; Return raw Org syntax.
+                       (and auth (org-element-interpret-data auth))))))
+    (list
+     (when (org-string-nw-p author)
+       (list "name" "author" author))
+     (when (org-string-nw-p (plist-get info :description))
+       (list "name" "description"
+             (plist-get info :description)))
+     (when (org-string-nw-p (plist-get info :keywords))
+       (list "name" "keywords" (plist-get info :keywords)))
+     '("name" "generator" "Org Mode"))))
+
 (defun org-html--build-meta-entry
     (label identity &optional content-format &rest content-formatters)
   "Build a meta tag using the provided information.
@@ -1864,11 +1903,6 @@ INFO is a plist used as a communication channel."
 	 ;; Set title to an invisible character instead of leaving it
 	 ;; empty, which is invalid.
 	 (title (if (org-string-nw-p title) title "&lrm;"))
-	 (author (and (plist-get info :with-author)
-		      (let ((auth (plist-get info :author)))
-			;; Return raw Org syntax.
-			(and auth (org-html-plain-text
-				   (org-element-interpret-data auth) info)))))
 	 (charset (or (and org-html-coding-system
 			   (fboundp 'coding-system-get)
 			   (symbol-name
@@ -1899,16 +1933,11 @@ INFO is a plist used as a communication channel."
 
      (format "<title>%s</title>\n" title)
 
-     (when (org-string-nw-p author)
-       (org-html--build-meta-entry "name" "author" author))
-
-     (when (org-string-nw-p (plist-get info :description))
-       (org-html--build-meta-entry "name" "description" (plist-get info :description)))
-
-     (when (org-string-nw-p (plist-get info :keywords))
-	(org-html--build-meta-entry "keywords" (plist-get info :keywords)))
-
-     (org-html--build-meta-entry "name" "generator" "Org Mode"))))
+     (mapconcat
+      (lambda (args) (apply #'org-html--build-meta-entry args))
+      (delq nil (if (functionp org-html-meta-tags)
+		    (funcall org-html-meta-tags info)
+		  org-html-meta-tags)) ""))))
 
 (defun org-html--build-head (info)
   "Return information for the <head>..</head> of the HTML output.
-- 
2.29.2


^ permalink raw reply related	[relevance 34%]

* Ready to merge! Re: [PATCH] Enhance org-html--build-meta-info
  @ 2021-01-14 16:02 93%                                                           ` TEC
  0 siblings, 0 replies; 200+ results
From: TEC @ 2021-01-14 16:02 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Bastien, org-mode-email


This thread has dragged on ages, and if no-one else is following this
chain I wouldn't blame them in the slightest.

To help indicate that this is actually ready (at last) now, I'm just
going to add that info the the subject line in the hope it helps Bastien
or any others notice that this is actually good to go now :)

--
Timothy

Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

> This looks fine to me.  Many thanks!
>
> Best wishes
> Jens



^ permalink raw reply	[relevance 93%]

* [PATCH]
@ 2021-01-20 10:46 39% TEC
  2021-01-20 11:00 93% ` [PATCH] tweaks to ox-html style TEC
                   ` (2 more replies)
  0 siblings, 3 replies; 200+ results
From: TEC @ 2021-01-20 10:46 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 615 bytes --]

Hi All,

This is just some tweaks to the styling in ox-html that I think may
appeal (and prevent ridiculously long lines on non-small displays, which
are an issue for legibility).

I also took the opportunity to remove the (obsolete) CDATA strings and
make the CSS more consistently formatted. If you don't want this to
get its own commit, please just squash it.

Style changes:
- Restrict max content width, and centre
- tweak styling of source code blocks

I took some screenshots (1440p monitor, 120% zoom, Firefox).
Current: https://0x0.st/-iW9.png
This patch: https://0x0.st/-iWp.png

All the best,

Timothy.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-html.el-remove-CDATA-strings.patch --]
[-- Type: text/x-patch, Size: 2679 bytes --]

From 635bd77cd7a2dc55cc0705c5bbf2e11091bfbaf3 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 20 Jan 2021 16:37:29 +0800
Subject: [PATCH 1/5] ox-html.el: remove CDATA strings

* lisp/ox-html.el (org-html-scripts, org-html-style-default,
org-html-infojs-template): remove CDATA strings, as they are now
considered obsolete --- see
https://developer.mozilla.org/en-US/docs/Web/API/CDATASection#specifications
---
 lisp/ox-html.el | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 03145e35c..0cf3425df 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -234,7 +234,6 @@ property on the headline itself.")
 (defconst org-html-scripts
   "<script type=\"text/javascript\">
 // @license magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt Public Domain
-<!--/*--><![CDATA[/*><!--*/
      function CodeHighlightOn(elem, id)
      {
        var target = document.getElementById(id);
@@ -251,14 +250,12 @@ property on the headline itself.")
          target.classList.remove(\"code-highlighted\");
        }
      }
-    /*]]>*///-->
 // @license-end
 </script>"
   "Basic JavaScript that is needed by HTML files produced by Org mode.")
 
 (defconst org-html-style-default
   "<style type=\"text/css\">
- <!--/*--><![CDATA[/*><!--*/
   .title  { text-align: center;
              margin-bottom: .2em; }
   .subtitle { text-align: center;
@@ -439,7 +436,6 @@ property on the headline itself.")
   .org-info-js_search-highlight
     { background-color: #ffff00; color: #000000; font-weight: bold; }
   .org-svg { width: 90%; }
-  /*]]>*/-->
 </style>"
   "The default style specification for exported HTML files.
 You can use `org-html-head' and `org-html-head-extra' to add to
@@ -515,10 +511,8 @@ means to use the maximum value consistent with other options."
 
 <script type=\"text/javascript\">
 // @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&amp;dn=gpl-3.0.txt GPL-v3-or-Later
-<!--/*--><![CDATA[/*><!--*/
 %MANAGER_OPTIONS
 org_html_manager.setup();  // activate after the parameters are set
-/*]]>*///-->
 // @license-end
 </script>"
   "The template for the export style additions when org-info.js is used.
@@ -1448,13 +1442,11 @@ done, timestamp, timestamp-kwd, tag, target.
 For example, a valid value would be:
 
    <style type=\"text/css\">
-    /*<![CDATA[*/
       p { font-weight: normal; color: gray; }
       h1 { color: black; }
       .title { text-align: center; }
       .todo, .timestamp-kwd { color: red; }
       .done { color: green; }
-    /*]]>*/
    </style>
 
 If you want to refer to an external style, use something like
-- 
2.29.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-ox-html.el-limit-maximum-content-width-and-center.patch --]
[-- Type: text/x-patch, Size: 895 bytes --]

From 5bef340093102936efe831f85fabdb589070ce43 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 20 Jan 2021 16:45:20 +0800
Subject: [PATCH 2/5] ox-html.el: limit maximum content width and center

* lisp/ox-html.el (org-html-style-default): To improve the appearance
and legibility on larger screens:
 1. Limit the content width to the upper end of advised line width, ~140
 characters.
 2. Centre the content.
---
 lisp/ox-html.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 0cf3425df..9bbfad678 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -256,6 +256,7 @@ property on the headline itself.")
 
 (defconst org-html-style-default
   "<style type=\"text/css\">
+  #content { max-width: 60em; margin: auto; }
   .title  { text-align: center;
              margin-bottom: .2em; }
   .subtitle { text-align: center;
-- 
2.29.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-ox-html.el-format-CSS-more-consistently.patch --]
[-- Type: text/x-patch, Size: 2278 bytes --]

From 2c0f648ae87e789f21c24b645b2049f05d084799 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 20 Jan 2021 17:58:38 +0800
Subject: [PATCH 3/5] ox-html.el: format CSS more consistently

* lisp/ox-html.el (org-html-style-default): Format CSS declarations more
consistently.
---
 lisp/ox-html.el | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 9bbfad678..14f023e87 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -257,8 +257,8 @@ property on the headline itself.")
 (defconst org-html-style-default
   "<style type=\"text/css\">
   #content { max-width: 60em; margin: auto; }
-  .title  { text-align: center;
-             margin-bottom: .2em; }
+  .title { text-align: center;
+           margin-bottom: .2em; }
   .subtitle { text-align: center;
               font-size: medium;
               font-weight: bold;
@@ -282,13 +282,11 @@ property on the headline itself.")
     padding: 8pt;
     font-family: monospace;
     overflow: auto;
-    margin: 1.2em;
-  }
+    margin: 1.2em; }
   pre.src {
     position: relative;
     overflow: auto;
-    padding-top: 1.2em;
-  }
+    padding-top: 1.2em; }
   pre.src:before {
     display: none;
     position: absolute;
@@ -296,8 +294,7 @@ property on the headline itself.")
     top: -10px;
     right: 10px;
     padding: 3px;
-    border: 1px solid black;
-  }
+    border: 1px solid black; }
   pre.src:hover:before { display: inline; margin-top: 14px;}
   /* Languages per Org manual */
   pre.src-asymptote:before { content: 'Asymptote'; }
@@ -410,22 +407,17 @@ property on the headline itself.")
   .equation-container {
     display: table;
     text-align: center;
-    width: 100%;
-  }
-  .equation {
-    vertical-align: middle;
-  }
+    width: 100%; }
+  .equation { vertical-align: middle; }
   .equation-label {
     display: table-cell;
     text-align: right;
-    vertical-align: middle;
-  }
+    vertical-align: middle; }
   .inlinetask {
     padding: 10px;
     border: 2px solid gray;
     margin: 10px;
-    background: #ffffcc;
-  }
+    background: #ffffcc; }
   #org-div-home-and-up
    { text-align: right; font-size: 70%; white-space: nowrap; }
   textarea { overflow-x: auto; }
-- 
2.29.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-ox-html.el-tweak-styling-of-src-blocks.patch --]
[-- Type: text/x-patch, Size: 1617 bytes --]

From c341a278291be3c6a4fcca77fede476a04417a69 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 20 Jan 2021 18:17:06 +0800
Subject: [PATCH 4/5] ox-html.el: tweak styling of src blocks

* lisp/ox-html.el (org-html-style-default): Apply the following changes
to the styling of src blocks:
- Remove box shadow.
- Lighten border.
- Add very light grey background colour.
- Make lang label (visible on hover) less obtrusive by removing border.
---
 lisp/ox-html.el | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 14f023e87..e83648726 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -277,24 +277,24 @@ property on the headline itself.")
   #postamble p, #preamble p { font-size: 90%; margin: .2em; }
   p.verse { margin-left: 3%; }
   pre {
-    border: 1px solid #ccc;
-    box-shadow: 3px 3px 3px #eee;
+    border: 1px solid #e6e6e6;
+    border-radius: 3px;
+    background-color: #f2f2f2;
     padding: 8pt;
     font-family: monospace;
     overflow: auto;
     margin: 1.2em; }
   pre.src {
     position: relative;
-    overflow: auto;
-    padding-top: 1.2em; }
+    overflow: auto; }
   pre.src:before {
     display: none;
     position: absolute;
-    background-color: white;
-    top: -10px;
-    right: 10px;
+    top: -8px;
+    right: 12px;
     padding: 3px;
-    border: 1px solid black; }
+    color: #555;
+    background-color: #f2f2f299; }
   pre.src:hover:before { display: inline; margin-top: 14px;}
   /* Languages per Org manual */
   pre.src-asymptote:before { content: 'Asymptote'; }
-- 
2.29.2


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-ox-html.el-add-lang-label-to-authinfo-src-blocks.patch --]
[-- Type: text/x-patch, Size: 931 bytes --]

From b8eb175c709ad9cff259b4326d8c9a344a4381ba Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 20 Jan 2021 18:22:58 +0800
Subject: [PATCH 5/5] ox-html.el: add lang label to authinfo src blocks

* lisp/ox-html.el (org-html-style-default): `authinfo-mode' is defined
in Emacs 27. As such, in the CSS add an "Authinfo" lang label to
authinfo src blocks.
---
 lisp/ox-html.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index e83648726..e5e82a5d8 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -299,6 +299,7 @@ property on the headline itself.")
   /* Languages per Org manual */
   pre.src-asymptote:before { content: 'Asymptote'; }
   pre.src-awk:before { content: 'Awk'; }
+  pre.src-authinfo::before { content: 'Authinfo'; }
   pre.src-C:before { content: 'C'; }
   /* pre.src-C++ doesn't work in CSS */
   pre.src-clojure:before { content: 'Clojure'; }
-- 
2.29.2


^ permalink raw reply related	[relevance 39%]

* Re: [PATCH] tweaks to ox-html style
  2021-01-20 10:46 39% [PATCH] TEC
@ 2021-01-20 11:00 93% ` TEC
      2 siblings, 0 replies; 200+ results
From: TEC @ 2021-01-20 11:00 UTC (permalink / raw)
  To: org-mode-email


Gah! I left the subject as a placeholder [shame emoji].
Apologies for that.

Why do I always seem to notice these things as the Email is sending...

--
Timothy

TEC <tecosaur@gmail.com> writes:

> Hi All,
>
> This is just some tweaks to the styling in ox-html that I think may
> appeal (and prevent ridiculously long lines on non-small displays, which
> are an issue for legibility).
>
> I also took the opportunity to remove the (obsolete) CDATA strings and
> make the CSS more consistently formatted. If you don't want this to
> get its own commit, please just squash it.
>
> Style changes:
> - Restrict max content width, and centre
> - tweak styling of source code blocks
>
> I took some screenshots (1440p monitor, 120% zoom, Firefox).
> Current: https://0x0.st/-iW9.png
> This patch: https://0x0.st/-iWp.png
>
> All the best,
>
> Timothy.



^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Enhance org-html--build-meta-info
  @ 2021-01-21  5:55 93%                                                           ` TEC
  0 siblings, 0 replies; 200+ results
From: TEC @ 2021-01-21  5:55 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: org-mode-email


Kyle Meyer <kyle@kyleam.com> writes:

> I've applied this (a8df7670c) with two minor changes (shown in the diff
> at end): s/with with/with/ in a docstring and move an element to its own
> line to avoid the warning from lisp-mode's lisp--match-hidden-arg.

Thanks :)

> This thread has gone on long enough that I'll avoid requesting changes
> for convention/style nits, but some things to keep in mind for future
> patches:

I'll try to keep these in mind in future. Might there be a Worg page or
something listing all of these little things so I don't keep on being
told of them a few at a time as I violate them?

> Also, it'd be good for this to be accompanied by a NEWS entry.  I'd
> appreciated if that were sent in a separate thread, though.  For some
> reason I haven't debugged, my usual MUA can't load this thread.

Will do 👍.

--
Timothy


^ permalink raw reply	[relevance 93%]

* [PATCH] document org-html-meta-tags
@ 2021-01-31 19:04 60% TEC
    0 siblings, 1 reply; 200+ results
From: TEC @ 2021-01-31 19:04 UTC (permalink / raw)
  To: org-mode-email, Kyle Meyer

[-- Attachment #1: Type: text/plain, Size: 88 bytes --]

Hi Kyle, All,

As requested, here's a small documentation entry for the new setting :)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-manual-news-Document-org-html-meta-tags.patch --]
[-- Type: text/x-patch, Size: 1613 bytes --]

From 636330422eef59f448a60b933be9a55818888af9 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 1 Feb 2021 03:01:12 +0800
Subject: [PATCH] manual, news: Document org-html-meta-tags

* docs/org-manual.org, etc/ORG-NEWS: Document and announce the new
setting `org-html-meta-tags'.
---
 doc/org-manual.org | 3 +++
 etc/ORG-NEWS       | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 20a0d1d7a..a82b0f9a4 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -12624,6 +12624,9 @@ settings described in [[*Export Settings]].
   multiple =DESCRIPTION= lines.  The exporter takes care of wrapping
   the lines properly.
 
+  The exporter includes a number of other meta tags, which can be customised
+  by modifying ~org-html-meta-tags~.
+
 - =HTML_DOCTYPE= ::
 
   #+cindex: @samp{HTML_DOCTYPE}, keyword
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index ba769224f..a2f1667b2 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -81,6 +81,13 @@ block. ~org-babel-latex-preamble~, ~org-babel-latex-begin-env~ and
 the user to specify the preamble and code that preceedes and proceeds
 the contents of the source block.
 
+*** New option ~org-html-meta-tags~  allows for HTML meta tags customisation
+
+New variable ~org-html-meta-tags~ makes it possible to customise the
+=<meta>= tags used in an HTML export. Accepts either a static list of
+values, or a function that generates such a list (see
+~org-html-meta-tags-default~ as an example of the latter).
+
 ** New features
 *** =ob-python= improvements to =:return= header argument 
 
-- 
2.30.0


[-- Attachment #3: Type: text/plain, Size: 1335 bytes --]


Oh, by the way --- regarding your commits on commit/code conventions.
With (what seem like to me) quite a few "best practices" to keep in
mind, has anyone created a patch lint tool to make sure they're being
adhered to? I imagine it wouldn't be hard to check for blank lines in
functions or commits without a sentence case commit message.

For someone who isn't aware of all the nits that may be picked :P this
would be rather useful, and far better than a list of guidelines (I'm
not actually any such list though).

Oh dear, I sense myself diverging but I'm now considering the
possibility of setting up CI for the org-mode repo to check for as many
such concerns as we can to try to make the code base more consistent
(from my experience, every time I'm told to check for a specific issue
in a patch I wrote, I find many other matches in the file).

Perhaps it could be possible to hook up the ML to a process that runs
the CI script on a copy of Org with the patch(es) applied and replies
with any errors that may come up?

I should really stop here, before I really get going and start
explaining why I think it could be good to migrate to Gitea and other
ideas :P

Feel free to disregard my ramble, I've just been accumulating thoughts
on the state of Org development, and a few are liable to spill out.

All the best,

Timothy

^ permalink raw reply related	[relevance 60%]

* Re: [PATCH] document org-html-meta-tags
  @ 2021-02-09 19:51 93%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-02-09 19:51 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: org-mode-email


Kyle Meyer <kyle@kyleam.com> writes:

> Thanks.  Pushed (5b0eb9aad) with the tweaks mentioned below.

Great!

>> Oh, by the way --- [...]
>
> Sorry, I don't have the bandwidth at the moment for that discussion.

No problem, I mainly wanted to put the thought /somewhere/ --- which I
have now done :)

--
Timothy.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] tweaks to ox-html style
    @ 2021-02-12 18:16 88%     ` Timothy
    2 siblings, 0 replies; 200+ results
From: Timothy @ 2021-02-12 18:16 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Kyle Meyer, org-mode-email


Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

> I do not know why the CDATA lines exist.  I don’t see a reason to
> keep them (patch 0001), but that might be a lack of understanding on
> my part.

I'll cover this in my reply to your follow-up.

> Patch 0003 is about whitespace fixes.
>
> Patches 0002, 0004, 0005 change defconst styling.  I don’t have a
> strong opinion here.  However, if they are changed now, what about
> turning them into defcustoms?  Then each of us would be entitled to
> their own opinion ;)
>
> The docstring for org-html-head-include-default-style says that
> org-html-style-default (a defconst proposed to be changed here)
> should not be changed.  Why not?

The defconst is left a defsconst because I don't really know why it is
one, and when I don't know why something is the way it is, I try to leave
it alone.  In my own config I actually overwrite it, but oh well.

I'm guessing this is just a case of "User beware, this contains
important stuff to have Org look reasonable. Don't remove that."

Perhaps this should be a defcustom? It would be good to hear from
someone else on this. If this ends up being a hold up though I'd rather
resolve this separately.

--
Timothy.


^ permalink raw reply	[relevance 88%]

* Re: [PATCH] tweaks to ox-html style
  @ 2021-02-12 18:22 92%       ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-02-12 18:22 UTC (permalink / raw)
  To: Jens Lechtenboerger; +Cc: Kyle Meyer, org-mode-email


Jens Lechtenboerger <lechten@wi.uni-muenster.de> writes:

> On 2021-02-12, Jens Lechtenboerger wrote:
>
>> I do not know why the CDATA lines exist.  I don’t see a reason to
>> keep them (patch 0001), but that might be a lack of understanding on
>> my part.
>
> OK, that is probably for XHTML, where < and & are only allowed
> inside CDATA sections.
>
> Timothy, did you try to validate XHTML output?

If you look at the commit message for 001, you can see the following:

> remove CDATA strings, as they are now
> considered obsolete --- see
> https://developer.mozilla.org/en-US/docs/Web/API/CDATASection#specifications

Does that page clear things up for you?

I did a bit more googling and found
https://dev.w3.org/html5/html-polyglot/html-polyglot.html#bib-HTML5
which mentions CDATA:

> The CDATA code is then seen as text by the HTML parser (and can thus
> interfere with the scripting or styling language!), while the XML
> parser sees the content as text without markup semantics.

In other words, CDATA allows you to keep XML comparability, but now
breaks strict HTML comparability. IMO the latter is much more important
for an org-html export.

--
Timothy


^ permalink raw reply	[relevance 92%]

* Re: [PATCH] tweaks to ox-html style
  @ 2021-02-14  4:36 93%         ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-02-14  4:36 UTC (permalink / raw)
  To: Christian Moe; +Cc: Tim Cross, emacs-orgmode


Regarding any use case which would benefit from turning
org-html-style-default into a defcustom, IMO there are two:
+ When you don't want to have to add a #+HTML_HEAD to every file you
  export
+ When you want to include a long inline style (my use case)

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Async session eval (2nd attempt)
  @ 2021-03-01  6:22 92%     ` Timothy
    1 sibling, 0 replies; 200+ results
From: Timothy @ 2021-03-01  6:22 UTC (permalink / raw)
  To: Jack Kamm; +Cc: emacs-orgmode


Jack Kamm <jackkamm@gmail.com> writes:

> I'm attaching an updated patch rebased on master.

Fantastic. Thanks for doing this.

> ob-python session blocks don't use "return", so this should just be:

Ah, oops 😛

> The non-session case is substantially different, and I think it would
> probably require a separate implementation.

I see, fair enough. I haven't looked at the internals myself.

> One possible approach would be to modify ob-eval.el, so that
> org-babel--shell-command-on-region uses make-process instead of
> process-file.
>
> I agree it would be nice to have, but it would take a bit of work to
> figure it all out, and there is already ob-async.el [1] that implements
> non-session async for all languages. (I wish it could be brought into
> org-mode, but it probably can't, because it depends on the external
> async.el.)

Interesting that you use a different async method.

>> p.s. After this is merged, it would be great to see support for other
>> languages grow :)
>
> I also have an async implementation for ob-R that's ready after this is
> merged :)

Brilliant! I can't wait.

I know Bastien has found himself unfortunately busy as of late (which I
think is why he's looking to have someone else take over as project
lead), but please don't be disheartened by the slow progress with
getting this merged! I can assure you that quite a few people are
watching this with keen interest :)

All the best,

Timothy.


^ permalink raw reply	[relevance 92%]

* [PATCH] Improve documentation of #+startup keyword
@ 2021-03-19 12:03 77% Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-03-19 12:03 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 478 bytes --]

Hello all,

I was talking to someone who was finding the behaviour of `#+startup'
confusing, and they managed to work out a table summarising the
behaviour.

I think that this would be a good addition to the manual, and help
clarify the behaviour --- so I've prepared a little patch to the manual.
I notice that there are some `#+cindex' lines lying around but I'm not
quite sure what they do. Please let me know if I should add anything
like that etc.

All the best,
*Timothy*

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-doc-org-manual.org-clarify-startup-behaviour.patch --]
[-- Type: text/x-patch, Size: 1720 bytes --]

From 8ff32dfbf2e14419eb542d58ee39c1545f34354b Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Fri, 19 Mar 2021 20:01:03 +0800
Subject: [PATCH] doc/org-manual.org: clarify #+startup behaviour

* doc/org-manual.org: clarify the behaviour that each #+startup option
implies.
---
 doc/org-manual.org | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index e8763ff17..a005cce52 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -598,6 +598,19 @@ *** Initial visibility
   is requested by startup options and =VISIBILITY= properties in
   individual entries.
 
+A summary of each keyword's behaviour may be seen in the table below.
+| #+startup:          | org-startup-folded | VISIBILITY | shows headings | shows body |
+|---------------------+--------------------+------------+----------------+------------|
+| overview (or fold)  | t                  | x          | lvl1           |            |
+| content             | 'content           | x          | all            |            |
+| show2levels         | 'show2levels       | x          | lvl1-2         |            |
+| ...                 | 'showNlevels       | x          | lvl1-N         |            |
+| show5levels         | 'show5levels       | x          | lvl1-5         |            |
+| showall (or nofold) | nil                | x          | all            | x          |
+| showeverything      | 'showeverything    |            | all            | x          |
+| <DEFAULT>           | 'showeverything    |            | all            | x          |
+
+
 *** Catching invisible edits
 :PROPERTIES:
 :DESCRIPTION: Preventing mistakes when editing invisible parts.
-- 
2.30.1


^ permalink raw reply related	[relevance 77%]

* [PATCH] Fontification for inline src blocks
@ 2021-03-31 15:00 42% Timothy
  2021-04-28  7:14 88% ` Timothy
    0 siblings, 2 replies; 200+ results
From: Timothy @ 2021-03-31 15:00 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]


Hi All,

I've been using inline src blocks a fair bit more recently, and I've
thought it's a pity how bad they look as they are currently without
fontification. A little digging into Org internals and font-lock later
and we have this patch. I could speak about what's been done, but I
think a screenshot does a much better comparison.

For more details, see the attached patch.

--
Timothy


[-- Attachment #2: fontify-inline-src.png --]
[-- Type: image/png, Size: 132455 bytes --]

[-- Attachment #3: 0001-org-src-Implement-native-inline-src-fontification.patch --]
[-- Type: text/x-patch, Size: 7361 bytes --]

From 563281f8bed02e8ec12e48696ebdd98e61ccfbac Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 31 Mar 2021 22:30:40 +0800
Subject: [PATCH] org-src: Implement native inline src fontification

* lisp/org-src.el (org-fontify-inline-src-blocks,
org-fontify-inline-src-blocks-1): Create a function to search the buffer
up to a limit for inline src blocks.  Light fontification is applied to
matched inline src blocks.  When `org-src-fontify-natively' is
set, `org-src-font-lock-fontify-block' to the content.
(org-fontify-inline-src-results): Search for {{{results(...)}}}
constructs.  Then when `org-inline-src-prettify-results` is non-nil,
mimic prettify-symbols and use `compose-region' to substitute visually
simpler elements for the wrapping around the value.

* lisp/org.el (org-set-font-lock-defaults): Add
`org-fontify-inline-src-blocks' to `org-font-lock-extra-keywords', which
is locally bound inside `org-set-font-lock-defaults'.
(org-inline-src-fontify-max-length, org-inline-src-prettify-results):
Create variables for use in the new inline src/result fontification
methods in org-src.el.
---
 lisp/org-src.el | 73 +++++++++++++++++++++++++++++++++++++++++++++++++
 lisp/org.el     | 21 +++++++++++++-
 2 files changed, 93 insertions(+), 1 deletion(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index 20acee4e6..9119372d7 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -624,6 +624,79 @@ (defun org-src-font-lock-fontify-block (lang start end)
 	 '(font-lock-fontified t fontified t font-lock-multiline t))
 	(set-buffer-modified-p modified)))))
 
+(defun org-fontify-inline-src-blocks (limit)
+  "Try to apply `org-fontify-inline-src-blocks-1'."
+  (condition-case nil
+      (org-fontify-inline-src-blocks-1 limit)
+    (error (message "Org mode fontification error in %S at %d"
+                    (current-buffer)
+                    (line-number-at-pos)))))
+
+(defun org-fontify-inline-src-blocks-1 (limit)
+  "Fontify inline src_LANG blocks, from `point' up to LIMIT."
+  (let ((case-fold-search t)
+        (initial-point (point)))
+    (while (re-search-forward "\\_<src_\\([^ \t\n[{]+\\)[{[]?" limit t) ; copied from `org-element-inline-src-block-parser'
+      (let ((beg (match-beginning 0))
+            (lang-beg (match-beginning 1))
+            (lang-end (match-end 1))
+            pt)
+        (remove-text-properties beg lang-end '(face nil))
+        (font-lock-append-text-property lang-beg lang-end 'face 'org-meta-line)
+        (font-lock-append-text-property beg lang-beg 'face 'shadow)
+        (font-lock-append-text-property beg lang-end 'face 'org-block)
+        (setq pt (goto-char lang-end))
+        ;; `org-element--parse-paired-brackets' doesn't take a limit, so to
+        ;; prevent it searching the entire rest of the buffer we temporarily
+        ;; narrow the active region.
+        (save-restriction
+          (narrow-to-region beg (min (point-max)
+                                     limit
+                                     (+ lang-end org-inline-src-fontify-max-length)))
+          (when (ignore-errors (org-element--parse-paired-brackets ?\[))
+            (remove-text-properties pt (point) '(face nil))
+            (font-lock-append-text-property pt (point) 'face 'org-block)
+            (setq pt (point)))
+          (when (ignore-errors (org-element--parse-paired-brackets ?\{))
+            (remove-text-properties pt (point) '(face nil))
+            (font-lock-append-text-property pt (1+ pt) 'face '(org-block shadow))
+            (unless (= (1+ pt) (1- (point)))
+              (if org-src-fontify-natively
+                  (org-src-font-lock-fontify-block
+                   (buffer-substring-no-properties lang-beg lang-end)
+                   (1+ pt) (1- (point)))
+                (font-lock-append-text-property (1+ pt) (1- (point)) 'face 'org-block)))
+            (font-lock-append-text-property (1- (point)) (point)'face '(org-block shadow))
+            (setq pt (point))))
+        (when (and org-inline-src-prettify-results
+                   (re-search-forward "\\= {{{results(" limit t))
+          (font-lock-append-text-property pt (1+ pt) 'face 'org-block)
+          (goto-char pt))))
+    (when org-inline-src-prettify-results
+      (goto-char initial-point)
+      (org-fontify-inline-src-results limit))))
+
+(defun org-fontify-inline-src-results (limit)
+  "Apply prettify-symbols modifications to inline results blocks.
+Performed according to `org-inline-src-prettify-results'."
+  (while (re-search-forward "{{{results(\\(.+?\\))}}}" limit t)
+    (remove-list-of-text-properties (match-beginning 0) (point)
+                                    '(composition
+                                      prettify-symbols-start
+                                      prettify-symbols-end))
+    (font-lock-append-text-property (match-beginning 0) (match-end 0)
+                                    'face 'org-block)
+    (let ((start (match-beginning 0)) (end (match-beginning 1)))
+      (with-silent-modifications
+        (compose-region start end (if (eq org-inline-src-prettify-results t)
+                                      "⟨" (car org-inline-src-prettify-results)))
+        (add-text-properties start end `(prettify-symbols-start ,start prettify-symbols-end ,end))))
+    (let ((start (match-end 1)) (end (point)))
+      (with-silent-modifications
+        (compose-region start end (if (eq org-inline-src-prettify-results t)
+                                      "⟩" (cdr org-inline-src-prettify-results)))
+        (add-text-properties start end `(prettify-symbols-start ,start prettify-symbols-end ,end))))))
+
 \f
 ;;; Escape contents
 
diff --git a/lisp/org.el b/lisp/org.el
index 04da1afcd..f4d069504 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5223,6 +5223,23 @@ (defcustom org-allow-promoting-top-level-subtree nil
   :version "24.1"
   :group 'org-appearance)
 
+(defcustom org-inline-src-fontify-max-length 200
+  "Maximum content length of an inline src block that will be fontified.
+This is only relevant when `org-src-fontify-natively' is t."
+  :type 'integer
+  :package-version '(Org . "9.5")
+  :group 'org-appearance
+  :group 'org-babel)
+
+(defcustom org-inline-src-prettify-results t
+  "Whether to use (ab)use prettify-symbols-mode on {{{results(...)}}}.
+Either t or a cons cell of strings which are used as substitutions
+for the start and end of inline results, respectively."
+  :type '(choice boolean (cons string string))
+  :package-version '(Org . "9.5")
+  :group 'org-appearance
+  :group 'org-babel)
+
 (defun org-fontify-meta-lines-and-blocks (limit)
   (condition-case nil
       (org-fontify-meta-lines-and-blocks-1 limit)
@@ -5720,7 +5737,9 @@ (defun org-set-font-lock-defaults ()
 		  org-comment-string)
 		 '(9 'org-special-keyword t))
 	   ;; Blocks and meta lines
-	   '(org-fontify-meta-lines-and-blocks))))
+	   '(org-fontify-meta-lines-and-blocks)
+           ;; Inline src blocks
+           '(org-fontify-inline-src-blocks))))
     (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords))
     (run-hooks 'org-font-lock-set-keywords-hook)
     ;; Now set the full font-lock-keywords
-- 
2.30.1


^ permalink raw reply related	[relevance 42%]

* [PATCH] avoid loading major modes when exporting to file
@ 2021-03-31 15:25 76% Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-03-31 15:25 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 201 bytes --]


Hello,

Another little patch, this time a one-liner.
I think the commit description is pretty thorough, so give that a look.
TLDR; it makes `org-export-to-file' behave a bit more nicely.

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-don-t-load-a-major-mode-when-exporting-to-file.patch --]
[-- Type: text/x-patch, Size: 1406 bytes --]

From eb9d7c038dbb9e7a4b89edf61db83a31dda27170 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 31 Mar 2021 23:16:58 +0800
Subject: [PATCH] ox: don't load a major-mode when exporting to file

* lisp/ox.el (org-export-to-file): Prior to this, when
`org-export-to-file' was called it activated the major mode for that
file type based on `auto-mode-alist'.  This can be mildly annoying in
various ways as loading the major mode (1) makes the export take
longer, (2) can produce unwanted "noise" while initialising, namely
warnings and errors related to the mode itself, (3) can produce spurious
files like an .auctex-auto folder.  By locally binding `auctex-auto' to
nil all of these undesirable behaviours can be avoided.
---
 lisp/ox.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index f705bc83a..96d2866dd 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -6388,7 +6388,8 @@   (defun org-latex-export-to-latex
   (declare (indent 2))
   (if (not (file-writable-p file)) (error "Output file not writable")
     (let ((ext-plist (org-combine-plists `(:output-file ,file) ext-plist))
-	  (encoding (or org-export-coding-system buffer-file-coding-system)))
+	  (encoding (or org-export-coding-system buffer-file-coding-system))
+          (auto-mode-alist nil))
       (if async
           (org-export-async-start
 	      `(lambda (file)
-- 
2.30.1


^ permalink raw reply related	[relevance 76%]

* [PATCH] Add font-lock rule for inline export snippets
@ 2021-03-31 15:57 80% Timothy
  2021-04-28  7:23 93% ` Timothy
  0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-03-31 15:57 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 528 bytes --]


Hello,

The latest in my visually-oriented (mostly) short patch series, adding
basic fontification to inline export snippets --- @@comment:these things@@.

I think fontification for stuff like this is nice because it visually
indicates to the user that they've written out an Org construct, and
haven't just mis-remembered / imagined some syntax.

In future this could be extended to use native fontification for
recognised export formats (like src blocks do), but I think this is a
nice improvement over nothing.

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-Add-font-lock-rule-for-inline-export-snippets.patch --]
[-- Type: text/x-patch, Size: 942 bytes --]

From 3584602f88381ab9624c767a83c18cfd93ffeaf0 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 31 Mar 2021 23:47:58 +0800
Subject: [PATCH] org: Add font-lock rule for inline export snippets

* lisp/org.el (org-set-font-lock-defaults): Add font-lock rule for
inline export snippets.
---
 lisp/org.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index f4d069504..240f745c7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5719,6 +5719,11 @@ (defun org-set-font-lock-defaults ()
 	   ;; Description list items
 	   '("^[ \t]*[-+*][ \t]+\\(.*?[ \t]+::\\)\\([ \t]+\\|$\\)"
 	     1 'org-list-dt prepend)
+           ;; Inline export snippets
+           '("\\(@@\\)\\([a-z-]+:\\).*?\\(@@\\)"
+             (1 'font-lock-comment-face t)
+             (2 'org-tag t)
+             (3 'font-lock-comment-face t))
 	   ;; ARCHIVEd headings
 	   (list (concat
 		  org-outline-regexp-bol
-- 
2.30.1


^ permalink raw reply related	[relevance 80%]

* [PATCH] Wrap LaTeX snippets in $$ with markdown export
@ 2021-03-31 16:41 59% Timothy
                     ` (2 more replies)
  0 siblings, 3 replies; 200+ results
From: Timothy @ 2021-03-31 16:41 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 936 bytes --]


Hi All,

I anticipate that this change may be somewhat contentions because ox-md
explicitly follows only the original Markdown spec from 2003, however
I've thought this over and come to the conclusion that this change is
still in keeping with that, and beneficial.

Currently ox-md simply inherits the output from ox-html's handling of
LaTeX snippets. Needless to say, the original Markdown specification
does not mention LaTeX snippets. As such, by subtly tweaking the output
(either adding $$ or substituting out LaTeX-style \(\) / \[\] for $ /
$$) we are not deviating from the original specification any more than we
already are.

While I don't see any issue with this, I do see some benefits. Namely
that, of the many Markdown variants that now exist, many support LaTeX
snippets, but exclusively in the TeX $$ form. Hence, by applying this
change the overall utility of ox-md is increased.

Let me know what you think,

Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-md-Use-TeX-style-math-wrapping.patch --]
[-- Type: text/x-patch, Size: 2721 bytes --]

From b7f1b89a50752398672a642519534818d23c72a4 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Thu, 1 Apr 2021 00:25:41 +0800
Subject: [PATCH] ox-md: Use TeX-style $ math wrapping

* lisp/ox-md.el (org-md-latex-environment, org-md-latex-fragment):
These two new filters wrap LaTeX maths in $ / $$ TeX-style notation.
While ox-md endeavours to adhere to the original Markdown specification,
and not any particular variant, the original specification does not deal
with LaTeX fragments at all, and so this change does not reduce how
faithfully the original specification is followed.
There is a major upside to this though. Of the many Markdown variants
that have emerged, those that support LaTeX very often exclusively
support TeX style notation.  This change thus improves the utility of
the Markdown export for many use cases, and deviates no more from the
original specification that the current method.
---
 lisp/ox-md.el | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index b6b2c1728..c5c0e05a5 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -100,6 +100,8 @@ (org-export-define-derived-backend 'md 'html
 		     (italic . org-md-italic)
 		     (item . org-md-item)
 		     (keyword . org-md-keyword)
+                     (latex-environment . org-md-latex-environment)
+                     (latex-fragment . org-md-latex-fragment)
 		     (line-break . org-md-line-break)
 		     (link . org-md-link)
 		     (node-property . org-md-node-property)
@@ -460,6 +462,32 @@ (defun org-md-keyword (keyword contents info)
     (_ (org-export-with-backend 'html keyword contents info))))
 
 
+;;;; Latex Environment
+
+(defun org-md-latex-environment (latex-environment contents info)
+  "Transcode a LATEX-ENVIRONMENT object from Org to Markdown.
+CONTENTS is nil.  INFO is a plist holding contextual information."
+  (when (plist-get info :with-latex)
+    (concat "$$\n"
+            (org-html-latex-environment latex-environment contents info)
+            "$$\n")))
+
+
+;;;; Latex Fragment
+
+(defun org-md-latex-fragment (latex-fragment contents info)
+  "Transcode a LATEX-FRAGMENT object from Org to Markdown.
+CONTENTS is nil.  INFO is a plist holding contextual information."
+  (when (plist-get info :with-latex)
+    (let ((frag (org-html-latex-fragment contents info)))
+      (cond
+       ((string-match-p "^\\\\(" frag)
+        (concat "$" (substring frag 2 -2) "$"))
+       ((string-match-p "^\\\\\\[" frag)
+        (concat "$$" (substring frag 2 -2) "$$"))
+       (t (message "unrecognised fragment: %s" frag)
+          frag)))))
+
 ;;;; Line Break
 
 (defun org-md-line-break (_line-break _contents _info)
-- 
2.30.1


^ permalink raw reply related	[relevance 59%]

* [PATCH] Use <img> tags for SVGs
@ 2021-04-07 11:24 58% Timothy
  2021-04-07 11:29 93% ` Timothy
  0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-04-07 11:24 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

Hey everyone,

This is the first patch addressing an item raised in
https://orgmode.org/list/87sga4914t.fsf@gmail.com/ [subject: W3C
violations in Org's HTML export].

For more information see the email mentioned above and/or the commit
message.
It's worth nothing that the current approach isn't just "not great", but
actually causes some issues. For instance, in the ox-html export of my
Emacs config, here's an SVG generated by Gnuplot with org-plot:


[-- Attachment #2: svg-object.png --]
[-- Type: image/png, Size: 45527 bytes --]

[-- Attachment #3: Type: text/plain, Size: 66 bytes --]


If I just change <object> to <img> this is much better behaved:


[-- Attachment #4: svg-img.png --]
[-- Type: image/png, Size: 47244 bytes --]

[-- Attachment #5: Type: text/plain, Size: 69 bytes --]


Anyway, that's enough preamble --- here's the patch :)

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0001-ox-html-Use-img-tags-for-svgs-not-object.patch --]
[-- Type: text/x-patch, Size: 3210 bytes --]

From 9c041f16a947309d47c5a162146946268788d459 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 7 Apr 2021 19:07:53 +0800
Subject: [PATCH] ox-html: Use <img> tags for svgs, not <object>

* lisp/ox-html.el (org-html--format-image, org-html--svg-image): Remove
special treatment of SVGs with <object>, and just use <img>.  This used
to be poorly supported, but since Firefox 4 / Chrome 28 / Safari 9 this
is no longer a concern (https://caniuse.com/svg-img) and the last
browser release that didn't support SVG images was in 2010 (SVG data
URIs took until 2015 to be fully supported, but this is a lesser
concern).
---
 lisp/ox-html.el | 49 ++++++++++++-------------------------------------
 1 file changed, 12 insertions(+), 37 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 89da823e8..adda7365e 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1693,43 +1693,18 @@ (defun org-html--format-image (source attributes info)
 ATTRIBUTES is a plist, as returned by
 `org-export-read-attribute'.  INFO is a plist used as
 a communication channel."
-  (if (string= "svg" (file-name-extension source))
-      (org-html--svg-image source attributes info)
-    (org-html-close-tag
-     "img"
-     (org-html--make-attribute-string
-      (org-combine-plists
-       (list :src source
-	     :alt (if (string-match-p
-		       (concat "^" org-preview-latex-image-directory) source)
-		      (org-html-encode-plain-text
-		       (org-find-text-property-in-string 'org-latex-src source))
-		    (file-name-nondirectory source)))
-       attributes))
-     info)))
-
-(defun org-html--svg-image (source attributes info)
-  "Return \"object\" embedding svg file SOURCE with given ATTRIBUTES.
-INFO is a plist used as a communication channel.
-
-The special attribute \"fallback\" can be used to specify a
-fallback image file to use if the object embedding is not
-supported.  CSS class \"org-svg\" is assigned as the class of the
-object unless a different class is specified with an attribute."
-  (let ((fallback (plist-get attributes :fallback))
-	(attrs (org-html--make-attribute-string
-		(org-combine-plists
-                 ;; Remove fallback attribute, which is not meant to
-                 ;; appear directly in the attributes string, and
-                 ;; provide a default class if none is set.
-                 '(:class "org-svg") attributes '(:fallback nil)))))
-    (format "<object type=\"image/svg+xml\" data=\"%s\" %s>\n%s</object>"
-	    source
-	    attrs
-	    (if fallback
-		(org-html-close-tag
-		 "img" (format "src=\"%s\" %s" fallback attrs) info)
-	      "Sorry, your browser does not support SVG."))))
+  (org-html-close-tag
+   "img"
+   (org-html--make-attribute-string
+    (org-combine-plists
+     (list :src source
+           :alt (if (string-match-p
+                     (concat "^" org-preview-latex-image-directory) source)
+                    (org-html-encode-plain-text
+                     (org-find-text-property-in-string 'org-latex-src source))
+                  (file-name-nondirectory source)))
+     attributes))
+   info))
 
 (defun org-html--textarea-block (element)
   "Transcode ELEMENT into a textarea block.
-- 
2.30.1


^ permalink raw reply related	[relevance 58%]

* Re: [PATCH] Use <img> tags for SVGs
  2021-04-07 11:24 58% [PATCH] Use <img> tags for SVGs Timothy
@ 2021-04-07 11:29 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-07 11:29 UTC (permalink / raw)
  To: org-mode-email


Timothy <tecosaur@gmail.com> writes:

> It's worth nothing that the current approach isn't just "not great", but
> actually causes some issues.

Oh, and for reference the W3C violation this fixes is:
"Attribute alt not allowed on element object"

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] ob-tangle.el: Speed up tangling
  @ 2021-04-21  8:02 93%         ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-21  8:02 UTC (permalink / raw)
  To: sebastien.miquel; +Cc: Tom Gillespie, emacs-orgmode


Sébastien Miquel <sebastien.miquel@posteo.eu> writes:

> On second thought, I'm uneasy about my approach. If tangling fails,
> the user might miss the error message since it is quickly replaced by
> the tangling info. Ideally we should backup all the tangled files and
> restore them all if a single one fails to ensure we're back to a
> consistent state.
>
> I'm unsure what would be best practices here. In case of a remote
> tangled files, I don't know if temporary files should be remote or
> not, and what guarantees do emacs primitives such as ~rename-file~
> offer.

Just 2c from me on how I'd like this to work as a user, when tangling
fails:
+ Every file that could be tangled is tangled, or there's a variable
  which controls what to do on an error
+ Loud message at the end that lists all files which files failed to
  tangle

--
Timothy


^ permalink raw reply	[relevance 93%]

* [PATCH] Refresh inline plotted images
@ 2021-04-24  4:59 74% Timothy
  2021-04-26 14:54 93% ` Timothy
  0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-04-24  4:59 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 325 bytes --]

Hi All,

This patch improves the result of running org-plot in the following
situation

#+plot: ... file:"somefile.png"

[[file:somefile.png]]

Previously, when somefile.png is re-plotted the [[file:]] inline image
did not refresh. With this patch, after plotting, overlays of the
replotted image are refreshed.

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-plot-Refresh-inline-images-after-plotting.patch --]
[-- Type: text/x-patch, Size: 1786 bytes --]

From 5c848c186f2dd4d77b0dcc1035b3c889a4b023a2 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Sat, 24 Apr 2021 12:49:26 +0800
Subject: [PATCH] org-plot: Refresh inline images after plotting

* lisp/org-plot.el (org-plot/redisplay-img-in-buffer): New function
which searches the current Org buffer for overlays of a certain image,
and refreshes those overlays.
(org-plot/gnuplot): Use `org-plot/redisplay-img-in-buffer' after
plotting to redisplay any associated inline images.
---
 lisp/org-plot.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 28cff94f2..65bc71074 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -610,6 +610,13 @@ (defun org-plot/gnuplot-script (table data-file num-cols params &optional prefac
 				    ",\\\n    "))))
       script)))
 
+(defun org-plot/redisplay-img-in-buffer (img-file)
+  "Find any overlays for IMG-FILE in the current Org buffer, and refresh them."
+  (dolist (img-overlay org-inline-image-overlays)
+    (when (string= img-file (plist-get (cdr (overlay-get img-overlay 'display)) :file))
+      (when (file-exists-p img-file)
+        (image-refresh (overlay-get img-overlay 'display))))))
+
 ;;-----------------------------------------------------------------------------
 ;; facade functions
 ;;;###autoload
@@ -697,7 +704,10 @@ (defun org-plot/gnuplot (&optional params)
 	(gnuplot-mode)
 	(gnuplot-send-buffer-to-gnuplot))
       ;; Cleanup.
-      (bury-buffer (get-buffer "*gnuplot*")))))
+      (bury-buffer (get-buffer "*gnuplot*"))
+      ;; Refresh any displayed images
+      (when (plist-get params :file)
+        (org-plot/redisplay-img-in-buffer (expand-file-name (plist-get params :file)))))))
 
 (provide 'org-plot)
 
-- 
2.31.1


^ permalink raw reply related	[relevance 74%]

* Re: [PATCH] org-capture.el: Add new capture template option :refile-to
  @ 2021-04-25  3:16 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:16 UTC (permalink / raw)
  To: emacs-orgmode


Marking this patch as cancelled for updates.orgmode.org.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] I updated patch by deleteing duplicate tags
  @ 2021-04-25  3:25 99%             ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:25 UTC (permalink / raw)
  To: emacs-orgmode


This was not marked as applied. Doing so with the X-Woof-Patch header.

Kyle Meyer <kyle@kyleam.com> writes:

> Christopher Miles writes:
>
>> Subject: [PATCH] org.el: Complete tags from both global and buffer local
>
> Thanks.  Applied (86ad8d279)...


^ permalink raw reply	[relevance 99%]

* Re: [PATCH] New "project" option for org-link-file-path-type
  @ 2021-04-25  3:29 93%         ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:29 UTC (permalink / raw)
  To: Jack Kamm; +Cc: Kyle Meyer, emacs-orgmode


This was not marked as applied on updates.orgmode.org.
Doing so with the X-Woof-Patch header.

Jack Kamm <jackkamm@gmail.com> writes:

> Thanks, I've fixed the remaining issues you pointed out and pushed this
> in 5371b30fe.
>
> Cheers,
> Jack


^ permalink raw reply	[relevance 93%]

* Re: [final patch] Re: add new link type "contact:" for org-contacts.el
  @ 2021-04-25  3:31 93%                           ` Timothy
  2021-04-25  3:59 93%                             ` Timothy
  0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-04-25  3:31 UTC (permalink / raw)
  To: emacs-orgmode


This was not marked as applied on updates.orgmode.org.
Doing so with the X-Woof-Patch header.

Bastien <bzg@gnu.org> writes:

> Of course, done (c822c80ef).
>
> Sorry I forgot about this patch, and thanks for your reply.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Apply emacs manual css to org pages
  @ 2021-04-25  3:34 93%     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:34 UTC (permalink / raw)
  To: org-mode-email


This was not marked as applied on updates.orgmode.org.
Doing so with the X-Woof-Patch header.

Bastien <bzg@gnu.org> writes:

> I made this change and tested it online, the HTML Org manual now looks
> like the Emacs manual: https://orgmode.org/manual/
>
> Thanks for the suggestion!

> In any cas, the Emacs manual css is better than my attempt and using
> it for Org makes sense IMO.
>
> Best,


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Apply emacs manual css to org pages
  @ 2021-04-25  3:36 93%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:36 UTC (permalink / raw)
  To: org-mode-email

For some reason updates.orgmode.org registered this as a new patch??
Marking as closed via X-Woof-Patch header.

Greg Minshall <minshall@umich.edu> writes:

> Timothy,
>
>> This is a quick patch to use the Emacs manual CSS with our generated Org
>> manual.
>
> that's certainly visually pleasing.  nice!
>
> Greg


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] ol: Avoid initial input when completing function for storing link
  @ 2021-04-25  3:38 93%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:38 UTC (permalink / raw)
  To: emacs-orgmode


This was not marked as applied on updates.orgmode.org.
Doing so with the X-Woof-Patch header.

Kyle Meyer <kyle@kyleam.com> writes:

> Pushed (00b4de329).


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] org-contacts.el: Use `bound-and-true-p' to check (unbound) var
  @ 2021-04-25  3:41 93%     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:41 UTC (permalink / raw)
  To: emacs-orgmode


This was not marked as applied on updates.orgmode.org.
Doing so with the X-Woof-Patch header.

miles christopher <numbchild@gmail.com> writes:

> Applied, I think this should be the final version.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] ob-java, a proposal on import improvement
  @ 2021-04-25  3:42 93%             ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:42 UTC (permalink / raw)
  To: emacs-orgmode


This was not marked as applied on updates.orgmode.org.
Doing so with the X-Woof-Patch header.

ian martins <ianxm@jhu.edu> writes:

> It's no problem. Didn't mean to rush you. Thanks again for the patch. Applied.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] ob-java: Allow import to end with asterisk
  @ 2021-04-25  3:43 93%       ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:43 UTC (permalink / raw)
  To: emacs-orgmode


This was not marked as applied on updates.orgmode.org.
Doing so with the X-Woof-Patch header.

ian martins <ianxm@jhu.edu> writes:

> Thanks. And thanks for taking the time to fix issues that you find. It
> continues to improve because of your contributions.
> The patch looks good. Applied.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Startup option to separate macros arguments with an alternative string
  @ 2021-04-25  3:46 93%         ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:46 UTC (permalink / raw)
  To: emacs-orgmode


As you have said you'll start a new thread for your revised proposal,
I'll mark this as closed on updates.orgmode.org via the X-Woof-Patch
header.

Juan Manuel Macías <maciaschain@posteo.net> writes:

> Ok, I agree. Next week I will start a new thread for submit this new
> proposal.
>
> Best regards,
>
> Juan Manuel


^ permalink raw reply	[relevance 93%]

* Re: [PATCH 0/1] Add option to delay fontification of source blocks
  @ 2021-04-25  3:48 93%     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:48 UTC (permalink / raw)
  To: emacs-orgmode


Marking as closed on updates.orgmode.org via the X-Woof-Patch header.

Leo Okawa Ericson <leo@relevant-information.com> writes:

> I can't think of a reason either (now that I know that jit-lock exists)
> so I will retract my patch.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH 0/1] Add option to delay fontification of source blocks
  @ 2021-04-25  3:48 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:48 UTC (permalink / raw)
  To: emacs-orgmode


Marking as closed on updates.orgmode.org via the X-Woof-Patch header.

Leo Okawa Ericson <leo@relevant-information.com> writes:

> I can't think of a reason either (now that I know that jit-lock exists)
> so I will retract my patch.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH 0/1] Add option to delay fontification of source blocks
  @ 2021-04-25  3:49 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:49 UTC (permalink / raw)
  To: emacs-orgmode


Marking as closed on updates.orgmode.org via the X-Woof-Patch header.

Leo Okawa Ericson <leo@relevant-information.com> writes:

> I can't think of a reason either (now that I know that jit-lock exists)
> so I will retract my patch.


^ permalink raw reply	[relevance 93%]

* Re: [final patch] Re: add new link type "contact:" for org-contacts.el
  2021-04-25  3:31 93%                           ` Timothy
@ 2021-04-25  3:59 93%                             ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  3:59 UTC (permalink / raw)
  To: emacs-orgmode


I'm afraid it looks like I either made a typo while doing this, or
something odd happened. Regardless it didn't work correctly.

Take 2, sorry for the noise --- but at least the patch section on
updates.orgmode.org should be more useful now as it only shows pending
patches again.

Timothy <tecosaur@gmail.com> writes:

> This was not marked as applied on updates.orgmode.org.
> Doing so with the X-Woof-Patch header.
>
> Bastien <bzg@gnu.org> writes:
>
>> Of course, done (c822c80ef).
>>
>> Sorry I forgot about this patch, and thanks for your reply.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Async session eval (2nd attempt)
  @ 2021-04-25  6:26 89%       ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  6:26 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: Jack Kamm, emacs-orgmode


Hi Jack, Kyle,

This is moving at a glacial pace, but I'd love to see this merged ---
there's clearly a lot of interest in this from the community if not
within this mailing list (ob-async which is more limited has 250 stars
on GitHub).

Jack, do you think you might be able to make these tweaks so I can
implore the maintainers to "just merge this"? :P

Kyle, if Jack doesn't get back to us do you think we could just make
those changes and merge the patch as-is at some point? Or merge it and
then add a commit making these fixes?

--
Timothy.

Kyle Meyer <kyle@kyleam.com> writes:

> Jack Kamm writes:
>
>> I also have an async implementation for ob-R that's ready after this is
>> merged :)
>
> It's a bit disappointing that only one babel user has tested this out
> and provided feedback, but please feel free to merge this whenever you
> think it's ready.
>
> I'm very happy to leave the babel details to you, but here are minor
> comments from a quick read-through looking for things that will likely
> be changed/cleaned up (either in the Org repo or the Emacs repo) if left
> as is.
>
>> Subject: [PATCH] ob-comint.el, ob-python.el: Async session evaluation
> [...]
>> +;; Async evaluation
>
> For a heading comment, please use at least three semicolons.
>
>   (info "(elisp)Comment Tips")
>
>> +
>> +(defvar-local org-babel-comint-async-indicator nil
>> +  "Regular expression that `org-babel-comint-async-filter' scans for.
>> +It should have 2 parenthesized expressions,
>> +e.g. \"org_babel_async_\\(start\\|end\\|file\\)_\\(.*\\)\". The
>> +first parenthesized expression determines whether the token is
>> +delimiting a result block, or whether the result is in a file. If
>> +delimiting a block, the second expression gives a UUID for the
>> +location to insert the result. Otherwise, the result is in a tmp
>> +file, and the second expression gives the file name.")
>> +
>> +(defvar-local org-babel-comint-async-buffers nil
>> +  "List of org-mode buffers to check for Babel async output results.")
>
> s/org-mode/Org mode/ here and other spots, following
> doc/Documentation_Standards.org and tree-wide cleanups like de24694f0
> (Turn org-mode into Org or Org mode, 2016-08-23).
>
> Also, you're missing two spaces between some sentences.
>
>> +(defmacro org-babel-comint-async-delete-dangling-and-eval
>> +    (session-buffer &rest body)
>> +  "Remove dangling text in SESSION-BUFFER and evaluate BODY.
>> +This is analogous to `org-babel-comint-with-output', but meant
>> +for asynchronous output, and much shorter because inserting the
>> +result is delegated to `org-babel-comint-async-filter'."
>> +  (declare (indent 1))
>> +  `(org-babel-comint-in-buffer ,session-buffer
>> +     (goto-char (process-mark (get-buffer-process (current-buffer))))
>> +     (delete-region (point) (point-max))
>> +     ,@body))
>> +(def-edebug-spec org-babel-comint-async-with-output (sexp body))
>
> Please move this edebug spec to the `declare' form (see 7dd1cfb6c,
> 2021-02-12).
>
>> diff --git a/testing/lisp/test-ob-python.el b/testing/lisp/test-ob-python.el
>> index a2cc7b79c..0267678cd 100644
>> --- a/testing/lisp/test-ob-python.el
>> +++ b/testing/lisp/test-ob-python.el
>> @@ -207,6 +207,67 @@ (ert-deftest test-ob-python/session-value-sleep ()
>>  #+end_src"
>>  	    (org-babel-execute-src-block)))))
>>
>> +(ert-deftest test-ob-python/async-simple-session-output ()
>> +  (let ((org-babel-temporary-directory "/tmp")
>
> Prefer `temporary-file-directory' to hard coding "/tmp".
>
> Thanks.


^ permalink raw reply	[relevance 89%]

* Re: [PATCH] Add org-meta*-final-hook
  @ 2021-04-25  6:31 91% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25  6:31 UTC (permalink / raw)
  To: Jay Bosamiya; +Cc: emacs-orgmode


Hi Jay,

Apologies for how incredibly long it's taken for someone to reply to
your email. It looks like this is your first contribution, so please
don't think this is the norm 😅, you just seemed to slip through the
cracks.

Jay Bosamiya <jaybosamiya@gmail.com> writes:

> Similar to org-shiftup-final-hook, org-shiftdown-final-hook, etc, I have
> added org-metaup-final-hook, org-metadown-final-hook, etc. Please see
> attached patch.

This seems consistent with what we already have, and so a good addition 👍.

> Please do let me know if any changes are required.

It looks like you have >15 lines changed here, so this is not eligible
to be a TINYCHANGE, i.e. we require FSF assignment
(see: https://orgmode.org/contribute.html#copyright) if you haven't got
this already.

--
Timothy


^ permalink raw reply	[relevance 91%]

* [PATCH] Babel: remove LaTeX environment -type #+results
@ 2021-04-25  9:06 74% Timothy
      0 siblings, 2 replies; 200+ results
From: Timothy @ 2021-04-25  9:06 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

Hi All,

I think there's potential for some really nice experiences leveraging
Org's latex rendering in combination with some languages' symbolic maths
ability.

This is /very nearly/ already supported, `org-babel-result-end' just
needs to be tweaked to also remove LaTeX environment -type #+results.

This is what I'd like to make possible:


[-- Attachment #2: julia-org-inline-maths.png --]
[-- Type: image/png, Size: 22821 bytes --]

[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0001-ob-core-Remove-LaTeX-environment-results-type.patch --]
[-- Type: text/x-patch, Size: 1618 bytes --]

From e7e7eb698883348eeb404c0bc58ed7aed52344c4 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Sun, 25 Apr 2021 16:51:15 +0800
Subject: [PATCH] ob-core: Remove LaTeX environment #+results type

* lisp/ob-core.el (org-babel-result-end): By adding latex-enviroment to
the possible results types, a much richer experience is possible for
backends that can produce LaTeX-formatted maths as their results (for
example: Calc, Julia with Latexify, Python with SymPy, Octave with
symbolic). This is superior to a LaTeX export block as LaTeX
environments can be (1) rendered inline, and (2) better used in
non-LaTeX export formats (e.g. HTML with MathJax).  Without this,
backends can output a LaTeX environment, but new results will be added
in front instead of replacing the environment.
---
 lisp/ob-core.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 2e78ac3e6..12f67a8e2 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2559,8 +2559,9 @@ (defun org-babel-result-end ()
 	 (let ((element (org-element-at-point)))
 	   (if (memq (org-element-type element)
 		     ;; Possible results types.
-		     '(drawer example-block export-block fixed-width item
-			      plain-list special-block src-block table))
+                     '(drawer example-block export-block fixed-width
+                              special-block src-block item plain-list table
+                              latex-environment))
 	       (save-excursion
 		 (goto-char (min (point-max) ;for narrowed buffers
 				 (org-element-property :end element)))
-- 
2.31.1


^ permalink raw reply related	[relevance 74%]

* Re: [PATCH] Babel: remove LaTeX environment -type #+results
  @ 2021-04-25 18:09 92%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-25 18:09 UTC (permalink / raw)
  To: Greg Minshall; +Cc: org-mode-email


Greg Minshall <minshall@umich.edu> writes:

> Timothy,
>
> interesting.  would this show up in #+RESULTS blocks?  in (heaven
> forbid!) #+BEGIN_SRC blocks?
>
> cheers, Greg

The screenshot where it shows up is from the following Org buffer
(manually constructed for the example):

#+begin_src julia
[1 2; 3 4]
#+end_src

#+RESULTS:
\begin{equation}
\left[
\begin{array}{cc}
1 & 2 \\
3 & 4 \\
\end{array}
\right]
\end{equation}

#+begin_src julia
using Symbolics
@variables t
2^sin(t) + cos(t)/t
#+end_src

#+RESULTS:
\begin{equation}
\frac{\cos\left( t \right)}{t} + 2^{\sin\left( t \right)}
\end{equation}

The rendering is just done by `org-latex-preview'.

Hope that clears things up.

--
Timothy


^ permalink raw reply	[relevance 92%]

* Re: [PATCH] Refresh inline plotted images
  2021-04-24  4:59 74% [PATCH] Refresh inline plotted images Timothy
@ 2021-04-26 14:54 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-26 14:54 UTC (permalink / raw)
  To: org-mode-email


Applied in dadbd025f.*

Timothy <tecosaur@gmail.com> writes:

> Hi All,
>
> This patch improves the result of running org-plot in the following
> situation
>
> #+plot: ... file:"somefile.png"
>
> [[file:somefile.png]]
>
> Previously, when somefile.png is re-plotted the [[file:]] inline image
> did not refresh. With this patch, after plotting, overlays of the
> replotted image are refreshed.

* As Bastien pointed out to me, I /am/ the org-plot maintainer...


^ permalink raw reply	[relevance 93%]

* [PATCH] Have C-c C-c recognise #+plot lines
  @ 2021-04-26 16:24 63% ` Timothy
       [not found]     ` <88f6c54a01f345d785492c4d5b3b82d3@VI1PR0102MB3327.eurprd01.prod.exchangelabs.com>
  1 sibling, 0 replies; 200+ results
From: Timothy @ 2021-04-26 16:24 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]


A while ago Eric raised two nice suggestions. (2) has just been
implemented as Bastien reminded me that I can now just push straight to
Org for org-plot.el without going through a patch-review process.

This patch resolves (1).

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> 1. it would be consistent and useful if "C-c C-c" executed
>    org-plot/gnuplot when on such a #+PLOT line.
>
> 2. why does point move to the next line when I do execute the command?
>    This is somewhat annoying when playing around with the settings.  It
>    would be nice to have point remain where it is.
>
> Thank you all!

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-Enable-plotting-with-C-c-C-c.patch --]
[-- Type: text/x-patch, Size: 2964 bytes --]

From fccd5f2c66fe8342da2a8eb405240f5247958597 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Tue, 27 Apr 2021 00:05:37 +0800
Subject: [PATCH] org: Enable plotting with C-c C-c

* lisp/org.el (org-ctrl-c-ctrl-c): When at a table, check if the current
line starts with "#+plot", and if so call `org-plot/gnuplot'.
As I think 4-deep nested if statements are bad for readability, I
refactored the nested if statements to use `cond' while I was at it.
---
 lisp/org.el | 40 ++++++++++++++++++++++------------------
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 3f9c9a284..950509bfd 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17693,24 +17693,28 @@ (defun org-ctrl-c-ctrl-c (&optional arg)
 	 ;; send the table if necessary.  If the table has
 	 ;; a `table.el' type, just give up.  At a table row or cell,
 	 ;; maybe recalculate line but always align table.
-	 (if (eq (org-element-property :type context) 'table.el)
-	     (message "%s" (substitute-command-keys "\\<org-mode-map>\
-Use `\\[org-edit-special]' to edit table.el tables"))
-	   (if (or (eq type 'table)
-		   ;; Check if point is at a TBLFM line.
-		   (and (eq type 'table-row)
-			(= (point) (org-element-property :end context))))
-	       (save-excursion
-		 (if (org-at-TBLFM-p)
-		     (progn (require 'org-table)
-			    (org-table-calc-current-TBLFM))
-		   (goto-char (org-element-property :contents-begin context))
-		   (org-call-with-arg 'org-table-recalculate (or arg t))
-		   (orgtbl-send-table 'maybe)))
-	     (org-table-maybe-eval-formula)
-	     (cond (arg (call-interactively #'org-table-recalculate))
-		   ((org-table-maybe-recalculate-line))
-		   (t (org-table-align))))))
+         (cond
+          ((string-match-p "#\\+plot" (thing-at-point 'line t))
+           (org-plot/gnuplot))
+          ((eq (org-element-property :type context) 'table.el)
+           (message "%s" (substitute-command-keys "\\<org-mode-map>\
+Use `\\[org-edit-special]' to edit table.el tables")))
+          ((or (eq type 'table)
+               ;; Check if point is at a TBLFM line.
+               (and (eq type 'table-row)
+                    (= (point) (org-element-property :end context))))
+           (save-excursion
+             (if (org-at-TBLFM-p)
+                 (progn (require 'org-table)
+                        (org-table-calc-current-TBLFM))
+               (goto-char (org-element-property :contents-begin context))
+               (org-call-with-arg 'org-table-recalculate (or arg t))
+               (orgtbl-send-table 'maybe))))
+          (t
+           (org-table-maybe-eval-formula)
+           (cond (arg (call-interactively #'org-table-recalculate))
+                 ((org-table-maybe-recalculate-line))
+                 (t (org-table-align))))))
 	((or `timestamp (and `planning (guard (org-at-timestamp-p 'lax))))
 	 (org-timestamp-change 0 'day))
 	((and `nil (guard (org-at-heading-p)))
-- 
2.31.1


^ permalink raw reply related	[relevance 63%]

* Re: [PATCH] Have C-c C-c recognise #+plot lines
  @ 2021-04-26 17:11 63%     ` Timothy
  2021-04-26 17:13 64%       ` Timothy
  0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-04-26 17:11 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 111 bytes --]


Since you don't seem to have pushed yet, here's an updated patche that
takes into account Nicolas' comments.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-Enable-plotting-with-C-c-C-c.patch --]
[-- Type: text/x-patch, Size: 3028 bytes --]

From 04270b64315fed399748509f1c09428557b7742d Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Tue, 27 Apr 2021 00:05:37 +0800
Subject: [PATCH] org: Enable plotting with C-c C-c

* lisp/org.el (org-ctrl-c-ctrl-c): When at a table, check if the current
line starts with "#+plot", and if so call `org-plot/gnuplot'.
As I think 4-deep nested if statements are bad for readability, I
refactored the nested if statements to use `cond' while I was at it.
---
 lisp/org.el | 41 +++++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 3f9c9a284..c4e2e132f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17693,24 +17693,29 @@ (defun org-ctrl-c-ctrl-c (&optional arg)
 	 ;; send the table if necessary.  If the table has
 	 ;; a `table.el' type, just give up.  At a table row or cell,
 	 ;; maybe recalculate line but always align table.
-	 (if (eq (org-element-property :type context) 'table.el)
-	     (message "%s" (substitute-command-keys "\\<org-mode-map>\
-Use `\\[org-edit-special]' to edit table.el tables"))
-	   (if (or (eq type 'table)
-		   ;; Check if point is at a TBLFM line.
-		   (and (eq type 'table-row)
-			(= (point) (org-element-property :end context))))
-	       (save-excursion
-		 (if (org-at-TBLFM-p)
-		     (progn (require 'org-table)
-			    (org-table-calc-current-TBLFM))
-		   (goto-char (org-element-property :contents-begin context))
-		   (org-call-with-arg 'org-table-recalculate (or arg t))
-		   (orgtbl-send-table 'maybe)))
-	     (org-table-maybe-eval-formula)
-	     (cond (arg (call-interactively #'org-table-recalculate))
-		   ((org-table-maybe-recalculate-line))
-		   (t (org-table-align))))))
+         (cond
+          ((and (< (point) (org-element-property :post-affiliated context))
+                (org-match-line "[ \t]*#+plot:"))
+           (org-plot/gnuplot))
+          ((eq (org-element-property :type context) 'table.el)
+           (message "%s" (substitute-command-keys "\\<org-mode-map>\
+Use `\\[org-edit-special]' to edit table.el tables")))
+          ((or (eq type 'table)
+               ;; Check if point is at a TBLFM line.
+               (and (eq type 'table-row)
+                    (= (point) (org-element-property :end context))))
+           (save-excursion
+             (if (org-at-TBLFM-p)
+                 (progn (require 'org-table)
+                        (org-table-calc-current-TBLFM))
+               (goto-char (org-element-property :contents-begin context))
+               (org-call-with-arg 'org-table-recalculate (or arg t))
+               (orgtbl-send-table 'maybe))))
+          (t
+           (org-table-maybe-eval-formula)
+           (cond (arg (call-interactively #'org-table-recalculate))
+                 ((org-table-maybe-recalculate-line))
+                 (t (org-table-align))))))
 	((or `timestamp (and `planning (guard (org-at-timestamp-p 'lax))))
 	 (org-timestamp-change 0 'day))
 	((and `nil (guard (org-at-heading-p)))
-- 
2.31.1


[-- Attachment #3: Type: text/plain, Size: 579 bytes --]


Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Monday, 26 Apr 2021 at 16:24, Timothy wrote:
>> A while ago Eric raised two nice suggestions. (2) has just been
>> implemented as Bastien reminded me that I can now just push straight to
>> Org for org-plot.el without going through a patch-review process.
>>
>> This patch resolves (1).
>
> Timothy,
>
> I've updated org and applied the patch.  Both aspects seem to work just
> fine.  I haven't done much testing, however, as it's beer time...  I'll
> update tomorrow should I run into any strange behaviour.
>
> thank you,
> eric

^ permalink raw reply related	[relevance 63%]

* Re: [PATCH] Have C-c C-c recognise #+plot lines
  2021-04-26 17:11 63%     ` Timothy
@ 2021-04-26 17:13 64%       ` Timothy
  2021-04-26 17:17 64%         ` Timothy
  0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-04-26 17:13 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 242 bytes --]


Timothy <tecosaur@gmail.com> writes:

> Since you don't seem to have pushed yet, here's an updated patch that
> takes into account Nicolas' comments.

... and that patch didn't take into account the need to escape "+" in
the regex.
Take 3.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-Enable-plotting-with-C-c-C-c.patch --]
[-- Type: text/x-patch, Size: 3030 bytes --]

From 4e5fcb4726711ff356656cb6fccf6e341656443d Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Tue, 27 Apr 2021 00:05:37 +0800
Subject: [PATCH] org: Enable plotting with C-c C-c

* lisp/org.el (org-ctrl-c-ctrl-c): When at a table, check if the current
line starts with "#+plot", and if so call `org-plot/gnuplot'.
As I think 4-deep nested if statements are bad for readability, I
refactored the nested if statements to use `cond' while I was at it.
---
 lisp/org.el | 41 +++++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 3f9c9a284..94ef9660d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17693,24 +17693,29 @@ (defun org-ctrl-c-ctrl-c (&optional arg)
 	 ;; send the table if necessary.  If the table has
 	 ;; a `table.el' type, just give up.  At a table row or cell,
 	 ;; maybe recalculate line but always align table.
-	 (if (eq (org-element-property :type context) 'table.el)
-	     (message "%s" (substitute-command-keys "\\<org-mode-map>\
-Use `\\[org-edit-special]' to edit table.el tables"))
-	   (if (or (eq type 'table)
-		   ;; Check if point is at a TBLFM line.
-		   (and (eq type 'table-row)
-			(= (point) (org-element-property :end context))))
-	       (save-excursion
-		 (if (org-at-TBLFM-p)
-		     (progn (require 'org-table)
-			    (org-table-calc-current-TBLFM))
-		   (goto-char (org-element-property :contents-begin context))
-		   (org-call-with-arg 'org-table-recalculate (or arg t))
-		   (orgtbl-send-table 'maybe)))
-	     (org-table-maybe-eval-formula)
-	     (cond (arg (call-interactively #'org-table-recalculate))
-		   ((org-table-maybe-recalculate-line))
-		   (t (org-table-align))))))
+         (cond
+          ((and (< (point) (org-element-property :post-affiliated context))
+                (org-match-line "[ \t]*#\\+plot:"))
+           (org-plot/gnuplot))
+          ((eq (org-element-property :type context) 'table.el)
+           (message "%s" (substitute-command-keys "\\<org-mode-map>\
+Use `\\[org-edit-special]' to edit table.el tables")))
+          ((or (eq type 'table)
+               ;; Check if point is at a TBLFM line.
+               (and (eq type 'table-row)
+                    (= (point) (org-element-property :end context))))
+           (save-excursion
+             (if (org-at-TBLFM-p)
+                 (progn (require 'org-table)
+                        (org-table-calc-current-TBLFM))
+               (goto-char (org-element-property :contents-begin context))
+               (org-call-with-arg 'org-table-recalculate (or arg t))
+               (orgtbl-send-table 'maybe))))
+          (t
+           (org-table-maybe-eval-formula)
+           (cond (arg (call-interactively #'org-table-recalculate))
+                 ((org-table-maybe-recalculate-line))
+                 (t (org-table-align))))))
 	((or `timestamp (and `planning (guard (org-at-timestamp-p 'lax))))
 	 (org-timestamp-change 0 'day))
 	((and `nil (guard (org-at-heading-p)))
-- 
2.31.1


^ permalink raw reply related	[relevance 64%]

* Re: [PATCH] Have C-c C-c recognise #+plot lines
  2021-04-26 17:13 64%       ` Timothy
@ 2021-04-26 17:17 64%         ` Timothy
  2021-04-28 18:04 93%           ` Timothy
  2021-04-30  7:06 93%           ` Timothy
  0 siblings, 2 replies; 200+ results
From: Timothy @ 2021-04-26 17:17 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 82 bytes --]


... I didn't regenerate the patch after amending the commit.

:big sigh: Take 4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-Enable-plotting-with-C-c-C-c.patch --]
[-- Type: text/x-patch, Size: 3030 bytes --]

From 4e5fcb4726711ff356656cb6fccf6e341656443d Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Tue, 27 Apr 2021 00:05:37 +0800
Subject: [PATCH] org: Enable plotting with C-c C-c

* lisp/org.el (org-ctrl-c-ctrl-c): When at a table, check if the current
line starts with "#+plot", and if so call `org-plot/gnuplot'.
As I think 4-deep nested if statements are bad for readability, I
refactored the nested if statements to use `cond' while I was at it.
---
 lisp/org.el | 41 +++++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 3f9c9a284..94ef9660d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17693,24 +17693,29 @@ (defun org-ctrl-c-ctrl-c (&optional arg)
 	 ;; send the table if necessary.  If the table has
 	 ;; a `table.el' type, just give up.  At a table row or cell,
 	 ;; maybe recalculate line but always align table.
-	 (if (eq (org-element-property :type context) 'table.el)
-	     (message "%s" (substitute-command-keys "\\<org-mode-map>\
-Use `\\[org-edit-special]' to edit table.el tables"))
-	   (if (or (eq type 'table)
-		   ;; Check if point is at a TBLFM line.
-		   (and (eq type 'table-row)
-			(= (point) (org-element-property :end context))))
-	       (save-excursion
-		 (if (org-at-TBLFM-p)
-		     (progn (require 'org-table)
-			    (org-table-calc-current-TBLFM))
-		   (goto-char (org-element-property :contents-begin context))
-		   (org-call-with-arg 'org-table-recalculate (or arg t))
-		   (orgtbl-send-table 'maybe)))
-	     (org-table-maybe-eval-formula)
-	     (cond (arg (call-interactively #'org-table-recalculate))
-		   ((org-table-maybe-recalculate-line))
-		   (t (org-table-align))))))
+         (cond
+          ((and (< (point) (org-element-property :post-affiliated context))
+                (org-match-line "[ \t]*#\\+plot:"))
+           (org-plot/gnuplot))
+          ((eq (org-element-property :type context) 'table.el)
+           (message "%s" (substitute-command-keys "\\<org-mode-map>\
+Use `\\[org-edit-special]' to edit table.el tables")))
+          ((or (eq type 'table)
+               ;; Check if point is at a TBLFM line.
+               (and (eq type 'table-row)
+                    (= (point) (org-element-property :end context))))
+           (save-excursion
+             (if (org-at-TBLFM-p)
+                 (progn (require 'org-table)
+                        (org-table-calc-current-TBLFM))
+               (goto-char (org-element-property :contents-begin context))
+               (org-call-with-arg 'org-table-recalculate (or arg t))
+               (orgtbl-send-table 'maybe))))
+          (t
+           (org-table-maybe-eval-formula)
+           (cond (arg (call-interactively #'org-table-recalculate))
+                 ((org-table-maybe-recalculate-line))
+                 (t (org-table-align))))))
 	((or `timestamp (and `planning (guard (org-at-timestamp-p 'lax))))
 	 (org-timestamp-change 0 'day))
 	((and `nil (guard (org-at-heading-p)))
-- 
2.31.1


[-- Attachment #3: Type: text/plain, Size: 31 bytes --]


Sorry for the noise,

Timothy

^ permalink raw reply related	[relevance 64%]

* Re: [PATCH] ox-md.el export code blocks using grave accents.
  @ 2021-04-27 10:18 92%     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-27 10:18 UTC (permalink / raw)
  To: Bruce D'Arcus; +Cc: Tim Cross, emacs-orgmode


Bruce D'Arcus <bdarcus@gmail.com> writes:

> On Sat, Jan 30, 2021, 6:29 PM Tim Cross <theophilusx@gmail.com> wrote:
>
>> There are no precise standards for markdown, but org states in the
>> manual that the version of markdown it supports is that defined at
>> http://daringfireball.net/projects/markdown
>
> Perhaps at some point it would make sense to change to this, which is
> much more precisely specified:
>
> https://commonmark.org/

The only change I'd think would be worthwhile, is to complicate ox-md by
introducing the concept of styles/presets.

Even just commonmark has multiple ways you can do things (backticks and
spaces for code), and I'd think supporting a set like: Gruber's
original, commonmark, and GFM would make sense.

Alternatively, we can leave that to other backends like ox-gfm.

Basically: markdown is a mess and I'm not sure what would be a good
course of action.

--
Timothy


^ permalink raw reply	[relevance 92%]

* Re: [PATCH]
  @ 2021-04-28  3:53 91%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-28  3:53 UTC (permalink / raw)
  To: Bastien; +Cc: org-mode-email


Bastien <bzg@gnu.org> writes:

> Feel free to install changes when they have reached consensus, 
> or to ask for decisions when not.

Thanks for the reply Bastien, would you mind elaborating on this a bit
more? I'm comfortable with the idea of what I can do with org-plot.el as
the maintainer (directly push, but field patches to the ML for
non-trivial changes), but as a non-core-contributor I didn't think I
could push my own patches for other things.

Also, with the batch of patches I sent a plea about recently, how would
you recommend I proceed with that? There doesn't seem to be any
consensus or decision despite prompting.

Thanks,

Timothy


^ permalink raw reply	[relevance 91%]

* Re: [PATCH] Fontification for inline src blocks
  2021-03-31 15:00 42% [PATCH] Fontification for inline src blocks Timothy
@ 2021-04-28  7:14 88% ` Timothy
  2021-05-02 20:17 93%   ` Timothy
    1 sibling, 1 reply; 200+ results
From: Timothy @ 2021-04-28  7:14 UTC (permalink / raw)
  To: org-mode-email


Timothy <tecosaur@gmail.com> writes:

> Hi All,
>
> I've been using inline src blocks a fair bit more recently, and I've
> thought it's a pity how bad they look as they are currently without
> fontification. A little digging into Org internals and font-lock later
> and we have this patch. I could speak about what's been done, but I
> think a screenshot does a much better comparison.
>
> For more details, see the attached patch.

Since this affects font-lock, display performance is obviously a key
concern, and so I have two things to note on that front:

1. I have been using this patch for over a month at this point,
   frequently in a ~10k line Org file (my Emacs config), and there has
   been no noticeable performance degradation
2. The most expensive part of this is the native syntax highlighting,
   which is only used when `org-src-fontify-natively' is t, and the
   second most expensive part (results formatting) is only performed
   when `org-inline-src-prettify-results' (a new variable) is t.

In brief: I don't anticipate any significant performance implications of
this patch, though of course second opinions would be great :)

--
Timothy


^ permalink raw reply	[relevance 88%]

* Re: [PATCH] Add font-lock rule for inline export snippets
  2021-03-31 15:57 80% [PATCH] Add font-lock rule for inline export snippets Timothy
@ 2021-04-28  7:23 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-28  7:23 UTC (permalink / raw)
  To: org-mode-email


Timothy <tecosaur@gmail.com> writes:

> Hello,
>
> The latest in my visually-oriented (mostly) short patch series, adding
> basic fontification to inline export snippets --- @@comment:these things@@.
>
> I think fontification for stuff like this is nice because it visually
> indicates to the user that they've written out an Org construct, and
> haven't just mis-remembered / imagined some syntax.
>
> In future this could be extended to use native fontification for
> recognised export formats (like src blocks do), but I think this is a
> nice improvement over nothing.

This addition to the font-lock regexps is quite simple, and doesn't
contain anything fancy/expensive (like backtracking), so I don't expect
there to be any performance concerns --- but it would be good to hear
from others :)

I considered limiting this to no-newlines, but
https://orgmode.org/worg/dev/org-syntax.html says anything other than @@
is allowed.

--
Timothy


^ permalink raw reply	[relevance 93%]

* [PATCH] fix point position shifting in some org-src instances
@ 2021-04-28 10:33 63% Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-28 10:33 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]

Hi All,

I've noticed for a while that if you have a block with
overlays/invisible characters that editing it with `org-edit-special'
moves the point around.

For example, with Org pretty entities enabled, and █ indicating the
cursor, if I call org-edit-special on a LaTeX fragment like:
  \( \alpha +█\beta \)
which is displayed as \( α +█β \)
The point is moved on creation of the org-src buffer
  \( \alpha + \beta █\)
Then if I move it back to after the "+", on calling `org-edit-src-exit'
the point is moved to
  \(█ \alpha + \beta \)
In the original buffer.

This may seem quite minor, but if you're editing a lot of LaTeX
fragments having the point constantly jumping around can be quite a
pain.

After investigating this, I tried shifting org-src--{goto-}coordinates
to a point-based approach from a column-based approach, and it seems to
have fixed the problem.

I have tested a few other situations (e.g. LaTeX environments, example
blocks, src blocks), and it seems to work well.

--
Timothy


[-- Attachment #2: 0001-org-src-Use-point-instead-of-column-for-coords.patch --]
[-- Type: text/x-patch, Size: 1882 bytes --]

From 8e8faf389d6d5c0769b5f95775ec7883820b10b3 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 28 Apr 2021 18:17:00 +0800
Subject: [PATCH] org-src: Use point instead of column for coords
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/org-src.el (org-src--coordinates, org-src--goto-coordinates):
Using a column-based approach fails to account for invisible regions
or display overlays that change the number of columns: for example,
showing a LaTeX \alpha as α.  In src edits which involve such
structures, this causes the point to be shifted undesirably.
By using a point-based approach this issue does not occur.
---
 lisp/org-src.el | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index cabedecb6..a694e5595 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -327,8 +327,7 @@ (defun org-src--coordinates (pos beg end)
      (cons (count-lines beg (line-beginning-position))
 	   ;; Column is relative to the end of line to avoid problems of
 	   ;; comma escaping or colons appended in front of the line.
-	   (- (current-column)
-	      (progn (end-of-line) (current-column)))))))
+	   (- (point) (min end (line-end-position)))))))
 
 (defun org-src--goto-coordinates (coord beg end)
   "Move to coordinates COORD relatively to BEG and END.
@@ -341,9 +340,9 @@ (defun org-src--goto-coordinates (coord beg end)
      (org-with-wide-buffer
       (goto-char beg)
       (forward-line (car coord))
-      (end-of-line)
-      (org-move-to-column (max (+ (current-column) (cdr coord)) 0))
-      (point)))))
+      (max (point)
+           (+ (min end (line-end-position))
+              (cdr coord)))))))
 
 (defun org-src--contents-area (datum)
   "Return contents boundaries of DATUM.
-- 
2.31.1


^ permalink raw reply related	[relevance 63%]

* Re: [PATCH] Have C-c C-c recognise #+plot lines
  2021-04-26 17:17 64%         ` Timothy
@ 2021-04-28 18:04 93%           ` Timothy
    2021-04-30  7:06 93%           ` Timothy
  1 sibling, 1 reply; 200+ results
From: Timothy @ 2021-04-28 18:04 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode@gnu.org


Hi Eric,

Have you had a chance to test this out?

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Have C-c C-c recognise #+plot lines
  2021-04-26 17:17 64%         ` Timothy
  2021-04-28 18:04 93%           ` Timothy
@ 2021-04-30  7:06 93%           ` Timothy
  1 sibling, 0 replies; 200+ results
From: Timothy @ 2021-04-30  7:06 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode@gnu.org


Now that Eric and I have both tested this, and Nicolas' comments have
been taken into account, it would be great if a core maintainer could
consider applying this patch :)

--
Timothy

p.s. I'm specifically making a new reply to the version of the patch
that should be looked at, in the hope that this might help with clarity
when there are 4 different patches in this thread.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Have C-c C-c recognise #+plot lines
  @ 2021-04-30  8:52 93%                 ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-04-30  8:52 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode@gnu.org, Eric S Fraga


Bastien <bzg@gnu.org> writes:

> Eric S Fraga <e.fraga@ucl.ac.uk> writes:
>
>> Further on this, I don't have time to debug right now but the patch
>> seems to have broken org table recalculation, specifically C-u C-c C-c
>> on a table.
>
> Thanks for reporting - Tim can you double-check this?

I checked the docs for `org-table-recalculate' and based on manually
calling it compared the behaviour to C-u C-c C-c on a table and noticed
no difference, but I'm not familiar with the intended functionality so
an example from Eric (or someone else) of what should happen would be
very helpful.

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Have C-c C-c recognise #+plot lines
  @ 2021-04-30 12:16 91%                     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-04-30 12:16 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: Bastien, emacs-orgmode@gnu.org


Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> I have updated org.  Problem persists.
>
> Attached is a full backtrace after hitting C-u C-c C-c on a table.  The
> document itself has 2 headings and a small table.
>
> I unfortunately cannot spend more time on this at the moment as I have a
> presentation to make this afternoon and it's not quite ready...

Thank you for taking the time to check this in what sounds like a busy
day, and the backtrace. It's much appreciated :)

It seems like for you (org-element-property :post-affiliated context)
was unexpectedly nil. (or 0 ...) would be a quick-fix, but I find it odd
that this is a issue, and am yet to be able to reproduce this myself.

Is anybody else willing to try this and weigh in?

--
Timothy

p.s. Good luck with the presentation!


^ permalink raw reply	[relevance 91%]

* Re: [PATCH] org-src.el Do not ask to revert unmodified buffers
  @ 2021-05-01 10:55 93%     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-05-01 10:55 UTC (permalink / raw)
  To: pillule; +Cc: Kyle Meyer, emacs-orgmode


Hi pillule, should we consider this patch cancelled?

pillule <pillule@riseup.net> writes:

> You are right I clearly missed org-src-ask-before-returning-to-edit-buffer
> Don't know how . . .
>
> Sorry for the noise.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] A proposal to add LaTeX attributes to verse blocks
    @ 2021-05-01 10:58 93%         ` Timothy
  1 sibling, 0 replies; 200+ results
From: Timothy @ 2021-05-01 10:58 UTC (permalink / raw)
  To: Juan Manuel Macías; +Cc: orgmode


Hi Juan,

Sorry it's still taking a while for your patch to be looked at.
Assuming it does get merged, it would be good to check if you'd be
willing to write a manual entry to accompany this (in a separate patch
works).

Thanks again for the patch,

Timothy.

Juan Manuel Macías <maciaschain@posteo.net> writes:


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] LaTeX export: arbitrary float environments
  @ 2021-05-01 11:08 91% ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-05-01 11:08 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode


Hi Thomas,

On the surface, this looks reasonable to me :)

Just commenting on some technicalities with the patch itself:
- In ORG-NEWS it would be good to wrap the content over multiple lines
  instead of having a single 270 char line :)
- You seem to have an anomalous change to the ob-python :return entry
- I don't think your patch subject follows the convention for Org, it
  should be:
  "main file/feature: overall change summary"
  so, something like
  "ox-latex: allow for arbitrary float environments"
  rather than
  "LaTeX export: arbitrary float environments"

Thanks for the patch :)

Timothy


^ permalink raw reply	[relevance 91%]

* Re: [PATCH] Babel: remove LaTeX environment -type #+results
  @ 2021-05-01 11:44 93%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-05-01 11:44 UTC (permalink / raw)
  To: Bastien; +Cc: org-mode-email


Bastien <bzg@gnu.org> writes:

> Applied in master as commit b90b850ae.
>
> Can you add a etc/ORG-NEWS entry for this?

Great! News entry added.

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] avoid loading major modes when exporting to file
  @ 2021-05-01 17:26 84%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-05-01 17:26 UTC (permalink / raw)
  To: Bastien; +Cc: org-mode-email


Bastien <bzg@gnu.org> writes:

> This even be "auto-mode-alist" instead of "(auto-mode-alist nil)".

Ah, it can indeed.

> I'm still unsure the patch is correct: what if people *need* major
> mode initialization before any contents is exported to a file?

I haven't responded to this concern, because I haven't been able to
conceive of a single situation where loading the normal-mode for the
exported file could be desirable.

>> I think the commit description is pretty thorough, so give that a look.
>> TLDR; it makes `org-export-to-file' behave a bit more nicely.
>
> I find it useful to have a small description of the change and why it
> is needed in the body of the email, when a patch is attached.

I think I may have been become overly used to how convenient mu4e is for
showing patches inline 😅.

For the sake of anyone just looking at the Email body, here's what I
considered to be an informative commit message, subtly reworded:

Currently, when `org-export-to-file' is called it activated the major
mode for that file type based on `auto-mode-alist'. This can be mildly
annoying in various ways as loading the major mode:
1. makes the export take longer
2. can produce unwanted "noise" while initialising, namely warnings and
   errors related to the mode itself
3. can produce spurious files like an .auctex-auto folder

By locally binding `auctex-auto' to nil all of these undesirable
behaviours can be avoided.

--
Timothy


^ permalink raw reply	[relevance 84%]

* Re: [PATCH] LaTeX export: arbitrary float environments
  @ 2021-05-01 17:31 88%     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-05-01 17:31 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode


Thomas S. Dye <tsd@tsdye.online> writes:

> Aloha Timothy,

:waves:

> Sorry for the clumsy patch, which I guess would also benefit from an addition to
> the manual, as well?

No problem, we all start somewhere :) (and I know I'm still making mistakes)

An update to the manual to describe the changed behaviour would be good.
If you'd like you could wait till a core maintainer says this looks good
before going to that effort, or you could add it in now so it's all in a
single patch --- as long as something happens.

> Larger question: do we really want to tinker with ob-latex in this way?  Or,
> should changes like this patch follow a path indicated by Tim Cross and into
> their own package, say ob-latex-ex, which might someday replace ob-latex if it
> proved useful and stable?

I don't think LaTeX support is likely to leave Org any time soon, so at
least until a core maintainer tells you otherwise I'd be inclined to
proceed with your current patch.

If this was a huge/transformational change I may be more uncertain, but
this looks fairly simple to me at least.

--
Timothy

> All the best,
> Tom
>
> Timothy <tecosaur@gmail.com> writes:
>
>> Hi Thomas,
>>
>> On the surface, this looks reasonable to me :)
>>
>> Just commenting on some technicalities with the patch itself:
>> - In ORG-NEWS it would be good to wrap the content over multiple lines
>>   instead of having a single 270 char line :)
>> - You seem to have an anomalous change to the ob-python :return entry
>> - I don't think your patch subject follows the convention for Org, it
>>   should be:
>>   "main file/feature: overall change summary"
>>   so, something like
>>   "ox-latex: allow for arbitrary float environments"
>>   rather than
>>   "LaTeX export: arbitrary float environments"
>>
>> Thanks for the patch :)
>>
>> Timothy


^ permalink raw reply	[relevance 88%]

* Re: [PATCH] A proposal to add LaTeX attributes to verse blocks
       [not found]               ` <87tunlxws3.fsf@ucl.ac.uk>
@ 2021-05-02 11:31 92%             ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-05-02 11:31 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: Bastien, Juan Manuel Macías, emacs-orgmode


Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> Is the verse package loaded automatically already?  I did not see any
> change in the patch to that aspect and when I export a simple test, the
> package is not loaded.

Wouldn't it be nice if there was something in-between loading the
kitchen sink and manually adding packages*... [ foreshadowing ;) ]

--
Timothy

* My prototype is now rather stable and I like the interface, I'm just
  wondering if I should generalise it for arbitrary backends or keep it
  as LaTeX-only, but don't let me take this thread on a tangent over
  this. I just thought it was worth mentioning.


^ permalink raw reply	[relevance 92%]

* Re: [PATCH] Fontification for inline src blocks
  2021-04-28  7:14 88% ` Timothy
@ 2021-05-02 20:17 93%   ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-05-02 20:17 UTC (permalink / raw)
  To: org-mode-email


It would be good to hear if anyone has been able to test this, and if so
what your experience has been :)

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Wrap LaTeX snippets in $$ with markdown export
  @ 2021-05-02 20:20 93%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-05-02 20:20 UTC (permalink / raw)
  To: Berry, Charles; +Cc: org-mode-email


> Will this handle LaTeX macros[1] gracefully and other things intended as raw LaTeX?
> [1] https://pandoc.org/MANUAL.html#latex-macros

This only affects LaTeX fragments, and then it's just changing \(\) /
\[\] for $ / $$. I don't think this has any effect on your concerns.

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Wrap LaTeX snippets in $$ with markdown export
  2021-03-31 16:41 59% [PATCH] Wrap LaTeX snippets in $$ with markdown export Timothy
  @ 2021-05-02 20:23 93% ` Timothy
    2 siblings, 0 replies; 200+ results
From: Timothy @ 2021-05-02 20:23 UTC (permalink / raw)
  To: Nicolas Goaziou, org-mode-email


Hello Nicolas,

In my plea for patch feedback email, Bastien said he'd like to leave
this patch to your discretion.

As such, it would be fantastic if you might be able to provide your
thoughts on this.

All the best,

Timothy.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Fontification for inline src blocks
  @ 2021-05-02 21:03 87%       ` Timothy
  2021-05-03  3:29 43%       ` Timothy
  1 sibling, 0 replies; 200+ results
From: Timothy @ 2021-05-02 21:03 UTC (permalink / raw)
  To: Tom Gillespie; +Cc: org-mode-email


Thanks for trying this!

Tom Gillespie <tgbugs@gmail.com> writes:

> Hi Timothy,
>    It seems to work more or less as expected. A few comments below. Best,
> Tom
>
> 1. I think there needs to be a function to toggle
> org-inline-src-prettify-results as there is e.g. for hyperlinks. I was
> quite confused by the prettified results.

I see. I imagine the expected behaviour of such a function would be to
toggle org-inline-src-prettify-results and redisplay?

> 2. I'm also not sure that this approach to prettify is a good idea.
> There are issues with unexpected killing/yanking and basic navigation
> behavior of the prettified text which seem worse than the already
> troublesome issues with hyperlinks. I'm not sure we can do anything
> about this though?

If there is something that can be done, I'd love to hear about it. I'm
no aware of anything though.

> 3. I'm not sure about the default choice for prettified delimiters. I
> see there is already a way to customize the delimiters by providing a
> cons. I think a default value of '("" . "") might be a better choice
> since ⟨ and ⟩ being hardcoded seems like it introduces completely
> alien characters. Going with empty strings also seems consistent with
> the behavior for hyperlinks.

Hmmm, yes. Perhaps something else would make for a better default.
I'm open to suggestions on this, I just didn't personally like any of
the ASCII chars I tried when writing this.

> 4. There is an interaction with rainbow delimiters that there isn't an
> easy solution for. I wish there was a syntax type that was "this is a
> paren for electric pair mode but not for font locking."

This sounds like something worth being aware of, that nothing can really
(currently) be done about.

> 5. I'm not sure that the faces selected for src_ and lang are the
> right ones. Is there any issue with adding new faces specifically for
> those rather than reusing existing faces? I thought that matching the
> font locking of #+begin_src lines might make sense, but then I
> realized that that doesn't make sense because that is for blocks more
> generally.

I don't know if adding faces is a big deal or not, so I tried to pick
"sensible choices" from the current set. Further input on this would be
appreciated (particularly more people's thoughts).

--
Timothy


^ permalink raw reply	[relevance 87%]

* Re: [PATCH] Fontification for inline src blocks
    2021-05-02 21:03 87%       ` Timothy
@ 2021-05-03  3:29 43%       ` Timothy
  2021-05-12 11:15 93%         ` Timothy
  1 sibling, 1 reply; 200+ results
From: Timothy @ 2021-05-03  3:29 UTC (permalink / raw)
  To: Tom Gillespie; +Cc: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 750 bytes --]


Tom Gillespie <tgbugs@gmail.com> writes:

> 1. I think there needs to be a function to toggle
> org-inline-src-prettify-results as there is e.g. for hyperlinks. I was
> quite confused by the prettified results.

Added org-toggle-inline-results-display.

> 3. I'm not sure about the default choice for prettified delimiters. I
> see there is already a way to customize the delimiters by providing a
> cons. I think a default value of '("" . "") might be a better choice
> since ⟨ and ⟩ being hardcoded seems like it introduces completely
> alien characters. Going with empty strings also seems consistent with
> the behavior for hyperlinks.

Changed to your suggestion.

Awaiting others' thoughts on 2. and 5.

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-src-Implement-native-inline-src-fontification.patch --]
[-- Type: text/x-patch, Size: 7451 bytes --]

From 81c56a48ebe516890691420243efe966f3c50eef Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 3 May 2021 11:16:17 +0800
Subject: [PATCH] org-src: Implement native inline src fontification

* lisp/org-src.el (org-fontify-inline-src-blocks,
org-fontify-inline-src-blocks-1): Create a function to search the buffer
up to a limit for inline src blocks.  Light fontification is applied to
matched inline src blocks.  When `org-src-fontify-natively' is
set, `org-src-font-lock-fontify-block' to the content.
(org-fontify-inline-src-results): Search for {{{results(...)}}}
constructs.  Then when `org-inline-src-prettify-results` is non-nil,
mimic prettify-symbols and use `compose-region' to substitute visually
simpler elements for the wrapping around the value.

* lisp/org.el (org-set-font-lock-defaults): Add
`org-fontify-inline-src-blocks' to `org-font-lock-extra-keywords', which
is locally bound inside `org-set-font-lock-defaults'.
(org-inline-src-fontify-max-length, org-inline-src-prettify-results):
Create variables for use in the new inline src/result fontification
methods in org-src.el.
---
 lisp/org-src.el | 79 +++++++++++++++++++++++++++++++++++++++++++++++++
 lisp/org.el     | 21 ++++++++++++-
 2 files changed, 99 insertions(+), 1 deletion(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index a694e5595..1d09f03a8 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -623,6 +623,85 @@ (defun org-src-font-lock-fontify-block (lang start end)
 	 '(font-lock-fontified t fontified t font-lock-multiline t))
 	(set-buffer-modified-p modified)))))
 
+(defun org-fontify-inline-src-blocks (limit)
+  "Try to apply `org-fontify-inline-src-blocks-1'."
+  (condition-case nil
+      (org-fontify-inline-src-blocks-1 limit)
+    (error (message "Org mode fontification error in %S at %d"
+                    (current-buffer)
+                    (line-number-at-pos)))))
+
+(defun org-fontify-inline-src-blocks-1 (limit)
+  "Fontify inline src_LANG blocks, from `point' up to LIMIT."
+  (let ((case-fold-search t)
+        (initial-point (point)))
+    (while (re-search-forward "\\_<src_\\([^ \t\n[{]+\\)[{[]?" limit t) ; copied from `org-element-inline-src-block-parser'
+      (let ((beg (match-beginning 0))
+            (lang-beg (match-beginning 1))
+            (lang-end (match-end 1))
+            pt)
+        (remove-text-properties beg lang-end '(face nil))
+        (font-lock-append-text-property lang-beg lang-end 'face 'org-meta-line)
+        (font-lock-append-text-property beg lang-beg 'face 'shadow)
+        (font-lock-append-text-property beg lang-end 'face 'org-block)
+        (setq pt (goto-char lang-end))
+        ;; `org-element--parse-paired-brackets' doesn't take a limit, so to
+        ;; prevent it searching the entire rest of the buffer we temporarily
+        ;; narrow the active region.
+        (save-restriction
+          (narrow-to-region beg (min (point-max)
+                                     limit
+                                     (+ lang-end org-inline-src-fontify-max-length)))
+          (when (ignore-errors (org-element--parse-paired-brackets ?\[))
+            (remove-text-properties pt (point) '(face nil))
+            (font-lock-append-text-property pt (point) 'face 'org-block)
+            (setq pt (point)))
+          (when (ignore-errors (org-element--parse-paired-brackets ?\{))
+            (remove-text-properties pt (point) '(face nil))
+            (font-lock-append-text-property pt (1+ pt) 'face '(org-block shadow))
+            (unless (= (1+ pt) (1- (point)))
+              (if org-src-fontify-natively
+                  (org-src-font-lock-fontify-block
+                   (buffer-substring-no-properties lang-beg lang-end)
+                   (1+ pt) (1- (point)))
+                (font-lock-append-text-property (1+ pt) (1- (point)) 'face 'org-block)))
+            (font-lock-append-text-property (1- (point)) (point)'face '(org-block shadow))
+            (setq pt (point))))
+        (when (and org-inline-src-prettify-results
+                   (re-search-forward "\\= {{{results(" limit t))
+          (font-lock-append-text-property pt (1+ pt) 'face 'org-block)
+          (goto-char pt))))
+    (when org-inline-src-prettify-results
+      (goto-char initial-point)
+      (org-fontify-inline-src-results limit))))
+
+(defun org-fontify-inline-src-results (limit)
+  "Apply prettify-symbols modifications to inline results blocks.
+Performed according to `org-inline-src-prettify-results'."
+  (while (re-search-forward "{{{results(\\(.+?\\))}}}" limit t)
+    (remove-list-of-text-properties (match-beginning 0) (point)
+                                    '(composition
+                                      prettify-symbols-start
+                                      prettify-symbols-end))
+    (font-lock-append-text-property (match-beginning 0) (match-end 0)
+                                    'face 'org-block)
+    (let ((start (match-beginning 0)) (end (match-beginning 1)))
+      (with-silent-modifications
+        (compose-region start end (if (eq org-inline-src-prettify-results t)
+                                      "(" (car org-inline-src-prettify-results)))
+        (add-text-properties start end `(prettify-symbols-start ,start prettify-symbols-end ,end))))
+    (let ((start (match-end 1)) (end (point)))
+      (with-silent-modifications
+        (compose-region start end (if (eq org-inline-src-prettify-results t)
+                                      ")" (cdr org-inline-src-prettify-results)))
+        (add-text-properties start end `(prettify-symbols-start ,start prettify-symbols-end ,end))))))
+
+(defun org-toggle-inline-results-display ()
+  "Toggle the literal or contracted display of inline src blocks results."
+  (interactive)
+  (setq org-inline-src-prettify-results (not org-inline-src-prettify-results))
+  (org-restart-font-lock))
+
 \f
 ;;; Escape contents
 
diff --git a/lisp/org.el b/lisp/org.el
index 10eeae514..ab817a0a7 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5239,6 +5239,23 @@ (defcustom org-allow-promoting-top-level-subtree nil
   :version "24.1"
   :group 'org-appearance)
 
+(defcustom org-inline-src-fontify-max-length 200
+  "Maximum content length of an inline src block that will be fontified.
+This is only relevant when `org-src-fontify-natively' is t."
+  :type 'integer
+  :package-version '(Org . "9.5")
+  :group 'org-appearance
+  :group 'org-babel)
+
+(defcustom org-inline-src-prettify-results t
+  "Whether to use (ab)use prettify-symbols-mode on {{{results(...)}}}.
+Either t or a cons cell of strings which are used as substitutions
+for the start and end of inline results, respectively."
+  :type '(choice boolean (cons string string))
+  :package-version '(Org . "9.5")
+  :group 'org-appearance
+  :group 'org-babel)
+
 (defun org-fontify-meta-lines-and-blocks (limit)
   (condition-case nil
       (org-fontify-meta-lines-and-blocks-1 limit)
@@ -5739,7 +5756,9 @@ (defun org-set-font-lock-defaults ()
 		  org-comment-string)
 		 '(9 'org-special-keyword t))
 	   ;; Blocks and meta lines
-	   '(org-fontify-meta-lines-and-blocks))))
+	   '(org-fontify-meta-lines-and-blocks)
+           ;; Inline src blocks
+           '(org-fontify-inline-src-blocks))))
     (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords))
     (run-hooks 'org-font-lock-set-keywords-hook)
     ;; Now set the full font-lock-keywords
-- 
2.31.1


^ permalink raw reply related	[relevance 43%]

* Re: [PATCH] Wrap LaTeX snippets in $$ with markdown export
  @ 2021-05-03 18:03 88%   ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-05-03 18:03 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org-mode-email


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> This sounds reasonable.

I'm glad to hear that!

>> +(defun org-md-latex-environment [...]
> Nitpick: I would use `format', also the final newline character is
> useless, since it will be removed later during the export process.

Actually, since writing this patch I'm not sure that $$-surrounding
\begin{}...\end{} environments is also a good idea. I'm inclined to
leave this out of the patch.

>> +;;;; Latex Fragment
>> +
>> +(defun org-md-latex-fragment (latex-fragment contents info)
>> +  "Transcode a LATEX-FRAGMENT object from Org to Markdown.
>> +CONTENTS is nil.  INFO is a plist holding contextual information."
>> +  (when (plist-get info :with-latex)
>> +    (let ((frag (org-html-latex-fragment contents info)))
>> +      (cond
>> +       ((string-match-p "^\\\\(" frag)
>> +        (concat "$" (substring frag 2 -2) "$"))
>> +       ((string-match-p "^\\\\\\[" frag)
>> +        (concat "$$" (substring frag 2 -2) "$$"))
>> +       (t (message "unrecognised fragment: %s" frag)
>> +          frag)))))
>
> Nitpick: I suggest to use `rx' macro. It really makes the code base
> a better place.

I do rather like the `rx' macro, however I'm not sure that
(rx bol "\\(") is really an improvement over "^\\\\(" in this particular
case.

> You are missing some cases. The fragment could be $...$ or $$...$$
> already, so you can return it as-is without sending the message.

Ah yep, after getting your thoughts on this message I'll send a revised
patch with fixes this (along with any other changes).

> Otherwise, it is a macro. We can assume it lives outside math mode. So
> maybe the "Unrecognized fragment: %S" is in order in that situation. We
> could also let HTML export back-end deal with it. I don't know what is
> better.

I'm not sure what to do here either. Perhaps nothing/HTML backend?

Finally, I think if this case (lone macro) is handled, there aren't any
possible "Unrecognized fragment"s that could be passed, and so that
condition would no longer be necessary?

--
Timothy.


^ permalink raw reply	[relevance 88%]

* Re: [PATCH] Wrap LaTeX snippets in $$ with markdown export
  @ 2021-05-04  3:35 57%       ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-05-04  3:35 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 951 bytes --]


Hi Nicolas,

So, I've now fixed the handling of already-$-delaminated fragments, and
removed the $$ from around environments.

Sorry to complicate things, but, looking at what the HTML fallback
actually is, I've had some further thoughts. The HTML backend will
either leave the content as-is, run `org-latex-to-html-convert-command',
or run something from `org-preview-latex-process-alist' and include an
<img>.

Should one want to convert LaTeX images say to an SVG for HTML export, I
do not think one would want this behaviour to also apply to LaTeX being
exported to markdown.

As such I see two 'sensible' paths forward: (1) just include LaTeX
verbatim when :with-latex is non-nil, or (2) introduce
`org-markdown-with-latex' which can be set to t/'verbatim or 'html.

In the attached patch, I've taken the first approach. Let me know if
you'd like to take the second approach, or just inherit the HTML
behaviour for LaTeX after all.

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-md-Use-TeX-style-math-wrapping.patch --]
[-- Type: text/x-patch, Size: 3018 bytes --]

From a02dbcb21dddb6d9239d13308a78a45738d9b7e6 Mon Sep 17 00:00:00 2001
From: Timothy <tecosaur@gmail.com>
Date: Thu, 1 Apr 2021 00:41:29 +0800
Subject: [PATCH] ox-md: Use TeX-style $ math wrapping

* lisp/ox-md.el (org-md-latex-environment, org-md-latex-fragment):
These two new filters wrap LaTeX maths in $ / $$ TeX-style notation.
While ox-md endeavours to adhere to the original Markdown specification,
and not any particular variant, the original specification does not deal
with LaTeX fragments at all, and so this change does not reduce how
faithfully the original specification is followed.
There is a major upside to this though. Of the many Markdown variants
that have emerged, those that support LaTeX very often exclusively
support TeX style notation.  This change thus improves the utility of
the Markdown export for many use cases, and deviates no more from the
original specification that the current method.
---
 lisp/ox-md.el | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/lisp/ox-md.el b/lisp/ox-md.el
index b6b2c1728..1ae0cf2d9 100644
--- a/lisp/ox-md.el
+++ b/lisp/ox-md.el
@@ -100,6 +100,8 @@ (org-export-define-derived-backend 'md 'html
 		     (italic . org-md-italic)
 		     (item . org-md-item)
 		     (keyword . org-md-keyword)
+                     (latex-environment . org-md-latex-environment)
+                     (latex-fragment . org-md-latex-fragment)
 		     (line-break . org-md-line-break)
 		     (link . org-md-link)
 		     (node-property . org-md-node-property)
@@ -460,6 +462,35 @@ (defun org-md-keyword (keyword contents info)
     (_ (org-export-with-backend 'html keyword contents info))))
 
 
+;;;; Latex Environment
+
+(defun org-md-latex-environment (latex-environment contents info)
+  "Transcode a LATEX-ENVIRONMENT object from Org to Markdown.
+CONTENTS is nil.  INFO is a plist holding contextual information."
+  (when (plist-get info :with-latex)
+    (let ((latex-frag (org-remove-indentation
+                       (org-element-property :value latex-environment)))
+          (label (org-html--reference latex-environment info t)))
+      (if (org-string-nw-p label)
+          (replace-regexp-in-string "\\`.*"
+                                    (format "\\&\n\\\\label{%s}" label)
+                                    latex-frag)
+        latex-frag))))
+
+;;;; Latex Fragment
+
+(defun org-md-latex-fragment (latex-fragment contents info)
+  "Transcode a LATEX-FRAGMENT object from Org to Markdown.
+CONTENTS is nil.  INFO is a plist holding contextual information."
+  (when (plist-get info :with-latex)
+    (let ((frag (org-element-property :value latex-fragment)))
+      (cond
+       ((string-match-p "^\\\\(" frag)
+        (concat "$" (substring frag 2 -2) "$"))
+       ((string-match-p "^\\\\\\[" frag)
+        (concat "$$" (substring frag 2 -2) "$$"))
+       (t frag))))) ; either already $-deliminated or a macro
+
 ;;;; Line Break
 
 (defun org-md-line-break (_line-break _contents _info)
-- 
2.31.1


^ permalink raw reply related	[relevance 57%]

* Re: [PATCH] Wrap LaTeX snippets in $$ with markdown export
  @ 2021-05-04 13:31 88%           ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-05-04 13:31 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org-mode-email


Hello,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>> Should one want to convert LaTeX images say to an SVG for HTML export, I
>> do not think one would want this behaviour to also apply to LaTeX being
>> exported to markdown.
>
> Why do you think so? This is consistent with everything else not
> supported by vanilla Markdown.

To speak personally, at the moment I use mathjax for HTML. I'm quite
content with the markdown output from this patch without what's
discussed below.
However, if/when I can get the SVG baseline to work with dvisvgm I plan
on switching to that for HTML files. However, I'd consider this
behaviour undesirable for markdown.

The main reason why I'm hesitant about including <img>s in Markdown, is
because unlike <table> etc. the output now relies on external files.

>> As such I see two 'sensible' paths forward: (1) just include LaTeX
>> verbatim when :with-latex is non-nil, or (2) introduce
>> `org-markdown-with-latex' which can be set to t/'verbatim or 'html.
>>
> Obeying to :with-latex property means "ox-md" is somehow actively
> handling LaTeX fragments, which was not the initial intent, IIUC. The
> first idea was to provide a sensible default for such objects, because
> we're outside the specification anyway. I'd rather not overdo it.

I'm happy to strip this out of the patch (there's always advice for my
own config...), I just thought there may be people who like me are
interested in <img>s for LaTeX in HTML, but not in Markdown.

--
Timothy


^ permalink raw reply	[relevance 88%]

* Re: [PATCH] Wrap LaTeX snippets in $$ with markdown export
  @ 2021-05-09 20:12 93%               ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-05-09 20:12 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org-mode-email


Hi,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>> I just thought there may be people who like me are interested in
>> <img>s for LaTeX in HTML, but not in Markdown.
>
> Fair enough. Let's push your last patch, then.

Going off this, I've taken this as assent and just pushed my patch in
its current form as 981f25031.

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Fontification for inline src blocks
  2021-05-03  3:29 43%       ` Timothy
@ 2021-05-12 11:15 93%         ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-05-12 11:15 UTC (permalink / raw)
  To: Tom Gillespie; +Cc: org-mode-email


If anyone else is interested in this, it would be great to get your
thoughts.

I'd also appreciate it if a core maintainer might be able to find the
time to review the patch and let me know if it looks good.

Thanks,

Timothy.

--

> Tom Gillespie <tgbugs@gmail.com> writes:
>
>> 1. I think there needs to be a function to toggle
>> org-inline-src-prettify-results as there is e.g. for hyperlinks. I was
>> quite confused by the prettified results.
>
> Added org-toggle-inline-results-display.
>
>> 3. I'm not sure about the default choice for prettified delimiters. I
>> see there is already a way to customize the delimiters by providing a
>> cons. I think a default value of '("" . "") might be a better choice
>> since ⟨ and ⟩ being hardcoded seems like it introduces completely
>> alien characters. Going with empty strings also seems consistent with
>> the behavior for hyperlinks.
>
> Changed to your suggestion.
>
> Awaiting others' thoughts on 2. and 5.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Fontification for inline src blocks
  @ 2021-05-12 14:47 93%             ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-05-12 14:47 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Tom Gillespie, org-mode-email


Thanks for your response.

Ihor Radchenko <yantar92@gmail.com> writes:

> I do not like abusing prettify-symbols-mode. What if it is not enabled?

Ah, it does it anyway at the moment.

> What will happen if user toggles prettify-symbols-mode in Org buffer?

This seems to be toggled nicely by prettify-symbols-mode too.

> Maybe better use something like org-entities?

I'm not sure if that would work, perhaps someone else knows otherwise.

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Fontification for inline src blocks
  @ 2021-05-12 16:39 82%                 ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-05-12 16:39 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Tom Gillespie, org-mode-email


Thank you for the detailed feedback :)

Ihor Radchenko <yantar92@gmail.com> writes:

> Timothy <tecosaur@gmail.com> writes:
>
>>> I do not like abusing prettify-symbols-mode. What if it is not enabled?

If you know of another way of accomplishing text-replacement which
changes back when the cursor enters the region, please let me know.

>> Ah, it does it anyway at the moment.
>
> Hmm. You are right. You are calling compose-region directly. Note, that
> you do not add 'decompose-region function for automatic region
> destruction (see help:pretty-symbol-pattern-to-keyword).

Isn't the same effect achieved by the remove-list-of-text-properties call?

> If I understand correctly (I did not really install your patch), if you have
> composed region, disable font-lock, and try to edit the region, edits
> will be invisible. Or imagine setting org-inline-src-prettify-results to
> nil in already fontified buffer.

I just tried "setting org-inline-src-prettify-results to nil in already
fontified buffer." and the region just decomposed and stayed that way.

> Also, you may find help:font-lock-extra-managed-props useful. That way,
> you will not have to manually remove composition and other non-standard
> properties during fontification

Hmmm, from a look I can't tell exactly how these are "managed". Are they
just removed when a region is processed?

> why are you even removing 'face? It should be already done by font-lock).

I tried removing such calls, and everything still worked, so this is no
longer done.

>>> What will happen if user toggles prettify-symbols-mode in Org buffer?
>>
>> This seems to be toggled nicely by prettify-symbols-mode too.
>
> I would not expect it to. Why would prettify-symbols-mode interfere with
> Org mode native fontification if it is not strictly necessary?

Well, I guess this is a by-product of using prettify-symbols-start/end,
see my note at the start of this email about not being aware of anything else.

> P.S. Nitpick: You do not need to run fontification in while loops. Just
> fontifying next match before limit should be enough. Font-lock will call
> the function again if needed.

I'm guessing for this to work I'd need to return the final char
fortified? Or is the moving of point enough?

Maybe related - I've noticed this doesn't seem to work with multiple
src_ blocks per line, might you have any insight here?

Thanks,

Timothy


^ permalink raw reply	[relevance 82%]

* Re: [PATCH] Fontification for inline src blocks
  @ 2021-05-18 13:34 80%                     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-05-18 13:34 UTC (permalink / raw)
  To: sebastien.miquel; +Cc: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 969 bytes --]


Hi Sébastien, thanks for your comments.

Sébastien Miquel <sebastien.miquel@posteo.eu> writes:

> Hi Timothy,
>
> Thanks for your work. I hope this can be merged.

:)

> Here are a few comments.
>
> Doesn't this line in ~org-toggle-inline-results-display~ throw the
> configured delimiters away when called twice ?
> : (setq org-inline-src-prettify-results (not org-inline-src-prettify-results))
>
> I think the =org-block= face should only be applied to the actual
> code, note the =src_lang= part, nor the result. For normal src blocks,
> it is only used inside the block.

In src blocks, you have the org-block-begin-line face applied. This (in
any sensible theme) has the same background as org-block. For the sake
of visual consistency, I think we want to have this applied to the
src_lang and result parts too. However, the org-block-begin-line face
overly fades the text, and so I've combined the org-block face with
other faces.


[-- Attachment #2: inline-src-back.png --]
[-- Type: image/png, Size: 9480 bytes --]

[-- Attachment #3: Type: text/plain, Size: 2642 bytes --]


> The ~org-src-font-lock-fontify-block~ function could be modified to
> take an optional =inline= argument. When =t=, it should not set the
> =multiline= font property. Although this is very minor, it would allow
> one to easily advice this function to behave differently in inline src
> blocks. For example, to not use the =org-block= face in this case.

I don't see where the multiline property is currently set, would you mind
pointing it out to me?

> I think the default parenthesis pair around results are bad. I much
> preferred your original brackets. Yes, as Tom said, they look alien,
> but alien is appropriate for use of ~prettify-symbols~.

I'm going to be using the original symbols in my configuration anyway
because I think they're nicer, but clearly this is contentious. I'd want
to hear from more people on this.

> Since ~prettify-symbols~ seems to be raising some usability concerns,
> perhaps ~org-inline-src-prettify-results~ should default to ~nil~.
> It'd be unlike org to hide things from the user in the default
> configuration.

This seems somewhat sensible to me, but I must say that {{{results()}}}
is /ugly/ and I suspect that many users would like the effect, but a
minority will be aware of this option. Perhaps this is worth doing
anyway.

> As Tom points out, the two faces used (for the =src_= and bracket and
> the language part) should be customizable. The default value you chose
> are fine IMO. Perhaps the language one could also be used to highlight
> the language of normal src blocks, though It might be easier to use a
> single face.

So are you suggesting I do or don't create new faces for this?

> Timothy writes:
>>> P.S. Nitpick: You do not need to run fontification in while loops. Just
>>> fontifying next match before limit should be enough. Font-lock will call
>>> the function again if needed.
>> I'm guessing for this to work I'd need to return the final char
>> fortified? Or is the moving of point enough?
>>
>> Maybe related - I've noticed this doesn't seem to work with multiple
>> src_ blocks per line, might you have any insight here?
>
> You need only return =t= if some fontification has been done (and set
> point after the fontified part). If your function returns =t=, it will
> be called again.
>
> A case can be made for keeping the loop though. It works fine and is
> clearer since the aforementioned fontlock behaviour is poorly
> documented. Really, the only downside is the loss of consistency, since
> the function ~org-fontify-meta-lines-and-blocks-1~ doesn't loop.

Returning t works nicely, and now we can highlight more than one inline
src per line :)

--
Timothy

^ permalink raw reply	[relevance 80%]

* [PATCH] Change default latex compiler to latexmk
@ 2021-06-06 16:55 68% Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-06-06 16:55 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

Hey all,

From the earlier discussion on this, I got feeling a consensus had
reached that this is a good idea, as long as we check that latexmk is
available first.
As such, here is a patch changing the default LaTeX compiler to latexmk
--- as long as it's available. For what it's worth I've been using this
exact command in my personal config for months now, and it's worked
excellently.

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-latex-Change-default-compiler-to-latexmk.patch --]
[-- Type: text/x-patch, Size: 2093 bytes --]

From 95806243e40d5f9f19a8db71e2b8b0cd0c5fdb68 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 7 Jun 2021 00:46:09 +0800
Subject: [PATCH] ox-latex: Change default compiler to latexmk

* lisp/ox-latex.el (org-latex-pdf-process): Check for the presence of
latexmk when setting the default, and use it when available.  Fall back
to the current default.  This is important for the incoming citation
support, as PDF generation will now need to involve bibliography
generation.  By using latexmk this is taken care of for us.  The -%latex
part of the command is slightly hacky, but allows latexmk to behave more
intelligently for non-pdflatex options.  Note that latexmk also seems to
care about the order of the arguments.
---
 lisp/ox-latex.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 9724b0d87..c761cfd7f 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1165,9 +1165,11 @@ (defcustom org-latex-bib-compiler "bibtex"
   :package-version '(Org . "9.0"))
 
 (defcustom org-latex-pdf-process
-  '("%latex -interaction nonstopmode -output-directory %o %f"
-    "%latex -interaction nonstopmode -output-directory %o %f"
-    "%latex -interaction nonstopmode -output-directory %o %f")
+  (if (executable-find "latexmk")
+      '("latexmk -f -pdf -%latex -interaction=nonstopmode -output-directory=%o %f")
+    '("%latex -interaction nonstopmode -output-directory %o %f"
+      "%latex -interaction nonstopmode -output-directory %o %f"
+      "%latex -interaction nonstopmode -output-directory %o %f"))
   "Commands to process a LaTeX file to a PDF file.
 
 This is a list of strings, each of them will be given to the
@@ -1211,7 +1213,7 @@ (defcustom org-latex-pdf-process
 	  (const :tag "texi2dvi"
 		 ("cd %o; LATEX=\"%latex\" texi2dvi -p -b -V %b.tex"))
 	  (const :tag "latexmk"
-		 ("latexmk -g -pdf -pdflatex=\"%latex\" -outdir=%o %f"))
+		 ("latexmk -f -pdf -%latex -interaction=nonstopmode -output-directory=%o %f"))
 	  (function)))
 
 (defcustom org-latex-logfiles-extensions
-- 
2.31.1


^ permalink raw reply related	[relevance 68%]

* [PATCH] html export: remove W3C warning, improve accessibility
@ 2021-06-06 18:02 53% Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-06-06 18:02 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 711 bytes --]

Hi All,

Following on from my comments /ages/ ago, I have done some more work to
improve the HTML export. I intend to push it if I don't hear any
complaints. Please let me know if anything looks dodgy, or if anything
should also be improved with this patch :)

This patch:
- Resolves a W3C warning about type="text/css" in <style>
- Removes a docstring reference to IE8- (urgh!)
- Adds some ARIA roles to improve accessibility (let me know if you spot
anything else that could benefit from them being added).

Running the default html export through the W3C validator with my
massive Org-based config now results in nothing other than complaints
about dodgy unicode characters (not Org's fault) :)

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-html-Resolve-W3C-warning-improve-a11y.patch --]
[-- Type: text/x-patch, Size: 4085 bytes --]

From 722d61e5cc49153428c0858ab83ee1db5ee5c1c6 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 7 Jun 2021 01:51:45 +0800
Subject: [PATCH] ox-html: Resolve W3C warning, improve a11y

* lisp/ox-html.el (org-html-style-default, org-html-head): Remove
unwarranted type="text/css" from <style> (W3C warning).
(org-html-html5-fancy): Remove note about IE8- from docstring.
(org-html-footnote-section, org-html-template, org-html-toc,
org-html-footnote-reference): Add some ARIA roles to improve
accessibility.
---
 lisp/ox-html.el | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 8f8470bb9..bd6771a76 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -260,7 +260,7 @@ (defcustom org-html-scripts
   :type 'string)
 
 (defcustom org-html-style-default
-  "<style type=\"text/css\">
+  "<style>
   #content { max-width: 60em; margin: auto; }
   .title  { text-align: center;
              margin-bottom: .2em; }
@@ -1060,13 +1060,7 @@ (defcustom org-html-doctype "xhtml-strict"
 
 (defcustom org-html-html5-fancy nil
   "Non-nil means using new HTML5 elements.
-This variable is ignored for anything other than HTML5 export.
-
-For compatibility with Internet Explorer, it's probably a good
-idea to download some form of the html5shiv (for instance
-https://code.google.com/p/html5shiv/) and add it to your
-HTML_HEAD_EXTRA, so that your pages don't break for users of IE
-versions 8 and below."
+This variable is ignored for anything other than HTML5 export."
   :group 'org-export-html
   :version "24.4"
   :package-version '(Org . "8.0")
@@ -1472,7 +1466,7 @@ (defcustom org-html-head ""
 
 For example, a valid value would be:
 
-   <style type=\"text/css\">
+   <style>
       p { font-weight: normal; color: gray; }
       h1 { color: black; }
       .title { text-align: center; }
@@ -1818,12 +1812,12 @@ (defun org-html-footnote-section (info)
 		    (anchor (org-html--anchor
 			     (format "fn.%d" n)
 			     n
-			     (format " class=\"footnum\" href=\"#fnr.%d\"" n)
+			     (format " class=\"footnum\" href=\"#fnr.%d\" role=\"doc-backlink\"" n)
 			     info))
 		    (contents (org-trim (org-export-data def info))))
 		(format "<div class=\"footdef\">%s %s</div>\n"
 			(format (plist-get info :html-footnote-format) anchor)
-			(format "<div class=\"footpara\">%s</div>"
+			(format "<div class=\"footpara\" role=\"doc-footnote\">%s</div>"
 				(if (not inline?) contents
 				  (format "<p class=\"footpara\">%s</p>"
 					  contents))))))))
@@ -2120,7 +2114,7 @@ (defun org-html-template (contents info)
 	  (if subtitle
 	      (format
 	       (if html5-fancy
-		   "<p class=\"subtitle\">%s</p>\n"
+		   "<p class=\"subtitle\" role=\"doc-subtitle\">%s</p>\n"
 		 (concat "\n" (org-html-close-tag "br" nil info) "\n"
 			 "<span class=\"subtitle\">%s</span>\n"))
 	       (org-export-data subtitle info))
@@ -2321,14 +2315,14 @@ (defun org-html-toc (depth info &optional scope)
 			 (org-export-get-relative-level headline info)))
 		 (org-export-collect-headlines info depth scope))))
     (when toc-entries
-      (let ((toc (concat "<div id=\"text-table-of-contents\">"
+      (let ((toc (concat "<div id=\"text-table-of-contents\" role=\"doc-toc\">"
 			 (org-html--toc-text toc-entries)
 			 "</div>\n")))
 	(if scope toc
 	  (let ((outer-tag (if (org-html--html5-fancy-p info)
 			       "nav"
 			     "div")))
-	    (concat (format "<%s id=\"table-of-contents\">\n" outer-tag)
+	    (concat (format "<%s id=\"table-of-contents\" role=\"doc-toc\">\n" outer-tag)
 		    (let ((top-level (plist-get info :html-toplevel-hlevel)))
 		      (format "<h%d>%s</h%d>\n"
 			      top-level
@@ -2601,7 +2595,7 @@ (defun org-html-footnote-reference (footnote-reference _contents info)
      (format
       (plist-get info :html-footnote-format)
       (org-html--anchor
-       id n (format " class=\"footref\" href=\"#fn.%d\"" n) info)))))
+       id n (format " class=\"footref\" href=\"#fn.%d\" role=\"doc-backlink\"" n) info)))))
 
 ;;;; Headline
 
-- 
2.31.1


^ permalink raw reply related	[relevance 53%]

* [PATCH] Allow LaTeX reference command (\ref) to be customised
@ 2021-06-06 18:19 61% Timothy
  2021-06-09  2:11 93% ` Timothy
  0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-06-06 18:19 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 523 bytes --]

Hi All,

I've started doing some more cross-referencing in documents exported to
LaTeX, and a hardcoded use of \ref has begun to stand out to me as a
rather annoying thing. Hypperef provides \autoref for adding helpful
prefixes (section, figure, etc.), and there are other packages which one
may want to use to generate 'clever' references (like cleveref with
\cref).

As such, I think that the hardcoded \ref should actually be turned into
a customisable format string, which is what the attached patch does.

--
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-latex-Allow-reference-command-to-be-customised.patch --]
[-- Type: text/x-patch, Size: 2863 bytes --]

From db01398de3a29043dbb545ee66006b0b7c0f1368 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 7 Jun 2021 02:13:18 +0800
Subject: [PATCH] ox-latex: Allow reference command to be customised

* lisp/ox-latex.el (org-latex-reference-command): Create a new variable
so the user may modify the reference command used.
(org-latex-link): Make use of the new `org-latex-reference-command' when
generating references for labels without a description (previously using
\ref).
(org-latex-prefer-user-labels): Mention the new
`org-latex-reference-command' when describing the generated LaTeX
referencing labels.
---
 lisp/ox-latex.el | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index c761cfd7f..940800750 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -381,6 +381,9 @@ (defcustom org-latex-prefer-user-labels nil
   This is section \\ref{sec:foo}.
   And this is still section \\ref{sec:foo}.
 
+A non-default value of `org-latex-reference-command' will change the
+command (\\ref by default) used to create label references.
+
 Note, however, that setting this variable introduces a limitation
 on the possible values for CUSTOM_ID and NAME.  When this
 variable is non-nil, Org passes their value to \\label unchanged.
@@ -400,6 +403,18 @@ (defcustom org-latex-prefer-user-labels nil
   :version "26.1"
   :package-version '(Org . "8.3"))
 
+(defcustom org-latex-reference-command "\\ref{%s}"
+  "Format string that takes a reference to produce a LaTeX reference command.
+
+The reference is a label such as sec:intro.  A format string of \"\\ref{%s}\"
+produces numbered references and will always work.  It may be desirable to make
+use of a package such as hyperref or cleveref and then change the format string
+to \"\\autoref{%s}\" or \"\\cref{%s}\" for example."
+  :group 'org-export-latex
+  :type 'string
+  :version "28.1"
+  :package-version '(Org . "9.5"))
+
 ;;;; Preamble
 
 (defcustom org-latex-default-class "article"
@@ -2608,7 +2623,7 @@ (defun org-latex-link (link desc info)
 	   (let ((label (org-latex--label destination info t)))
 	     (if (and (not desc)
 		      (org-export-numbered-headline-p destination info))
-		 (format "\\ref{%s}" label)
+		 (format org-latex-reference-command label)
 	       (format "\\hyperref[%s]{%s}" label
 		       (or desc
 			   (org-export-data
@@ -2616,7 +2631,7 @@ (defun org-latex-link (link desc info)
           ;; Fuzzy link points to a target.  Do as above.
 	  (otherwise
 	   (let ((ref (org-latex--label destination info t)))
-	     (if (not desc) (format "\\ref{%s}" ref)
+	     (if (not desc) (format org-latex-reference-command ref)
 	       (format "\\hyperref[%s]{%s}" ref desc)))))))
      ;; Coderef: replace link with the reference name or the
      ;; equivalent line number.
-- 
2.31.1


^ permalink raw reply related	[relevance 61%]

* Re: [PATCH] Allow LaTeX reference command (\ref) to be customised
  2021-06-06 18:19 61% [PATCH] Allow LaTeX reference command (\ref) to be customised Timothy
@ 2021-06-09  2:11 93% ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-06-09  2:11 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org-mode-email


Hi Nicolas,

Since this is a fairly small thing and ox-latex seems to be your domain,
I'm wondering if you've had a chance to take a look yet? (just making
sure this hasn't slipped by, given your recent replies in other threads).

> Hi All,
>
> I've started doing some more cross-referencing in documents exported to
> LaTeX, and a hardcoded use of \ref has begun to stand out to me as a
> rather annoying thing. Hypperef provides \autoref for adding helpful
> prefixes (section, figure, etc.), and there are other packages which one
> may want to use to generate 'clever' references (like cleveref with
> \cref).
>
> As such, I think that the hardcoded \ref should actually be turned into
> a customisable format string, which is what the attached patch does.

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Allow LaTeX reference command (\ref) to be customised
  @ 2021-06-09 13:36 90%     ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-06-09 13:36 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org-mode-email


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> I agree there is no good reason to hard-code "\ref", but, off the top of
> my head, there may be a couple of things to consider:
>
> 1. There is still a dangling \ref in `org-latex-footnote-defined-format';

I noticed this, but looking at the usage I think the user would be
surprised if changing \ref for sections, figures etc. also changed how
footnotes looked.

> 2. This change is already somewhat trivial using a link filter:
>
>      (defun my-ref-link-filter (s &rest _)
>        (replace-regexp-in-string (rx string-start "\\ref") "\\foo" s nil t))
>
>      (add-to-list 'org-export-filter-link-functions #'my-ref-link-filter)

As are many things :P but I think it's worth making some more obvious to
users, and IMO this is worth it.

> 3. \hyperref is still hard-coded in `org-latex-link'; your patch could
>    look like a partial solution.

A reference with a named description does use hyperref, but I think
that would still be expected --- let me know if you think otherwise
though.

> Those are not strong objections, so if you think none of them is worth
> considering, then I'm fine with your patch.

If what I've said above makes sense, I think it would be good to merge 👍.

All the best,

Timothy.


^ permalink raw reply	[relevance 90%]

* Re: [PATCH] Allow LaTeX reference command (\ref) to be customised
  @ 2021-06-09 17:38 93%         ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-06-09 17:38 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: org-mode-email


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Sure, LGTM!

Cool :) Merged.

Now the only other LaTeX PR I may poke you about in the future is the
latexmk one :P

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Fix erroneous tangling of blocks
  @ 2021-07-01 13:38 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-07-01 13:38 UTC (permalink / raw)
  To: Jacopo De Simoi; +Cc: emacs-orgmode


HI Jacopo,

I've just taken a look at your patch and it looks good :) glad to see
you've also followed the commit message format. I hope this gets merged
soon.

--
Timothy

p.s. Just a little note for the future: it's good if you have full
sentences in the description of the changes.

Jacopo De Simoi <jacopods@protonmail.com> writes:

> Dear All,
>
>  Please find attached a patch (against master) which takes care of the
> following issue. Assume I have a block like this
>
> #+begin_src sh :tangle no
>   This should not be tangled
> #+end_src
>
> Then the block is correctly ignored when tangling the whole file, but
> erroneously tangled (to a file named "no") when tangling is run with the
> universal argument (so that only the current block should be tangled)
>
> This happens because the check for the "no" option is not performed when
> tangling a single block.  In the proposed patch I address this issue by
> checking for the "no" option in the function org-babel-effective-tangled-
> filename


^ permalink raw reply	[relevance 93%]

* Re: [patch] add :url and :doi optional entries for export to BiBTeX
  @ 2021-07-01 14:23 93%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-07-01 14:23 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode


Hi Eric,

I've not used Org for exporting to BibTeX, so I don't really know what
I'm on about, but is there any particular reason why only some entries
have :url ? Other than that, this seems like a fairly straightforward
patch.

--
Timothy

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> I introduced an error in the previous patch.  Please use this one.
> Thank you,
> eric


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Customizify org-babel-fortran-compiler
  @ 2021-07-01 14:40 85% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-07-01 14:40 UTC (permalink / raw)
  To: Nico Sonack; +Cc: emacs-orgmode


Hi Nico,

Thanks for sending in the patch. Seeing it pointed out, this seems like
a pretty obvious omission. This looks like it should be pretty easy to
merge :)

Four minor niggles with your commit message:
+ Since `defvar' and `defcustom' are elisp symbols, they should be
  quoted as such.
+ It's probably better to avoid shorthand like "X -> Y", and write out
  "Change X to Y" instead.
+ You have included "lisp/" in the commit subject, which isn't needed.
  Just "ob-fortran.el" or even "ob-fortran" is enough here.
+ Your commit subject goes over 50 chars, which is undesirable.

Here's what I'd recommend:

#+begin_example
ob-fortran: Use a defcustom for fortran compiler

* lisp/ob-fortran.el (org-babel-fortran-compiler): Change `defvar' to `defcustom'
so that the fortran compiler is customizable like almost all other org-babel
compilers.
#+end_example

This is rather minor though, I mention this mostly as a note for the
future :)

--
Timothy

Nico Sonack <nsonack@outlook.com> writes:

> Hey there,
>
> I've been using org-mode for quite a while already and am pretty
> happy with it!
>
> Today I noticed a minor oddity, that occured when I tried to run some
> Fortran code with org-babel: it failed with the compiler not being
> found. Looking at the custom variables of the org-babel group, I was
> unable to find a compiler option for Fortran. Thus, I quickly patched
> the ob-fortran.el and turned the defvar of
> `org-babel-fortran-compiler' into a defcustom such that it is a little
> more consistent with the rest of the org-babel languages.
>
> The patch is attached to this mail. Please let me know if I should
> correct anything.
>
> Nico


^ permalink raw reply	[relevance 85%]

* Re: [PATCH] Customizify org-babel-fortran-compiler
  @ 2021-07-01 14:45 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-07-01 14:45 UTC (permalink / raw)
  To: emacs-orgmode


Marking as closed in favour of 2nd email.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] ob-R output file with graphics parameter
  @ 2021-07-03  4:52 92%         ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-07-03  4:52 UTC (permalink / raw)
  To: Jack Kamm; +Cc: Colin Baxter, Berry, Charles, emacs-orgmode


Jack Kamm <jackkamm@gmail.com> writes:

> I think it would still make sense though, and would be beneficial beyond
> ob-R. According to [1], the "graphics" and "link" arguments don't do
> anything unless used with "file", so it would make sense for them to
> automatically add the "file" argument.

Mmmm, I think it would be good if we could make it so it's generally
less effort to create plots.

Would it be strange if running the code block with just

:output graphics

Automatically added "link" if *only* graphics is set, and generated a
file name if no :file is set?

I think it would be nice if I could declare a "figures directory"
(default to "/tmp" or "."?) for exactly this.

--
Timothy


^ permalink raw reply	[relevance 92%]

* Re: [PATCH] Change default latex compiler to latexmk
  @ 2021-07-09 14:25 93%           ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-07-09 14:25 UTC (permalink / raw)
  To: Bastien; +Cc: org-mode-email, Bruce D'Arcus


Bastien <bzg@gnu.org> writes:

> I let Timothy decide.

I consider this patch fit to merge. I'm just under the impression that
this I should only push files I'm listed as a maintainer for without
explicit approval.

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Change default latex compiler to latexmk
  @ 2021-07-09 16:41 93%               ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-07-09 16:41 UTC (permalink / raw)
  To: Bastien; +Cc: org-mode-email, Bruce D'Arcus


Bastien <bzg@gnu.org> writes:

> You can consider this an explicit approval :)  Even if we do something
> wrong, we can always discuss and revert it.
>
> Thanks!

Pushed :) For future reference, should I be less wary of pushing commits
I'm confident in and haven't had any negative feedback on?

--
Timothy

p.s. updates.orgmode.org is returning a 502 error again


^ permalink raw reply	[relevance 93%]

* [PATCH] be more cautious when setting csl etc dir location
@ 2021-07-12 18:07 71% Timothy
  2021-07-14 19:39 93% ` Timothy
  0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-07-12 18:07 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

Hello,

It's come to my attention that the current value of
org-cite-ctl--etc-dir is problematic for anyone managing Org with
package.el or straight. This patch adds a check to see if the initial
location actually exists, if it doesn't we try the expected location
when using package.el/straight.

-- 
Timothy


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-oc-csl-be-more-caution-about-the-csl-etc-location.patch --]
[-- Type: text/x-patch, Size: 1639 bytes --]

From 5e6700177f4ef59131c153d985b8eaeb3b303799 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Tue, 13 Jul 2021 02:00:38 +0800
Subject: [PATCH] oc-csl: be more caution about the csl etc location

* lisp/oc-csl.el (org-cite-ctl--etc-dir): The previous value of
`org-cite-ctl--etc-dir' is incorrect when using either package.el or
straight to manage Org. We can be a bit more considerate by just
checking if the initial location exists, and then trying the expected
location when using package.el/straight if it doesn't exist.
---
 lisp/oc-csl.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el
index a7a2a6042..5e0e27211 100644
--- a/lisp/oc-csl.el
+++ b/lisp/oc-csl.el
@@ -177,9 +177,14 @@ (defcustom org-cite-csl-latex-hanging-indent "1.5em"
 \f
 ;;; Internal variables
 (defconst org-cite-csl--etc-dir
-  (expand-file-name
-   (concat (file-name-directory (locate-library "oc"))
-           "../etc/csl/"))
+  (let* ((oc-root (file-name-directory (locate-library "oc")))
+         (oc-etc-dir-1 (expand-file-name "../etc/csl/" oc-root)))
+      ;; package.el and straight will put all of org-mode/lisp/ in org-mode/.
+      ;; This will cause .. to resolve to the directory above Org.
+      ;; To make life easier for people using package.el or straight, we can
+      ;; check to see if ../etc/csl exists, and if it doesn't try ./etc/csl.
+    (if (file-exists-p oc-etc-dir-1) oc-etc-dir-1
+      (expand-file-name "etc/csl/" oc-root)))
   "Directory \"etc/\" from repository.")
 
 (defconst org-cite-csl--fallback-locales-dir org-cite-csl--etc-dir
-- 
2.32.0


^ permalink raw reply related	[relevance 71%]

* Re: [PATCH] be more cautious when setting csl etc dir location
  2021-07-12 18:07 71% [PATCH] be more cautious when setting csl etc dir location Timothy
@ 2021-07-14 19:39 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-07-14 19:39 UTC (permalink / raw)
  To: org-mode-email


Applied.

This seems quite simple, so I've taken the liberty of applying the
patch. Please don't hesitate to revert it if something seems off.

--
Timothy <tecosaur@gmail.com> writes:

> Hello,
>
> It's come to my attention that the current value of
> org-cite-ctl--etc-dir is problematic for anyone managing Org with
> package.el or straight. This patch adds a check to see if the initial
> location actually exists, if it doesn't we try the expected location
> when using package.el/straight.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] bad table formula recorded in some cases
  @ 2021-07-21 10:50 93% ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-07-21 10:50 UTC (permalink / raw)
  To: tbanelwebmin; +Cc: emacs-orgmode


Hi Thierry,

Thanks for this! Looking at the change you suggest, do you know why the
(match-string 2) bit might have been added in the first place? I'm just
wondering if there might be some edge-case adversely affected by this ---
hence trading one bug for another :P

--
Timothy

tbanelwebmin <tbanelwebmin@free.fr> writes:

> Small bug, small fix.
>
> Suppose we have a table embedded in a begin-end block.
>
> #+begin: aaa :param value
> | a | b |
> | a | b |
> #+end:
>
> Suppose we want to add a formula, with C-c =
> We end up with an incorrect result:
>
> #+begin: aaa :param value
> | a | 33 |
> | a |  b |
>  :param value $2=33
> #+end:
>
> The fix: in org-table.el, line 2177, change
>   (insert (or (match-string 2) "#+TBLFM:")))
> to
>   (insert "#+TBLFM:"))
>
> Then we get the correct result:
>
> #+begin: aaa :param value
> | a | 33 |
> | a |  b |
> #+TBLFM: $2=33
> #+end:
>
> Why? Because (match-string 2) is supposed to refer to the (looking-at)
> instruction 7 lines above. But (match-string 2) is in the else branch,
> which means that (looking-at) failed. Therefore (match-string 2) returns
> garbage.
>
> Thanks to Uwe Brauer for pointing to this bug.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] bad table formula recorded in some cases
  @ 2021-07-21 15:07 93%     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-07-21 15:07 UTC (permalink / raw)
  To: tbanelwebmin; +Cc: emacs-orgmode


Hi Thierry,

tbanelwebmin <tbanelwebmin@free.fr> writes:
> I don't know the intention. But the answer may lie in the comment 4
> lines above:
>    ;; Don't overwrite TBLFM, we might use text properties to
>    ;; store stuff.
>
> In this case, the intention would be to keep the original "#+TBLFM:"
> instead of inserting a fresh new one.
>
> But we are in the else branch of (if (looking-at ...)), which means
> there was no "#+TBLFM:". And no text properties to save. Therefore we
> may safely remove this (match-string 2).

Thank you for looking into this, I'm reassured by your inference that
this change is safe to make. I'm not really one of the main
contribution-acceptors/pushers though, so I'd rather leave this for
someone like Nicolas to sign off on.

Would you mind bumping this thread in a few weeks if nothing happens?

Hope that's not too much of an inconvenience,

Timothy.

> Le 21/07/2021 à 12:50, Timothy a écrit :
>> Hi Thierry,
>>
>> Thanks for this! Looking at the change you suggest, do you know why the
>> (match-string 2) bit might have been added in the first place? I'm just
>> wondering if there might be some edge-case adversely affected by this ---
>> hence trading one bug for another :P
>>
>> --
>> Timothy
>>
>> tbanelwebmin <tbanelwebmin@free.fr> writes:
>>
>>> Small bug, small fix.
>>>
>>> Suppose we have a table embedded in a begin-end block.
>>>
>>> #+begin: aaa :param value
>>> | a | b |
>>> | a | b |
>>> #+end:
>>>
>>> Suppose we want to add a formula, with C-c =
>>> We end up with an incorrect result:
>>>
>>> #+begin: aaa :param value
>>> | a | 33 |
>>> | a |  b |
>>>  :param value $2=33
>>> #+end:
>>>
>>> The fix: in org-table.el, line 2177, change
>>>   (insert (or (match-string 2) "#+TBLFM:")))
>>> to
>>>   (insert "#+TBLFM:"))
>>>
>>> Then we get the correct result:
>>>
>>> #+begin: aaa :param value
>>> | a | 33 |
>>> | a |  b |
>>> #+TBLFM: $2=33
>>> #+end:
>>>
>>> Why? Because (match-string 2) is supposed to refer to the (looking-at)
>>> instruction 7 lines above. But (match-string 2) is in the else branch,
>>> which means that (looking-at) failed. Therefore (match-string 2) returns
>>> garbage.
>>>
>>> Thanks to Uwe Brauer for pointing to this bug.


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] ob-core: tangle check library of babel after current buffer
  @ 2021-07-24 19:41 93%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-07-24 19:41 UTC (permalink / raw)
  To: Tom Gillespie; +Cc: emacs-orgmode


Hi Tom,

Sorry that it's taken so long for someone to get to this. I've just
applied your patch to my local Org instance, and then tested the
described behaviour before and afterwards. I can confirm that the issue
reported exists, and that your patch fixes this.

In light of this and the two other positive reviews here, I feel it's
pretty safe, and so have applied this patch as f052acee5 :)

--
Timothy

Tom Gillespie <tgbugs@gmail.com> writes:

> Pinging on this to see if anyone can test it so that it can be merged.
> Tom
>
> On Wed, Jun 16, 2021 at 4:29 PM Tom Gillespie <tgbugs@gmail.com> wrote:
>>
>> Hi,
>>    This is a patch that fixes tangling behavior when a block has been
>> ingested into the library of babel and then modified. Best!
>> Tom


--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Fix regression in org-get-time-of-day introduced in aba1f2066
  @ 2021-07-24 19:48 93%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-07-24 19:48 UTC (permalink / raw)
  To: emacs-orgmode


Marking as applied for updates.orgmode.org.

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Thanks. I applied a slightly different fix.

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] org-agenda.el: Avoid dependency on subr-x
  @ 2021-08-06 20:30 93%       ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-08-06 20:30 UTC (permalink / raw)
  To: Maxim Nikulin; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 778 bytes --]

Hi Maxim,

> Timothy, I have seen that discussion. For me it does not matter in which way
> org-agenda.el will be fixed: by adding (require ’subr-x) or by using string=
> instead of string-empty-p. Both variants work with Emacs-26.3. The point is that
> “make single” should work without warnings and in the case of mixed install
> users should not get confusing errors that resemble real issues.
>
> The only reason why I suggested namely to avoid string-empty-p is that
> compatibility with Emacs-24.3 is still declared in Org sources.

Ah, cool. I took your original email to indicate that this change was solely for
Emacs 24.3 comparability, but I now see you simply used that as a reason to
choose between two different fixes.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* [PATCH] org-cite: define \citeprocitem for LaTeX export
@ 2021-08-23 10:23 75% Timothy
  2021-08-26  8:18 93% ` Timothy
  0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-08-23 10:23 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 528 bytes --]

Hi All,

There’s been a discussion over at citeproc-el about how to make hyperref treat
its references the same way as bib(la)tex references, and to get this to work we
need to add a command definition to the preamble, `\citeprocitem'.

┌────
│ \makeatletter
│ \newcommand{\citeprocitem}[2]{\hyper@linkstart{cite}{citeproc_bib_item_#1}#2\hyper@linkend}
│ \makeatother
└────

See <https://github.com/andras-simonyi/citeproc-el/issues/34> for more information.

All the best,
*Timothy*

[-- Attachment #1.2: Type: text/html, Size: 4006 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-oc-csl-Define-citeprocitem-for-LaTeX-export.patch --]
[-- Type: text/x-patch, Size: 1409 bytes --]

From 0988d1c331b8872a4c4aa1b1ea40aa2f9f668d17 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 23 Aug 2021 18:14:05 +0800
Subject: [PATCH 3/4] oc-csl: Define \citeprocitem for LaTeX export

* lisp/oc-csl.el (org-cite-csl-finalizer): In order for
citeproc-generated references to be treated the same as bib(la)tex
references by hyperref, we need to make use of \hyper@linkstart.
However, this requires \makeatletter and \makeatother, which can only be
used in the preamble.  To allow citeproc-el to use \hyper@linkstart, we
add a command definition in the preamble, \citeprocitem.
---
 lisp/oc-csl.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el
index 0a057036e..617bddb7e 100644
--- a/lisp/oc-csl.el
+++ b/lisp/oc-csl.el
@@ -589,6 +589,8 @@ (defun org-cite-csl-finalizer (output _keys _files _style _backend info)
     (with-temp-buffer
       (save-excursion (insert output))
       (when (search-forward "\\begin{document}" nil t)
+        ;; Ensure that \citeprocitem is defined for citeproc-el
+        (insert "\\makeatletter\n\\newcommand{\\citeprocitem}[2]{\\hyper@linkstart{cite}{citeproc_bib_item_#1}#2\\hyper@linkend}\n\\makeatother\n\n")
         ;; Ensure there is a \usepackage{hanging} somewhere or add one.
         (goto-char (match-beginning 0))
         (let ((re (rx "\\usepackage" (opt "[" (*? nonl) "]") "{hanging}")))
-- 
2.32.0


^ permalink raw reply related	[relevance 75%]

* [PATCH] org-cite: prevent ' from being an active char in LaTeX export
@ 2021-08-23 10:27 72% Timothy
  2021-08-26  8:24 93% ` Timothy
  0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-08-23 10:27 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 750 bytes --]

Hi All,

This is a band-aid over the issue raised in
<https://lists.gnu.org/archive/html/emacs-orgmode/2021-08/msg00342.html>.

      I’ve come across an issue with the `hanging’ package we’re currently using for
      LaTeX exports — it also affects punctuation, and makes `,.’“`?!:;’ active
      characters throughout the entire document. That means a LaTeX snippet like:
      f’(x) Will now fail to compile ☹. See…

By just adding the [notquote] option, ’ is no longer an active char, and so
f’(x) no longer breaks documents. Long-term, I still think that getting rid of
all this active char stuff would be a good idea, by switching out hanging for
use of `\parshape' if possible.

All the best,
Timothy

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-oc-csl-Prevent-from-being-a-LaTeX-active-char.patch --]
[-- Type: text/x-patch, Size: 1358 bytes --]

From ad63eb8f4d7d02c9864d5caded0b4f2ee9f54133 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 23 Aug 2021 18:18:33 +0800
Subject: [PATCH] oc-csl: Prevent ' from being a LaTeX active char

* lisp/oc-csl.el (org-cite-csl-finalizer): The hanging LaTeX package
we're using also affects punctuation and makes `,.'"`?!:;' active
characters throughout the entire document.  That means a LaTeX snippet
like \(f'(x)\) will now make the document fail to compile.
See <https://tex.stackexchange.com/questions/61732/hanging-package-chokes-on-apostrophes>
for more information.  Adding the [notquote] option stops \(f'(x)\) from
being an issue.

In time it could be worth looking into replacing the hanging package
with some use of \parshape.
---
 lisp/oc-csl.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/oc-csl.el b/lisp/oc-csl.el
index 617bddb7e..36a885641 100644
--- a/lisp/oc-csl.el
+++ b/lisp/oc-csl.el
@@ -595,7 +595,7 @@ (defun org-cite-csl-finalizer (output _keys _files _style _backend info)
         (goto-char (match-beginning 0))
         (let ((re (rx "\\usepackage" (opt "[" (*? nonl) "]") "{hanging}")))
           (unless (re-search-backward re nil t)
-            (insert "\\usepackage{hanging}\n"))))
+            (insert "\\usepackage[notquote]{hanging}\n"))))
       (buffer-string))))
 
 \f
-- 
2.32.0


^ permalink raw reply related	[relevance 72%]

* Re: [PATCH] org-cite: define \citeprocitem for LaTeX export
  2021-08-23 10:23 75% [PATCH] org-cite: define \citeprocitem for LaTeX export Timothy
@ 2021-08-26  8:18 93% ` Timothy
  2021-09-19 13:19 93%   ` Timothy
  0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-08-26  8:18 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 276 bytes --]

Heyo,

As it’s been a few days, given the prior consultation with citeproc-el, and that
this is a very small change, I’m pushing this as 818bec57eb. We can always
revert/patch over in case I’m walking on someone’s (nickolas’?) toes :)

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] org-cite: prevent ' from being an active char in LaTeX export
  2021-08-23 10:27 72% [PATCH] org-cite: prevent ' from being an active char in " Timothy
@ 2021-08-26  8:24 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-08-26  8:24 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

Heyo,

> This is a band-aid over the issue raised in
> <https://lists.gnu.org/archive/html/emacs-orgmode/2021-08/msg00342.html>.

As this actually fixes a real annoyance, and is a trivial change, I’m pushing
this as a3ba79cd3a.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Update some changed export keybindings [worg]
  @ 2021-08-31 11:37 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-08-31 11:37 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

Hi Stefan,

Thanks for the patch. I’ve just applied it. I haven’t had a look at the other
“C-c C-e” keybindings, but I’m glad that you brought it up. Hopefully someone
else will take a look at some point.

> The attached patch fixes some incorrect keybindings in worg.
>
> I’d recommend that someone takes a look at all the “C-c C-e …”
> keybindings, as there are some that I was unsure about, and may still
> be incorrect even after this patch.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil
  @ 2021-08-31 11:59 90% ` Timothy
    2021-09-19 13:13 92% ` Timothy
  1 sibling, 1 reply; 200+ results
From: Timothy @ 2021-08-31 11:59 UTC (permalink / raw)
  To: Morgan Willcock; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

Hi Morgan,

> I’ve attached a patch to fix an issue where tab characters are generated by
> the ASCII exporter when `indent-tabs-mode’ has its default value of t.

Thanks for finding this bug, fixing it, and sending us it 🙂. I was able to
reproduce your test case with “emacs -Q” (thanks for that, by the way).
As you suspected, with the small number of changed lines, this would be fine to
accept without FSF assignment.
However, your “patch” seems to consist of a diff at the bottom of your email and
a commit message at the top?? It would be preferable if you could provide a
“proper” patch, that way you can get attribution for your help instead of just
someone committing it on your behalf.

All the best,
Timothy

^ permalink raw reply	[relevance 90%]

* Re: [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil
  @ 2021-08-31 12:54 93%     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-08-31 12:54 UTC (permalink / raw)
  To: Morgan Willcock; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

Hi Morgan,

> Great! Thank you for taking a look.

No problem, thanks for making the patch :)

> I used `git send-email` which is listed as being OK on the website:

Huh, I guess it should be fine then. I’ve just never seen the commit message at
the top like that so I assumed you’d done it by hand. :shrug:

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Fix bug assuming canonical duration units in org-agenda-format-items
  @ 2021-08-31 13:55 93%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-08-31 13:55 UTC (permalink / raw)
  To: Anders Johansson; +Cc: emacs-orgmode, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 688 bytes --]

Hi Anders,

Did you have any thoughts on Nicolas’ comments?

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Anders Johansson <mejlaandersj@gmail.com> writes:
>
>> org-duration-from-minutes was called with canonical = t, but without
>> providing a corresponding format only using the canonical units. This
>> broke if the user’s org-duration-format used other than the canonical
>> units.
>
> I think a proper fix would be to change `org-duration-from-minutes’ so
> it removes any unknown unit from what is provided from fmt or
> `org-duration-format’, and defaults to (special . h:mm) if nothing is
> left.
>
> WDYT?

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Fix match/maxlevel conflict in colview dynblock
  @ 2021-08-31 14:33 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-08-31 14:33 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2522 bytes --]

Hi Nick,

Thanks for reporting this issue here, and providing a patch. Unfortunately the
“main maintainers” seem to be rather busy as of late, leaving you hanging for
quite a while. I’ve had a look at the issue and your patch, and it the issue
seems clear, and your patch small and straightforward enough that I feel
confident pushing it should be fine :) it’s now on master with a small tweak to
the commit message.

Thanks for your efforts.

> Specifying both `maxlevel’ and `match’ in a columnview dynamic block
> was broken: the `match’ argument is ignored in that case. See the link
> below for a (not so minimal) ECM.
>
> Reported-by: Pablo A Perez-Fernandez
> Link: <https://emacs.stackexchange.com/questions/66658/filter-columnview-dblock-on-properties-or-tags>
>
> –
> Nick
>
> “There are only two hard problems in computer science: cache
> invalidation, naming things, and off-by-one errors.” -Martin Fowler
>
> From 8bcff482e59c24758f87b9b5cdef3bc123dc12f8 Mon Sep 17 00:00:00 2001
> From: Nick Dokos <ndokos@gmail.com>
> Date: Sun, 11 Jul 2021 22:30:22 -0400
> Subject: [PATCH] Fix match/maxlevel conflict in colview dynblock
>
> * lisp/org-coplview.el (org-columns–capture-view): Combine the match
> and maxlevel arguments properly to construct the MATCH argument of
> `org-map-entries’.
>
> Specifying both `maxlevel’ and `match’ in a columnview dynamic block
> does not work: the `match’ argument is ignored in that case. See the
> link below for a (not so minimal) ECM.
>
> Reported-by: Pablo A Perez-Fernandez
> Link: <https://emacs.stackexchange.com/questions/66658/filter-columnview-dblock-on-properties-or-tags>
> —
>  lisp/org-colview.el | 5 +++–
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff –git a/lisp/org-colview.el b/lisp/org-colview.el
> index 2e1c29a99..7144308ff 100644
> — a/lisp/org-colview.el
> +++ b/lisp/org-colview.el
> @@ -1398,8 +1398,9 @@ other rows.  Each row is a list of fields, as strings, or
>  				  (org-get-tags))))
>  	     (push (cons (org-reduced-level (org-current-level)) (nreverse row))
>  		   table)))))
> -     (or (and maxlevel (format “LEVEL<=%d” maxlevel))
> -	 (and match match))
> +     (if match
> +         (concat match (and maxlevel (format “+LEVEL<=%d” maxlevel)))
> +       (and maxlevel (format “LEVEL<=%d” maxlevel)))
>       (and local ’tree)
>       ’archive ’comment)
>      (org-columns-quit)


All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [patch] priorities range reversed
  @ 2021-08-31 15:14 93%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-08-31 15:14 UTC (permalink / raw)
  To: Joe Corneli; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]

Hi Joe,

Thanks for looking into this and figuring out a patch. I’ve just taken a peek at
your patches, and I have two minor comments:
⁃ Why use saved-position instead of save-excursion
⁃ I’m think ascii versions of ② et. al would be preferable

Also, I notice that your patches are just diffs and don’t have a commit message.
Are you planning on writing them later?

Joe Corneli via “General discussions about Org-mode.” <emacs-orgmode@gnu.org> writes:

> Actually, there some bigger problems with the function as well…
>
> — It didn’t update the priority cookie properly when one had been set before
>
> * [#1] Exercise: update to [#2]
>
> — After fixing that, I noticed that the included save-excursion doesn’t work
>   (<https://emacs.stackexchange.com/questions/7574/why-save-excursion-doesnt-save-point-position>)
>
> So, here’s a more comprehensive patch, including the previous changes
> (in order to support numeric priorities) and then adjusting the
> update/insert logic so that it makes more sense.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] ox-latex: Allow percent sign in 'src-block' caption
  @ 2021-09-07 13:17 93%     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-07 13:17 UTC (permalink / raw)
  To: Maxim Nikulin; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 734 bytes --]

Hi Maxim,

> I have decided that it is better to provide a partial fix than to leave
> the problem as is.  This patch covers only plain verbatim environment,
> more advanced formatting using listings or minted should be addressed
> by another change (Anybody?).  Do not close the bug after applying
> this patch.
>
> [2. text/x-patch; 0001-ox-latex-Allow-percent-sign-in-src-block-caption.patch]…

Thanks for the patch. At a glance it looks good, and it’s great to see you’ve
gone to the effort of writing some tests for it too! That’s something we should
probably do more of 😅. Hopefully someone else will get around to giving your
work a closer look and maybe merge it soon-ish :)

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Re: New source block results option for attaching file to node
  @ 2021-09-10  6:26 93%           ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-10  6:26 UTC (permalink / raw)
  To: Ryan Scott; +Cc: Greg Minshall, emacs-orgmode, Ihor Radchenko


[-- Attachment #1.1: Type: text/plain, Size: 234 bytes --]

Hi Ryan,

I’ve just had a glance, but this looks much better to me than what was proposed
earlier 👍. Hopefully we’ll be able to get some feedback on this from others,
and then see it merged 🙂.

All the best,
Timothy

[-- Attachment #1.2: Type: text/html, Size: 7242 bytes --]

^ permalink raw reply	[relevance 93%]

* Re: [BUG?][PATCH] Should the `lexical-binding' variable be bound during src block with :lexical t? [9.4.6 (9.4.6-ga451f9 @ /home/n/.emacs.d/straight/build/org/)]
  @ 2021-09-10  6:32 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-10  6:32 UTC (permalink / raw)
  To: No Wayman; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 363 bytes --]

Hi NoWayman,

> I ran into this with some code I’m writing which checks against
> `lexical-binding’.
> Should the following result in “lexical binding enabled” or
> “lexical binding disabled”?:

Can you think of any examples where this results in different behaviour (without
explicitly checking `lexical-binding')?

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Fix some typos
  @ 2021-09-17  9:03 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-17  9:03 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 161 bytes --]

Hi Stefan,

Thanks again for going through our documentation and picking up these mistakes.
I’ve just applied this as 215d80d :)

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Re: [BUG] Creating sparse tree with regexp property matches
  @ 2021-09-17 10:17 85%                     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-17 10:17 UTC (permalink / raw)
  To: Daniel Fleischer; +Cc: emacs-orgmode, Cassio Koshikumo

[-- Attachment #1: Type: text/plain, Size: 854 bytes --]

Hi Daniel,

Thanks for bumping your patch, unfortunately many of us (people who can push to
Org) seem to be stretched a bit thin as of late. I’ve just gone over it, it
reads well IMO and I think looking at the non-trivial changes in your patch it’s
possible to charitably interpret this as <=15 non-trivial lines changed. I’ve
applied this as 6600dc09 on Org master with a tweaked commit message 🙂.

Documentation is vital to communicating what Org offers to users, so thanks
again for going to the effort to clear up a possible point of confusion. Should
you wish to make any further contributions (which would be great!) it would be
very helpful if you could get FSF assignment (see
<https://orgmode.org/contribute.html>), as we can’t accept more than 15 lines of
non-trivial lines as an FSF project.

All the best,
Timothy

^ permalink raw reply	[relevance 85%]

* Re: [PATCH] Rename headline to heading
  @ 2021-09-19 11:06 89% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-19 11:06 UTC (permalink / raw)
  To: André A. Gomes; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 776 bytes --]

Hi  André,

Sorry that you haven’t heard anything in a while. I’ve been hoping that Bastien
or Nicolas might have been able to take a look at this and give their thoughts,
but unfortunately judging from their recent activity they both seem to be quite
busy as of late. I dream of the day when Org could actually employ a full-time
maintainer via opencollective (or similar).

In the meantime, I’ve flagged this message in my own mail client, and it appears
on <https://updates.orgmode.org/> so you can at least be sure that this won’t be
forgotten about.

> I’m still waiting for the FSF to send me back my form signed.  I’ve sent
> it on the 31st of July.

Could you let us know if the FSF have got back to you on this?

All the best,
Timothy

^ permalink raw reply	[relevance 89%]

* Re: [PATCH] minor typo fix in org-tutorials/org-protocol-custom-handler.org
  @ 2021-09-19 12:42 93%     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-19 12:42 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 43 bytes --]

Marking as applied on updates.orgmode.org.

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] ob-tangle.el: Fix error in org-tangle from org-src edit buffer
  @ 2021-09-19 12:57 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-19 12:57 UTC (permalink / raw)
  To: markgdawson; +Cc: emacs-orgmode


Hi Mark,

Many thanks for not only tracking down this problem but making a fix and
submitting it 🙂. I've just pushed this as 986341b with minor tweaks to the
commit message.

Mark Dawson <markgdawson@gmail.com> writes:

> [PATCH] ob-tangle.el: Fix error in org-tangle from org-src edit
>  buffer
>
> (org-babel-tangle) : Fix stringp error which happens when confirming
> successful tangle when `org-babel-tangle` is called from an org-src edit
> buffer.
>
> TINYCHANGE
> ---
>  lisp/ob-tangle.el | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
> index 2f60ef9a4..0768c8588 100644
> --- a/lisp/ob-tangle.el
> +++ b/lisp/ob-tangle.el
> @@ -281,7 +281,10 @@ matching a regular expression."
>   (if (= block-counter 1) "" "s")
>   (file-name-nondirectory
>    (buffer-file-name
> -   (or (buffer-base-buffer) (current-buffer)))))
> +   (or (buffer-base-buffer)
> +                       (current-buffer)
> +                       (and (org-src-edit-buffer-p)
> +                            (org-src-source-buffer))))))
>   ;; run `org-babel-post-tangle-hook' in all tangled files
>   (when org-babel-post-tangle-hook
>    (mapc

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Various minor docfixes found by checkdoc
  @ 2021-09-19 13:00 93%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-19 13:00 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 66 bytes --]

Just marking as applied for <https://updates.orgmode.org/> 🙂.

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Fixed lstset where language= wipes out previous definitions
  @ 2021-09-19 13:02 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-19 13:02 UTC (permalink / raw)
  To: Karl Stump; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1426 bytes --]

Hi  Karl,

Thanks for sending in this patch, and sorry it’s taken so long for someone to
get back to you. Would you mind explaining the issue here a bit more? I can’t
see at a glance how preceding definitions are wiped in the current
code.

Karl Stump <karlstump@gmail.com> writes:

> * ox-latex.el (org-latex-src-block): moved ((“language” ,lst-lang)) to the head of the list.
> This fixes wiping out preceding definitions given in `org-latex-listings-options’.
> TINYCHANGE
> —
>  lisp/ox-latex.el | 4 ++–
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff –git a/lisp/ox-latex.el b/lisp/ox-latex.el
> index b9ecf070a..f956c851e 100644
> — a/lisp/ox-latex.el
> +++ b/lisp/ox-latex.el
> @@ -3075,13 +3075,13 @@ contextual information.“
>  	    (concat
>  	     (org-latex–make-option-string
>  	      (append
> -	       lst-opt
> +               `((”language“ ,lst-lang))
> +               lst-opt
>  	       (cond
>  		((and (not float) (plist-member attributes :float)) nil)
>  		((string= ”multicolumn“ float) ’((”float“ ”*“)))
>  		((and float (not (assoc ”float“ lst-opt)))
>  		 `((”float“ ,(plist-get info :latex-default-figure-position)))))
> -	       `((”language“ ,lst-lang))
>  	       (if label
>  		   `((”label“ ,(org-latex–label src-block info)))
>  		 ’((”label“ ” “)))

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil
    2021-08-31 11:59 90% ` Timothy
@ 2021-09-19 13:13 92% ` Timothy
    1 sibling, 1 reply; 200+ results
From: Timothy @ 2021-09-19 13:13 UTC (permalink / raw)
  To: Morgan Willcock; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 646 bytes --]

Hi  Morgan,

I’ve just taken a look at your patch (it `git am's just fine), since nobody else
seems to have had the time to look at your patch as of late. There’s one thing
which I now realise completely slipped by me last time — why are tabs bad?
Maybe I’m missing something obvious, but exporting with tabs and viewing/`cat'ing
the file everything looks fine to me in terms of alignment.

Morgan Willcock <mwillcock@precedence.co.uk> writes:

> I’ve attached a patch to fix an issue where tab characters are generated by
> the ASCII exporter when `indent-tabs-mode’ has its default value of t.

All the best,
Timothy

^ permalink raw reply	[relevance 92%]

* Re: [PATCH] org-cite: define \citeprocitem for LaTeX export
  2021-08-26  8:18 93% ` Timothy
@ 2021-09-19 13:19 93%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-19 13:19 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 109 bytes --]

Looks like I forgot to mark this patch as applied on updates.orgmode.org.
Let’s just quickly fix that…

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Add faces to improve contextuality of agenda views
  @ 2021-09-19 13:23 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-19 13:23 UTC (permalink / raw)
  To: Protesilaos Stavrou; +Cc: emacs-orgmode, Gustavo Barros

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]

Hi  Protesilaos,

Thanks for sending this patch in, and sorry it’s taken a while for you to hear
anything back. I see the utility of org-imminent-deadline, but am fairly
indifferent about the rest.

Hopefully bumping this might prompt some others to give their thoughts on your
patch.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] manual: How to refer to tables in other files
  @ 2021-09-19 13:36 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-19 13:36 UTC (permalink / raw)
  To: William Denton; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 543 bytes --]

Hi  William,

Thanks for sending in this patch. Documentation improvements are always great to
see. I’ve just applied your patch with minor tweaks to the commit message, and
the “Nu HTML” bit removed as d700c03 🙂.

William Denton <wtd@pobox.com> writes:

> Attached is a very small update to the docs about how to refer to tables in
> other files.  Probably there’s something wrong with the formatting, but git
> send-email didn’t work, and I hope the Changelog entry gets through.
>
> Bill

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil
  @ 2021-09-19 17:02 93%     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-19 17:02 UTC (permalink / raw)
  To: Morgan Willcock; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 938 bytes --]

Hi  Morgan,

Thanks for clarifying this. That makes sense to me, and so I’ve just pushed your
patch as 3a77e59 🙂, with a slightly tweaked commit message. Thanks for going to
the effort of pinpointing and fixing this issue, and your patience in seeing
this accepted.

Morgan Willcock <mwillcock@precedence.co.uk> writes:

> It seems to default to spaces everywhere else. If you export an actual
> document through the ascii exporter instead of just a document header
> you will get a mix of tabs and spaces. This is how it was brought to my
> attention, I was distributing a file that was batch exported and someone
> pointed out that the indentation was inconsistent.
>
> If it is handled as an export preference or defaults to the global
> indentation preference then that would be fine but I don’t believe
> either of those are the case.
>
> Thanks for continuing to look,
> Morgan

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] org-cite: Use citeproc-el to create CSL processor itemgetters
  @ 2021-09-20 12:29 91% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-20 12:29 UTC (permalink / raw)
  To: András Simonyi; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 737 bytes --]

Hi  András,

Great to see this patch from you 🙂.

> this is the first item in a series of oc-csl patches which I’ve
> accumulated and am planning to send this week. (My first attempt to
> send a patch, so please be patient and forgiving :-) )

This may be your first attempt sending a patch, but it all looks good to me.
Simply attaching a `.patch' file is all that’s needed, and you seem to be
following our commit message guidelines, which is good to see.

Regarding the content of this patch and the few you have planned that follow —
would it be fair to say that overall you’re trying to update `oc-csl' based on
changes you’ve made to `citeproc-el' since `oc-csl' was written?

All the best,
Timothy

^ permalink raw reply	[relevance 91%]

* Re: [patch suggestion] Mitigating the poor Emacs performance on huge org files: Do not use overlays for PROPERTY and LOGBOOK drawers
  @ 2021-09-21 13:32 93%                                         ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-21 13:32 UTC (permalink / raw)
  To: Bastien
  Cc: Karl Voit, Ihor Radchenko, emacs-orgmode, Nicolas Goaziou,
	Christian Heinrich, Kyle Meyer

[-- Attachment #1: Type: text/plain, Size: 445 bytes --]

I’m suspect it too short notice for such a large change to make its way into Org
9.5, but Bastien’s release email is certainly a good prompt to bump this.

Bastien <bzg@gnu.org> writes:

> Thank you *very much* for this work and sorry for the slow reply.
>
> I urge everyone to test this change, as I’d like to include it in
> Org 9.5 if it’s ready.
>
> I will test this myself this week and report.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] org-manual.org: Augment TODO keywords example
  @ 2021-09-24  4:39 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-24  4:39 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 45 bytes --]

Marking as cancelled for updates.orgmode.org

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] org-manual.org: Augment TODO keywords example
  @ 2021-09-24  4:41 93% ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-24  4:41 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 45 bytes --]

Marking as cancelled for updates.orgmode.org

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Include support for evaluating julia code
  @ 2021-09-24 20:04 93% ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-09-24 20:04 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 522 bytes --]

Hi Pedro,

Thanks for your patch, it’s great to see the interest in Julia support and it’s
something that I absolutely think should be in org-core 🙂. However, ob-julia.el
was moved into org-contrib because it was not well maintained, and very buggy.
I’m actually currently working on a successor with Nicolò (see the linked repo)
in my free time, and intend to submit that to Org when I feel it is mature
enough. See <https://github.com/nico202/ob-julia/> for more information.

All the best,
Timothy

[-- Attachment #1.2: Type: text/html, Size: 4044 bytes --]

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Include support for evaluating julia code
  @ 2021-09-25 14:13 93%     ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-25 14:13 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 675 bytes --]

Hi Bastien,

> We had previous discussions with Pedro on his contribution regarding
> ob-julia.el¹, I agreed he could be the maintainer once he signed the
> FSF copyright assignment, so I feel an obligation to apply his patch
> right now, but I’m sure Pedro, you and Nicolò can work together on
> the improved version.

As far as I’m concerned, the more the merrier 😀.

> I don’t know if Nicolò has signed the FSF copyright assignment but
> once he does, he can join the party too.

I’ve talked to Nicolò about this, and I don’t think he has yet, but he’s said he
knows what’s needed and it won’t be a problem.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* [PATCH]
@ 2021-09-26 11:51 54% Timothy
  2021-09-26 12:01 93% ` [PATCH] Timothy
  2021-09-26 12:14 63% ` [PATCH] Timothy
  0 siblings, 2 replies; 200+ results
From: Timothy @ 2021-09-26 11:51 UTC (permalink / raw)
  To: Org Mode List


[-- Attachment #1.1: Type: text/plain, Size: 1370 bytes --]

Hi Everyone,

I’ve recently been wondering why it is that for sensibly sized images in a
LaTeX-export-oriented document I need to do both:
┌────
│ #+attr_org: :width 400
│ #+attr_latex: :width 0.4\linewidth
└────

When in HTML, just
┌────
│ #+attr_html: :width 400px
└────
is fine.

This has lead me to have a look at `org-display-inline-images', and I’ve realised
that the `#+attr_latex' width of `0.4\linewidth' is actually picked up, and
interpreted as a width of `0.4' pixels. I think it would make much more sense for
fractional values between zero and one to be interpreted as that portion of the
text width in the buffer. On second thoughts, given that the document width can
be slightly larger than the text width, perhaps an upper bound just a bit higher
— say 2, could be better.

I’ve prepared a patch which implements this logic, by converting extracted
widths that are:
⁃ floats, and
⁃ within the range [0,2]
and sizes them as that proportion of the text width in the buffer, which is
determined by checking
1. `visual-fill-column-width', when that package is installed and the mode active
2. `fill-column', when auto fill is active
3. `(window-text-width)', if neither of the above two cases hold

Please let me know what you think 🙂.

All the best,
Timothy

[-- Attachment #1.2: Type: text/html, Size: 6912 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-Display-proportional-image-widths.patch --]
[-- Type: text/x-patch, Size: 4258 bytes --]

From bc8aa862f513946599efe4a9bb420e54c504ab3b Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Fri, 24 Sep 2021 01:39:31 +0800
Subject: [PATCH] org: Display proportional image widths

* lisp/org.el (org-display-inline-images): When the image width is given
as a float less than 2, interpret the value as that portion of the text
area width.  This works well with cases such as "#+attr_latex: :width
0.6\linewidth" as this will now be interpreted as 60% of the text area
width.  The upper bound is set to 2 not 1, as more than 100% of the text
width can be realistic, e.g. "1.2\linewidth" in LaTeX, but more than
200% seems unrealistic.
---
 lisp/org.el | 47 +++++++++++++++++++++++++++++++----------------
 1 file changed, 31 insertions(+), 16 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 66ca73d5e..ce2ac7404 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16622,22 +16622,37 @@ (defun org-display-inline-images (&optional include-linked refresh beg end)
 			   (cond
 			    ((eq org-image-actual-width t) nil)
 			    ((listp org-image-actual-width)
-			     (or
-			      ;; First try to find a width among
-			      ;; attributes associated to the paragraph
-			      ;; containing link.
-			      (pcase (org-element-lineage link '(paragraph))
-				(`nil nil)
-				(p
-				 (let* ((case-fold-search t)
-					(end (org-element-property :post-affiliated p))
-					(re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)"))
-				   (when (org-with-point-at
-					     (org-element-property :begin p)
-					   (re-search-forward re end t))
-				     (string-to-number (match-string 1))))))
-			      ;; Otherwise, fall-back to provided number.
-			      (car org-image-actual-width)))
+                             (let ((width
+                                    (or
+                                     ;; First try to find a width among
+                                     ;; attributes associated to the paragraph
+                                     ;; containing link.
+                                     (pcase (org-element-lineage link '(paragraph))
+                                       (`nil nil)
+                                       (par (let* ((case-fold-search t)
+                                                   (end (org-element-property :post-affiliated par))
+                                                   (re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)"))
+                                              (when (org-with-point-at
+                                                        (org-element-property :begin par)
+                                                      (re-search-forward re end t))
+                                                (string-to-number (match-string 1)))))))
+                                    ;; Otherwise, fall-back to provided number.
+                                    (car org-image-actual-width))))
+                               (when width
+                                 (if (and (floatp width) (<= 0 width 2.0))
+                                     ;; A float in [0,2] should be interpereted as this portion of
+                                     ;; the text width in the window.  This works well with cases like
+                                     ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width,
+                                     ;; as the "0.X" is pulled out as a float.  We use 2 as the upper
+                                     ;; bound as cases such as 1.2\linewidth are feasible.
+                                     (round (* width
+                                               (window-pixel-width)
+                                               (/ (or (and (bound-and-true-p visual-fill-column-mode)
+                                                           (or visual-fill-column-width auto-fill-function))
+                                                      (when auto-fill-function fill-column)
+                                                      (window-text-width))
+                                                  (float (window-total-width)))))
+                                   width))))
 			    ((numberp org-image-actual-width)
 			     org-image-actual-width)
 			    (t nil)))
-- 
2.33.0


^ permalink raw reply related	[relevance 54%]

* Re: [PATCH]
  2021-09-26 11:51 54% [PATCH] Timothy
@ 2021-09-26 12:01 93% ` Timothy
  2021-09-26 12:14 63% ` [PATCH] Timothy
  1 sibling, 0 replies; 200+ results
From: Timothy @ 2021-09-26 12:01 UTC (permalink / raw)
  To: Org Mode List


How on earth did I remember to start writing the subject, then switch to the
message, and forget to finish it... (sigh). Ooops.

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH]
  2021-09-26 11:51 54% [PATCH] Timothy
  2021-09-26 12:01 93% ` [PATCH] Timothy
@ 2021-09-26 12:14 63% ` Timothy
    1 sibling, 1 reply; 200+ results
From: Timothy @ 2021-09-26 12:14 UTC (permalink / raw)
  To: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 222 bytes --]


Hello again,

> I’ve prepared a patch which implements this logic

I've just noticed that I had (when x (if (floatp x) ..)) which is a bit
silly, so I've removed the unnecessary when. Here's the updated patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-Display-proportional-image-widths.patch --]
[-- Type: text/x-patch, Size: 4155 bytes --]

From 2d8f151bb996e0159793b590baea50c530e3ed11 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Fri, 24 Sep 2021 01:39:31 +0800
Subject: [PATCH] org: Display proportional image widths

* lisp/org.el (org-display-inline-images): When the image width is given
as a float less than 2, interpret the value as that portion of the text
area width.  This works well with cases such as "#+attr_latex: :width
0.6\linewidth" as this will now be interpreted as 60% of the text area
width.  The upper bound is set to 2 not 1, as more than 100% of the text
width can be realistic, e.g. "1.2\linewidth" in LaTeX, but more than
200% seems unrealistic.
---
 lisp/org.el | 46 ++++++++++++++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 16 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 66ca73d5e..1a1feda78 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16622,22 +16622,36 @@ (defun org-display-inline-images (&optional include-linked refresh beg end)
 			   (cond
 			    ((eq org-image-actual-width t) nil)
 			    ((listp org-image-actual-width)
-			     (or
-			      ;; First try to find a width among
-			      ;; attributes associated to the paragraph
-			      ;; containing link.
-			      (pcase (org-element-lineage link '(paragraph))
-				(`nil nil)
-				(p
-				 (let* ((case-fold-search t)
-					(end (org-element-property :post-affiliated p))
-					(re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)"))
-				   (when (org-with-point-at
-					     (org-element-property :begin p)
-					   (re-search-forward re end t))
-				     (string-to-number (match-string 1))))))
-			      ;; Otherwise, fall-back to provided number.
-			      (car org-image-actual-width)))
+                             (let ((width
+                                    (or
+                                     ;; First try to find a width among
+                                     ;; attributes associated to the paragraph
+                                     ;; containing link.
+                                     (pcase (org-element-lineage link '(paragraph))
+                                       (`nil nil)
+                                       (par (let* ((case-fold-search t)
+                                                   (end (org-element-property :post-affiliated par))
+                                                   (re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)"))
+                                              (when (org-with-point-at
+                                                        (org-element-property :begin par)
+                                                      (re-search-forward re end t))
+                                                (string-to-number (match-string 1)))))))
+                                    ;; Otherwise, fall-back to provided number.
+                                    (car org-image-actual-width))))
+                             (if (and (floatp width) (<= 0 width 2.0))
+                                 ;; A float in [0,2] should be interpereted as this portion of
+                                 ;; the text width in the window.  This works well with cases like
+                                 ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width,
+                                 ;; as the "0.X" is pulled out as a float.  We use 2 as the upper
+                                 ;; bound as cases such as 1.2\linewidth are feasible.
+                                 (round (* width
+                                           (window-pixel-width)
+                                           (/ (or (and (bound-and-true-p visual-fill-column-mode)
+                                                       (or visual-fill-column-width auto-fill-function))
+                                                  (when auto-fill-function fill-column)
+                                                  (window-text-width))
+                                              (float (window-total-width)))))
+                               width))
 			    ((numberp org-image-actual-width)
 			     org-image-actual-width)
 			    (t nil)))
-- 
2.33.0


^ permalink raw reply related	[relevance 63%]

* Re: [PATCH] ob-svgbob: New babel backend for SVGBob
  @ 2021-09-26 20:35 89%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-26 20:35 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Steven vanZyl

[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]

Hi  Bastien,

> Not later than a few hours ago, I removed several ob-* files:
> <https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=db67c7e9>
>
> (ob-svgbob.el should not go in org-contrib, though, because the
> org-contrib repo is for unmaintained libraries.)
>
> I suggest you maintain ob-svgbob.el as a contributed library to
> GNU ELPA (<https://elpa.gnu.org>) to help people find it. See the
> instructions here:
>
> <https://git.savannah.gnu.org/cgit/emacs/elpa.git/plain/README>

Thanks for taking a look at this. In light of your response I’m wondering about
the ob-* inclusion criteria. I recall when removal was being discussed the
concerns being with ob-* libraries that were some combination of:
⁃ Too niche
⁃ Being actively maintained

Which is why I thought SVGBob could be a good fit, as it’s a small useful
general-purpose tool that only takes ~50 lines of code for a library (and so I’d
be quite happy to maintain) and IMO fits in nicely with Org.

Would you mind elaborating a bit more on your thoughts on what makes an ob-*
library a good fit for Org or not?

All the best,
Timothy

^ permalink raw reply	[relevance 89%]

* Re: [PATCH]
  @ 2021-09-27 10:35 38%     ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-09-27 10:35 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 893 bytes --]

Hi  Bastien,

Thanks for taking a look at my patch.

Bastien <bzg@gnu.org> writes:

> On a first look, it seems a bit hackish, but this is probably useful.

Taking a look at the commit, I can see how it doesn’t look particularly tidy. I
think this is more a function of the way that function is structured than my
change though. As such, I’ve had a second look at the code, and given how large
that function is, split off the width calculation into a new function, where
I’ve re-implemented the logic in (IMO) a cleaner way.

So now, in the original function there’s just
┌────
│ (let ((width (org-display-inline-image--width link))
└────

See the attached patch for the new function `org-display-inline-image--width' (to
be applied on top of my previous patch). Oh, and I’ve also added support for
`:width 70%'.

All the best,
Timothy

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-org-Support-displaying-X-width-images.patch --]
[-- Type: text/x-patch, Size: 1916 bytes --]

From d9c83a962c0ce26e3d7baf2a5b7a58ba054ef275 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 27 Sep 2021 19:16:58 +0800
Subject: [PATCH 3/3] org: Support displaying X% width images

* lisp/org.el (org-display-inline-image--width): Instead of interpreting
an image :width of X% as X pixels, take it as X% of the text width of
the buffer.
---
 lisp/org.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index d61e74572..829df8cae 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16647,7 +16647,8 @@ (defun org-display-inline-image--width (link)
 - When `org-image-actual-width' is t, the image's pixel width is used.
 - When `org-image-actual-width' is a number, that value will is used.
 - When `org-image-actual-width' is nil or a list, the first :width attribute
-  set (if it exists) is used to set the image width.
+  set (if it exists) is used to set the image width.  A width of X% is
+  divided by 100.
   If no :width attribute is given and `org-image-actual-width' is a list with
   a number as the car, then that number is used as the default value.
   If the value is a float between 0 and 2, it interpreted as that proportion
@@ -16667,7 +16668,11 @@ (defun org-display-inline-image--width (link)
                              (re-search-forward attr-re par-end t)))
               (string-to-number (match-string 1))))
            (attr-width-val
-            (when attr-width (string-to-number attr-width)))
+            (cond
+             ((null attr-width) nil)
+             ((string-match-p "\\`[0-9.]+%")
+              (/ (string-to-number attr-width) 100.0))
+             (t (string-to-number attr-width))))
            ;; Fallback to `org-image-actual-width' if no explicit width is given.
            (width (or attr-width-val (car org-image-actual-width))))
       (if (and (floatp width) (<= 0 width 2.0))
-- 
2.33.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-org-Refactor-width-in-org-display-inline-images.patch --]
[-- Type: text/x-patch, Size: 6646 bytes --]

From 1fd5e43137a34418c149240b15fd4bdc311f4fd3 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Mon, 27 Sep 2021 18:46:03 +0800
Subject: [PATCH 2/3] org: Refactor width in `org-display-inline-images'

* lisp/org.el (org-display-inline-images,
org-display-inline-image--width): Extract the width determination in
`org-display-inline-images' into a new function
`org-display-inline-image--width' where I have taken the opportunity to
refactor the width-determination code.
---
 lisp/org.el | 85 +++++++++++++++++++++++++++++------------------------
 1 file changed, 47 insertions(+), 38 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 1a1feda78..d61e74572 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16617,44 +16617,7 @@ (defun org-display-inline-images (&optional include-linked refresh beg end)
 				  (ignore-errors (org-attach-expand path)))
                               (expand-file-name path))))
 		  (when (and file (file-exists-p file))
-		    (let ((width
-			   ;; Apply `org-image-actual-width' specifications.
-			   (cond
-			    ((eq org-image-actual-width t) nil)
-			    ((listp org-image-actual-width)
-                             (let ((width
-                                    (or
-                                     ;; First try to find a width among
-                                     ;; attributes associated to the paragraph
-                                     ;; containing link.
-                                     (pcase (org-element-lineage link '(paragraph))
-                                       (`nil nil)
-                                       (par (let* ((case-fold-search t)
-                                                   (end (org-element-property :post-affiliated par))
-                                                   (re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)"))
-                                              (when (org-with-point-at
-                                                        (org-element-property :begin par)
-                                                      (re-search-forward re end t))
-                                                (string-to-number (match-string 1)))))))
-                                    ;; Otherwise, fall-back to provided number.
-                                    (car org-image-actual-width))))
-                             (if (and (floatp width) (<= 0 width 2.0))
-                                 ;; A float in [0,2] should be interpereted as this portion of
-                                 ;; the text width in the window.  This works well with cases like
-                                 ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width,
-                                 ;; as the "0.X" is pulled out as a float.  We use 2 as the upper
-                                 ;; bound as cases such as 1.2\linewidth are feasible.
-                                 (round (* width
-                                           (window-pixel-width)
-                                           (/ (or (and (bound-and-true-p visual-fill-column-mode)
-                                                       (or visual-fill-column-width auto-fill-function))
-                                                  (when auto-fill-function fill-column)
-                                                  (window-text-width))
-                                              (float (window-total-width)))))
-                               width))
-			    ((numberp org-image-actual-width)
-			     org-image-actual-width)
-			    (t nil)))
+		    (let ((width (org-display-inline-image--width link))
 			  (old (get-char-property-and-overlay
 				(org-element-property :begin link)
 				'org-image-overlay)))
@@ -16679,6 +16642,52 @@ (defun org-display-inline-images (&optional include-linked refresh beg end)
 				(overlay-put ov 'keymap image-map))
 			      (push ov org-inline-image-overlays))))))))))))))))
 
+(defun org-display-inline-image--width (link)
+  "Determine the display width of the image LINK, in pixels.
+- When `org-image-actual-width' is t, the image's pixel width is used.
+- When `org-image-actual-width' is a number, that value will is used.
+- When `org-image-actual-width' is nil or a list, the first :width attribute
+  set (if it exists) is used to set the image width.
+  If no :width attribute is given and `org-image-actual-width' is a list with
+  a number as the car, then that number is used as the default value.
+  If the value is a float between 0 and 2, it interpreted as that proportion
+  of the text width in the buffer."
+  ;; Apply `org-image-actual-width' specifications.
+  (cond
+   ((eq org-image-actual-width t) nil)
+   ((listp org-image-actual-width)
+    (let* ((case-fold-search t)
+           (par (org-element-lineage link '(paragraph)))
+           (attr-re "^[ \t]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)")
+           (par-end (org-element-property :post-affiliated par))
+           ;; Try to find an attribute providing a :width.
+           (attr-width
+            (when (and par (org-with-point-at
+                               (org-element-property :begin par)
+                             (re-search-forward attr-re par-end t)))
+              (string-to-number (match-string 1))))
+           (attr-width-val
+            (when attr-width (string-to-number attr-width)))
+           ;; Fallback to `org-image-actual-width' if no explicit width is given.
+           (width (or attr-width-val (car org-image-actual-width))))
+      (if (and (floatp width) (<= 0 width 2.0))
+          ;; A float in [0,2] should be interpereted as this portion of
+          ;; the text width in the window.  This works well with cases like
+          ;; #+attr_latex: :width 0.X\{line,page,column,etc.}width,
+          ;; as the "0.X" is pulled out as a float.  We use 2 as the upper
+          ;; bound as cases such as 1.2\linewidth are feasible.
+          (round (* width
+                    (window-pixel-width)
+                    (/ (or (and (bound-and-true-p visual-fill-column-mode)
+                                (or visual-fill-column-width auto-fill-function))
+                           (when auto-fill-function fill-column)
+                           (window-text-width))
+                       (float (window-total-width)))))
+        width)))
+   ((numberp org-image-actual-width)
+    org-image-actual-width)
+   (t nil)))
+
 (defun org-display-inline-remove-overlay (ov after _beg _end &optional _len)
   "Remove inline-display overlay if a corresponding region is modified."
   (let ((inhibit-modification-hooks t))
-- 
2.33.0


^ permalink raw reply related	[relevance 38%]

* Re: [PATCH]
  @ 2021-09-27 12:20 93%         ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-09-27 12:20 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 306 bytes --]

Bastien <bzg@gnu.org> writes:

> It looks better, Thanks.  The two patches don’t apply on main here.
> Can you apply the change yourself and add an entry in etc/ORG-NEWS?

I’ve written an ORG-NEWS entry, verified it works (and fixed a trivial
oversight), and pushed :)

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH]
  @ 2021-09-27 15:36 93%             ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-09-27 15:36 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 740 bytes --]

Bastien <bzg@gnu.org> writes:

> This triggers a compiler warning about `visual-fill-column-width’ not
> being declared.
>
> This variable comes from
> <https://github.com/joostkremers/visual-fill-column>
>
> Why relying on this package?  Any chance to avoid this dependency?
>
> If not, can you please add the needed declaration?

Here I’m not relying on the package, but trying to make it so that this will
still function as intended if the package is used, as it can modify the area
used for text in a buffer (hence the bound-and-true-p). I think this is worth
having, but obviously byte-compile errors aren’t nice. Would adding a
declare-function statement be the best thing to do here?

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH]
  @ 2021-09-27 17:52 93%                 ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-09-27 17:52 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 559 bytes --]

Bastien <bzg@gnu.org> writes:

> Since this is a variable, a simple (defvar visual-fill-column-width)
> will silent the compiler.

I’ve just had another thought which wouldn’t add visual-fill-column-width to the
namespace (if that’s worth worrying about). Not sure if this is better or worse
though.

┌────
│ (/ (or (and (bound-and-true-p visual-fill-column-mode)
│             (or (bound-and-true-p visual-fill-column-mode) auto-fill-function))
└────

Might you have an opinion on this?

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* [PATCH] (minor) Use lower case keywords in ox-org
@ 2021-09-28 14:58 64% Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-28 14:58 UTC (permalink / raw)
  To: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

Hello,

Just a little thing, if it’s of interest. A while ago I remember upper/lower
case keywords being discussed and the conclusion being that upper case keywords
were only to be used in the manual. Since `ox-org' isn’t the manual, I’ve gone and
lowered the case of all the keywords used there.

All the best,
Timothy

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-org-Use-lower-case-keywords.patch --]
[-- Type: text/x-patch, Size: 2556 bytes --]

From d5c0cb92198d315031a5e4539e227b22a1f0b98b Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Tue, 28 Sep 2021 22:45:55 +0800
Subject: [PATCH] ox-org: Use lower case keywords

* lisp/ox-org.el (org-org-identity, org-org-template): As it has
previously been clarified on the mailing list that upper-case keywords
are only intended for the manual[1], an Org export of an Org file should
use lower-case keywords.

[1]: https://list.orgmode.org/87tuuw3n15.fsf@nicolasgoaziou.fr/
---
 lisp/ox-org.el | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lisp/ox-org.el b/lisp/ox-org.el
index c2b85473c..0c4290ebf 100644
--- a/lisp/ox-org.el
+++ b/lisp/ox-org.el
@@ -141,7 +141,7 @@ (defun org-org-identity (blob contents _info)
 CONTENTS is its contents, as a string or nil.  INFO is ignored."
   (let ((case-fold-search t))
     (replace-regexp-in-string
-     "^[ \t]*#\\+ATTR_[-_A-Za-z0-9]+:\\(?: .*\\)?\n" ""
+     "^[ \t]*#\\+attr_[-_a-za-z0-9]+:\\(?: .*\\)?\n" ""
      (org-export-expand blob contents t))))
 
 (defun org-org-headline (headline contents info)
@@ -185,26 +185,26 @@ (defun org-org-template (contents info)
 	       (org-element-map (plist-get info :parse-tree) 'keyword
 		 (lambda (k)
 		   (and (string-equal (org-element-property :key k) "OPTIONS")
-			(concat "#+OPTIONS: "
+			(concat "#+options: "
 				(org-element-property :value k)))))
 	       "\n"))
    (and (plist-get info :with-title)
-	(format "#+TITLE: %s\n" (org-export-data (plist-get info :title) info)))
+	(format "#+title: %s\n" (org-export-data (plist-get info :title) info)))
    (and (plist-get info :with-date)
 	(let ((date (org-export-data (org-export-get-date info) info)))
 	  (and (org-string-nw-p date)
-	       (format "#+DATE: %s\n" date))))
+	       (format "#+date: %s\n" date))))
    (and (plist-get info :with-author)
 	(let ((author (org-export-data (plist-get info :author) info)))
 	  (and (org-string-nw-p author)
-	       (format "#+AUTHOR: %s\n" author))))
+	       (format "#+author: %s\n" author))))
    (and (plist-get info :with-email)
 	(let ((email (org-export-data (plist-get info :email) info)))
 	  (and (org-string-nw-p email)
-	       (format "#+EMAIL: %s\n" email))))
+	       (format "#+email: %s\n" email))))
    (and (plist-get info :with-creator)
 	(org-string-nw-p (plist-get info :creator))
-	(format "#+CREATOR: %s\n" (plist-get info :creator)))
+	(format "#+creator: %s\n" (plist-get info :creator)))
    contents))
 
 (defun org-org-timestamp (timestamp _contents _info)
-- 
2.33.0


^ permalink raw reply related	[relevance 64%]

* Re: [PATCH]
  @ 2021-09-28 15:50 93%                       ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-28 15:50 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

Bastien Guerry <bzg@gnu.org> writes:

>> It seems to me that the defvar declaration is good enough.
>
> I just pushed this.

Ah, cool. Thanks for taking care of this Bastien.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* [PATCH] Prevent displayed images from being re-scaled
@ 2021-09-29 13:33 71% Timothy
  2021-10-02 20:30 93% ` Timothy
    0 siblings, 2 replies; 200+ results
From: Timothy @ 2021-09-29 13:33 UTC (permalink / raw)
  To: Org-Mode Mailing List

[-- Attachment #1: Type: text/plain, Size: 922 bytes --]

Hello,

After my last patch providing support for proportional image width attributes
(e.g. 70% of the text width), I noticed that the results looked slightly off.
Investigating the code lead me to `create-image' which takes the liberty of
re-scaling images based on your default font size. As you might imagine, this
can be problematic when if you say determine that image should be 70% of the
text width, the text width is 1000px, and so the image should be 700px wide —
but upon being told to make the image 700 pixels wide `create-image' decides to
make it say 850 pixels wide. I personally found that images >~80% wide were
being made wider than the buffer, which isn’t good.

To make image width behave as expected, we can just specify `:scale 1' when
calling `create-image', and that will stop it from re-interpreting the `:width'
specification. See the patch attached.

All the best,
Timothy

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-Don-t-change-image-size-based-on-font-size.patch --]
[-- Type: text/x-patch, Size: 1113 bytes --]

From 9c34dd6aba62d734f6ae9aecaffa76a0250bf495 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Wed, 29 Sep 2021 21:29:27 +0800
Subject: [PATCH] org: Don't change image size based on font size

* lisp/org.el (org--create-inline-image): When `create-image' is called
without the :scale parameter, the image size is expanded based on the
default font size (if it is larger than 10px).  When displaying images
with a specified width in Org buffers, either in pixels or proportional
to the text width, this width should not be modified according the to
font size.  Giving a :scale parameter of 1 prevents this font-size based
rescaling.
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 2ec6566c0..0e7f926f0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16518,7 +16518,7 @@ (defun org--create-inline-image (file width)
 			 width
 			 'imagemagick)
 		    remote?
-		    :width width))))
+		    :width width :scale 1))))
 
 (defun org-display-inline-images (&optional include-linked refresh beg end)
   "Display inline images.
-- 
2.33.0


^ permalink raw reply related	[relevance 71%]

* Re: [PATCH] Treat :tangle-mode as an octal value not integer
  @ 2021-09-29 13:48 87% ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-09-29 13:48 UTC (permalink / raw)
  To: Jeremy Cowgar; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

Hi  Jeremy,

> As an org user I would expect :tangle-mode 0660 to produce a file that
> has user rw, group rw, other nothing. Instead, what really happens
> currently is 0660 is treated as an integer which is actually
> 3140. This produces unexpected file permissions.

I agree that :tangle-mode could be more user-friendly. However, I think we can
go further. Currently, only (identity #o755 / 493) works, however I think it would be
good if it worked like chmod and accepted most of the following forms:
⁃ `#o755'
⁃ `755' (because people are used to this, as technically misleading as it may be,
  as long as we can tell “:tangle-mode 356” from “:tangle-mode (identity #o544)”)
⁃ `rw' (equivalent to a=rw, and so #o555)
⁃ `a=rw,u+x' (equivalent to #o755) [hardest to support, so maybe?]

And then I’d also be in favour of accepting
⁃ `rw-r--r--' (equivalent to #o544)

I think as long as it’s clear what’s intended, and it’s not some home-baked
non-standard format, or terribly annoying to support — why not?

All the best,
Timothy

^ permalink raw reply	[relevance 87%]

* Re: [PATCH] Treat :tangle-mode as an octal value not integer
  @ 2021-09-29 14:58 78%     ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-09-29 14:58 UTC (permalink / raw)
  To: tomas; +Cc: emacs-orgmode


<tomas@tuxteam.de> writes:

> So you favour going the "full custom special parser". You're much more
> involved in Org, so I think your gut feeling counts more than mine here :)

Well, I'm not sure that my feeling is representative of experienced Org users,
my opinion basically boils down to:

>> I think as long as it’s clear what’s intended, and it’s not some home-baked
>> non-standard format, or terribly annoying to support — why not?

Rephrased: I think there are a few arguably "sensible" formats that a user could
reasonably assume, and if we can support most of them without introducing
ambiguity in parsing or interpretation (and I think we can), can't we make
everyone happy?

> `755' is the funniest one, since, strictly speaking it doesn't correspond
> to anything "out there" (note that the shell command `chmod' wants the
> leading zero, or, well, it will do surprising things if you don't
> provide it ;-)

Consider my suggestion amended to 0755 etc. :)

Anyway, as an example here's a code snippet that implements everything I've
mentioned.

#+begin_src emacs-lisp
(defvar org-tangle-default-mode #o544
  "The default mode for tangled files, as an integer.")

(defun org-interpret-file-mode (mode)
  (cond
   ((integerp mode) mode)
   ((not (stringp mode))
    (user-error "File mode %S not recognised as a valid format." mode))
   ((string-match-p "^0[0-7][0-7][0-7]$" mode)
    (string-to-number mode 8))
   ((string-match-p "^#o[0-7][0-7][0-7]$" mode)
    (string-to-number (substring mode 2) 8))
   ((string-match-p "^[ugoa]*\\(?:[+-=][rwxXstugo]*\\)+\\(,[ugoa]*\\(?:[+-=][rwxXstugo]*\\)+\\)*$" mode)
    (file-modes-symbolic-to-number mode 0))
   ((string-match-p "^[rwx-]\\{3\\}$" mode)
    (file-modes-symbolic-to-number (concat "u=" mode) org-tangle-default-mode))
   ((string-match-p "^[rwx-]\\{9\\}$" mode)
    (file-modes-symbolic-to-number (concat  "u=" (substring mode 0 3)
                                           ",g=" (substring mode 3 6)
                                           ",a=" (substring mode 6 9))
                                   org-tangle-default-mode))
   (t (user-error "File mode %S not recognised as a valid format." mode))))
#+end_src

--
Timothy


^ permalink raw reply	[relevance 78%]

* [PATCH] Don't fill displayed equations
@ 2021-09-30 17:20 66% Timothy
  2021-09-30 17:44 74% ` Timothy
    0 siblings, 2 replies; 200+ results
From: Timothy @ 2021-09-30 17:20 UTC (permalink / raw)
  To: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 898 bytes --]

Hi All,

If a displayed equation (`\[ ... \]') starts on its own line, I don’t think it
should be filled into the rest of the text. I.e.,

┌────
│ some nice text
│ \[
│   1+1=2
│ \]
│ more text.
└────
should not become,
┌────
│ some nice text \[ 1+1=3 \] more text.
└────

While the above example may not look bad, with non-trivial equations
this can become quite messy.

As such, I have attached a patch which adds fill “cuts” around `\[' and
`\]', when `\[' occurs at the start of a line. This leaves the display equation
delimiters on their own line.

I think this motivation for this change is fairly clear, and so without feedback
I intend to push this in a few days, however I if anybody has comments on the way
I’m currently implementing this, I’d like to hear your thoughts.

All the best,
Timothy

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-Don-t-fill-displayed-equations-into-text.patch --]
[-- Type: text/x-patch, Size: 2168 bytes --]

From d008ff3c2218e19bb501137715b05e06a0c511e3 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Fri, 1 Oct 2021 01:14:21 +0800
Subject: [PATCH] org: Don't fill displayed equations into text

* list/org.el (org-fill-element): If a displayed equation (\[ ... \])
starts on its own line, it should not be filled into the rest of the
text. I.e.,

some nice text
\[
  1+1=2
\]
more text.

should not become,

some nice text \[ 1+1=3 \] more text.

While the above example may not look bad, with non-trivial equations
this can become quite messy.
---
 lisp/org.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 405f0f0f9..daf1d91b4 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19551,10 +19551,10 @@ (defun org-fill-element (&optional justify)
 			 (org-element-property :contents-end element))))
 	   ;; Do nothing if point is at an affiliated keyword.
 	   (if (< (line-end-position) beg) t
-	     ;; Fill paragraph, taking line breaks into account.
 	     (save-excursion
 	       (goto-char beg)
 	       (let ((cuts (list beg)))
+                 ;; Cut fill on line breaks.
 		 (while (re-search-forward "\\\\\\\\[ \t]*\n" end t)
 		   (when (eq 'line-break
 			     (org-element-type
@@ -19562,6 +19562,16 @@ (defun org-fill-element (&optional justify)
 					      (org-element-context))))
 		     (push (point) cuts)))
 		 (dolist (c (delq end cuts))
+                 ;; Cut fill on displayed equations.
+                 (while (re-search-forward "^[ \t]*\\\\\\[" end t)
+                   (let ((el (org-element-context)))
+                     (when (eq 'latex-fragment (org-element-type el))
+                       (setf cuts (append
+                                   (list (org-element-property :end el)
+                                         (- (org-element-property :end el) 2)
+                                         (+ (org-element-property :begin el) 2)
+                                         (org-element-property :begin el))
+                                   cuts)))))
 		   (fill-region-as-paragraph c end justify)
 		   (setq end c))))
 	     t)))
-- 
2.33.0


^ permalink raw reply related	[relevance 66%]

* Re: [PATCH] Don't fill displayed equations
  2021-09-30 17:20 66% [PATCH] Don't fill displayed equations Timothy
@ 2021-09-30 17:44 74% ` Timothy
    1 sibling, 0 replies; 200+ results
From: Timothy @ 2021-09-30 17:44 UTC (permalink / raw)
  To: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]


The initial patch was just slightly off. Here's a correct version.

Timothy <tecosaur@gmail.com> writes:
> As such, I have attached a patch which adds fill “cuts” around `\[' and
> `\]', when `\[' occurs at the start of a line. This leaves the display equation
> delimiters on their own line.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-Don-t-fill-displayed-equations-into-text.patch --]
[-- Type: text/x-patch, Size: 2129 bytes --]

From d6d2221a7a9bf5e3cf93265c13cb643bcfe46929 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Fri, 1 Oct 2021 01:14:21 +0800
Subject: [PATCH] org: Don't fill displayed equations into text

* list/org.el (org-fill-element): If a displayed equation (\[ ... \])
starts on its own line, it should not be filled into the rest of the
text. I.e.,

some nice text
\[
  1+1=2
\]
more text.

should not become,

some nice text \[ 1+1=3 \] more text.

While the above example may not look bad, with non-trivial equations
this can become quite messy.
---
 lisp/org.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 405f0f0f9..ff86a9dd0 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19551,16 +19551,26 @@ (defun org-fill-element (&optional justify)
 			 (org-element-property :contents-end element))))
 	   ;; Do nothing if point is at an affiliated keyword.
 	   (if (< (line-end-position) beg) t
-	     ;; Fill paragraph, taking line breaks into account.
 	     (save-excursion
 	       (goto-char beg)
 	       (let ((cuts (list beg)))
+                 ;; Cut fill on line breaks.
 		 (while (re-search-forward "\\\\\\\\[ \t]*\n" end t)
 		   (when (eq 'line-break
 			     (org-element-type
 			      (save-excursion (backward-char)
 					      (org-element-context))))
 		     (push (point) cuts)))
+                 ;; Cut fill on displayed equations.
+                 (while (re-search-forward "^[ \t]*\\\\\\[" end t)
+                   (let ((el (org-element-context)))
+                     (when (eq 'latex-fragment (org-element-type el))
+                       (setf cuts (append
+                                   (list (org-element-property :end el)
+                                         (- (org-element-property :end el) 2)
+                                         (+ (org-element-property :begin el) 2)
+                                         (org-element-property :begin el))
+                                   cuts)))))
 		 (dolist (c (delq end cuts))
 		   (fill-region-as-paragraph c end justify)
 		   (setq end c))))
-- 
2.33.0


^ permalink raw reply related	[relevance 74%]

* Re: [PATCH] Treat :tangle-mode as an octal value not integer
  @ 2021-09-30 18:13 93%         ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-09-30 18:13 UTC (permalink / raw)
  To: Jeremy Cowgar; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 185 bytes --]

Hi  Jeremy,

> I love it! Much better than my proposed patch.

I’m about to send a patch based on my snippet, so I’m marking this patch as cancelled.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* [PATCH] Accept more :tangle-mode specification forms
@ 2021-09-30 18:14 52% Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-09-30 18:14 UTC (permalink / raw)
  To: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]

Hello,

Currently, the only way to set a file mode when tangling seems to be 
:tangle-mode (identity #o755)

In a [prior thread], Jeremy proposed that :tangle-mode should convert octal
number strings to the required decimal form. I think we should go further, and
so have prepared the attached patch based on a snippet I shared in the thread.

To quote the docstring of the new function I’m introducing, this patch now
accepts the following :tangle-mode forms:
• an integer (returned without modification)
• “#o755” (elisp-style octal)
• “0755” (c style octal)
• “755” (chmod style octal)
• “rwxrw-r–” (ls style specification)
• “a=rw,u+x” (chmod style)
• “rwx” (interpreted as “u=rwx”)

Why be so permissive? I’d refer you to my reasoning in the prior thread:

I think there are a few arguably “sensible” formats that a user could reasonably
assume, and if we can support most of them without introducing ambiguity in
parsing or interpretation (and I think we can), can’t we make everyone happy?

All the best,
Timothy


[prior thread] <https://list.orgmode.org/20210928145448.245883-1-jeremy@cowgar.com/>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-tangle-Accept-more-tangle-mode-forms.patch --]
[-- Type: text/x-patch, Size: 3691 bytes --]

From 5087de0d70151c33d66eb13dda84d78a361d7053 Mon Sep 17 00:00:00 2001
From: TEC <tec@tecosaur.com>
Date: Fri, 1 Oct 2021 02:02:22 +0800
Subject: [PATCH] ob-tangle: Accept more :tangle-mode forms

* lisp/ob-tangle.el (org-babel-tangle): Accept many more forms for
:tangle-mode, including octal strings (#o755, 0755, 755), ls forms (rwx,
rw-r--r--), and chmod forms (a=rw,u+x).  The interpretation of the input
is now handled by the new function `org-babel-interpret-file-mode' which
references the new variable `org-babel-tangle-default-mode' when
considering relative mode forms.
---
 lisp/ob-tangle.el | 42 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 2dd1d031c..28a235429 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -140,6 +140,14 @@ (defcustom org-babel-process-comment-text 'org-remove-indentation
   :version "24.1"
   :type 'function)
 
+(defcustom org-babel-tangle-default-mode #o544
+  "The default mode used for tangled files, as an integer.
+The default value 356 correspands to the octal #o544, which is
+read-write permissions for the user, read-only for everyone else."
+  :group 'org-babel
+  :version "9.6"
+  :type 'integer)
+
 (defun org-babel-find-file-noselect-refresh (file)
   "Find file ensuring that the latest changes on disk are
 represented in the file."
@@ -255,7 +263,7 @@ (defun org-babel-tangle (&optional arg target-file lang-re)
 		        (when she-bang
 			  (unless tangle-mode (setq tangle-mode #o755)))
 		        (when tangle-mode
-			  (add-to-list 'modes tangle-mode))
+			  (add-to-list 'modes (org-babel-interpret-file-mode tangle-mode)))
 		        ;; Possibly create the parent directories for file.
 		        (let ((m (funcall get-spec :mkdirp)))
 			  (and m fnd (not (string= m "no"))
@@ -298,6 +306,38 @@ (defun org-babel-tangle (&optional arg target-file lang-re)
 	   path-collector))
 	path-collector))))
 
+(defun org-babel-interpret-file-mode (mode)
+  "Determine the integer representation of a file MODE specification.
+The following forms are currently recognised:
+- an integer (returned without modification)
+- \"#o755\" (elisp-style octal)
+- \"0755\" (c style octal)
+- \"755\" (chmod style octal)
+- \"rwxrw-r--\" (ls style specification)
+- \"a=rw,u+x\" (chmod style) *
+- \"rwx\" (interpreted as \"u=rwx\") *
+
+* The interpretation of these forms relies on `file-modes-symbolic-to-number',
+  and uses `org-babel-tangle-default-mode' as the base mode."
+  (cond
+   ((integerp mode) mode)
+   ((not (stringp mode))
+    (error "File mode %S not recognised as a valid format." mode))
+   ((string-match-p "^0?[0-7][0-7][0-7]$" mode)
+    (string-to-number mode 8))
+   ((string-match-p "^#o[0-7][0-7][0-7]$" mode)
+    (string-to-number (substring mode 2) 8))
+   ((string-match-p "^[ugoa]*\\(?:[+-=][rwxXstugo]*\\)+\\(,[ugoa]*\\(?:[+-=][rwxXstugo]*\\)+\\)*$" mode)
+    (file-modes-symbolic-to-number mode org-babel-tangle-default-mode))
+   ((string-match-p "^[rwx-]\\{3\\}$" mode)
+    (file-modes-symbolic-to-number (concat "u=" mode) org-babel-tangle-default-mode))
+   ((string-match-p "^[rwx-]\\{9\\}$" mode)
+    (file-modes-symbolic-to-number (concat  "u=" (substring mode 0 3)
+                                            ",g=" (substring mode 3 6)
+                                            ",a=" (substring mode 6 9))
+                                   0))
+   (t (error "File mode %S not recognised as a valid format." mode))))
+
 (defun org-babel-tangle-clean ()
   "Remove comments inserted by `org-babel-tangle'.
 Call this function inside of a source-code file generated by
-- 
2.33.0


^ permalink raw reply related	[relevance 52%]

* Re: [PATCH] Don't fill displayed equations
  @ 2021-09-30 18:54 93%   ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-09-30 18:54 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> I strongly disagree with this. \[...\] is an inline element, not a block
> element. As such, it can be filled, and filling function should obey to
> the inner structure of the document.
>
> You can use a real block element here, e.g.,
> \begin{equation*}...\end{equation*}, which will not be filled.

Given that \[ ... \] is an alias for \begin{equation*} ...
\end{equation*} I don't see why it should be treated any differently
when filling.

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Don't fill displayed equations
  @ 2021-09-30 19:28 93%       ` Timothy
  2021-09-30 20:45 63%       ` Timothy
  1 sibling, 0 replies; 200+ results
From: Timothy @ 2021-09-30 19:28 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

>> Given that \[ ... \] is an alias for \begin{equation*} ...
>> \end{equation*}
>
> This is true in LaTeX, not in Org, obviously.

Isn't the whole point of the \[ ... \], \( ... \), $ ... $, $$ ... $$,
and \begin{env} ... \end{env} and constructs in Org to be consistent
with LaTeX?

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Don't fill displayed equations
    2021-09-30 19:28 93%       ` Timothy
@ 2021-09-30 20:45 63%       ` Timothy
    2021-10-04  6:05 83%         ` Timothy
  1 sibling, 2 replies; 200+ results
From: Timothy @ 2021-09-30 20:45 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 3095 bytes --]

Hi Nicolas,

I think there are also some relevant points which I haven’t mentioned so far,
separate from my thoughts that since we’re using the LaTeX syntax we should be
consistent with how LaTeX treats this.

> As I wrote above, they do not belong to the same category of syntax.
> There’s no reason to special case ....

I think we already do special-case `\[ ... \]' somewhat. When refer to inline
elements like bold, verbatim, italic, etc. they sit in the text. Semantically,
this doesn’t hold for `\[ ... \]' either. The semantically inline maths element is
`\( ... \)'. Considering other “inline” syntax elements, like bold, verbatim,
italic, etc. if you spread the delimiters across multiple lines that doesn’t
work. So I’d argue the ship has already sailed on treating `\[ ... \]' differently
to other inline elements.

If you’re wondering why I’m so opposed to the current behaviour, that is probably
best explained by a more realistic demo that what I have in the commit message.

┌────
│ Since \(\cos\) is an even function, we can negate the numerator of the argument
│ without changing the result, giving
│ \[
│   \cos \left( \pi \frac{C_1-x}{2C_1+D} \right) \ , \quad C_1 = \frac{D}{2}.
│ \]
│ this will be positive over \(x \in (0,D)\), and so we can rewrite \(\tilde{y}\) as,
│ \[
│   \tilde{y}(x) = \frac{2D}{\pi} \log \cos \left( \pi \frac{\frac{D}{2}-x}{2D} \right) + C_2.
│ \]
│ Once again considering that \(y(0)=y(D)=0\), it is clear that
│ \[
│   C_2 = - \frac{2D}{\pi} \log \cos \left( \frac{\pi}{4} \right) = - \frac{2D}{\pi} \log 2^{-\frac{1}{2}} = \frac{D}{\pi} \log 2.
│ \]
│ The complete solution for \(\tilde{y}\) is hence,
│ \[
│   \tilde{y} = \frac{2D}{\pi} \log \cos \left( \pi \frac{D-2x}{4D} \right) + \frac{D}{\pi} \log 2.
│ \]
└────
is currently filled to
┌────
│ Since \(\cos\) is an even function, we can negate the numerator of the argument
│ without changing the result, giving \[ \cos \left( \pi \frac{C_1-x}{2C_1+D}
│ \right) \ , \quad C_1 = \frac{D}{2}. \] this will be positive over \(x \in (0,D)\),
│ and so we can rewrite \(\tilde{y}\) as, \[ \tilde{y}(x) = \frac{2D}{\pi} \log \cos \left( \pi
│ \frac{\frac{D}{2}-x}{2D} \right) + C_2. \] Once again considering that
│ \(y(0)=y(D)=0\), it is clear that \[ C_2 = - \frac{2D}{\pi} \log \cos \left(
│ \frac{\pi}{4} \right) = - \frac{2D}{\pi} \log 2^{-\frac{1}{2}} = \frac{D}{\pi} \log 2.
│ \] The complete solution for \(\tilde{y}\) is hence, \[ \tilde{y} = \frac{2D}{\pi} \log \cos
│ \left( \pi \frac{D-2x}{4D} \right) + \frac{D}{\pi} \log 2. \]
└────

Suffice to say, I find the second terrible to read compared to the first.
Furthermore, when using org-latex-preview, wrapped `\[ ... \]' blocks join lines,
resulting in lines that are displayed going off edge of the page after filling.

Basically, this leads to a worse experience when using Org in what I would think
to be a perfectly reasonably way.

All the best,
Timothy

^ permalink raw reply	[relevance 63%]

* Re: [PATCH] Accept more :tangle-mode specification forms
  @ 2021-10-01  6:59 71%   ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-10-01  6:59 UTC (permalink / raw)
  To: Tom Gillespie; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 2738 bytes --]

Hi Tom,

Thanks for giving me your thoughts on this. I have a few thoughts in response :)

> I strongly oppose this patch. It adds far too much complexity to the
> org grammar. Representation of numbers is an extremely nasty part of
> nearly every language, and I suggest that org steer well clear of
> trying to formalize this.

I’m not quite sure I see your point here, as I don’t see how this affects the
grammar of Org at all. The :attribute value syntax is unaffected, this just
changes how a particular :attribute’s value is interpreted. Attribute specific
interpretation is normal, with “:file ~/hello” you expect `~' to be interpreted as
`$HOME', but were I to give “:session ~/hello” I would not expect `~' to be
expanded etc.

Similarly, with regard to the representation of numbers, I’m not sure that
applies here, as the value is still a string not a number, it’s just
interpreted. Arguably, we’re not even representing numbers here but representing
file permissions which are currently abstracted by a numerical representation.

> With an eye to future portability I suggest that no special cases be given to
> [snipped for later] tangle mode without very careful consideration.

Mmmm, we defiantly want to think about what options we allow for, but I don’t
think that precludes us from accepting more than one common permissions
representations.

> [the snip]: something as important for security as tangle mode

Thank you for considering potential security implications, this is something
that I didn’t consider when writing the patch, but if we allow for a confusing
format that could deceive people into tangling files in modes they didn’t
realise they were tangling to.

I think there are two relevant points here
⁃ If we only allow very widely-understood, standard representations, I think the
  risk of people misunderstanding a :tangle-mode value is acceptably low
⁃ If you consider things this way, since arbitrary lisp closures are currently
  permitted, one can already trivially create a much more misleading
  :tangle-mode value with the current code.

> Emacs lisp closures have clear semantics in Org and the number syntax is clear

See my earlier comments on the semantics being unaffected, and this not being a
number syntax.

> If users are concerned about the verbosity of (identity #o0600) they could go
> with the sorter (or #o0600).

Perhaps, but I personally find it easier to interpret “rwxr-xr–” for example
than “(or #o754)”, and I feel quite confident in guessing that
a. I’m not alone
b. Nobody that understands “#o754” will have difficult understanding “rwxr-xr–”

All the best,
Timothy

^ permalink raw reply	[relevance 71%]

* Re: [PATCH] Don't fill displayed equations
    @ 2021-10-01  7:43 69%           ` Timothy
    1 sibling, 1 reply; 200+ results
From: Timothy @ 2021-10-01  7:43 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List


Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Timothy <tecosaur@gmail.com> writes:
>
>> I think there are also some relevant points which I haven’t mentioned so far,
>> separate from my thoughts that since we’re using the LaTeX syntax we should be
>> consistent with how LaTeX treats this.
>
> I'm not convinced about this. I don't think it is even possible.

By this, I'm specifically thinking of the fact that \( ... \) is inline,
and \[ ... \] is a display equation. What's the point of Org having both
if they're treated the same in "org syntax", on top of the inconstancy
that creates with HTML, LaTeX exports etc. where it is once again
treated as a display equation? Perhaps the discussion should shift from
my specific patch to this general situation, but this behaviour feels
wrong to me.

>>> As I wrote above, they do not belong to the same category of syntax.
>>> There’s no reason to special case ....
>>
>> I think we already do special-case `\[ ... \]' somewhat. When refer to inline
>> elements like bold, verbatim, italic, etc. they sit in the text. Semantically,
>> this doesn’t hold for `\[ ... \]' either. The semantically inline maths element is
>> `\( ... \)'. Considering other “inline” syntax elements, like bold, verbatim,
>> italic, etc. if you spread the delimiters across multiple lines that doesn’t
>> work. So I’d argue the ship has already sailed on treating `\[ ... \]' differently
>> to other inline elements.
>
> I'm not sure about what you mean. \[...\] is no different than, e.g.,
> verbatim. It's an inline element, with all that it implies.

Is it? I can't use verbatim like this:

=
some
verbatim
text
=

but I can do

\[
some
display
equation
\]

It seems to me that \[ ... \] is already treated differently from other
inline markup.

> Now, if you want to discuss changing syntax for \[...\] and make it
> a block element, you can of course do it to your heart's content (it has
> been discussed already in this ML and I don't have an opinion on the
> subject), but please don't make filling do bizarre things (not all Org
> users use LaTeX or even like LaTeXisms), just because LaTeX modes behave
> differently.

If that's the only way that Org could treat \[ ... \] differently from
\( ... \), I'd be strongly in favour of this.

>> If you’re wondering why I’m so opposed to the current behaviour, that is probably
>> best explained by a more realistic demo that what I have in the commit message.
>> [*snip*]
> In every case above, you can already use
> \begin{equation*}...\end{equation*}, so I don't see the point.

I prefer \[ ... \] over \begin{equation*}...\end{equation*} as it's much
more succinct, and helps reduce the "markup noise" in my documents. I
don't think this is an insignificant concern, brevity may not be
something I'm very good at in emails 😛 but is something I look for in
syntax.

> You already have all you need without breaking filling function for
> the rest of us.

I must admit, I don't see the downside here --- how does this break the
filling function for the rest of you? This only affects \[ ... \] blocks
that have already been put on their own line.

> I don't think it is a worse experience, unless you apply expectations
> from LaTeX to Org. It just doesn't work.

Why can't we apply LaTeX expectations to LaTeX elements in Org? Applying
LaTeX expectations to Org as a whole is clearly a silly idea, but Org
copies \[ .. \] from LaTeX and it is a LaTeX construct.

> Notwithstanding filling behaviour, \[...\] in Org is much more limited
> than \[...\] in LaTeX.

I'd be curious to hear how, as I personally haven't run into any
instances where \[ ... \] has behaved differently other than when an
environment starts on a new line in of a \[ ... \] block (which can
easily be fixed by putting something like \!\ at the start of the line).

> If you need to write or copy "advanced" LaTeX code, Org provides
> dedicated environments.

I don't want "advanced" LaTeX code, I just want my display equations to
be treated as display equations consistently 😂.

Anyway, thanks for engaging with this Nicolas. Even if my patch is a bad
idea, I hope that by the end of this conversation we may arrive at an
agreement on how \[ ... \] should be treated.

--
Timothy


^ permalink raw reply	[relevance 69%]

* Re: [PATCH] Accept more :tangle-mode specification forms
  @ 2021-10-01 18:14 82%             ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-10-01 18:14 UTC (permalink / raw)
  To: Tom Gillespie; +Cc: tomas, emacs-orgmode, mail

[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]

Hi Tom,

Thanks for going through the replies so far and refining your thoughts.

> *snip a whole bunch of comments*

I think I’m of the same mind as you that if we try to mentally separate Org the
markup format and Org the emacs mode, the format should not specify the
interpretation of the :tangle-mode value.

I think the best way to have it would be,
⁃ Org the format, :tangle-mode takes a value representing the file permissions
  the tangled file should have. Optional: here are some common examples that
  might be recognised
⁃ Org the emacs mode, :tangle-mode’s value is interpreted like so (…)

> That said, reducing the number of forms as Eric suggests would
> be a happy medium.

Indeed, I’ve basically supported every form I could think of. I’m currently
inclined to cut it down to:
• 755
• “rwxrw-r–” (`ls -l' style)
• chmod style with `org-babel-tangle-default-mode' and `file-modes-symbolic-to-number'

Maybe with (if anybody says they would like this)
• #o755 (elisp octal)
• 0755 (C octal)
• “rwx” = user perm, bit-or’d with `org-babel-tangle-default-mode' for the rest
  (i.e. `org-babel-tangle-default-mode', but not exceeding the user perm)

All the best,
Timothy

^ permalink raw reply	[relevance 82%]

* Re: [PATCH] Don't fill displayed equations
  @ 2021-10-02 10:18 83%                 ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-10-02 10:18 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 1220 bytes --]

Hi  Eric,

>> text
>> 1+1=3
>> text
>>
>> is a single paragraph in LaTeX.

> This is true and probably the most convincing argument in this debate.

I can’t help but think that this line of thinking is a bit of a trap, because
what LaTeX’s idea of a paragraph does not line up with Org’s. I think the more
pertinent consideration is that `\[ ... \]' changes LaTeX into vertical mode,
which does not allow for any other content on the ’line’ — which is far
closer to Org’s concept of a block element than an inline element.

Frankly, I think the issue is that the semantics of `\[ ... \]' simply don’t play
well with Org. Unfortunately, due to the Org/LaTeX difference I don’t see any
ideologically “pure” way we can have it in Org. The most idiomatic solution
would be to just remove support for `\[ ... \]' *. Otherwise, we have to treat
`\[ ... \]' specially in if we want ’sensible’ behaviour — as I mention in my
reply to Nicolas, we’re already parsing it differently to other inline markup…

All the best,
Timothy

* However, I am not advocating for this: There’s both the obvious comparability
  issue, but I also rather like using `\[ ... \]' myself.

^ permalink raw reply	[relevance 83%]

* Re: [PATCH] Don't fill displayed equations
  @ 2021-10-02 11:24 93%               ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-10-02 11:24 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 487 bytes --]

Hi Nicolas,

> *snip lots of text*

Thanks for going through my points in detail. I think I understand your
perspective much better now. At this point though, I’m not really sure what to
make of `\[ ... \]', I now feel like it’s sitting in some sort of markup limbo
where it can’t be either fully LaTeX-y or fully Org-y. I still think it would be
good to improve this, but I no longer have such a firm idea that “modifying fill
is the way”.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Don't fill displayed equations
  @ 2021-10-02 18:28 93%                         ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-10-02 18:28 UTC (permalink / raw)
  To: Tom Gillespie; +Cc: Max Nikulin, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]

Hi Tom,

> The answer is that  can only occur inside paragraphs. The issues
> here are exactly the same as the issues for inline footnotes. Org gives
> us a bit more power, but not the full power because Org is Org, not
> Latex. Making  available outside of a paragraph would be a massive
> breaking change.
>
> In Timothy’s original example he is narrowly skirting the syntax to
> allow that all to remain a single paragraph, but stick in a newline
> anywhere and boom, no more paragraph, no more equation.

I don’t understand what you’re talking about here. You can already use `\[ ... \]'
outside a paragraph, e.g.

┌────
│ blah blah blah
│ 
│ \[
│   not part of a paragraph
│ \]
│ 
│ blah blah blah
└────

I also don’t see how footnotes are analogous, as footnotes are placed in the
middle of a line of text.

If you could explain your thoughts here a bit more, that would be appreciated.

> I guess one thing I’m missing/not understanding is when/why people
> want to use  instead of full #+begin_export latex block?

org-latex-preview :)

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Prevent displayed images from being re-scaled
  2021-09-29 13:33 71% [PATCH] Prevent displayed images from being re-scaled Timothy
@ 2021-10-02 20:30 93% ` Timothy
    1 sibling, 0 replies; 200+ results
From: Timothy @ 2021-10-02 20:30 UTC (permalink / raw)
  To: Org-Mode Mailing List

[-- Attachment #1: Type: text/plain, Size: 119 bytes --]

Hi All,

I intend to push this in the next few days, assuming I don’t get any feedback.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Prevent displayed images from being re-scaled
  @ 2021-10-03  5:45 93%   ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-10-03  5:45 UTC (permalink / raw)
  To: Bastien; +Cc: Org-Mode Mailing List

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

Bastien <bzg@gnu.org> writes:

> Nitpick: I suggest shortening the ChangeLog part like this:
> *snip*
> The ChangeLog part should not be too verbose, you can add explanations
> after it.

Thanks Bastien, I’ll use that message when I push the commit 👍.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Fontification for inline src blocks
  @ 2021-10-03  7:16 93%   ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-10-03  7:16 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: org-mode-email


Ihor Radchenko <yantar92@gmail.com> writes:

> Let me bump this thread again and mark it as a patch ;)

Thanks for the bump. I'd like to get this working, but I don't know how best to
deal with the "prettification" of {{{results(=value=)}}}, which is the major blocker as I
see it.

Other than that, this all works fantastically as far as I can tell from a few
months of usage of my branch of Org 🙂.

--
Timothy


^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Don't fill displayed equations
  @ 2021-10-03  8:50 93%                   ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-10-03  8:50 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org Mode List, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 525 bytes --]

Hi Ihor,

> What about making org-fill-element modular?  We may define separate fill
> functions for different elements and let the user override them
> individually if the user prefer so.  It may be implemented similar to
> export functionality with customisable formatters for different
> elements.

Thanks for that idea. Perhaps something along those lines may be the best
solution here. If we don’t want to make the whole function modular, perhaps we
could make a setting for this?

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Don't fill displayed equations
  @ 2021-10-03  9:14 93%                       ` Timothy
    0 siblings, 1 reply; 200+ results
From: Timothy @ 2021-10-03  9:14 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org Mode List, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

Ihor Radchenko <yantar92@gmail.com> writes:

> I personally would prefer modular function as a whole.  For my taste,
> Org code has too much of (case (variant 1) (variant 2) …)-style
> functions (i.e. org-todo, org-cycle, org-ctrl-c-ctrl-c, org-store-link,
> etc) and they are a pain to debug and advice for users. 

Mmmm, I’m with you on this in general. I also think the code base has far too
many monolithic “200 line” functions which are crying out to be split up.
Now if I could just clone myself once or twice… 😛

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Fontification for inline src blocks
  @ 2021-10-03  9:22 83%       ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-10-03  9:22 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Protesilaos Stavrou, org-mode-email

[-- Attachment #1: Type: text/plain, Size: 1864 bytes --]

Hi Ihor,

> What about separating the src_{nil} fontification into separate patch? I
> think that part raised no objections.

That sounds like a good idea to me. We may as well get that in.

> As for the results prettifications, I look at this and similar ideas as
> at Emacs themes.  It looks nice on your screenshot with your fonts and
> colours, but may not be good for other people.  Similar to org-bullets
> and co.

The behaviour makes me think of link prettification more than what Emacs themes
do. Hiding the text {{{results( with an overlay seems like something a
major/minor mode should be responsible for, not a theme.

> I can see how some people (I am among those people) want to reduce the
> markup noise beyond hiding emphasis markers.  However, some people
> prefer not to hide text in buffer under “bells and whistles”.

Indeed, and it’s good to have this option. This is why I also introduced a new
setting, `org-inline-src-prettify-results' (similarly named to
`org-pretty-entities').

> Maybe we can create some kind of “prettify-symbol themes” replacing different
> markup elements in bulk with nice symbols/svg (e.g. inline results, block
> headers/footers, uninteresting property drawers aka org-custom-properties,
> bullets, etc)? WDYT? Also, CCing Prot as it might be of interest for him.
> Best, Ihor

I think it could make sense for some prettification capabilities to be built
into Org well. Currently there are a few little things we have, but it seems to
be handled inconsistently and I think it could be nice to provide a more unified
approach. There are also things like
<https://github.com/awth13/org-appear/blob/master/org-appear.el> which I feel just
make a lot of sense with Org (you never have to guess if `point' is before or
after a markup character).

All the best,
Timothy

^ permalink raw reply	[relevance 83%]

* Re: [PATCH] Don't fill displayed equations
  @ 2021-10-03  9:42 93%                           ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-10-03  9:42 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Org Mode List, Nicolas Goaziou

[-- Attachment #1: Type: text/plain, Size: 304 bytes --]

Hi Ihor,

> Then would you mind proposing a patch for org-fill-element in
> particular? At least, you seem to have a motivation for this particular
> function ;)

Perhaps in a few weeks, for now I’m a bit to busy for anything other than
“accidental” 😛 patches.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

* Re: [PATCH] Don't fill displayed equations
  2021-09-30 20:45 63%       ` Timothy
  @ 2021-10-04  6:05 83%         ` Timothy
    1 sibling, 1 reply; 200+ results
From: Timothy @ 2021-10-04  6:05 UTC (permalink / raw)
  To: Org Mode List


Hi All,

Given the way the conversation has evolved I think it may be worth revisiting
another viewpoint to see if anybody has any nice ideas.

As things are, regardless of the complexities of parsing and inline vs.
block elements etc., just considering the user experience when running
org-fill on an example like the one below, the behaviour isn't /nice/.

Might there be some way we could allow for people who are used to LaTeX
and/or like \[ ... \] to have fill behaviour that leaves \[ ... \]
blocks alone? My original idea was changing how org-fill works for
everyone, the discussion has gone on to changing \[ ... \] to a block
element -- both of these seem to have rather significant issues.

Ihor came up with the idea of making org-fill something more
customisable by the user, so that someone could have this behaviour
without making Org behave un-idiomatically for everyone. I proposed
maybe just having a setting could be a halfway house between my original
patch and his idea.

Does anybody have any other thoughts?

> If you’re wondering why I’m so opposed to the current behaviour, that is probably
> best explained by a more realistic demo that what I have in the commit message.
>
> ┌────
> │ Since \(\cos\) is an even function, we can negate the numerator of the argument
> │ without changing the result, giving
> │ \[
> │   \cos \left( \pi \frac{C_1-x}{2C_1+D} \right) \ , \quad C_1 = \frac{D}{2}.
> │ \]
> │ this will be positive over \(x \in (0,D)\), and so we can rewrite \(\tilde{y}\) as,
> │ \[
> │   \tilde{y}(x) = \frac{2D}{\pi} \log \cos \left( \pi \frac{\frac{D}{2}-x}{2D} \right) + C_2.
> │ \]
> │ Once again considering that \(y(0)=y(D)=0\), it is clear that
> │ \[
> │   C_2 = - \frac{2D}{\pi} \log \cos \left( \frac{\pi}{4} \right) = - \frac{2D}{\pi} \log 2^{-\frac{1}{2}} = \frac{D}{\pi} \log 2.
> │ \]
> │ The complete solution for \(\tilde{y}\) is hence,
> │ \[
> │   \tilde{y} = \frac{2D}{\pi} \log \cos \left( \pi \frac{D-2x}{4D} \right) + \frac{D}{\pi} \log 2.
> │ \]
> └────
> is currently filled to
> ┌────
> │ Since \(\cos\) is an even function, we can negate the numerator of the argument
> │ without changing the result, giving \[ \cos \left( \pi \frac{C_1-x}{2C_1+D}
> │ \right) \ , \quad C_1 = \frac{D}{2}. \] this will be positive over \(x \in (0,D)\),
> │ and so we can rewrite \(\tilde{y}\) as, \[ \tilde{y}(x) = \frac{2D}{\pi} \log \cos \left( \pi
> │ \frac{\frac{D}{2}-x}{2D} \right) + C_2. \] Once again considering that
> │ \(y(0)=y(D)=0\), it is clear that \[ C_2 = - \frac{2D}{\pi} \log \cos \left(
> │ \frac{\pi}{4} \right) = - \frac{2D}{\pi} \log 2^{-\frac{1}{2}} = \frac{D}{\pi} \log 2.
> │ \] The complete solution for \(\tilde{y}\) is hence, \[ \tilde{y} = \frac{2D}{\pi} \log \cos
> │ \left( \pi \frac{D-2x}{4D} \right) + \frac{D}{\pi} \log 2. \]
> └────

--
Timothy


^ permalink raw reply	[relevance 83%]

* Re: [PATCH] Don't fill displayed equations
  @ 2021-10-04  7:15 93%             ` Timothy
  0 siblings, 0 replies; 200+ results
From: Timothy @ 2021-10-04  7:15 UTC (permalink / raw)
  To: Tom Gillespie; +Cc: Org Mode List

[-- Attachment #1: Type: text/plain, Size: 764 bytes --]

Hi Tom,

> From time to time I encounter random patterns that I don’t want to be
> reformatted during a fill operation. Maybe a custom variable like
> org-fill-paragraph-skip-regexp or similar that could be set by the user?
> For Timothy’s use case he would set it to the regexp provided in the
> original patch? Not sure how much of the implementation in the patch
> is dependent on that particular regexp, but a general solution that
> could even be set per org file might be a very useful new feature.

Hmmm, that’s an interesting idea. I suppose you could have something like a list
of cons cells where the car is a regexp matching the start of the “don’t touch”
region and the cdr a regexp matching the end.

All the best,
Timothy

^ permalink raw reply	[relevance 93%]

Results 1-200 of ~300   | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2019-12-07  7:26     PATCH: Display point of code block point when confirming evaluation Jarmo Hurri
2020-09-30  4:04     ` Kyle Meyer
2020-09-30  4:57 93%   ` TEC
2020-04-24  6:55     [patch suggestion] Mitigating the poor Emacs performance on huge org files: Do not use overlays for PROPERTY and LOGBOOK drawers Ihor Radchenko
2020-05-17 15:00     ` Ihor Radchenko
2020-05-17 15:40       ` Ihor Radchenko
2020-05-18 14:35         ` Nicolas Goaziou
2020-05-18 16:52           ` Ihor Radchenko
2020-05-19 13:07             ` Nicolas Goaziou
2020-05-23 13:52               ` Ihor Radchenko
2020-05-26  8:33                 ` Nicolas Goaziou
2020-06-02  9:21                   ` Ihor Radchenko
2020-06-05  7:26                     ` Nicolas Goaziou
2020-06-05  8:18                       ` Ihor Radchenko
2020-06-05 13:50                         ` Nicolas Goaziou
2020-06-08  5:05                           ` Ihor Radchenko
2020-06-10 17:14                             ` Nicolas Goaziou
2020-08-11  6:45                               ` Ihor Radchenko
2020-08-11 23:07                                 ` Kyle Meyer
2020-08-12  6:29                                   ` Ihor Radchenko
2020-09-20  5:53                                     ` Ihor Radchenko
2020-12-04  5:58                                       ` Ihor Radchenko
2021-03-21  9:09                                         ` Ihor Radchenko
2021-05-03 17:28                                           ` Bastien
2021-09-21 13:32 93%                                         ` Timothy
2020-09-06  5:50 65% [PATCH] org-plot abstractions and extension TEC
     [not found]     ` <87blijmnv9.fsf@gnu.org>
     [not found]       ` <CAHNg_jM8sE4a6XvL5D8Gks4dQXfWhZvRBR33BDLkRgEgZ++ZGg@mail.gmail.com>
2020-09-15  3:43 10%     ` TEC
2020-09-25 17:51 93%       ` TEC
2020-10-17  2:12 93%         ` TEC
2020-10-24 11:31               ` Bastien
2020-10-24 18:16  8%             ` TEC
2020-12-09  2:58 93%               ` TEC
2020-12-14  5:41                   ` Bastien
2020-12-14  6:30 93%                 ` TEC
2020-12-23  5:09                     ` Kyle Meyer
2020-12-23  5:10 93%                   ` TEC
2020-12-23  6:19 43%                     ` TEC
2020-12-23  7:14                           ` Kyle Meyer
2020-12-23  8:38 41%                         ` TEC
2020-12-23 16:55                               ` Kyle Meyer
2020-12-23 18:19 43%                             ` TEC
2020-09-17 13:50 93% [PATCH] Enhance org-html--build-meta-info TEC
2020-09-17 14:21 48% ` TEC
2020-09-17 15:53     ` Jens Lechtenboerger
2020-09-17 16:14 45%   ` TEC
2020-09-18  8:11         ` Jens Lechtenboerger
2020-09-25 17:48 47%       ` TEC
2020-09-27 15:17             ` Jens Lechtenboerger
2020-09-27 17:39 46%           ` TEC
2020-09-27 18:00                 ` Jens Lechtenboerger
2020-09-27 18:35 93%               ` TEC
2020-09-28  8:17                     ` Jens Lechtenboerger
2020-12-13 16:12 46%                   ` TEC
2020-12-14  6:04                         ` Bastien
2020-12-14  6:34 66%                       ` TEC
2020-12-14  7:20                             ` Bastien
2020-12-14  7:27 90%                           ` TEC
2020-12-14  8:11                                 ` Bastien
2020-12-14 10:01 37%                               ` TEC
2020-12-14  9:49                           ` Jens Lechtenboerger
2020-12-15 11:39 34%                         ` TEC
2020-12-16  4:13                               ` Tom Gillespie
2020-12-16  5:04 73%                             ` Timothy E Chapman
2020-12-16  6:55                               ` Jens Lechtenboerger
2020-12-16  7:22 86%                             ` TEC
2020-12-16  8:37                                   ` Jens Lechtenboerger
2020-12-20  5:08 93%                                 ` TEC
2020-12-20 17:59                                       ` Jens Lechtenboerger
2021-01-02 18:51 34%                                     ` TEC
2021-01-03 13:26                                           ` Jens Lechtenboerger
2021-01-03 14:48 33%                                         ` TEC
2021-01-03 15:41                                               ` Jens Lechtenboerger
2021-01-03 17:17 34%                                             ` TEC
2021-01-04  7:11                                                   ` Jens Lechtenboerger
2021-01-10 15:52 34%                                                 ` TEC
2021-01-10 17:02                                                       ` Jens Lechtenboerger
2021-01-10 20:36 93%                                                     ` TEC
2021-01-14 10:36 34%                                                       ` TEC
2021-01-14 15:59                                                             ` Jens Lechtenboerger
2021-01-14 16:02 93%                                                           ` Ready to merge! " TEC
2021-01-21  4:05                                                             ` Kyle Meyer
2021-01-21  5:55 93%                                                           ` TEC
2020-12-20  5:08 93%                                 ` TEC
2020-09-28 22:37     [PATCH] Add org-meta*-final-hook Jay Bosamiya
2021-04-25  6:31 91% ` Timothy
2020-10-25 18:54     [PATCH] Async session eval (2nd attempt) Jack Kamm
2021-01-03  8:51 70% ` TEC
2021-02-28 22:23       ` Jack Kamm
2021-03-01  6:22 92%     ` Timothy
2021-03-04  5:13         ` Kyle Meyer
2021-04-25  6:26 89%       ` Timothy
2020-10-29  0:46     [PATCH] New "project" option for org-link-file-path-type Jack Kamm
2020-11-02  5:41     ` Kyle Meyer
2020-11-04 18:11       ` Jack Kamm
2020-11-06  3:33         ` Kyle Meyer
2020-11-12  1:05           ` Jack Kamm
2021-04-25  3:29 93%         ` Timothy
2020-10-30  7:35     [PATCH] add new link type "contact:" for org-contacts.el stardiviner
2020-10-30  7:44     ` stardiviner
2020-11-09  0:24       ` stardiviner
2020-11-09  6:14         ` Jean Louis
2020-11-10  1:15           ` [UPDATED PATCH] " stardiviner
2020-11-11  8:37             ` Bastien
2020-11-11 12:04               ` stardiviner
2020-11-11 13:57                 ` More on design of org-contacts.el - " Jean Louis
2020-11-16  9:26                   ` stardiviner
2020-12-14  6:06                     ` Bastien
2020-12-15  8:53                       ` [final patch] " stardiviner
2020-12-15  9:56                         ` Bastien
2020-12-15 14:13                           ` stardiviner
2020-12-15 14:27                             ` Bastien
2021-04-25  3:31 93%                           ` Timothy
2021-04-25  3:59 93%                             ` Timothy
2020-11-03 20:40     [PATCH] ox-md.el/preserve radio target hyperlink nazar.stasiv
2021-01-03 10:11 93% ` TEC
2020-11-04  6:40     [PATCH] ox-md.el/markdown-hyperlink turbo.cafe
2021-01-03 10:06 93% ` TEC
2020-11-14 18:06     [PATCH] doc/org-manual.org: Extend table formulas Lisp form documentation Daniele Nicolodi
2020-11-16 10:25     ` Eric S Fraga
2020-11-16 10:51       ` Daniele Nicolodi
2020-11-16 12:35         ` Tim Cross
2020-11-18 19:42 71%       ` TEC
2020-12-02  9:30     [PATCH] [C-c C-q] completing tags from both buffer-local and global alist of tags stardiviner
2020-12-03  2:40     ` [PATCH] I updated patch by deleteing duplicate tags stardiviner
2021-01-10 22:10       ` Kyle Meyer
2021-01-11  2:24         ` Christopher Miles
2021-01-13  3:26           ` Kyle Meyer
2021-01-13  9:30             ` Christopher Miles
2021-01-14  5:24               ` Kyle Meyer
2021-04-25  3:25 99%             ` Timothy
2020-12-17 17:11     [patch] A proposal to add LaTeX attributes to verse blocks Juan Manuel Macías
2021-01-03 10:22 93% ` TEC
2020-12-17 17:23     [PATCH] " Juan Manuel Macías
2021-01-03 10:25 92% ` TEC
2021-01-03 13:07       ` Juan Manuel Macías
2021-01-03 13:08 79%     ` TEC
2021-01-07 18:52           ` Juan Manuel Macías
2021-05-01 10:58             ` Bastien
     [not found]               ` <87tunlxws3.fsf@ucl.ac.uk>
2021-05-02 11:31 92%             ` Timothy
2021-05-01 10:58 93%         ` Timothy
2020-12-23  2:35 82% [PATCH] Apply emacs manual css to org pages TEC
2020-12-23  3:42     ` Greg Minshall
2021-04-25  3:36 93%   ` Timothy
2020-12-27 21:29     ` Samuel Wales
2020-12-27 21:39       ` Samuel Wales
2020-12-27 21:45         ` Samuel Wales
2020-12-28  4:04 93%       ` TEC
2020-12-29  6:07     ` Kyle Meyer
2021-03-24  8:08       ` Bastien
2021-04-25  3:34 93%     ` Timothy
2021-01-02 22:13     [PATCH] ol: Avoid initial input when completing function for storing link Kyle Meyer
2021-01-05  5:16     ` Kyle Meyer
2021-04-25  3:38 93%   ` Timothy
2021-01-05  3:56     [PATCH v2] org-contacts.el: Only use org-id-store-link if org-id is loaded Kyle Meyer
2021-01-05  4:20     ` [PATCH] org-contacts.el: Use `bound-and-true-p' to check (unbound) var David Florness
2021-01-05 11:33       ` miles christopher
2021-04-25  3:41 93%     ` Timothy
2021-01-08 16:28     [PATCH] ob-java, a proposal on import improvement John Herrlin
2021-01-09 15:51     ` ian martins
2021-01-10 20:55       ` John Herrlin
2021-01-12 12:00         ` ian martins
2021-01-16 12:56           ` ian martins
2021-01-16 15:32             ` John Herrlin
2021-01-16 20:49               ` ian martins
2021-04-25  3:42 93%             ` Timothy
2021-01-20 10:46 39% [PATCH] TEC
2021-01-20 11:00 93% ` [PATCH] tweaks to ox-html style TEC
2021-02-12  6:16     ` Kyle Meyer
2021-02-12 16:57       ` Jens Lechtenboerger
2021-02-12 17:08         ` Jens Lechtenboerger
2021-02-12 18:22 92%       ` Timothy
2021-02-12 18:16 88%     ` Timothy
2021-02-12 21:46         ` Tim Cross
2021-02-13 13:32           ` Christian Moe
2021-02-14  4:36 93%         ` Timothy
2021-04-28  3:38     ` [PATCH] Bastien
2021-04-28  3:53 91%   ` [PATCH] Timothy
2021-01-26  7:53     [PATCH] ob-java: Allow import to end with asterisk John Herrlin
2021-01-27  3:21     ` ian martins
2021-01-28 20:03       ` John Herrlin
2021-01-30 10:50         ` ian martins
2021-04-25  3:43 93%       ` Timothy
2021-01-30 21:57     [PATCH] ox-md.el export code blocks using grave accents Rodrigo Morales
2021-01-30 22:51     ` Tim Cross
2021-04-27 10:03       ` Bruce D'Arcus
2021-04-27 10:18 92%     ` Timothy
2021-01-31 19:04 60% [PATCH] document org-html-meta-tags TEC
2021-02-08  0:50     ` Kyle Meyer
2021-02-09 19:51 93%   ` Timothy
2021-02-18 16:33     [PATCH] Startup option to separate macros arguments with an alternative string Juan Manuel Macías
2021-04-19  9:19     ` Nicolas Goaziou
2021-04-21 16:01       ` Juan Manuel Macías
2021-04-22 12:55         ` Nicolas Goaziou
2021-04-22 13:46           ` Juan Manuel Macías
2021-04-25  3:46 93%         ` Timothy
2021-03-08 22:57     [PATCH] org-src.el Do not ask to revert unmodified buffers pillule
2021-03-21 20:33     ` Kyle Meyer
2021-03-26  3:10       ` pillule
2021-05-01 10:55 93%     ` Timothy
2021-03-19 12:03 77% [PATCH] Improve documentation of #+startup keyword Timothy
2021-03-25 11:58     org-plot/gnuplot: question and feature suggestions Eric S Fraga
2021-04-26 16:24 63% ` [PATCH] Have C-c C-c recognise #+plot lines Timothy
     [not found]     ` <88f6c54a01f345d785492c4d5b3b82d3@VI1PR0102MB3327.eurprd01.prod.exchangelabs.com>
2021-04-26 17:05       ` Eric S Fraga
2021-04-26 17:11 63%     ` Timothy
2021-04-26 17:13 64%       ` Timothy
2021-04-26 17:17 64%         ` Timothy
2021-04-28 18:04 93%           ` Timothy
2021-04-30  8:17                 ` Eric S Fraga
2021-04-30  8:22                   ` Bastien
2021-04-30  8:52 93%                 ` Timothy
2021-04-30 10:59                       ` Eric S Fraga
2021-04-30 12:16 91%                     ` Timothy
2021-04-30  7:06 93%           ` Timothy
2021-03-25 17:19     [PATCH 0/1] Add option to delay fontification of source blocks Leo Okawa Ericson
2021-03-29  5:03     ` Kyle Meyer
2021-04-02 12:44       ` Leo Okawa Ericson
2021-04-25  3:48 93%     ` Timothy
2021-03-25 17:43     Leo Okawa Ericson
2021-04-25  3:48 93% ` Timothy
2021-03-25 18:25     leo
2021-04-25  3:49 93% ` Timothy
2021-03-31 15:00 42% [PATCH] Fontification for inline src blocks Timothy
2021-04-28  7:14 88% ` Timothy
2021-05-02 20:17 93%   ` Timothy
2021-05-02 20:57         ` Tom Gillespie
2021-05-02 21:03 87%       ` Timothy
2021-05-03  3:29 43%       ` Timothy
2021-05-12 11:15 93%         ` Timothy
2021-05-12 14:24               ` Ihor Radchenko
2021-05-12 14:47 93%             ` Timothy
2021-05-12 15:53                   ` Ihor Radchenko
2021-05-12 16:39 82%                 ` Timothy
2021-05-18 12:06                       ` Sébastien Miquel
2021-05-18 13:34 80%                     ` Timothy
2021-10-03  7:14     ` Ihor Radchenko
2021-10-03  7:16 93%   ` Timothy
2021-10-03  9:09         ` Ihor Radchenko
2021-10-03  9:22 83%       ` Timothy
2021-03-31 15:25 76% [PATCH] avoid loading major modes when exporting to file Timothy
2021-05-01 16:52     ` Bastien
2021-05-01 17:26 84%   ` Timothy
2021-03-31 15:57 80% [PATCH] Add font-lock rule for inline export snippets Timothy
2021-04-28  7:23 93% ` Timothy
2021-03-31 16:41 59% [PATCH] Wrap LaTeX snippets in $$ with markdown export Timothy
2021-03-31 20:59     ` Berry, Charles via General discussions about Org-mode.
2021-05-02 20:20 93%   ` Timothy
2021-05-02 20:23 93% ` Timothy
2021-05-03 16:13     ` Nicolas Goaziou
2021-05-03 18:03 88%   ` Timothy
2021-05-03 22:54         ` Nicolas Goaziou
2021-05-04  3:35 57%       ` Timothy
2021-05-04 13:03             ` Nicolas Goaziou
2021-05-04 13:31 88%           ` Timothy
2021-05-06 21:56                 ` Nicolas Goaziou
2021-05-09 20:12 93%               ` Timothy
2021-04-04 18:46     [PATCH] LaTeX export: arbitrary float environments Thomas S. Dye
2021-05-01 11:08 91% ` Timothy
2021-05-01 17:20       ` Thomas S. Dye
2021-05-01 17:31 88%     ` Timothy
2021-04-07 11:24 58% [PATCH] Use <img> tags for SVGs Timothy
2021-04-07 11:29 93% ` Timothy
2021-04-18  7:22     [PATCH] ob-tangle.el: Speed up tangling Sébastien Miquel
2021-04-18 18:47     ` Tom Gillespie
2021-04-19  8:05       ` Sébastien Miquel
2021-04-20  8:33         ` Tom Gillespie
2021-04-21  6:33           ` Sébastien Miquel
2021-04-21  8:02 93%         ` Timothy
2021-04-24  4:59 74% [PATCH] Refresh inline plotted images Timothy
2021-04-26 14:54 93% ` Timothy
2021-04-24 22:02     [PATCH] org-capture.el: Add new capture template option :refile-to Richard Garner
2021-04-25  3:16 93% ` Timothy
2021-04-25  9:06 74% [PATCH] Babel: remove LaTeX environment -type #+results Timothy
2021-04-25 13:44     ` Greg Minshall
2021-04-25 18:09 92%   ` Timothy
2021-05-01 11:03     ` Bastien
2021-05-01 11:44 93%   ` Timothy
2021-04-28 10:33 63% [PATCH] fix point position shifting in some org-src instances Timothy
2021-05-28 22:40     [PATCH] Fixed lstset where language= wipes out previous definitions Karl Stump
2021-09-19 13:02 93% ` Timothy
2021-06-03 21:58     [PATCH] Add faces to improve contextuality of agenda views Protesilaos Stavrou
2021-09-19 13:23 93% ` Timothy
2021-06-06 16:55 68% [PATCH] Change default latex compiler to latexmk Timothy
2021-06-29 14:32     ` Bruce D'Arcus
2021-06-30 10:48       ` Bastien
2021-06-30 11:14         ` Bruce D'Arcus
2021-07-09 12:30           ` Bruce D'Arcus
2021-07-09 14:17             ` Bastien
2021-07-09 14:25 93%           ` Timothy
2021-07-09 15:03                 ` Bastien
2021-07-09 16:41 93%               ` Timothy
2021-06-06 18:02 53% [PATCH] html export: remove W3C warning, improve accessibility Timothy
2021-06-06 18:19 61% [PATCH] Allow LaTeX reference command (\ref) to be customised Timothy
2021-06-09  2:11 93% ` Timothy
2021-06-09 11:52       ` Nicolas Goaziou
2021-06-09 13:36 90%     ` Timothy
2021-06-09 15:08           ` Nicolas Goaziou
2021-06-09 17:38 93%         ` Timothy
2021-06-16 23:29     [PATCH] ob-core: tangle check library of babel after current buffer Tom Gillespie
2021-07-17 17:42     ` Tom Gillespie
2021-07-24 19:41 93%   ` Timothy
2021-06-20  9:17     [PATCH] Fix regression in org-get-time-of-day introduced in aba1f2066 Ihor Radchenko
2021-06-20 16:09     ` Nicolas Goaziou
2021-07-24 19:48 93%   ` Timothy
2021-06-23 22:50     [PATCH] ob-R output file with graphics parameter Jeremie Juste
2021-06-24  9:21     ` Colin Baxter
2021-06-27 17:12       ` Jack Kamm
2021-06-28 21:54         ` Jeremie Juste
2021-07-03  4:21           ` Jack Kamm
2021-07-03  4:52 92%         ` Timothy
2021-06-28  9:34     [PATCH] Customizify org-babel-fortran-compiler Nico Sonack
2021-07-01 14:45 93% ` Timothy
2021-06-28 10:21     Nico Sonack
2021-07-01 14:40 85% ` Timothy
2021-06-28 12:42     [patch] add :url and :doi optional entries for export to BiBTeX Eric S Fraga
2021-06-28 12:59     ` Eric S Fraga
2021-07-01 14:23 93%   ` Timothy
2021-07-01  3:50     [PATCH] Fix erroneous tangling of blocks Jacopo De Simoi
2021-07-01 13:38 93% ` Timothy
2021-07-08 16:04     [PATCH] bad table formula recorded in some cases tbanelwebmin
2021-07-21 10:50 93% ` Timothy
2021-07-21 14:25       ` tbanelwebmin
2021-07-21 15:07 93%     ` Timothy
2021-07-12  3:51     [PATCH] Fix match/maxlevel conflict in colview dynblock Nick Dokos
2021-08-31 14:33 93% ` Timothy
2021-07-12 18:07 71% [PATCH] be more cautious when setting csl etc dir location Timothy
2021-07-14 19:39 93% ` Timothy
2021-07-15  2:33     [PATCH] manual: How to refer to tables in other files William Denton
2021-09-19 13:36 93% ` Timothy
2021-07-30 15:00     Bug: Percentage in caption (even escaped) does not work in LaTeX export Charest, Luc
2021-09-03 12:17     ` Maxim Nikulin
2021-09-07 12:21       ` [PATCH] ox-latex: Allow percent sign in 'src-block' caption Maxim Nikulin
2021-09-07 13:17 93%     ` Timothy
2021-07-30 15:24     Bug: org-agenda-highlight-todo: Symbol’s function definition is void: string-empty-p [9.4.6 (9.4.6-11-g1ee52c-elpa @ /home/vmg/.emacs.d/elpa/org-20210726/)] Вячеслав Гришин
2021-08-04 15:20     ` [PATCH] org-agenda.el: Avoid dependency on subr-x Maxim Nikulin
2021-08-05 12:59       ` Timothy
2021-08-06 17:10         ` Maxim Nikulin
2021-08-06 20:30 93%       ` Timothy
2021-08-02 15:45     [PATCH] minor typo fix in org-tutorials/org-protocol-custom-handler.org Atlas Cove
2021-08-14 23:25     ` Tim Cross
2021-08-15  2:24       ` Eric Abrahamsen
2021-09-19 12:42 93%     ` Timothy
2021-08-05 12:12     [PATCH] Rename headline to heading André A. Gomes
2021-09-19 11:06 89% ` Timothy
2021-08-09 13:06     [patch] priorities range reversed Joe Corneli via General discussions about Org-mode.
2021-08-09 13:51     ` Joe Corneli via General discussions about Org-mode.
2021-08-31 15:14 93%   ` Timothy
2021-08-09 14:41     [PATCH] Fix bug assuming canonical duration units in org-agenda-format-items Anders Johansson
2021-08-11  9:39     ` Nicolas Goaziou
2021-08-31 13:55 93%   ` Timothy
2021-08-17 23:07     [PATCH] ox-ascii.el: Fix justify when `indent-tabs-mode' is non-nil Morgan Willcock
2021-08-31 11:59 90% ` Timothy
2021-08-31 12:42       ` Morgan Willcock
2021-08-31 12:54 93%     ` Timothy
2021-09-19 13:13 92% ` Timothy
2021-09-19 15:30       ` Morgan Willcock
2021-09-19 17:02 93%     ` Timothy
2021-08-23 10:23 75% [PATCH] org-cite: define \citeprocitem for LaTeX export Timothy
2021-08-26  8:18 93% ` Timothy
2021-09-19 13:19 93%   ` Timothy
2021-08-23 10:27 72% [PATCH] org-cite: prevent ' from being an active char in " Timothy
2021-08-26  8:24 93% ` Timothy
2021-08-24 11:02     [PATCH] Update some changed export keybindings [worg] Stefan Kangas
2021-08-31 11:37 93% ` Timothy
2021-08-25 20:12     [BUG] Creating sparse tree with regexp property matches Cassio Koshikumo
2021-08-25 21:03     ` Daniel Fleischer
2021-08-25 22:30       ` Cassio Koshikumo
2021-08-31 11:27         ` Timothy
2021-08-31 12:28           ` Daniel Fleischer
2021-08-31 12:56             ` Timothy
2021-08-31 20:31               ` Daniel Fleischer
2021-09-01 10:28                 ` Timothy
2021-09-01 11:32                   ` Daniel Fleischer
2021-09-02  6:35                     ` [PATCH] " Daniel Fleischer
2021-09-16 15:01                       ` Daniel Fleischer
2021-09-17 10:17 85%                     ` Timothy
2021-09-02 13:44     [PATCH] Re: New source block results option for attaching file to node Greg Minshall
2021-09-03  3:10     ` Ihor Radchenko
2021-09-03  3:28       ` Ryan Scott
2021-09-05 13:22         ` Ihor Radchenko
2021-09-05 13:56           ` Ryan Scott
2021-09-10  1:04             ` Ryan Scott
2021-09-10  6:26 93%           ` Timothy
2021-09-09 22:58     [BUG?][PATCH] Should the `lexical-binding' variable be bound during src block with :lexical t? [9.4.6 (9.4.6-ga451f9 @ /home/n/.emacs.d/straight/build/org/)] No Wayman
2021-09-10  6:32 93% ` Timothy
2021-09-11  7:05     [PATCH] ob-tangle.el: Fix error in org-tangle from org-src edit buffer Mark Dawson
2021-09-19 12:57 93% ` Timothy
2021-09-16 10:34     [PATCH] Various minor docfixes found by checkdoc Stefan Kangas
2021-09-16 19:30     ` Marco Wahl
2021-09-19 13:00 93%   ` Timothy
2021-09-16 21:40     [PATCH] Fix some typos Stefan Kangas
2021-09-17  9:03 93% ` Timothy
2021-09-20 11:56     [PATCH] org-cite: Use citeproc-el to create CSL processor itemgetters András Simonyi
2021-09-20 12:29 91% ` Timothy
2021-09-24  0:03     [PATCH] org-manual.org: Augment TODO keywords example Thomas S. Dye
2021-09-24  4:39 93% ` Timothy
2021-09-24  0:06     Thomas S. Dye
2021-09-24  4:41 93% ` Timothy
2021-09-24 19:56     [PATCH] Include support for evaluating julia code Pedro Bruel
2021-09-24 20:04 93% ` Timothy
2021-09-25 14:06       ` Bastien
2021-09-25 14:13 93%     ` Timothy
2021-09-26 11:51 54% [PATCH] Timothy
2021-09-26 12:01 93% ` [PATCH] Timothy
2021-09-26 12:14 63% ` [PATCH] Timothy
2021-09-27  8:19       ` [PATCH] Bastien
2021-09-27 10:35 38%     ` [PATCH] Timothy
2021-09-27 11:45           ` [PATCH] Bastien
2021-09-27 12:20 93%         ` [PATCH] Timothy
2021-09-27 15:26               ` [PATCH] Bastien
2021-09-27 15:36 93%             ` [PATCH] Timothy
2021-09-27 17:44                   ` [PATCH] Bastien
2021-09-27 17:52 93%                 ` [PATCH] Timothy
2021-09-27 19:45                       ` [PATCH] Bastien
2021-09-28 15:31                         ` [PATCH] Bastien Guerry
2021-09-28 15:50 93%                       ` [PATCH] Timothy
2021-09-26 15:03     [PATCH] ob-svgbob: New babel backend for SVGBob Steven vanZyl
2021-09-26 20:33     ` Bastien
2021-09-26 20:35 89%   ` Timothy
2021-09-28 14:54     [PATCH] Treat :tangle-mode as an octal value not integer Jeremy Cowgar
2021-09-29 13:48 87% ` Timothy
2021-09-29 14:26       ` tomas
2021-09-29 14:58 78%     ` Timothy
2021-09-29 15:13           ` Jeremy Cowgar
2021-09-30 18:13 93%         ` Timothy
2021-09-28 14:58 64% [PATCH] (minor) Use lower case keywords in ox-org Timothy
2021-09-29 13:33 71% [PATCH] Prevent displayed images from being re-scaled Timothy
2021-10-02 20:30 93% ` Timothy
2021-10-03  4:57     ` Bastien
2021-10-03  5:45 93%   ` Timothy
2021-09-30 17:20 66% [PATCH] Don't fill displayed equations Timothy
2021-09-30 17:44 74% ` Timothy
2021-09-30 18:51     ` Nicolas Goaziou
2021-09-30 18:54 93%   ` Timothy
2021-09-30 19:02         ` Nicolas Goaziou
2021-09-30 19:28 93%       ` Timothy
2021-09-30 20:45 63%       ` Timothy
2021-09-30 22:55             ` Nicolas Goaziou
2021-10-01  7:38               ` Stefan Nobis
2021-10-01 20:41                 ` Nicolas Goaziou
2021-10-02 10:04                   ` Eric S Fraga
2021-10-02 10:18 83%                 ` Timothy
2021-10-02 11:24                       ` Eric S Fraga
2021-10-02 14:21                         ` Max Nikulin
2021-10-02 17:51                           ` Tom Gillespie
2021-10-02 18:28 93%                         ` Timothy
2021-10-01  7:43 69%           ` Timothy
2021-10-02 11:06                 ` Nicolas Goaziou
2021-10-02 11:24 93%               ` Timothy
2021-10-03  8:49                     ` Ihor Radchenko
2021-10-03  8:50 93%                   ` Timothy
2021-10-03  9:13                         ` Ihor Radchenko
2021-10-03  9:14 93%                       ` Timothy
2021-10-03  9:41                             ` Ihor Radchenko
2021-10-03  9:42 93%                           ` Timothy
2021-10-04  6:05 83%         ` Timothy
2021-10-04  7:11               ` Tom Gillespie
2021-10-04  7:15 93%             ` Timothy
2021-09-30 18:14 52% [PATCH] Accept more :tangle-mode specification forms Timothy
2021-10-01  1:24     ` Tom Gillespie
2021-10-01  6:59 71%   ` Timothy
2021-10-01  8:00         ` Stefan Nobis
2021-10-01 10:05           ` Eric S Fraga
2021-10-01 10:29             ` tomas
2021-10-01 18:04               ` Tom Gillespie
2021-10-01 18:14 82%             ` Timothy

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).