Re: [BUG] ob-shell doesn't evaluate last line on Windows (cmd/cmdproxy) [9.6.1 ( @ c:/Users/Osher/AppData/Roaming/.emacs.d/elpa/org-9.6.1/)]

2023-01-29 Thread Matt


  On Thu, 26 Jan 2023 04:51:19 -0500  Ihor Radchenko  wrote --- 

 > This will add a newline to "cmdproxy.exe" command -> "cmdproxy.exe\n".
 > You should instead look into `org-babel--write-temp-buffer-input-file'.

I made the change in `org-babel--shell-command-on-region' based on your 
recommendation in https://list.orgmode.org/orgmode/87bkmttv2h.fsf@localhost/

I'd be happy to put it in `org-babel--write-temp-buffer-input-file'.  
Unfortunately, I don't understand why you suggest the change be made there.  
Wouldn't it make more sense to insert the newline into the temp buffer that 
`org-babel--write-temp-buffer-input-file' writes from? 

I'm confused because I don't see a good way write a newline from 
`org-babel--write-temp-buffer-input-file'.  All the file writing 
functions[fn:1], with the exception of `with-temp-file', require a region's 
start and end and `with-temp-file' appears to overwrite the file.

;; 99.999% sure this isn't what you meant
 (defun org-babel--write-temp-buffer-input-file (input-file)
   "Write the contents of the current temp buffer into INPUT-FILE."
   (let ((start (point-min))
 (end (point-max)))
 (goto-char start)
 (push-mark (point) 'nomsg)
 (write-region start end input-file)
+(with-temp-buffer
+  (insert "\n")
+  (write-region (point-min) (point-max) input-file))
 (delete-region start end)
 (exchange-point-and-mark)))

AFAICT, `org-babel--write-temp-buffer-input-file' is only called by 
`org-babel--shell-command-on-region' and that's only ever called by 
`org-babel-eval'.  That's where the query (the block source) is inserted into a 
temp buffer.  Maybe something like this?

modified   lisp/ob-eval.el
@@ -64,7 +64,7 @@ Writes QUERY into a temp-buffer that is processed with
   (let ((error-buffer (get-buffer-create " *Org-Babel Error*")) exit-code)
 (with-current-buffer error-buffer (erase-buffer))
 (with-temp-buffer
-  (insert query "\n")
+  (insert (concat query "\n"))
   (setq exit-code
 (org-babel--shell-command-on-region
  command error-buffer))

 [fn:1] 
https://www.gnu.org/software/emacs/manual/html_node/elisp/Writing-to-Files.html#Writing-to-Files






Re: Firefox permission dialog and org-protocol

2023-01-29 Thread Max Nikulin

On 29/01/2023 20:50, Ihor Radchenko wrote:

Max Nikulin writes:

On 26/01/2023 01:01, Ihor Radchenko wrote:

https://bugzilla.mozilla.org/show_bug.cgi?id=1678994


Bug 1678994 "website permission to open special links in external
applications not configurable"

...

It appears to be a newer version of Firefox.
I originally got to know about the problem from
https://old.reddit.com/r/emacs/comments/10jr2up/orgprotocol_permissions_on_firefox/


Likely the person uses a bookmarklet to initiate capture. This case 
JavaScript snippet is executed in the context of the current web site, 
so it is necessary to confirm permission for each site. I would 
recommend to install an add-on for org-protocol instead. It would be 
enough to confirm once that *this extension* is allowed to launch 
external application through a custom scheme URI.


An additional advantage is that if some site were had a malicious 
org-protocol link hidden by some attractive description then browser 
would ask user even if some pages on the same site were captured earlier.


I faced a similar issue 3 years ago when "always allow" checkbox just 
disappeared from chromium popup.


The popup with permission request appeared because some version of zoom 
allowed unsolicited video call. They decided that a dialog in the app 
before switching on camera would be annoying to users. Users already 
confirmed their intention in the Safari dialog. So other browser had to 
add this popup as well. The intention is to avoid joining a video call 
accidentally while being naked.


https://infosecwriteups.com/zoom-zero-day-4-million-webcams-maybe-an-rce-just-get-them-to-visit-your-website-ac75c83f4ef5?gi=2ed4ab044837
Jonathan Leitschuh. Zoom Zero Day: 4+ Million Webcams & maybe an RCE? 
Just get them to visit your website! 2019-07-08


To summarize, I believe that a browser extension is a safer way to use 
org-protocol. With a native messaging helper application it is even 
possible to avoid desktop-wide org-protocol configuration and to call 
emacsclient directly by the add-on but not through links on non-trusted 
web sites.


P.S. Actually launching an application from an add-on is not really 
reliable as well. The following issue has links to some other bugs. Not 
to mention that external scheme URI is a shoot and forget approach with 
hardly possible error detection. (A native host application may check 
emacsclient exit code.)


https://bugzilla.mozilla.org/show_bug.cgi?id=1745931
External scheme handler configured to "Always ask" can not be launched 
from add-on background page.







Re: Inline markup: How does org identify nested code/verbatim?

2023-01-29 Thread Max Nikulin

On 30/01/2023 01:20, c.buhtz wrote:

Please let me add the nested-regex-approach.


You should look up for any markup starting at first. org-element parser 
uses "first wins" approach. Notice the following:


/italics ~code/ verbatim~

is exported as


italics ~code verbatim~

Notice that closing italics marker cancels recognizing of code snippet.




Re: [FEATURE REQUEST] Timezone support in org-mode datestamps and org-agenda

2023-01-29 Thread Tim Cross
Jean Louis  writes:

> * Tim Cross  [2023-01-28 00:15]:
>> >
>> >> What kinds of representations would a calendar system capable of
>> >> handling timezones require?
>> >> 
>> >> • Instant (fixed)
>> >>   • This is referring to an unambiguous moment in time
>> >>   • e.g., 2007-02-03T05:00:00.000Z
>> >> • Offset (fixed)
>> >>   • This captures the idea of "when did it happen for the person who
>> >> made the observation"
>> >>   • e.g., 2007-02-03T04:00:00.000+01:00
>> >
>> > Offset is not that fixed, maybe from viewpoint of storage as maybe it
>> > is considered fixed in it's representation, but you have to keep in
>> > mind that time offset by it's definition is changing itself, suddenly,
>> > depending of daylight saving and time zone.
>> >
>> 
>> I think your misinterpreting the intent here. If you specify a timestamp
>> with offset, it is fixed.
>
> That is what you say. And I am pointing out to international standard
> references.
>
> If you use offset as "fixed" it means such use would not be by
> standard, and you would confusing users and programmers who are using
> standard for calculations in programs.
>
>> It does not change with daylight savings or any other change in
>> rules for a time zone. It does not even specify a time zone.
>
> And while and before making that decision, did you review the standard
> that time zone offset is influenced and changed by daylight savings?
>
> It does not specify time zone. But it is derived from time zone, and
> is not same from time zone.
>
> Are you aware that time zone offset could have "skipped time" or
> "added time" due to daylight savings?
>
> That implies that by using time offset, you would forget daylight
> savings which are international standard, and make calculations wrong,
> because you started applying own standard in Org.
>

I think your still misunderstanding what is meant by offset.

Yes, a timezone is defined by the offset it has from UTC
Yes, a location time zone may change due to various reasons, such as
daylight savings time, which also means the offset for that timezone
changes. However, it is the time zone definition which has
changed. THink of it as a time zone with a new offset rather than a time
zone with a chagned offset. 

When you specify a date+time wiht an explicit offset, that offset is
fixed. That date+time is fixed. It will not change when daylight davings
comes in or goes out because it isn't a time zone. It is only an offset
and has no location reference and therefore no time zone.

Saying that an offset is a fixed value is very different from saying
that a time zone has a fixed offset. I think this is where your
confusion is coming from. 



Re: Inline markup: How does org identify nested code/verbatim?

2023-01-29 Thread c.buhtz
Please let me add the nested-regex-approach. I wouldn't call this a
solution but just an approach. No one understand that regex it is
nearly unmaintainable.

I hope for a more elegant solution.

This matches if we have code in verbatim
^|[ .,;:\-?!({\"']=.*?(?:^|[ .,;:\-?!({\"']~.*?~[.,;:\-?!)}\"']|$).*?=[ 
.,;:\-?!)}\"']|$

This matches if we have verbatim in code
(?:^|[ .,;:\-?!({\"']~.*?(?:^|[ .,;:\-?!({\"']=.*?=[.,;:\-?!)}\"']|$).*?~[ 
.,;:\-?!)}\"']|$)

If one of this matching I now which one of my "usual" regex pattern using 
catching groups to extract the content I should use first.

Just for testing (maybe on regex101.com) here is the text I used.

This =is ~code~ in verbatim= text.
This =is usual verbatim= text.

This ~is =verbatim= in code~ text.
This ~is usual code~ text.



Inline markup: How does org identify nested code/verbatim?

2023-01-29 Thread c.buhtz
Hi folks,

this is a question about org(mode) development itself.
It is magic to me how you do this. ;) And I would like to learn it
because I do write kind of an org parser in Python.

Here is a nested code-in-verbatim text.

This =is ~code~ in verbatim= text.

Exporting this to html (via org-html-export-as-html)

This is ~code~ in verbatim text.

Awsome! :D

The point is myself I'm able to identify code or verbatim with regex
including three catch groups for the content before, between and
after the inline markers.

for verbatim: "(^|[ .,;:\-?!({\"'])=(.*?)=([ .,;:\-?!)}\"']|$)"
for code: "(^|[ .,;:\-?!({\"'])~(.*?)~([ .,;:\-?!)}\"']|$)"
 
But they don't work together. In the example above I need to use the
verbatim regex first to make it right. 

If I would use the code regex first it wouldn't work because it would
find the ~code~ but without knowing that it is surrounded by ~verbatim~.

I don't know what my users inputs to my software: verbatim in code or
code in verbatim. So I have to figure out which regex to use first.

How does org solve this problem? I don't need a full working solution
but just an idea.

One approach in my mind is to run both regex separate and then compare
the results "somehow":

Verbatim: ['This', ' ', 'is ~code~ in verbatim', ' ', 'text.']
Code :['This =is', ' ', 'code', ' ', 'in verbatim= text.']

"Somehow"!

Another approach in my mind is to do something I would call nested
regex. Constructing a regex pattern looking for verbatim with code in
it. And the other way around of course.



Re: org-crypt fails if default key is expired while non-default key is to be used

2023-01-29 Thread Karl Voit
Hi Ihor,

* Ihor Radchenko  wrote:
> Karl Voit  writes:
>
>>> May I know how exactly did you set `org-crypt-key'? Do you happen to
>>> have CRYPTKEY properties somewhere in your buffer?
>>
>> Sure. My config is on
>> https://github.com/novoid/dot-emacs/blob/master/config.org and I've
>> set it with:
>>
>> (setq org-crypt-key "ABC12345")  ;; I may have to mask this online as well 
>> ;-)
>
> What is the return value of
>
> (epg-list-keys (epg-make-context nil t t) org-crypt-key)
>
> ?
>
> Does it show the right key?

