Re: org-capture firefox extension not capture in some cases

2023-10-07 Thread Samuel Wales
i am using firefox org-capture extension with the unicorn label on the
toolbar in firefox.  seems likely that this
possibly-tangential-to-org-per-se message is really wether the
extension is supposed to be able to capture js webmail content text,
or so.  but idk.  it could be an org connection of some type.


On 10/7/23, Ihor Radchenko  wrote:
> Samuel Wales  writes:
>
>> in html gmail, i can capture message body text and whatever else.
>>
>> gmail has an html version and a js version.  html is faster and better for
>> me.
>>
>> in disroot.org, if i try to capture message body text, it seems to
>> capture just the link but does not capture the message body text.
>
> Are you using bookmarklet? Particular extension?
>
> From Org perspective, all we care about is the data passed to Emacs via
> org-protocol key/value fields. The question is whether that data is
> actually given and mishandled by Org or whether the Firefox extension
> you are using is not being able to get the text from particular web page.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



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-07 Thread Visuwesh
[சனி அக்டோபர் 07, 2023] Visuwesh wrote:

> [சனி அக்டோபர் 07, 2023] Ihor Radchenko wrote:
>
>> Visuwesh  writes:
>>
>>> Attached patch considers your review and also another defcustom to tell
>>> how to generate the filename which by default autogenerates a filename
>>> based on current time.
>>
>> Thanks!
>> I still disagree about :safe, but I can change it myself to something
>> more restrictive like :safe (lambda (x) (eq x 'attach)))
>
> OK, I will change it on my end then.  I can always override the :safe
> function on my end.
>
>> Also, it looks like we also need to define `x-dnd-direct-save-function',
>> as Po Lu pointed in 
>> https://list.orgmode.org/orgmode/87bkdccihf@yahoo.com/ 
>
> I will get to it, hopefully by Sunday.

This was far easier than I initially thought.  Patch attached.

>From 7bdd892c0cdb248341e3284e9aeee341f073d38d 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): Add yank-media and DND handlers.

* etc/ORG-NEWS: Advertise the new features.
---
 etc/ORG-NEWS |  20 +
 lisp/org.el  | 234 ++-
 2 files changed, 253 insertions(+), 1 deletion(-)

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 in clipboard and files copied/cut to the
+clipboard from file managers using the ~yank-media~ command which also
+inserts a link to the attached file.  This command was added in Emacs 29.
+
+Images can be saved to a separate directory instead of being attached,
+customize ~org-yank-image-save-type~.
+
+Image filename chosen can be customized by setting
+~org-yank-image-file-name-function~ which by default autogenerates a
+filename based on the current time.
+
+*** Files and images can be attached by dropping onto Emacs
+
+Attachment method other than ~org-attach-method~ for dropped files can
+be specified using ~org-dnd-default-attach-method~.
+
+Images dropped also respect the value of ~org-yank-image-save-type~.
+
 ** New functions and changes in function arguments
 *** =TYPES= argument in ~org-element-lineage~ can now be a symbol
 
diff --git a/lisp/org.el b/lisp/org.el
index d0b2355ea..cfb314e23 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4999,7 +4999,10 @@ The following commands are available:
   (org--set-faces-extend '(org-block-begin-line org-block-end-line)
  org-fontify-whole-block-delimiter-line)
   (org--set-faces-extend org-level-faces org-fontify-whole-heading-line)
-  (setq-local org-mode-loading nil))
+  (setq-local org-mode-loading nil)
+
+  ;; `yank-media' handler and DND support.
+  (org-setup-yank-dnd-handlers))
 
 ;; Update `customize-package-emacs-version-alist'
 (add-to-list 'customize-package-emacs-version-alist
@@ -20254,6 +20257,235 @@ it has a `diary' type."
 		(org-format-timestamp timestamp fmt t))
 	  (org-format-timestamp timestamp fmt (eq boundary 'end)))
 
+;;; Yank media handler and DND
+(defun org-setup-yank-dnd-handlers ()
+  "Setup the `yank-media' and DND handlers for buffer."
+  (setq-local dnd-protocol-alist
+  (cons '("^file:///" . org--dnd-local-file-handler)
+dnd-protocol-alist))
+  (when (fboundp 'yank-media-handler)
+(yank-media-handler "image/.*" #'org--image-yank-media-handler)
+;; Looks like different DEs go for different handler names,
+;; https://larsee.com/blog/2019/05/clipboard-files/.
+(yank-media-handler "x/special-\\(?:gnome\|KDE\|mate\\)-files"
+#'org--copied-files-yank-media-handler))
+  (when (boundp 'x-dnd-direct-save-function)
+(setq-local x-dnd-direct-save-function #'org--dnd-xds-function)))
+
+(defcustom org-yank-image-save-type 'attach
+  "Method to save images yanked from clipboard and dropped to Emacs.
+It can be the symbol `attach' to add it as an attachment, or a
+directory name to copy/cut the image to that directory."
+  :group 'org
+  :package-version '(Org . "9.7")
+  :type '(choice (const :tag "Add it as attachment" attach)
+ (directory :tag "Save it in directory"))
+  :safe (lambda (x) (eq x 'attach)))
+
+(defcustom org-yank-image-file-name-function #'org-yank-image-autogen-filename
+  

Re: [FR] A more general case than footnotes

2023-10-07 Thread Maske


On 07/10/2023 15:21, Ihor Radchenko wrote:

Maske  writes:


The headings could be in different files, yes.

AFAIK, citations don't link two exact points. Footnotes do.

Do you mean that you also want to jump back-and-forth between footnote
definition in the another file and its footnote references?



Right: With C-c.

And maybe there could work directly commands like "org-footnote-action", 
being unneeded to create new commands like "org-note-action" with almost 
the same functionality.






I don't understand the option of "include", but I think it wouldn't be
the case.

Seehttps://orgmode.org/manual/Include-Files.html

Thanks, I save it.



I really think footnotes would be a particular case of this option.

** Reference in file A
:PROPERTIES:
:ID:   978-84-362-7195-9
:END:

...
A “comment line” starts with a hash character (#)
*[n:102@978-84-362-7195-9]* and either a whitespace character or the
immediate end of the line.
...


** Notes in file B

*[n:102@978-84-362-7195-9]* The hash character is important in orgmode.

May you explain the purpose of @978-84-... part?
You seem to assume that a footnote always has a single reference,
which may or may not be the case in practice.


If there would be more than one reference, a behavior like that of footnotes 
would be appropriate?

The purpose of the @978-84-... part:
@978-84-362-7195-9 would work like the ID for internal links: 
[[id:978-84-362-7195-9]]. That would allow jumping to the correct heading from 
any file.
I am not a programmer, so the syntax I am sure could be more solid.  Example:


** Reference in file A
:PROPERTIES:
:ID:   978-84-362-7195-9
:END:
...
A “comment line” starts with a hash character (#) [n:102@978-84-362-7195-9] and 
either a whitespace character or the immediate end of the line.
...


** Notes in file B
[[id:978-84-362-7195-9]]: Link to heading in file A

[n:102@978-84-362-7195-9]: Link to an exact point in file A. Where the point is 
defined by the LABEL 102, and the file can be find thanks to the ID 
978-84-362-7195-9


Re: [FR] A more general case than footnotes

2023-10-07 Thread Ihor Radchenko
Maske  writes:

> The headings could be in different files, yes.
>
> AFAIK, citations don't link two exact points. Footnotes do.

Do you mean that you also want to jump back-and-forth between footnote
definition in the another file and its footnote references?

> I don't understand the option of "include", but I think it wouldn't be 
> the case.

See https://orgmode.org/manual/Include-Files.html

> I really think footnotes would be a particular case of this option.
>
> ** Reference in file A
> :PROPERTIES:
> :ID:   978-84-362-7195-9
> :END:
>
> ...
> A “comment line” starts with a hash character (#)
> *[n:102@978-84-362-7195-9]* and either a whitespace character or the
> immediate end of the line.
> ...
>
>
> ** Notes in file B
>
> *[n:102@978-84-362-7195-9]* The hash character is important in orgmode.

May you explain the purpose of @978-84-... part?
You seem to assume that a footnote always has a single reference,
which may or may not be the case in practice.

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



Re: [FR] A more general case than footnotes

2023-10-07 Thread Maske

Hi Ihor

The headings could be in different files, yes.

AFAIK, citations don't link two exact points. Footnotes do.

I don't understand the option of "include", but I think it wouldn't be 
the case.



I really think footnotes would be a particular case of this option.

** Reference in file A
:PROPERTIES:
:ID:   978-84-362-7195-9
:END:

...
A “comment line” starts with a hash character (#)
*[n:102@978-84-362-7195-9]* and either a whitespace character or the
immediate end of the line.
...


** Notes in file B

*[n:102@978-84-362-7195-9]* The hash character is important in orgmode.



Thanks for reading


On 07/10/2023 13:12, Ihor Radchenko wrote:

Maske  writes:


Could exist a more general case than footnotes?

A kind of footnotes that work between different files?


Maybe the syntax could be [n:LABEL@ID]

Where the ID would be the unique ID of the heading.
Example:


** Reference
:PROPERTIES:
:ID:   978-84-362-7195-9
:END:

A “comment line” starts with a hash character (#)
[n:102@978-84-362-7195-9] and either a whitespace character or the
immediate end of the line.
...


** Notes

[n:102@978-84-362-7195-9] The hash character is important in orgmode.

I am not sure if I understand. Is the above in different files?

Random suggestions:

1. Use citations
2. Use a normal footnote and #+include statement in its definition to
incorporate a text from a different file during export.


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-07 Thread Ihor Radchenko
Visuwesh  writes:

> What do you think about adding a defcustom as requested by Liu Hui in
> https://yhetil.org/orgmode/caoqtw-p6_w3heepjftkcfey2rpfgjfouhwmseoe2ajnpoi+...@mail.gmail.com/

Looks reasonable. I have no objections.

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



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-07 Thread Visuwesh
[சனி அக்டோபர் 07, 2023] Ihor Radchenko wrote:

> Visuwesh  writes:
>
>> Attached patch considers your review and also another defcustom to tell
>> how to generate the filename which by default autogenerates a filename
>> based on current time.
>
> Thanks!
> I still disagree about :safe, but I can change it myself to something
> more restrictive like :safe (lambda (x) (eq x 'attach)))

OK, I will change it on my end then.  I can always override the :safe
function on my end.

> Also, it looks like we also need to define `x-dnd-direct-save-function',
> as Po Lu pointed in 
> https://list.orgmode.org/orgmode/87bkdccihf@yahoo.com/ 

I will get to it, hopefully by Sunday.

What do you think about adding a defcustom as requested by Liu Hui in
https://yhetil.org/orgmode/caoqtw-p6_w3heepjftkcfey2rpfgjfouhwmseoe2ajnpoi+...@mail.gmail.com/



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-07 Thread Ihor Radchenko
Visuwesh  writes:

> Attached patch considers your review and also another defcustom to tell
> how to generate the filename which by default autogenerates a filename
> based on current time.

Thanks!
I still disagree about :safe, but I can change it myself to something
more restrictive like :safe (lambda (x) (eq x 'attach)))

Also, it looks like we also need to define `x-dnd-direct-save-function',
as Po Lu pointed in https://list.orgmode.org/orgmode/87bkdccihf@yahoo.com/ 

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



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-07 Thread Ihor Radchenko
Max Nikulin  writes:

> ... Current action is to open text files in the 
> widow under cursor and it is what users may expect.

This is not always true. For example, dropping to dired buffers will
copy to the opened fired directory. Dropping to message buffers will add
an attachment to the email being written.

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



Re: Completion of links to man pages

2023-10-07 Thread Michael Albinus
Eli Zaretskii  writes:

Hi,

>> > I don't think woman.el is being developed, or is it?
>>
>> Do you mean that woman.el will be obsoleted?
>
> AFAIU, it already is, de-facto.  Unless someone steps forward and
> volunteers to develop woman.el so as to add all the many missing
> features that Groff has added during the last years, woman.el will
> continue to bitrot.

In my long-term TODO there is adding support for man pages on remote
hosts. This is counted for man.el, no plans for woman.el. See discussion
at bug#46911. (Unfortunately, no progress yet).

Just a data point.

Best regards, Michael.



Re: [FR] A more general case than footnotes

2023-10-07 Thread Ihor Radchenko
Maske  writes:

> Could exist a more general case than footnotes?
>
> A kind of footnotes that work between different files?
>
>
> Maybe the syntax could be [n:LABEL@ID]
>
> Where the ID would be the unique ID of the heading.

> Example:
>
>
> ** Reference
> :PROPERTIES:
> :ID:   978-84-362-7195-9
> :END:
>
> A “comment line” starts with a hash character (#) 
> [n:102@978-84-362-7195-9] and either a whitespace character or the 
> immediate end of the line.
> ...
>
>
> ** Notes
>
> [n:102@978-84-362-7195-9] The hash character is important in orgmode.

I am not sure if I understand. Is the above in different files?

Random suggestions:

1. Use citations
2. Use a normal footnote and #+include statement in its definition to
   incorporate a text from a different file during export.

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



[FR] A more general case than footnotes

2023-10-07 Thread Maske

Hi

Could exist a more general case than footnotes?

A kind of footnotes that work between different files?


Maybe the syntax could be [n:LABEL@ID]

Where the ID would be the unique ID of the heading.


Example:


** Reference
:PROPERTIES:
:ID:   978-84-362-7195-9
:END:

A “comment line” starts with a hash character (#) 
[n:102@978-84-362-7195-9] and either a whitespace character or the 
immediate end of the line.

...


** Notes

[n:102@978-84-362-7195-9] The hash character is important in orgmode.



Re: ob-sql dbconnection engine

2023-10-07 Thread Ihor Radchenko
Ihor Radchenko  writes:

> Andreas Gerler  writes:
>
>> In the end you are still able to overwrite in your src block parameters via 
>> :engine
>
> Sure, but wouldn't it be better to amend the patch adding aliases to the
> supported engine names in `sql-connection-alist'?

I considered merging and possibly amending the patch one more time, but
it appears that the proposed approach has another major downside of
ignoring :engine header argument completely. Due to non-triviality of
the merge and absence of followup from the patch author, I am closing
this feature request.

Canceled.

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



Re: COUNTER-SET for alphabetical ordered lists ignored for utf-8 exporter

2023-10-07 Thread Ihor Radchenko
"Tom Alexander"  writes:

> It seems that COUNTER-SET[1] is not being honored when exporting to utf-8 for 
> alphabetical lists even though it is honored for numeric lists. When 
> exporting to html, COUNTER-SET is honored for both.
>
> Test document:
> ```
> # An ordered list starting at 3
> 1. [@3] foo
>
>
> # An ordered list starting at 1
> m. bar
>
>
> # An ordered list starting at 11
> m. [@k] baz
> ```
> ...
> But when exporting to utf-8 you get: (whitespace removed again)
> ```
> 3. foo
> m. bar
> m. baz
> ```
>
> Whereas I would expect:  (whitespace removed again)
> ```
> 3. foo
> m. bar
> k. baz
> ```

Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=26f1cb77a

However, what we do for alphabetical bullets on export is slightly
different:

3. foo
1. bar
11. baz

Other export backends do not preserve alphabetical bullets. Numbers are
always used.

> On a slightly related note: it seems the COUNTER-SET[1] allows single-letter 
> values even when org-list-allow-alphabetical is nil. I don't think that is 
> going to hurt anyone but I figured I should mention it in case its a bug 
> (test doc: `1. [@k] foo` is a plain list starting at 11 even when 
> org-list-allow-alphabetical is nil).
>
> [1] https://orgmode.org/worg/org-syntax.html#Items

org-syntax.html#Items describes what the parser does 
(`org-element-item-parser').
`org-list-allow-alphabetical' should be changed to t in future and
obsoleted. We aim to reduce config-dependent Org syntax in the long
term.

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



Re: org-capture firefox extension not capture in some cases

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

> in html gmail, i can capture message body text and whatever else.
>
> gmail has an html version and a js version.  html is faster and better for me.
>
> in disroot.org, if i try to capture message body text, it seems to
> capture just the link but does not capture the message body text.

Are you using bookmarklet? Particular extension?

>From Org perspective, all we care about is the data passed to Emacs via
org-protocol key/value fields. The question is whether that data is
actually given and mishandled by Org or whether the Firefox extension
you are using is not being able to get the text from particular web page.

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



[FR] Auto-adjusting table formulas in org-table-transpose-table-at-point

2023-10-07 Thread Ihor Radchenko
Uwe Brauer  writes:

> Hi
>
> Starting with this
> ...
> #+TBLFM: $3=($2+1)-$1
> #+end_src
>
> org-table-transpose-table-at-point leads to
> 
> #+TBLFM: $3=($2+1)-$1
> #+end_src
>
> However the correct formula should have been
> ...
> #+TBLFM: @4$2..@4$13=@3+1-@2
> #+end_src
>
>
> Does there exist such a command (Scalc and I presume excel allow to transpose 
> a table and convert the corresponding formula)

No, we do not have such command - `org-table-transpose-table-at-point'
does not currently do any formula adjustments.
Patches welcome!

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



Re: Clarify that REST is not supported on the start TIME in a time-range timestamp.

2023-10-07 Thread Ihor Radchenko
"Tom Alexander"  writes:

>> As for the problem with REST you raised, I am inclined to remove it from
>> syntax doc for the time being - it only creates more confusion,
>> unfortunately.
>
> Makes sense, thanks. Is there anything we do to mark patches as rejected? I 
> removed [PATCH] from the subject line.

Canceled.
^^ This cancels the patch. See https://tracker.orgmode.org/howto

I have removed REST spec from the doc in 
https://git.sr.ht/~bzg/worg/commit/ba8f5fdc

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



Re: [BUG] No newline at end of exported HTML file [9.6.6 (release_9.6.6 @ /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/org/)]

2023-10-07 Thread Ihor Radchenko
YE  writes:

> Exporting HTML file from Org-mode, f.i. with `org-html-export-to-html',
> I expect to get a newline after the closing  tag, but it's not
> added. I believe this used to work with previous versions of Org-mode.
> Am I missing something?

`org-html-template' never ever had a newline at the end of the generated
html file. May you please explain why missing newline is a problem?

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