[PATCH]

2021-01-20 Thread TEC
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.

>From 635bd77cd7a2dc55cc0705c5bbf2e11091bfbaf3 Mon Sep 17 00:00:00 2001
From: TEC 
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
   "
 // @license magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt Public Domain
-
 // @license-end
 "
   "Basic JavaScript that is needed by HTML files produced by Org mode.")
 
 (defconst org-html-style-default
   "
- 
 "
   "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."
 
 
 // @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-v3-or-Later
-
 // @license-end
 "
   "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:
 

-/**/

 
 If you want to refer to an external style, use something like
-- 
2.29.2

>From 5bef340093102936efe831f85fabdb589070ce43 Mon Sep 17 00:00:00 2001
From: TEC 
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
   "

Re: [PATCH] tweaks to ox-html style

2021-01-20 Thread TEC


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  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.




Re: How can I keep Org-id links from breaking when moving files?

2021-01-20 Thread doltes


Yeah, I also found that confusing. Basically, because both mean the
same.

I think that a better description for those variables would be

+ =org-id-locations=: List obtained from `org-id-locations-file'. This
list maps each ID to the file in which the definition occurs. It
contains lists of the form (FILE ID).

+ =org-id-files=: List of files which contain ID definitions.



Re: How can I keep Org-id links from breaking when moving files?

2021-01-20 Thread arozbiz
This is helpful clarification, thank you. But does that mean that, if I
change the directory where some files with UUIDs are located, there's no
way to programmatically make sure that Org can find those IDs again (since
there's no way to simply add a folder, rather than a list of files, to
=org-id-locations= or  =org-id-files=?

Thanks,
Alan

On Wed, Jan 20, 2021 at 5:42 AM doltes  wrote:

>
> Yeah, I also found that confusing. Basically, because both mean the
> same.
>
> I think that a better description for those variables would be
>
> + =org-id-locations=: List obtained from `org-id-locations-file'. This
> list maps each ID to the file in which the definition occurs. It
> contains lists of the form (FILE ID).
>
> + =org-id-files=: List of files which contain ID definitions.
>


Re: logrepeat only logging LAST_REPEAT

2021-01-20 Thread Michael Heerdegen
Ihor Radchenko  writes:

> > Is there a way to get only the :LAST_REPEAT: prop logged, without the
> > ever-growing list?
>
> I guess you can try to play with org-log-done and org-log-repeat
> variables.

Thanks.  But as far as I recall, that's what I already tried and it
didn't help.

As far as I understand, the logging is implemented in
`org-auto-repeat-maybe', and the thing I do not want is caused by the
`org-add-log-setup' call, and that is done unconditionally unless
`org-log-repeat's value is nil.  Which I don't want because this would
also disable the "LAST_REPEAT" property setting.

Thanks,

Michael.



Re: logrepeat only logging LAST_REPEAT

2021-01-20 Thread Ihor Radchenko
Michael Heerdegen  writes:

> As far as I understand, the logging is implemented in
> `org-auto-repeat-maybe', and the thing I do not want is caused by the
> `org-add-log-setup' call, and that is done unconditionally unless
> `org-log-repeat's value is nil.  Which I don't want because this would
> also disable the "LAST_REPEAT" property setting.

You are right. Since this is hard-coded, you may have to use :around
advice to disable org-log-setup:

(cl-letf (((symbol-function org-log-setup) (lambda (&rest _) nil))) )

Best,
Ihor



Re: logrepeat only logging LAST_REPEAT

2021-01-20 Thread Michael Heerdegen
Ihor Radchenko  writes:

> You are right. Since this is hard-coded, you may have to use :around
> advice to disable org-log-setup: [...]

Do you think others may want the same and it could be worth to implement
this feature?

Michael.



greedy substitution in org-open-file

2021-01-20 Thread Maxim Nikulin
Looking into the code related to 'pty problem with 
start-process-shell-command, I have realized that the following case is 
not handled correctly:


#+begin_src elisp
  (setq org-file-apps '(("\\.pdf::\\([0-9]+\\)\\'" . "xpdf %s %1")))
#+end_src

I hope, I adapted an example from [[help:org-file-apps]] correctly. When 
I try to open the following link using C-c C-o


[[file:test-%1f.pdf::42]]

I get

Running xpdf /home/ubuntu/examples/org/test-\42f.pdf 42...done

I believe, it should be

Running xpdf /home/ubuntu/examples/org/test-%1f.pdf 42...done

Or

Running xpdf /home/ubuntu/examples/org/test-\%1f.pdf 42...done

Org mode version 9.4.4 (release_9.4.4-164-g7a9a8a

The source of the problem is that %s substitution is expanded at first 
and regexp groups are replaced later. Ideally, it should be performed in 
a single pass. I have found format-spec function but I am unsure 
concerning it, maybe it is avoided intentionally.





Re: [BUG] [C-u C-u C-c C-o] open link with external program invalid to open file

2021-01-20 Thread Maxim Nikulin

On 20/01/2021 10:21, Christopher Miles wrote:


Thanks for your working. I will modify my mailcap config temporary until Org
Mode fix this issue. You're right, this change might break some behavior of some
users. I don't understand Emacs sub-process mechanism. Can't help on this
problem. But I'm interested in this. I will take some time to study in. Anyway,
thanks for your work.


Changes could be less intrusive, see another (untested) patch. However I 
am against shell where it is really necessary.


Personally, I am not comfortable with emacs subprocess functions as 
well. I just tried to avoid creation of a pseudoterminal that could make 
some harm to GUI application. I do not know if someone uses a handler 
that really require terminal features.


I have realized that :filter argument is not appropriate to arbitrary 
handler that could spam with various assert messages. Maybe :sentinel is 
better to report configuration problem to user when handler is called 
with inappropriate arguments.


diff --git a/lisp/org.el b/lisp/org.el
index 5b1443c4e..43838783b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8765,7 +8765,9 @@ If the file does not exist, throw an error."
 
   (save-window-excursion
 	(message "Running %s...done" cmd)
-	(start-process-shell-command cmd nil cmd)
+	(make-process :name "org-open-file" :connection-type 'pipe
+		  :buffer "*Messages*" :noquery 't
+		  :command (list shell-command shell-commad-switch cmd))
 	(and (boundp 'org-wait) (numberp org-wait) (sit-for org-wait
  ((or (stringp cmd)
 	  (eq cmd 'emacs))


Re: Regression in org-element-fixed-width-parser? Extra newline added after exported block

2021-01-20 Thread General discussions about Org-mode.
On Tue, Jan 19, 2021 at 08:45:22PM +0100, mitch--- via General discussions 
about Org-mode. wrote:

> I have created a minimal test using the ox-ascii backend that shows
> the same behaviour in Org core.

Which is attached here because it forget it in the original mail.

Sorry
Christian

PS: My "From:" always gets "via General discussions about Org-mode."
appended.  Where does this come from?  I'm subscribed to this list
with same the address I use in my From: line.
-- 
Christian.Garbshttps://www.cgarbs.de

It looked so easy.
>From 93ff5348898eb68144dbc3cf602ed7fed7d212a3 Mon Sep 17 00:00:00 2001
From: Christian Garbs 
Date: Tue, 19 Jan 2021 20:07:11 +0100
Subject: [PATCH] testing/lisp/test-ox-ascii.el: Test fixed-width export in
 ox-ascii

* testing/lisp/test-ox-ascii.el: Add test of fixed-width export in
ox-ascii exporter to ensure that no extra newlines are exported after
a fixed-width block.
---
 testing/lisp/test-ox-ascii.el | 55 +++
 1 file changed, 55 insertions(+)
 create mode 100644 testing/lisp/test-ox-ascii.el

diff --git a/testing/lisp/test-ox-ascii.el b/testing/lisp/test-ox-ascii.el
new file mode 100644
index 0..aee2ee879
--- /dev/null
+++ b/testing/lisp/test-ox-ascii.el
@@ -0,0 +1,55 @@
+;;; test-ox-ascii.el --- Tests for ox-ascii.el -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021  Christian Garbs
+
+;; Author: Christian Garbs 
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see .
+
+;;; Code:
+
+(require 'ox-ascii)
+
+(defun test-org-ascii-export (input)
+  "Transform INPUT to Ascii and return the result."
+  (org-test-with-temp-text input
+			   (org-ascii-export-as-ascii)
+			   (with-current-buffer "*Org ASCII Export*"
+			 (buffer-substring-no-properties (point-min) (point-max)
+
+(ert-deftest test-org-ascii/export-fixed-width ()
+  (should (equal (test-org-ascii-export "#+AUTHOR: xyzzy
+#+OPTIONS: toc:nil
+paragraph 1
+
+: verbatim line
+:   indented verbatim line
+
+paragraph 2")
+		 "xyzzy
+
+
+paragraph 1
+
+,
+| verbatim line
+|   indented verbatim line
+`
+
+paragraph 2
+")))
+
+(provide 'test-ox-ascii)
+
+;;; test-ox-ascii.el ends here
-- 
2.20.1



Bug: [enhancement] "Insert Link" (C-c C-l) to propose completion (dired-listing?) of local files when link=local-file [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/)]

2021-01-20 Thread Guillaume MULLER



Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Hi,

This is a simple enhancement proposition for C-c C-l (insert link): when
user starts the link with ./ or / or file: , it would be great if org-mode could
propose completions based on some local-files listing (dired?)

Thanks for the great job. Emacs + Org + Lsp = Paradise :)

Emacs  : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14)
 of 2020-03-26, modified by Debian
Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
/usr/share/emacs/26.3/lisp/org/)

-- 
Guillaume MULLER
Data Scientist, PhD
Télécom Saint-Étienne (office i119)
25 rue du Dr Remy Annino
-
Laboratoire Hubert Curien (office e002)
18 rue du Pr Benoît Lauras
-
42000 Saint-Étienne
FRANCE
Mobile : +33 (0)6 51 22 33 49



signature.asc
Description: OpenPGP digital signature


[PATCH] Re: [BUG] [C-u C-u C-c C-o] open link with external program invalid to open file

2021-01-20 Thread Christopher Miles

Maxim Nikulin  writes:

> I have realized that :filter argument is not appropriate to arbitrary 
> handler that could spam with various assert messages. Maybe :sentinel is 
> better to report configuration problem to user when handler is called 
> with inappropriate arguments.

Yes, use ~:sentinel~ is better for report problem when detect process failed or
configuration error. ~:filter~ usually used in handling process output.

I "=git am=" your first patch, but failed to apply your second patch. Seems not
continuous. So I modify code manually. I found I can't find the local variable
~shell-command~, and ~shell-command-switch~. Can your provide complete patch? 
So I
can test it.

I update subject to prefix with [PATCH] so that reader knows this thread is on
patch discussion.

-- 
[ stardiviner ]
   I try to make every word tell the meaning that I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: logrepeat only logging LAST_REPEAT

2021-01-20 Thread Ihor Radchenko
Michael Heerdegen  writes:

> Do you think others may want the same and it could be worth to implement
> this feature?

It should be not too hard to implement. For example, one can add another
possible value of org-log-repeat. Patches welcome ;)

Best,
Ihor





Re: Bug: [enhancement] "Insert Link" (C-c C-l) to propose completion (dired-listing?) of local files when link=local-file [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/)]

2021-01-20 Thread Ihor Radchenko
Guillaume MULLER  writes:

> This is a simple enhancement proposition for C-c C-l (insert link): when
> user starts the link with ./ or / or file: , it would be great if org-mode 
> could
> propose completions based on some local-files listing (dired?)

org-mode does it already. Try C-c C-l file:  

Best,
Ihor




Re: [PATCH] Enhance org-html--build-meta-info

2021-01-20 Thread Kyle Meyer
TEC writes:

> TEC  writes:
>
> Sorry about that, here's an actual revision.

Thanks, this series is a good improvement as far as I can tell.  And
thank you Jens for all of the careful reviews.

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.

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:

  * Your changes replace several `and's with `when's as well as a
one-armed if.  The previous code is following the style/preference
of using `and' in cases where the return value is of interest,
leaving `when' for side effects.  As mentioned in the message below
(just the first example I found when searching the list), it's
definitely a matter of taste and not a hard rule, but please try to
stick with that convention.

https://orgmode.org/list/87d23sdtod@nicolasgoaziou.fr/

  * Please avoid adding blank lines within function definitions.

  * Please follow the project's convention of capitalizing the first
word after ": " in the commit message subject.

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.

Thanks again.


diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index bd2ca1753..11757bb35 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1431,8 +1431,8 @@ (defcustom org-html-meta-tags #'org-html-meta-tags-default
 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)."
+Also accept a function which gives such a list when called with a
+single argument (INFO, a communication plist)."
   :group 'org-export-html
   :package-version '(Org . "9.5")
   :type '(choice
@@ -1937,7 +1937,8 @@ (defun org-html--build-meta-info (info)
   (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)) ""
+ org-html-meta-tags))
+  ""
 
 (defun org-html--build-head (info)
   "Return information for the .. of the HTML output.




Re: ox-html Incorrectly (?) Puts HTML Into the `` Tag

2021-01-20 Thread Kyle Meyer
Tim Visher writes:

> Nice! I don't know enough about `org-export` but FWIW the use case I have
> is not to have an explicit `title` property but instead just the default
> title of the heading contents. I assume that's all handled transparently by
> the `(plist-get …` section.
>
> Do you have any idea the timeline for getting that patch merged?

It's been applied to master (f4b9f9808).  Please report back if you
still encounter the problem in your use case.



Re: [PATCH] Enhance org-html--build-meta-info

2021-01-20 Thread TEC


Kyle Meyer  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