It shows:

(#s(epg-key ultimate
(#s(epg-sub-key ultimate ... nil 1 4096 "ABC12345" 1515327255 nil 
"...ABC12345")
   #s(epg-sub-key ultimate ... nil 1 4096 "FFF" 1515327255 nil 
"."))
(#s(epg-user-id ultimate "Karl Voit (Internal key for orgmode) 
" nil

... with ABC12345 being the correct key for org-crypt and FFF being my
default OpenPGP key.

-- 
get mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML into Org-mode:
   > get Memacs from https://github.com/novoid/Memacs <
Personal Information Management > http://Karl-Voit.at/tags/pim/
Emacs-related > http://Karl-Voit.at/tags/emacs/




diary-anniversary doesn'work om Mac osx 12.6.3

2023-01-29 Thread Renato Pontefice
I’ l try here, because I’m really confused about this prob.

I try to perform this simple line of emacs manual (this is the perfect page of 
the manual where I took this: where I took this: "31.13.10 Sexp Entries and the 
Fancy Diary Display”). Because trying to learn emacs I would try as many entry 
possibile as I could (I know I can obtain that in a different way).

But on my Mac OS X platform I cannot obtain the right result.
I’ve tried with:
- emacs ver 26.2; 28.3; 28.3 (via terminal “emacs -Q” and via GUI With or 
without a init.el file

-aquamacs 3.6 (that use emacs 25.3.50.1)
And finally, I’ve installed a VM, running Debian 11 and try it running emacs by 
terminal and typing ORG-AGENDA ret a
I obtain the agenda with the correct entry.

So I’m wondering:
Maybe Mac osx does not contain the right (elisp?) code to obtain that?


Any suggestion will be appreciate, because I cannot explain to my self this

Thank you

Renato


Re: org-export to icalendar: ignore links?

2023-01-29 Thread Timm Lichte
I found the (pretty obvious) reason why I was getting errors about 
broken links when exporting my agenda to icalendar format: 
org-export-with-broken-links was not set to t.


After I changed this, everything works now.


Am 13.01.23 um 10:30 schrieb Ihor Radchenko:

Timm Lichte  writes:


Thanks for your quick response! Sorry mine took much longer ;-)

Unfortunately, I cannot confirm that this fixed the problem. I still
cannot export org-agenda-files with broken links via
org-icalendar-combine-agenda-files under Org v9.6.1, which includes the
changes of your commit.


Then, please provide an example of the broken export.
See https://orgmode.org/manual/Feedback.html#Feedback





Re: Supporting non-free SQL clients in ob-sql (was: [PATCH] ob-sql: Add support for Athena)

2023-01-29 Thread Ihor Radchenko
Richard Stallman  writes:

>   > Would it then make sense to note the reasons why we support one or
>   > another non-free software in a separate file like etc/NON-FREE-SUPPORT?
>
> I think it is a good idea to document the reasoning for these
> decision.  But I think it does not necessarily have to be centralized
> in one file for all of Emacs.  Another alternative, also natural,
> would be to describe these decisions with the code that implements the
> support.

Will file header be a good place?

Note that there is little point adding the reasons behind supporting
non-free software if they cannot be easily found. Ideally, it should be
a standard place documented as code convention. Then, people can
consistently check the reasons (or lack of) behind each individual
non-free software support decision.

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



Re: [FEATURE REQUEST] Timezone support in org-mode datestamps and org-agenda

2023-01-29 Thread Ihor Radchenko
Daryl Manning  writes:

> All these discussions are really great, devil is in the details and all,
> but is anyone working on implementation code for this? It’s tricky to have
> visibility on WIP on org-mode - probs just me not knowing where to look tbh
> (but big believer that working code is progress… )

No WIP yet.
The purpose of the ongoing discussion is figuring out the pitfalls to
not fall into. We do not want to start writing code just to find out
that it has to be completely scraped because we did not account to some
important details.

We do not even know yet what will be the timestamp format with
timezones.

Once we know the format, we can slowly work through Org functions to
support the timezone info in the timestamps.

Later, we will need to implement the necessary new features for TZ
support in agenda/calendar/input prompts.

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



Re: Firefox permission dialog and org-protocol

2023-01-29 Thread Ihor Radchenko
Max Nikulin  writes:

> On 26/01/2023 01:01, Ihor Radchenko wrote:
>> https://bugzilla.mozilla.org/show_bug.cgi?id=1678994
>
> Bug 1678994 "website permission to open special links in external 
> applications not configurable"
>
> Ihor, do you know any details concerning the affected add-on? It seems 
> in LinkRemark I managed to avoid the issue somehow. Perhaps due to 
>  (Access your data for all websites) permission is required in 
> the released version. Or I have specific handler for org-protocol, not 
> "always ask" in Firefox configuration.

It appears to be a newer version of Firefox.
I originally got to know about the problem from
https://old.reddit.com/r/emacs/comments/10jr2up/orgprotocol_permissions_on_firefox/

We may ask further details from the user if necessary.

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



Re: [ANN] Looking for new maintainers for ox-html.el

2023-01-29 Thread Ihor Radchenko
"Dr. Arne Babenhauserheide"  writes:

> Ihor Radchenko  writes:
>
>> I have been informed that our current ox-html maintainer will no longer
>> able to perform his duties in full extent.

[ This was actually not accurate - TEC, the current ox-html maintainer,
  is still around. However, he was recently focusing on developing new
  features for ox-html and other parts of Org. So, we can still use help
  from another maintainer with bug fixes. ]

>> We thus need volunteers to help maintaining Org HTML export library -
>> lisp/ox-html.el
>
> I depend on ox-html for my personal website. I would be glad to help.

Thanks for volunteering!
Upon Bastien's confirmation, you can follow
https://orgmode.org/worg/org-maintenance.html#maintainer-role and create
an account with write access to Org git sources.

Here is a list of some bug reports and patches related to ox-html:
- https://orgmode.org/list/875ygmzunb.fsf@localhost
- https://orgmode.org/list/878ril5nhw.fsf@localhost
- https://orgmode.org/list/87fsfxfzex.fsf@localhost
- https://orgmode.org/list/87sfj6av4t.fsf@localhost
- https://orgmode.org/list/87a646l45u.fsf@localhost
- https://orgmode.org/list/dd0ae51d-7d56-0ff6-5eb1-3786464ad...@arfer.net
- https://orgmode.org/list/875yfsu6i5.fsf@localhost
- https://orgmode.org/list/87edssx5kx.fsf@localhost

Bastien,

Arne has been around Org ML since 2012 with 200+ messages and
contributed 2 small commits to Org. He is also participating in
emacs-devel and reporting bugs to Emacs.

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



Re: Link from orgmode file to E-Mail (using kmail or notmuch)

2023-01-29 Thread Ihor Radchenko
Jean Louis  writes:

>> Try to derive list of supported schemes from `browse-url-handlers'.
>
> browse-url-handlers ➜ (("gemini:" . elpher-go) ("gopher:"
> . elpher-handler-go) ("about:" . hyperscope-about) ("hyperscope:"
> . hyperscope-url) ("e2dk://" . amule-handler))
>
> it is user option to be customized.
>
> It is obvious that my idea that URL schemes should be unified may be
> reasonable, but there is not enough programming functionality in Emacs
> to allow it to be very deterministic. And thus Org has to make it's
> own URL handling. That is how I understand, correct me if this is
> wrong.

Kind of. `browse-url-handlers' may have predicate as a function. Then,
or may need to run all the predicates any time we need to know if given
url-looking string is a link or not and what type of link. Considering
that such information is needed, among other times, during
fontification, I doubt that we can practically support
`browse-url-handlers'. Or we can make Org unusable.

`browse-url-handlers' is designed in a way that is to be used on demand
only - when the user issues an interactive command.

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