Re: [PATCH] ob-python: support header argument `:results file graphics'

2023-07-13 Thread Jack Kamm
Ihor Radchenko  writes:

> We may instead arrange org-lint and possibly ob-core to throw a
> warning when an src block uses confusing setting combinations.
> Without changing the underlying behaviour.
> Basically, discourage using confusing staff.
> ...
> We should update the docs to avoid such examples.
> ...
> We should generally rewrite that part of the manual, I think.
> My previous message was a tentative outline on how the things should be
> presented in the manual.
> ...
>> IMO the more technically correct approach is in the ob-python patch
>> that I proposed a couple years ago [2], and plan to revisit soon. In
>> that patch, ob-python ":results graphics output" will plot from
>> pyplot.gcf(), while ":results graphics value" will expect a
>> matplotlib.Figure object to be returned for plotting.
>
> Sounds reasonable. Let me know if you need any help along the way.

Thank you. And likewise, I agree with your suggestions to update
org-lint, org-manual, and Worg, and will try to help where I can. (I
might be a little slow to start due to other deadlines the next couple
weeks).



Re: [PATCH] ob-python: Fix async evaluation

2023-07-13 Thread Jack Kamm
Liu Hui  writes:

> Thanks for pointing out the problem! I find the problem disappears
> after removing the `run-python` line, and I have updated the patch
> accordingly.

Thank you. I applied your patch to main branch.

I am curious why the previous version of your test was causing hanging
-- whether it indicates a bug in ob-python, or just an issue with the
testing. Would be good to look into it more...



[Pre-PATCH v2] Add the capability to specify lexical scope in tangled files (was: Add new :lexical header argument)

2023-07-13 Thread General discussions about Org-mode.

Ihor Radchenko  writes:

> Evgenii Klimov  writes:
>
>> * lisp/ob-core.el (org-babel-common-header-args-w-values): Add new
>> :lexical header argument.
>
> A short note: ob-emacs-lisp already defines :lexical header arg. See
> org-babel-header-args:emacs-lisp.

Thanks for pointing it out. Updated the patch to reflect your note and
documented the change.

>From 7e75b55ccb4e82d9341b6b308b558e5d01df5128 Mon Sep 17 00:00:00 2001
From: Evgenii Klimov 
Date: Thu, 13 Jul 2023 18:16:08 +0100
Subject: [PATCH v2] ob-tangle.el: Add the capability to specify lexical scope
 in tangled files

* lisp/ob-tangle.el (org-babel-tangle): Add the ability to enable
lexical binding in Elisp tangled file.

* etc/ORG-NEWS (=:lexical= header argument now influences tangled
files): Document this change.

Previously one could achieve this manually, but 1) had to keep in mind
to hold this source block top-most, 2) couldn't use comment header
argument, as `lexical-binding' variable must be set in the first line
of a file.
---
 etc/ORG-NEWS  | 7 +++
 lisp/ob-tangle.el | 9 +++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index a4725ae8c..c632c4814 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -284,6 +284,13 @@ setting the ~STYLE~ property for each sub-task.
 The change is breaking when ~org-use-property-inheritance~ is set to ~t~.
 
 ** New and changed options
