Re: [BUG] [PATCH] Add yank-media and DND handler [9.6.7 (9.6.7-g6eb773 @ /home/viz/lib/emacs/straight/build/org/)]

2023-10-21 Thread Visuwesh
[திங்கள் அக்டோபர் 09, 2023] Ihor Radchenko wrote:

> Thanks!
>
>> +(defun org--dnd-attach-file (url action)
>> ...
>> +(insert
>> + (org-link-make-string
>> +  (concat (if separatep
>> +  "file:"
>> +"attachment:")
>> +  (if separatep
>> +  (expand-file-name (file-name-nondirectory filename)
>> +org-yank-image-save-type)
>> +(file-name-nondirectory filename
>> + "\n")
>> +'private))
>
>> +(pcase org--dnd-xds-method
>> +  (`attach (insert (org-link-make-string
>> +(concat "attachment:" (file-name-nondirectory 
>> filename)))
>
>> +  (`file-link (insert (org-link-make-string (concat "file:" filename))
>> +  "\n"))
>
> Is there any particular reason why you insert a newline after the image
> link?

I think this can stay here until Po Lu writes the platform-agnostic code
that you requested further down this thread?

> Also, we might want to add a subsection describing the new customization to
> 17 Miscellaneous section of the manual. Otherwise, users might have
> difficulties discovering relevant settings to customize dnd and yank
> behavior.

I have now added these to the manual with a few relevant concept
indices.  Please check if they are understandable as I am terrible at
writing documentation.  Thanks.

>From e8b142db0d91e305cbefbb2c945fee7c40ed03f3 Mon Sep 17 00:00:00 2001
From: Visuwesh 
Date: Fri, 22 Sep 2023 20:11:41 +0530
Subject: [PATCH] Add support for yank-media and DND

* lisp/org.el (org-mode): Call the setup function for yank-media and
DND.
(org-setup-yank-dnd-handlers): Register yank-media-handler and DND
handler.
(org-yank-image-save-type, org-yank-image-file-name-function)
(org-dnd-default-attach-method, org-dnd-method): New defcustoms.
(org--image-yank-media-handler, org--copied-files-yank-media-handler)
(org--dnd-attach-file, org--dnd-local-file-handler, org--dnd-xds-method)
(org--dnd-xds-function, org--dnd-rmc): Add yank-media and DND
handlers.

* doc/org-manual.org: (Drag and Drop & ~yank-media~): Describe the new
feature in the manual.

* etc/ORG-NEWS: Advertise the new features.
---
 doc/org-manual.org |  40 
 etc/ORG-NEWS   |  20 
 lisp/org.el| 243 -
 3 files changed, 298 insertions(+), 5 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 3e9d42f55..dcdaa98fa 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -21095,6 +21095,46 @@ most recent since the mobile application searches files that were last
 pulled.  To get an updated agenda view with changes since the last
 pull, pull again.
 
+** Drag and Drop & ~yank-media~
+:PROPERTIES:
+:DESCRIPTION: Dropping and pasting files and images
+:END:
+
+#+cindex: dropping files
+#+vindex: org-dnd-method
+Org can attach, insert =file:= links, or open files dropped onto an
+Emacs frame.  By default, Org asks the user what must be done with the
+dropped file but this can be changed by customizing the user option
+~org-dnd-method~.  Changing the variable can make Org do any of the
+above mentioned actions without prompting.
+
+#+vindex: org-dnd-default-attach-method
+If Org cannot figure out which attachment method to use automatically,
+it defaults to using the attachment method mentioned in
+~org-dnd-default-attach-method~.  Org uses the attachment method
+mentioned in ~org-attach-method~ by default, so Org using the =cp=
+method to attach the dropped files.
+
+#+cindex: pasting files, images from clipboard
+From Emacs 29, Org can deal with images copied to the clipboard, and
+files copied from a file manager when pasted using the command
+~yank-media~.  Org deals with them differently.
+
+#+vindex: org-yank-image-save-type
+#+vindex: org-yank-image-file-name-function
+For images, Org attaches the image when pasting but this can be
+changed by customizing ~org-yank-image-save-type~ to save them under
+another directory instead.  The name given to these images are
+autogenerated by default but you can customize what name should be
+given to the pasted image by customizing
+~org-yank-image-file-name-function~.  This function takes no argument
+and should return the filename without extension to use as the image's
+filename.
+
+For files copied from a file manager, Org attaches them to the current
+heading using the =mv= or the =cp= method if the files were cut or
+copied in the file manager respectively.
+
 * Hacking
 :PROPERTIES:
 :DESCRIPTION: How to hack your way around.
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 252c5a9f9..c4a58dd4d 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -596,6 +596,26 @@ return a matplotlib Figure object to plot. For output results, the
 current figure (as returned by =pyplot.gcf()=) is cleared before
 evaluation, and then plotted afterwards.
 
+*** Images and files in clipboard can be attached
+
+Org can now attach images

Re: Feature request: export form feed as page break

2023-10-21 Thread Jambunathan K

I am the original author of ox-odt.el.

The page break feature is available as part of
https://github.com/kjambunathan/org-mode-ox-odt

This is a fork of the ODT exporter in Emacs Orgmode.

If you are interested, please open an Discussions thread or a Issue on
Github.  Outline your requirements, and I will be happy to share a
recipe or improve the ODT exporter.

For those who rely on ODT exporter--I know there aren't many--please
consider switching to my repo.

If you are going to ask for a feature request for ODT exporter in
emacs-orgmode, you can get some lip-service, and low-effort
patches. (TLDR: The ODT exporter in Emacs is a working, but a dead
code.)

If you are going to ask for a feature request from me, you will
actually see patches.  (TLDR: I have been at this exporter for well
over 13 years now.  See my contribution activity on Github).

As a PSA, I have been working on an experimental ODS export feature in
order to help Uwe Brauer share Org mode tables (with TBLFMs) to ODS
spreadsheet with Excel formulae.

PS: ox-odt fork is a GPL software.  (People who insist on licenses and 
go crazy about it are commercial minded, or ideological nuts.  I am your 
neighbour uncle who wants to help you (and interact with you) in an 
unstructured setting ...


Jambunathan K.



On 21/10/23 13:12, Marvin Gülker wrote:

Dear list,

I am creating training material for the education of German law
students, which usually consists of a case story on one or two pages,
followed by a page break after which a proposal for resolving the case
is provided. The structure is like this because usually I provide the
case story before the meeting, where I work out a solution with the
students, and afterwards I want to provide them with complete material,
while still having everything contained in one file.

With org, I can easily export to LaTeX and thereby to PDF, and it works
quite nicely. However, for the page break I always need to write a
literal \newpage into the document, which does work, but only in LaTeX.
Since I am the only one using org/LaTeX at my chair, I have to convert
these documents to DOCX (using the ODT exporter) when a collegue wants
an editable version of them. As a LaTeX command, \newpage does not work
when exporting to ODT. I thus open the exported document manually after
the export and insert the page break using LibreOffice.

To ease this process, I would like to request that the ASCII control
character U+000C FORM FEED (displayed by emacs as ^L and also known as
`\f' in C string notation) is recognised by exporters and translated to
the corresponding page break command, that is, in LaTeX \newpage and in
ODT to the XML that makes LibreOffice start a new page. For HTML, it
could be exported as  or similar, and for exporters which have no notion of
pages, it could just be copied over to the exported document as-is.

   -MG







[BUG] org-icalendar-include-todo keyword doesn't include entries with keyword [9.7-pre (release_9.6.8-785-g72bbf8.dirty @ /home/bidar/.local/private/etc/emacs/lib/org/lisp/)]

2023-10-21 Thread Björn Bidar


* Description

I'm using org-caldav, I wanted to exclude todo without those
that don't have states that are not mapped to vtodo percent
states. So I tried to set org-icalendar-include-todo to include only
those with the todo states I want but that doesn't seem to work.
Either I select the other values the option provides (besides none)
or it won't export todos as vtodo.

* How to reproduce
1. emacs -Q or minimal org config
2. create a todo file like this one:
* TODO bar
foo
* NOT-VALID foo
bar
3. Set org-icalendar-include-todo to '("TODO")
4. C-c C-e c f
5. inspect the created ics file

Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-suse-linux-gnu, GTK+ Version 
3.24.38, cairo version 1.18.0)
Package: Org mode version 9.7-pre (release_9.6.8-785-g72bbf8.dirty @ 
/home/bidar/.local/private/etc/emacs/lib/org/lisp/)

current state:
==
(setq
 org-archive-location "%s_archive::* Archived Tasks"
 org-link-elisp-confirm-function 'yes-or-no-p
 org-directory '("/home/bidar/Dokumente/org" 
"/home/bidar/Dokumente/org/sailfishos"
 "/home/bidar/Dokumente/org/personal" 
"/home/bidar/Dokumente/org/jolla")
 org-global-properties '(("Effort_ALL" .
  "0:15 0:30 0:45 1:00 2:00 3:00 4:00 5:00 6:00 0:00")
 ("STYLE_ALL" . "habit"))
 org-after-todo-state-change-hook '(org-expiry-insert-created)
 org-caldav-backup-file "/home/bidar/.local/etc/emacs/var/org/caldav/backup.org"
 org-indirect-buffer-display 'current-window
 org-hide-emphasis-markers t
 org-bibtex-headline-format-function 'org-bibtex-headline-format-default
 org-export-with-sub-superscripts nil
 org-insert-heading-hook '(org-expiry-insert-created)
 org-yank-adjusted-subtrees t
 org-log-done 'note
 org-capture-bookmark nil
 org-pomodoro-long-break-sound 
"/home/bidar/.local/private/etc/emacs/lib/org-pomodoro/resources/bell_multiple.wav"
 org-agenda-custom-commands '(("A" "Agenda and all TODOs" ((agenda "") (alltodo 
"")))
  (" " "Current Project Agenda and TODOs"
   ((tags "REFILE") (agenda "") (alltodo ""))
   ((org-agenda-files
 '("/home/bidar/Dokumente/org/inbox.org"
   
"/home/bidar/Dokumente/org/caldav-inbox-arbeit.org"
   "/home/bidar/Dokumente/org/refile.org"
   "/home/bidar/Dokumente/org/jolla.org")
 )
)
   )
  ("j" "Jolla Agenda and TODOs"
   ((tags "REFILE") (agenda "") (alltodo ""))
   ((org-agenda-files
 '("/home/bidar/Dokumente/org/inbox.org"
   
"/home/bidar/Dokumente/org/caldav-inbox-arbeit.org"
   "/home/bidar/Dokumente/org/refile.org"
   "/home/bidar/Dokumente/org/jolla.org")
 )
)
   )
  ("p" "Personal Agenda and TODOs"
   ((tags "REFILE") (agenda "") (alltodo ""))
   ((org-agenda-files
 '("/home/bidar/Dokumente/org/inbox.org"
   
"/home/bidar/Dokumente/org/caldav-inbox-personal.org"
   
"/home/bidar/Dokumente/org/gemeinsam-inbox.org"
   "/home/bidar/Dokumente/org/gemeinsam.org"
   "/home/bidar/Dokumente/org/refile.org"
   "/home/bidar/Dokumente/org/personal.org")
 )
)
   )
  ("W" "Weekly Review"
   ((agenda "" ((org-agenda-span 7))) (stuck "")
(todo "PROJECT") (todo "MAYBE") (todo 
"WAITING"))
   )
  )
 org-log-into-drawer t
 org-koma-letter-default-class "my-letter"
 org-startup-folded t
 org-babel-after-execute-hook '(org-display-inline-images)
 org-link-abbrev-alist '(("google" . "http://www.google.com/search?q=";)
 ("gmap" . "http://maps.google.com/maps?q=%s";)
 ("omap" .
  
"http://nominatim.openstreetmap.org/search?q=%s&polygon=1";)
 ("wpen" . "http://en.wikipedia.org/wiki/%s";)
 ("wpde" . "http://de.wikipedia.org/wiki/%s";)
 ("mane" . "http://man.he.net/?topic=%s§ion=all";)
 ("JB" . "https://bugs.com/show_bug.cgi?id=%s";))
 org-agenda-files '("/home/bidar/Dokumente/org" 
"/home/bidar/Dokumente/org/sailfishos"

Re: Feature request: export form feed as page break

2023-10-21 Thread Marvin Gülker


Am Samstag, dem 21. Oktober 2023 schrieb Ihor Radchenko:
> In general, adding page breaks can make sense. The main concern is that
> the location of page breaks may or may not be export
> backend-independent. In certain scenarios, you may need to put page
> breaks in one place for odt export, but in other place in LaTeX export
> (for example, when page size is different in these two cases).

I think this conflates two different things. On the one hand, there are
typographically indicated page breaks, which appear to be those you are
thinking of here. For instance, the question where to break the page
within a running paragraph of text does depend on how many lines will
show up on the next page; if the answer is 1, better not put a break
here and rather break after the paragraph. Another example would be if
you want a page break before a heading only in certain cases dependent
on other material on the page or the page (size) itself. I agree that
this kind of page break feature cannot be represented properly in (org)
markup.

On the other hand, there are semantic page breaks. The page break I
described in the OP is of this kind – it has been added specifically to
hide the proposed solution from the first page and allow me to just
print page 1 and hand that one to the students. For this page break, the
paper size is completely irrelevant. Even if I printed on A3 for
whatever reason (maybe I ran out of A4 paper), the semantic still
requires the solution to be on page 2. It is this kind of page break I
am referring to and which I think is representable in markup.

> - In LaTeX, this is easy to achieve simply putting =\clearpage=

A quick note here: \newpage and \clearpage do different things in LaTeX
if there is floating material in the document. \clearpage typesets the
floats and then breaks the page, whereas \newpage does not consider them.

  -MG

-- 
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite
Passau, Deutschland  | kont...@guelker.eu| O<



Re: Feature request: export form feed as page break

2023-10-21 Thread Marvin Gülker
Am Samstag, dem 21. Oktober 2023 schrieb Max Nikulin:
> As a workaround you may define an Org macro that expands to
> @@latex:\newpage@@ and appropriate XML element inside @@odt:…@@.

Fair enough, this is possible, but then I have to consider each backend
I may export to and read up on how the respective backend does this. As
it stands, I just do not know how the piece inside @@odt:…@@ would have
to look like. If the decision here is to not add a page break feature to
org, then I will probably go that route, though.

> P.S. I am against using non-printable characters for markup. It might
> be an \... entity for page break inside a paragraph, "#+...:" keyword
> between block-level elements, etc.

I have no strong opinion on that, but I just thought that ^L seems like
a good fit, and I saw it used in Elisp files earlier so I thought it is
common enough to just reuse it.

  -MG

-- 
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite
Passau, Deutschland  | kont...@guelker.eu| O<



Re: Feature request: export form feed as page break

2023-10-21 Thread Max Nikulin

On 21/10/2023 16:19, Ihor Radchenko wrote:
- page breaks location is very much backend-dependent; typographic 
  detail https://list.orgmode.org/orgmode/875yhiyxnb.fsf@localhost


Is the link correct?

  Ihor Radchenko to emacs-orgmode… Re: FR: support hard-newlines
  [9.5.5 (release_9.5.5 @ /home/viz/lib/ports/emacs/lisp/org/)]
  Tue, 20 Sep 2022 21:37:44 +0800.





Re: Feature request: export form feed as page break

2023-10-21 Thread Max Nikulin

On 21/10/2023 14:42, Marvin Gülker wrote:
However, for the page break I always need to write a literal \newpage 
into the document, which does work, but only in LaTeX.


As a workaround you may define an Org macro that expands to 
@@latex:\newpage@@ and appropriate XML element inside @@odt:…@@.


Another approach is a tag or a property for headings and custom export 
backends that adds page break before or after such headings.


P.S. I am against using non-printable characters for markup. It might be 
an \... entity for page break inside a paragraph, "#+...:" keyword 
between block-level elements, etc.




Re: Case insensitivity of simple [[links]]

2023-10-21 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Ihor Radchenko  writes:
>
>> [...] loading happens before Emacs loads file-local variables. This is
>> by major mode design and we cannot do much about this. See
>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57003
>
> I see.  So, that is by design of Emacs, and Org has no built-in
> mechanism, akin to the existing #+OPTIONS, where I could say "show
> literal links", right?

We can add this to #+STARTUP options, if necessary.
It is similar to #+OPTIONS.

#+STARTUP is the way we currently work around the file-local variable
 problem.

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



Re: [PATCH] Fix obsolete sleep-for usage

2023-10-21 Thread Ihor Radchenko
gerard.vermeu...@posteo.net writes:

> Emacs-30 obsoletes the second integer  'millisec' argument of 
> 'sleep-for'
> and tells to use a float argument.  This patch fixes the obsolete usage.

Thanks!
Applied, onto main, with amendments to the commit message.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=149444511

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



Re: Feature request: IDs for everything

2023-10-21 Thread Ihor Radchenko
Tor Erlend Fjelde  writes:

> I was wondering if there's a reason why we couldn't have IDs a la
> org-id.el for everything? It seem to me that it would be useful to use
> something like `#+ID` in place of `#+NAME` for tables, blocks, etc. as
> well as headlines.

This has been discussed in the past.

Apart from #+NAME, we also have radio <<>> that can be used a
link anchors (#+NAME or other affiliated keywords are not allowed, for
example, in items).

We also discussed linking to #+name and <<>> globally, without
specifying the file path.

> Would this go against the intended design of
> org-id.el, or is this a change that would be welcome but that no one
> has gotten around to implementing yet?

Mostly nobody has gotten around.

Although we have at least one caveat that we need to consider - the
current users of the id: links blindly assume that they always link to
headings. This includes many third-party packages, like org-roam.

If we simply allow id: links to point to non-headings, it will be a
major breaking change that may affect third-party packages. So, we
need to design the extended ids carefully to avoid breakage. For
example, `org-id-find' and other API function may need to work in two
modes: (1) legacy, only searching for headings; (2) new, searching for
anything. This can, for example, be done via an extra optional argument.

-

As an alternative option, we had a proposal that extends id: links to
have a search option:

 [[id::search-string]]

Then, we may have top-level drawer like

:PROPERTIES:
:ID: unique-file-id
:END:

And then refer to anything inside the file as

 [[id:unique-file-id:object-id-inside-the-file]]

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



Re: Case insensitivity of simple [[links]]

2023-10-21 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

> [...] loading happens before Emacs loads file-local variables. This is
> by major mode design and we cannot do much about this. See
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57003

I see.  So, that is by design of Emacs, and Org has no built-in
mechanism, akin to the existing #+OPTIONS, where I could say "show
literal links", right?

Rudy
-- 
"I love deadlines.  I love the whooshing noise they make as they go by."
-- Douglas Adams, The Salmon of Doubt, 2002

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



No-description <> links

2023-10-21 Thread Rudolf Adamkovič
Hello there!

Consider the sentence

  "This is a [[link]]."

in a document with a "<>" target.

Org exports the sentence to HTML as

  "This is a No description for this link."

and to PDF as

  "This is a ."

How about we export it as

  "This is a link."

where the word "link" is the actual link?

WDYT?

Rudy
-- 
"Simplicity is complexity resolved."
-- Constantin Brâncuși, 1876-1957

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



[PATCH] Fix obsolete sleep-for usage

2023-10-21 Thread gerard . vermeulen

Hi,

Emacs-30 obsoletes the second integer  'millisec' argument of 
'sleep-for'

and tells to use a float argument.  This patch fixes the obsolete usage.

Regards -- Gerard

0001-Fix-obsolete-sleep-for-usage.patch
Description: Binary data


Re: Colons in :var header arguments

2023-10-21 Thread Ihor Radchenko
Stefano Ghirlanda  writes:

> I have run into an inconvenience in that colons in :var header
> arguments to source blocks are invariably interpreted as referring to
> another file. However, I use cleveref in LaTeX export (via org-ref) to
> automatically format references using labels like tab:data, and in
> these cases :var data=tab:data gives a reference not found because tab
> is interpreted as a filename.

I agree that it is a problem.
Attaching tentative patch that will make Org babel fall back to
searching in current file when FILE in FILE:REF does not exist.

It is technically a breaking change. If this is affecting someone's
workflow, please chime in.

>From 024cc1e6b31e9e3e9e4b8d3aee83221cb3326ee2 Mon Sep 17 00:00:00 2001
Message-ID: <024cc1e6b31e9e3e9e4b8d3aee83221cb3326ee2.1697883034.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Sat, 21 Oct 2023 13:08:55 +0300
Subject: [PATCH] org-babel-ref-resolve: Search current buffer when FILE in
 FILE:REF does not exist

* lisp/ob-ref.el (org-babel-ref-resolve): Only search in other file
when FILE in FILE:REF exists.
* doc/org-manual.org (Passing arguments):
* etc/ORG-NEWS (Babel references =FILE:REFERENCE= now search current
buffer when =FILE= does not exist): Document the change.

Reported-by: Stefano Ghirlanda 
Link: https://orgmode.org/list/cak_gy-q4f82dbdqgys+ffyeqahamxhqygq3e6zswnej-+eo...@mail.gmail.com
---
 doc/org-manual.org | 4 
 etc/ORG-NEWS   | 6 ++
 lisp/ob-ref.el | 5 +++--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index c0e9c8d7e..9a51a38a1 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -17764,6 +17764,10 @@ *** Passing arguments
 
 : :var NAME=FILE:REFERENCE
 
+When =FILE= does not exist, the reference is searched in the current
+file, using the verbatim reference.  This way,
+=:var table=tbl:example= will be searched inside the current buffer.
+
 Here are examples of passing values by reference:
 
 - table ::
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 985488016..f64081964 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -13,6 +13,12 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
 
 * Version 9.7 (not released yet)
 ** Important announcements and breaking changes
+*** Babel references =FILE:REFERENCE= now search current buffer when =FILE= does not exist
+
+When =FILE= does not exist, the reference is searched in the current
+file, using the verbatim reference.  This way,
+=:var table=tbl:example= will be searched inside the current buffer.
+
 *** New export option ~org-export-expand-links~
 
 The new option makes Org expand environment variables in link and INCLUDE paths.
diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el
index fd6927ccf..b7858569a 100644
--- a/lisp/ob-ref.el
+++ b/lisp/ob-ref.el
@@ -156,8 +156,9 @@ (defun org-babel-ref-resolve (ref)
 	  (when (string-match "^\\(.+\\):\\(.+\\)$" ref)
 	(setq split-file (match-string 1 ref))
 	(setq split-ref (match-string 2 ref))
-	(find-file split-file)
-	(setq ref split-ref))
+(when (file-exists-p split-file)
+	  (find-file split-file)
+	  (setq ref split-ref)))
 	  (org-with-wide-buffer
 	   (goto-char (point-min))
 	   (let* ((params (append args '((:results . "none"
-- 
2.42.0


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


Re: Feature request: export form feed as page break

2023-10-21 Thread Ihor Radchenko
Marvin Gülker  writes:

> 
> To ease this process, I would like to request that the ASCII control
> character U+000C FORM FEED (displayed by emacs as ^L and also known as
> `\f' in C string notation) is recognised by exporters and translated to
> the corresponding page break command, that is, in LaTeX \newpage and in
> ODT to the XML that makes LibreOffice start a new page. For HTML, it
> could be exported as  or similar, and for exporters which have no notion of
> pages, it could just be copied over to the exported document as-is.

See https://list.orgmode.org/orgmode/87mtamjrft.fsf@localhost/

In general, adding page breaks can make sense. The main concern is that
the location of page breaks may or may not be export
backend-independent. In certain scenarios, you may need to put page
breaks in one place for odt export, but in other place in LaTeX export
(for example, when page size is different in these two cases).

Below are some of my personal notes on this topic:

Page breaks is one of the common typographical settings people do use.

- In LaTeX, this is easy to achieve simply putting =\clearpage=
- However, in exports like odt, the page break may be tricky and involve direct 
xml - not great
  https://list.orgmode.org/orgmode/87leq49bu0.fsf...@posteo.net/
  
- Page breaks even make sense in text files (ASCII or even directly in Org)
  https://list.orgmode.org/orgmode/87mtamjrft.fsf@localhost
  
- Page breaks are directly supported by Emacs (filling), alongside with 
hard-newlines
  https://list.orgmode.org/orgmode/875yhiyxnb.fsf@localhost
  

We may as well add a new element to Org that marks page breaks.

+ Page break should be an object as page breaks do not necessarily split 
paragraphs
+ People also want page breaks to precede certain elements (most importantly, 
headlines)
  + This is somewhat unrelated issue though -- too complex just for a single 
syntax element
+ It would be more productive to introduce generalized syntax to prepend 
actual Org elements during export

- page breaks location is very much backend-dependent; typographic detail
  https://list.orgmode.org/orgmode/875yhiyxnb.fsf@localhost

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



Re: Feature request: IDs for everything

2023-10-21 Thread Tor Erlend Fjelde
> What could be the added benefits of having such a header argument? I can 
> think of this benefit: #+NAME would be used for referencing them through a 
> human-friendly name and the name could change and the #+ID would be an UUID 
> that is not expected to change.

This is indeed one use-case I had in mind!


Generally speaking, I would imagine the motivation is the same as for ID vs. 
CUSTOM_ID for headlines? As in, most arguments made for the introduction of 
org-id.el in the first place can be made about linking to blocks, etc. too? I 
haven't seen the original discussions around this, so I'm only speeculating 
here.

What I specifically had in mind is mainly about what you can expect from an ID 
vs. NAME. IIUC the ID property is meant to be a "globally" unique identifier, 
while something like NAME is generally only meant to only be /locally/ unique.
Hence, if you want to interact with such references programmatically, it's 
useful to have an a "globally" consistent way of referencing not just 
headlines, but also blocks, etc.

A fairly prominent example is org-roam.el, which, when they moved to v2, 
decided to solely rely on IDs rather than allowing all standard forms of Org 
links exactly because "global" consistency is so important for them.

org-id.el also just provides a lot of convenient functionality, e.g. automatic 
creation of ID if it does not yet exist, which would similarly benefit linking 
to non-files and -headlines.

Hope that clearifies a bit!

All the best,
Tor


On Fri, 20/10/2023, Rodrigo Morales  wrote:

> Currently, headlines can have an ID (see minimal working example below):
>
> #+BEGIN_SRC org
> * My headline 1
> * My headline 2
> :PROPERTIES:
> :ID: e8745be0-906d-4e02-b427-d298f5751f6c
> :END:
> #+END_SRC
>
> Blocks can't have IDs, but you could use a UUID as the for blocks (see
> minimal working example below). You can do the same with tables.
>
> #+BEGIN_SRC org
> ,#+NAME: 412f567b-26ce-4f21-b07f-f5296c830314
> ,#+BEGIN_SRC sh
> seq 1 3
> ,#+END_SRC
>
> ,#+RESULTS: 412f567b-26ce-4f21-b07f-f5296c830314
> ,#+begin_example
> 1
> 2
> 3
> ,#+end_example
>
> ,#+HEADER: :noweb yes
> ,#+BEGIN_SRC sh
> echo foo <<412f567b-26ce-4f21-b07f-f5296c830314()>>
> ,#+END_SRC
>
> ,#+RESULTS:
> ,#+begin_example
> foo 1
> foo 2
> foo 3
> foo
> ,#+end_example
> #+END_SRC
>
> What I understand from your message is that you would like to have a new
> header argument called #+ID: that could be used for code blocks and tables.
> Am I right? If so, I have a question: What could be the added benefits of
> having such a header argument? I can think of this benefit: #+NAME would be
> used for referencing them through a human-friendly name and the name could
> change and the #+ID would be an UUID that is not expected to change.
>
> On Fri, 20 Oct 2023 at 19:13, Tor Erlend Fjelde 
> wrote:
>
>> Hi all,
>>
>> I was wondering if there's a reason why we couldn't have IDs a la
>> org-id.el for everything?
>> It seem to me that it would be useful to use something like `#+ID` in
>> place of `#+NAME` for tables, blocks, etc. as well as headlines.
>> Would this go against the intended design of org-id.el, or is this a
>> change that would be welcome but that no one has gotten around to
>> implementing yet?
>>
>> Also, sorry if this is not correct way to go about this; it's my first
>> time posting to a mailing list. Let me know if there are some guidelines or
>> something somewhere that I should read and make use of.
>>
>> All the best,
>> Tor
>>
>>



[TASK] Allow customizeable ditaa executable in ob-ditaa.el (was: org-ditaa woes)

2023-10-21 Thread Ihor Radchenko
"Dr. Arne Babenhauserheide"  writes:

>>> In my current source I see [...]
>>>
>>> (use C-h v org-babel-ditaa-java-cmd to see the value of the java
>>> executable — you can then customize this to use a different command)
>>
>> As far as I understand that part of code it still kind-of assumes that
>> I'm using a command line of type "java -jar ditaa.jar ...", just with
>> more flexibility in choosing which "java" command I'm using, right?
>
> Yes, it does. ob-plantuml already migrated to allow a regular command,
> but ob-ditaa still only enables using the jar directly.
>
> That is something which would be nice to fix — and ob-plantuml should
> show the path forward.

+1
This is a relatively simple task.
One can indeed use ob-plantuml as a reference to extend ob-ditaa.
Patches welcome!

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



Feature request: export form feed as page break

2023-10-21 Thread Marvin Gülker
Dear list,

I am creating training material for the education of German law
students, which usually consists of a case story on one or two pages,
followed by a page break after which a proposal for resolving the case
is provided. The structure is like this because usually I provide the
case story before the meeting, where I work out a solution with the
students, and afterwards I want to provide them with complete material,
while still having everything contained in one file.

With org, I can easily export to LaTeX and thereby to PDF, and it works
quite nicely. However, for the page break I always need to write a
literal \newpage into the document, which does work, but only in LaTeX.
Since I am the only one using org/LaTeX at my chair, I have to convert
these documents to DOCX (using the ODT exporter) when a collegue wants
an editable version of them. As a LaTeX command, \newpage does not work
when exporting to ODT. I thus open the exported document manually after
the export and insert the page break using LibreOffice.

To ease this process, I would like to request that the ASCII control
character U+000C FORM FEED (displayed by emacs as ^L and also known as
`\f' in C string notation) is recognised by exporters and translated to
the corresponding page break command, that is, in LaTeX \newpage and in
ODT to the XML that makes LibreOffice start a new page. For HTML, it
could be exported as  or similar, and for exporters which have no notion of
pages, it could just be copied over to the exported document as-is.

  -MG

-- 
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | PGP: Siehe Webseite
Passau, Deutschland  | kont...@guelker.eu| O<



Re: org-ditaa woes

2023-10-21 Thread Dr. Arne Babenhauserheide

Florin Boariu  writes:
> Replying to Arne's comment:
>
>> In my current source I see [...]
>>
>> (use C-h v org-babel-ditaa-java-cmd to see the value of the java
>> executable — you can then customize this to use a different command)
>
> As far as I understand that part of code it still kind-of assumes that
> I'm using a command line of type "java -jar ditaa.jar ...", just with
> more flexibility in choosing which "java" command I'm using, right?

Yes, it does. ob-plantuml already migrated to allow a regular command,
but ob-ditaa still only enables using the jar directly.

That is something which would be nice to fix — and ob-plantuml should
show the path forward.

> I've just tried setting org-babel-ditaa-java-cmd to "/usr/bin/ditaa",
> and org-ditaa-jar-option to "", but now the error is something like:
>
>> /usr/bin/ditaa   /orgfile/base/folder  \
>>  /tmp/babel-0YxwcE/ditaa-NyIQwH \
>>  /orgfile/base/folder/network.png
>
> where "/orgfile/base/folder" is the dirname of the full path of my
> .org file (e.g. something like /orgfile/base/folder/file.org).
>
> So org-ditaa apparently somewhere still tries to set a work directory
> (or so?) after the org-ditaa-jar-option part. I'm not exactly sure
> which code version the current Emacs Flatpak has, and I don't know how
> to look (I'm not *that* much of a Flatpak nerd :-p ) But if I had to
> bet, I'd assume it's a fairly recent one.

If you do the C-h v org-ditaa-jar-option command, you should normally
have a link to ob-ditaa.el in your help buffer. You can click that to
get the source.

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


signature.asc
Description: PGP signature