+*** =:lexical= header argument now influences tangled files
+
+When extracting an Elisp src block, the target's file
+~lexical-binding~ variable is set according to the src block's
+=:lexical= parameter.  If at least one block is set to lexical scope,
+then the whole file will be with lexical scope.
+
 *** Commands affected by ~org-fold-catch-invisible-edits~ can now be customized
 
 New user option ~org-fold-catch-invisible-edits-commands~ controls
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 1274d0db7..10fe5dcf5 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -262,7 +262,7 @@ expression."
 	 (when file-name
(let ((lspecs (cdr by-fn))
 		 (fnd (file-name-directory file-name))
-		 modes make-dir she-banged lang)
+		 modes make-dir she-banged scoped lang)
 	 ;; drop source-blocks to file
 	 ;; We avoid append-to-file as it does not work with tramp.
 	 (with-temp-buffer
@@ -273,6 +273,8 @@ expression."
 			 (get-spec (lambda (name) (cdr (assq name (nth 4 spec)
 			 (she-bang (let ((sheb (funcall get-spec :shebang)))
  (when (> (length sheb) 0) sheb)))
+ (lexicalp (org-babel-emacs-lisp-lexical
+(funcall get-spec :lexical)))
 			 (tangle-mode (funcall get-spec :tangle-mode)))
 		(unless (string-equal block-lang lang)
 			  (setq lang block-lang)
@@ -294,7 +296,10 @@ expression."
 		(when (and she-bang (not she-banged))
 			  (insert (concat she-bang "\n"))
 			  (setq she-banged t))
-		(org-babel-spec-to-string spec)
+(org-babel-spec-to-string spec)
+		(when (and lexicalp (not scoped))
+			  (save-excursion (elisp-enable-lexical-binding))
+			  (setq scoped t))
 		(setq block-counter (+ 1 block-counter
 		lspecs)
 		   (when make-dir
-- 
2.34.1



Re: [Pre-PATCH] Add new :lexical header argument

2023-07-13 Thread Ihor Radchenko
Evgenii Klimov  writes:

> * lisp/ob-core.el (org-babel-common-header-args-w-values): Add new
> :lexical header argument.

A short note: ob-emacs-lisp already defines :lexical header arg. See
org-babel-header-args:emacs-lisp.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[Pre-PATCH] Add new :lexical header argument

2023-07-13 Thread Evgenii Klimov
Hi, here I propose new header argument to enable scope change
(lexical/dynamic binding) of the tangled file.  We have :shebang header
argument and the new one behaves similarly.

If you like the idea I think we should discuss the following:
- should we allow to set it for non-elisp blocks?  e.g. :shebang is not
  restricted and `elisp-enable-lexical-binding' is smart enough to use
  the comment symbol appropriate to the context. 
- should it be :lexical or :scope.  :lexical is long to type, but boolean
  and clear; scope is shorter, but the user will have to type
  "dynamic/lexical" or "dyn/lex".
- should we add the third option of the argument to explicitly forbid
  lexical binding?  E.g. if we a have source block that rely on the
  dynamic binding but it could be used in another block with lexical
  binding via noweb. I'm not sure that it's worth the effort.
- which default value to choose?  Currently if you tangle it would be
  dynamic, but lexical binding is the future.

After all I'll add tests and update Changelog/Docs if needed.

>From 3ad56137cb709182dc1bc242cd80a1474078cb95 Mon Sep 17 00:00:00 2001
From: Evgenii Klimov 
Date: Thu, 13 Jul 2023 18:16:08 +0100
Subject: [PATCH] ob-tangle.el: Add new :lexical header argument

* lisp/ob-tangle.el (org-babel-tangle-use-lexical-binding): Add
new customization variable.
(org-babel-tangle): Add ability to enable lexical binding in
tangled file.

* lisp/ob-core.el (org-babel-common-header-args-w-values): Add new
:lexical header argument.

Previously one could achieve this manually, but 1) had to keep in mind
to hold this source block top-most, 2) couldn't use comment header
argument, as `lexical-binding' variable must be set in the first line
of a file.
---
 lisp/ob-core.el   |  1 +
 lisp/ob-tangle.el | 15 +--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 47410b53f..c1801a677 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -437,6 +437,7 @@ then run `org-babel-switch-to-session'."
 (sep	. :any)
 (session	. :any)
 (shebang	. :any)
+(lexical. ((yes no)))
 (tangle	. ((tangle yes no :any)))
 (tangle-mode . ((#o755 #o555 #o444 :any)))
 (var	. :any)
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 1274d0db7..916dd8489 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -76,6 +76,11 @@ then the name of the language is used."
   :group 'org-babel-tangle
   :type 'boolean)
 
+(defcustom org-babel-tangle-use-lexical-binding nil
+  "Enable lexical binding in tangled file by default."
+  :group 'org-babel-tangle
+  :type 'boolean)
+
 (defcustom org-babel-post-tangle-hook nil
   "Hook run in code files tangled by `org-babel-tangle'."
   :group 'org-babel-tangle
@@ -262,7 +267,7 @@ expression."
 	 (when file-name
(let ((lspecs (cdr by-fn))
 		 (fnd (file-name-directory file-name))
-		 modes make-dir she-banged lang)
+		 modes make-dir she-banged scoped lang)
 	 ;; drop source-blocks to file
 	 ;; We avoid append-to-file as it does not work with tramp.
 	 (with-temp-buffer
@@ -273,6 +278,9 @@ expression."
 			 (get-spec (lambda (name) (cdr (assq name (nth 4 spec)
 			 (she-bang (let ((sheb (funcall get-spec :shebang)))
  (when (> (length sheb) 0) sheb)))
+ (lexicalp (or (string-equal (funcall get-spec :lexical)
+ "yes")
+   org-babel-tangle-use-lexical-binding))
 			 (tangle-mode (funcall get-spec :tangle-mode)))
 		(unless (string-equal block-lang lang)
 			  (setq lang block-lang)
@@ -294,7 +302,10 @@ expression."
 		(when (and she-bang (not she-banged))
 			  (insert (concat she-bang "\n"))
 			  (setq she-banged t))
-		(org-babel-spec-to-string spec)
+(org-babel-spec-to-string spec)
+		(when (and lexicalp (not scoped))
+			  (save-excursion (elisp-enable-lexical-binding))
+			  (setq scoped t))
 		(setq block-counter (+ 1 block-counter
 		lspecs)
 		   (when make-dir
-- 
2.34.1



Re: [PATCH] org.el: Remove undefined dynamic variable `org-log-states' from example

2023-07-13 Thread Ihor Radchenko
Evgenii Klimov  writes:

> Ihor Radchenko  writes:
>
>> It looks like 5 working days have passed since your email to FSF. If so,
>> please follow up once and wait another 5 working days.
>
> I've got papers from FSF, signed it and sent it back. It was 6 working
> days ago. 5 days that you mention is for the first response from them, I
> guess?

For any response.

The basic policy is

   When the contributor emails the form to the FSF, the FSF sends per an
   electronic (usually PDF) copy of the assignment. This, or __whatever
   response is required__, should happen within five business days of the
   initial request. If no reply from the FSF comes after that time,
   please send a reminder.
https://www.gnu.org/prep/maintain/maintain.html

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)

2023-07-13 Thread Jonathan Gregory

Hi

On 13 Jul 2023, Ihor Radchenko wrote:


Jonathan Gregory  writes:


Can you check if adding:

\version "2.24.1"
#(ly:set-option 'use-paper-size-for-page #f)
#(ly:set-option 'tall-page-formats 'pdf)

to the version-and-paper block fixes the issue.


Yes, except that I have lilypond 2.24.0, which failed until I 
changed the version to fit my lilypond version.


Do you happen to know the minimal required version needed for 
your change to work? And do we need that \version line at all?


I'd keep the version in sync with the stable release, but I guess 
that's up to the maintainer. The documentation says that "Every 
LilyPond file should contain a version statement":


The version statement is important for at least two reasons. 
First, it allows automatic updating of the input file as LilyPond 
syntax changes. Second, it describes the version of LilyPond 
needed to compile the file.


If the version statement is omitted from an input file, LilyPond 
prints a warning during the compilation of the file. 


--
Jonathan



[PATCH v2] ob-tangle.el: Blocks overwrite each other when grouping before tangling

2023-07-13 Thread Evgenii Klimov
In this version I just updated the docstrings for the relevant
functions, because prior to that it wasn't clear: does this "default
export file for *all* source blocks" influence blocks with :tangle
"yes"/FILENAME?

>From 1a4f76960cf11fb192f2bee2cdc8778c7b897f1a Mon Sep 17 00:00:00 2001
From: Evgenii Klimov 
Date: Wed, 12 Jul 2023 19:24:48 +0100
Subject: [PATCH v2] ob-tangle.el: Avoid relative file names when grouping
 blocks to tangle

* lisp/ob-tangle.el (org-babel-effective-tangled-filename): Avoid
using relative file names that could cause one block to overwrite the
others in `org-babel-tangle-collect-blocks' if they have the same
target file but in different formats.
(org-babel-tangle-file, org-babel-tangle): Clarify the meaning of the
TARGET-FILE argument.
---
 lisp/ob-tangle.el | 34 +-
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 25129616f..1274d0db7 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -194,11 +194,12 @@ evaluating BODY."
 
 ;;;###autoload
 (defun org-babel-tangle-file (file  target-file lang-re)
-  "Extract the bodies of source code blocks in FILE.
+  "Extract the bodies of source code blocks from FILE.
 Source code blocks are extracted with `org-babel-tangle'.
 
 Optional argument TARGET-FILE can be used to specify a default
-export file for all source blocks.
+export file for all source blocks without :tangle header
+argument.
 
 Optional argument LANG-RE can be used to limit the exported
 source code blocks by languages matching a regular expression.
@@ -230,9 +231,10 @@ With one universal prefix argument, only tangle the block at point.
 When two universal prefix arguments, only tangle blocks for the
 tangle file of the block at point.
 Optional argument TARGET-FILE can be used to specify a default
-export file for all source blocks.  Optional argument LANG-RE can
-be used to limit the exported source code blocks by languages
-matching a regular expression."
+export file for all source blocks without :tangle header
+argument.  Optional argument LANG-RE can be used to limit the
+exported source code blocks by languages matching a regular
+expression."
   (interactive "P")
   (run-hooks 'org-babel-pre-tangle-hook)
   ;; Possibly Restrict the buffer to the current code block
@@ -427,17 +429,23 @@ that the appropriate major-mode is set.  SPEC has the form:
 		org-babel-tangle-comment-format-end link-data)
 
 (defun org-babel-effective-tangled-filename (buffer-fn src-lang src-tfile)
-  "Return effective tangled filename of a source-code block.
+  "Return effective tangled absolute filename of a source-code block.
 BUFFER-FN is the name of the buffer, SRC-LANG the language of the
 block and SRC-TFILE is the value of the :tangle header argument,
 as computed by `org-babel-tangle-single-block'."
-  (let ((base-name (cond
-((string= "yes" src-tfile)
- ;; Use the buffer name
- (file-name-sans-extension buffer-fn))
-((string= "no" src-tfile) nil)
-((> (length src-tfile) 0) src-tfile)))
-(ext (or (cdr (assoc src-lang org-babel-tangle-lang-exts)) src-lang)))
+  (let* ((fnd (file-name-directory (buffer-file-name
+(get-buffer buffer-fn
+ (base-name (cond
+ ((string= "yes" src-tfile)
+  ;; Use the buffer name
+  (file-name-concat fnd
+(file-name-sans-extension buffer-fn)))
+ ((string= "no" src-tfile) nil)
+ ((> (length src-tfile) 0)
+  (if (file-name-directory src-tfile)
+  src-tfile
+(file-name-concat fnd src-tfile)
+ (ext (or (cdr (assoc src-lang org-babel-tangle-lang-exts)) src-lang)))
 (when base-name
   ;; decide if we want to add ext to base-name
   (if (and ext (string= "yes" src-tfile))
-- 
2.34.1



Improve org-insert-link completion (was: [Bug] org-insert-link removes on one link from 2 added by org-store-link)

2023-07-13 Thread Ihor Radchenko
Samuel Wales  writes:

> link has already been stored is a bug in my case in that i can't just
> go to a header, grab it [whether rabbed bfere or not] and then paste
> it.  i surprise easily when the wrong link gets pasted.

This has been fixed already.

> in answer to a q by ihor, indeed puttig previously stored id liks as
> descriptions in front of all the prefixes woudl be useful to me, but
> idk who is doing the sorting, so idk whether it wold make a difference
> but if it dos then gret..]

Org is actually not supposed to control sorting. It is to be customized
by user via `completions-sort'.

What we can do instead is provide grouping metadata.

Below, I provide a simple demo on how it looks like.
However, the demo will only make a difference starting from Emacs 28
that has the necessary completion API.

(defun org--complete-links (string predicate flag)
  (let* ((links '(:type ("id:" "file:") :path ("/a/a/b" "file.org") 
:description ("foo" "barr" "baz")))
 (all-links (append (plist-get links :type) (plist-get links :path) 
(plist-get links :description)))
 matches)
(pcase flag
  (`nil (try-completion string all-links predicate))
  (`t (all-completions string all-links predicate))
  (`lambda (test-completion string all-links predicate))
  (`(boundaries . suffix) (completion-boundaries string all-links predicate 
suffix))
  (`metadata
   `(metadata
 (group-function
  .
  (lambda (completion transform)
(if transform completion
  (let ((links ',links))
(cond
 ((member completion (plist-get links :type)) "Link type")
 ((member completion (plist-get links :path)) "Link path")
 ((member completion (plist-get links :description)) "Link 
description")))


(completing-read "Test: " #'org--complete-links)

> it seems org-insert-=inki is overloaded.  one use case says insert a
> previously stored link.  the other says insert a brand new link which
> i will now specify.  might it be useful to separate those two
> functions?

I do not see why it is overloaded. The last stored link is used as
default completion option, which is a common practice.

You can also use C-u 1 C-c C-M-l to insert the last stored link.
Or just C-c C-M-l.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)

2023-07-13 Thread Ihor Radchenko
Jonathan Gregory  writes:

> Can you check if adding:
>
> \version "2.24.1"
> #(ly:set-option 'use-paper-size-for-page #f)
> #(ly:set-option 'tall-page-formats 'pdf)
>
> to the version-and-paper block fixes the issue.

Yes, except that I have lilypond 2.24.0, which failed until I changed
the version to fit my lilypond version.

Do you happen to know the minimal required version needed for your
change to work? And do we need that \version line at all?

> Also, I believe tagline = "" is now the only variable needed.

Looks like this on my side as well.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] ob-python: Fix async evaluation

2023-07-13 Thread Liu Hui
Jack Kamm  于2023年7月13日周四 05:58写道:

> While your test works on its own, it seems to break subsequent tests
> (the next test hangs).

Thanks for pointing out the problem! I find the problem disappears
after removing the `run-python` line, and I have updated the patch
accordingly.
From 4c552eb4eec5d84727775645cdf41acebd7fd1da Mon Sep 17 00:00:00 2001
From: Liu Hui 
Date: Wed, 12 Jul 2023 18:07:06 +0800
Subject: [PATCH] ob-python: Fix async evaluation

* lisp/ob-python.el (org-babel-python-async-evaluate-session): Bind
`python-shell-buffer-name' inside the temp buffer.
* testing/lisp/test-ob-python.el (test-ob-python/async-local-python-shell):
Add test.
---
 lisp/ob-python.el  | 47 ++
 testing/lisp/test-ob-python.el | 14 ++
 2 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/lisp/ob-python.el b/lisp/ob-python.el
index 0e0539d7a..c15d45b96 100644
--- a/lisp/ob-python.el
+++ b/lisp/ob-python.el
@@ -400,28 +400,31 @@ (defun org-babel-python-async-evaluate-session
session (current-buffer)
"ob_comint_async_python_\\(.+\\)_\\(.+\\)"
'org-babel-chomp 'org-babel-python-async-value-callback)
-  (let ((python-shell-buffer-name (org-babel-python-without-earmuffs session)))
-(pcase result-type
-  (`output
-   (let ((uuid (org-id-uuid)))
- (with-temp-buffer
-   (insert (format org-babel-python-async-indicator "start" uuid))
-   (insert "\n")
-   (insert body)
-   (insert "\n")
-   (insert (format org-babel-python-async-indicator "end" uuid))
-   (python-shell-send-buffer))
- uuid))
-  (`value
-   (let ((tmp-results-file (org-babel-temp-file "python-"))
- (tmp-src-file (org-babel-temp-file "python-")))
- (with-temp-file tmp-src-file (insert body))
- (with-temp-buffer
-   (insert (org-babel-python-format-session-value tmp-src-file tmp-results-file result-params))
-   (insert "\n")
-   (insert (format org-babel-python-async-indicator "file" tmp-results-file))
-   (python-shell-send-buffer))
- tmp-results-file)
+  (pcase result-type
+(`output
+ (let ((uuid (org-id-uuid)))
+   (with-temp-buffer
+ (insert (format org-babel-python-async-indicator "start" uuid))
+ (insert "\n")
+ (insert body)
+ (insert "\n")
+ (insert (format org-babel-python-async-indicator "end" uuid))
+ (let ((python-shell-buffer-name
+(org-babel-python-without-earmuffs session)))
+   (python-shell-send-buffer)))
+   uuid))
+(`value
+ (let ((tmp-results-file (org-babel-temp-file "python-"))
+   (tmp-src-file (org-babel-temp-file "python-")))
+   (with-temp-file tmp-src-file (insert body))
+   (with-temp-buffer
+ (insert (org-babel-python-format-session-value tmp-src-file tmp-results-file result-params))
+ (insert "\n")
+ (insert (format org-babel-python-async-indicator "file" tmp-results-file))
+ (let ((python-shell-buffer-name
+(org-babel-python-without-earmuffs session)))
+   (python-shell-send-buffer)))
+   tmp-results-file
 
 (provide 'ob-python)
 
diff --git a/testing/lisp/test-ob-python.el b/testing/lisp/test-ob-python.el
index 7aac87116..82fbca36e 100644
--- a/testing/lisp/test-ob-python.el
+++ b/testing/lisp/test-ob-python.el
@@ -296,6 +296,20 @@ (ert-deftest test-ob-python/async-output-drawer ()
  (string= (concat src-block result)
   (buffer-string)))
 
+(ert-deftest test-ob-python/async-local-python-shell ()
+  ;; Disable the test on older Emacs as built-in python.el sometimes
+  ;; fail to initialize session.
+  (skip-unless (version<= "28" emacs-version))
+  (when-let ((buf (get-buffer "*Python*")))
+(let (kill-buffer-query-functions)
+  (kill-buffer buf)))
+  (org-test-with-temp-text-in-file
+  "# -*- python-shell-buffer-name: \"Python 3\" -*-
+#+begin_src python :session \"*Python 3*\" :async yes
+1
+#+end_src"
+(should (org-babel-execute-src-block
+
 (provide 'test-ob-python)
 
 ;;; test-ob-python.el ends here
-- 
2.25.1



Re: [PATCH] testing: Delete duplicate tests

2023-07-13 Thread Ihor Radchenko
Ilya Chernyshov  writes:

> In my last patch, I found a duplicate test, so I decided to find all of
> the duplicate tests inside testing/lisp/ folder via this function:

Thanks!

> --- a/testing/lisp/test-org-table.el
> +++ b/testing/lisp/test-org-table.el
> @@ -3368,10 +3368,6 @@ See also `test-org-table/copy-field'."
> (org-test-with-temp-text "| 1 | 2 | 3 |"
>   (org-table-get-field 3 " foo ")
>   (buffer-string
> -  (should
> -   (equal " 4 "
> -   (org-test-with-temp-text "| 1 | 2 |\n| 3 | 4 |"
> - (org-table-get-field 2

It looks like the real test is supposed to be

(equal " foo "
...
(org-table-get-field 2 " foo ")
(buffer-string)

> --- a/testing/lisp/test-org.el
> +++ b/testing/lisp/test-org.el
> @@ -994,14 +994,6 @@
> (org-auto-fill-function)
> (buffer-string)
>;; Comment block: auto fill contents.
> -  (should
> -   (equal "#+BEGIN_COMMENT\n12345\n7890\n#+END_COMMENT"
> -   (org-test-with-temp-text "#+BEGIN_COMMENT\n12345 7890\n#+END_COMMENT"
> - (let ((fill-column 5))
> -   (forward-line)
> -   (end-of-line)
> -   (org-auto-fill-function)
> -   (buffer-string)
>(should
> (equal "#+BEGIN_COMMENT\n12345\n7890\n#+END_COMMENT"
> (org-test-with-temp-text "#+BEGIN_COMMENT\n12345 7890\n#+END_COMMENT"

And this is the result of 8a97c60
Do not fill verse blocks contents

* lisp/org.el (org-fill-context-prefix, org-fill-paragraph): Do not
  fill verse blocks contents.  Verse blocks can be used to format
  free-form poetry, so filling has to be done manually.
* testing/lisp/test-org.el: Remove unnecessary tests.

The test was changed from testing verse block into a duplicate.
I think the right thing to do here would be `should-not' + old version
of the test with VERSE block.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] WORG example for ob-lilypond is no longer working as described

2023-07-13 Thread Jean Abou Samra
Le jeudi 13 juillet 2023 à 08:33 +0200, Dr. Arne Babenhauserheide a écrit :
> This is the lilypond-file in questoin:
> https://hg.sr.ht/~arnebab/draketos-songbook/browse/delfini-tune.ly?rev=tip
> 
> Converted to PNG in a two step process:
> lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts --pdf -o
> "$(basename "$i" .ly)"-lily $i
> convert -density 600 "$(basename "$i" .ly)"-lily.pdf "$(basename "$i"
> .ly)".png
> 
> @lilypond-user: I didn’t find solutions, so I’m CC’ing you as those who
>     might know. Can the page layout be changed to only the
>     content, not the whole page?




Yes, but the exact way to do it depends on what exactly you want.

The -dbackend=eps option has been obsoleted in version 2.24 and is now handled
in a way that is partly backwards compatible but not entirely. The up-to-date
documentation on the family of options that replaces it is here:

https://lilypond.org/doc/v2.24/Documentation/usage/other-programs




signature.asc
Description: This is a digitally signed message part


Re: [BUG] WORG example for ob-lilypond is no longer working as described

2023-07-13 Thread Dr. Arne Babenhauserheide

"Dr. Arne Babenhauserheide"  writes:

> Ihor Radchenko  writes:
>
>> "Dr. Arne Babenhauserheide"  writes:
>>
>>> I typically use it directly, but if the maintenance burden is
>>> manageable, I could offer maintenance here, too (once I have the papers
>>> in place).
>>
>> I have recently seen https://masto.ai/@rfc1149/110674961710491363 that
>> revealed a problem with example from
>> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html#org29a742f
>>
>> Instead of lilypond fragments, full pages are inserted when exporting to pdf.
>>
>> Upon further investigation, it looks like something changed in how
>> Lilypond defines page layout.

> @lilypond-user: I didn’t find solutions, so I’m CC’ing you as those who
> might know. Can the page layout be changed to only the
> content, not the whole page?

Jonathan suggested

\version "2.24.1"
#(ly:set-option 'use-paper-size-for-page #f)
#(ly:set-option 'tall-page-formats 'pdf)

This works for me.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


Re: [BUG] WORG example for ob-lilypond is no longer working as described (was: Moving some lisp/ob-*.el files to org-contrib - your advice?)

2023-07-13 Thread Dr. Arne Babenhauserheide

Jonathan Gregory  writes:

> Hi Ihor
>
> On 12 Jul 2023, Ihor Radchenko wrote:
>
> [...]
>
>> I have recently seen https://masto.ai/@rfc1149/110674961710491363
>> that revealed a problem with example from
>> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html#org29a742f
>>
>> Instead of lilypond fragments, full pages are inserted when
>> exporting to pdf.
>>
>> Upon further investigation, it looks like something changed in how
>> Lilypond defines page layout.
>
> Can you check if adding:
>
> \version "2.24.1"
> #(ly:set-option 'use-paper-size-for-page #f)
> #(ly:set-option 'tall-page-formats 'pdf)

For a plain Lilypond file this works! It does not even need the version
(I tried it with \version "2.19.80").

Thank you!

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


Re: [BUG] WORG example for ob-lilypond is no longer working as described

2023-07-13 Thread Dr. Arne Babenhauserheide

Ihor Radchenko  writes:

> "Dr. Arne Babenhauserheide"  writes:
>
>> I typically use it directly, but if the maintenance burden is
>> manageable, I could offer maintenance here, too (once I have the papers
>> in place).
>
> I have recently seen https://masto.ai/@rfc1149/110674961710491363 that
> revealed a problem with example from
> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html#org29a742f
>
> Instead of lilypond fragments, full pages are inserted when exporting to pdf.
>
> Upon further investigation, it looks like something changed in how
> Lilypond defines page layout.
>
> Arne, maybe you can point me in the right direction?

I would love to, because I have the same problem. But the only solution
I found was to crop the images that get inserted from lilypond:

\includegraphics[width=0.96\linewidth, keepaspectratio, trim=0 160cm 0 
0]{delfini-tune}% trim, because lilypond creates full-page pngs

This is the lilypond-file in questoin:
https://hg.sr.ht/~arnebab/draketos-songbook/browse/delfini-tune.ly?rev=tip

Converted to PNG in a two step process:
lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts --pdf -o 
"$(basename "$i" .ly)"-lily $i
convert -density 600 "$(basename "$i" .ly)"-lily.pdf "$(basename "$i" .ly)".png

@lilypond-user: I didn’t find solutions, so I’m CC’ing you as those who
might know. Can the page layout be changed to only the
content, not the whole page?

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature