Add 'readonly' option to ob-sqlite

2024-06-06 Thread Daniel M. German


hi everybody,

Sometimes I think it is useful to open a DB in readonly mode

eg. to avoid modifying by mistake

This is a patch to ob-sqlite.el to accomplish that

It adds support for opening a sqlite database in readonly only.

It does it by adding a babel parameter readonly. If present, the
database will be opened in readonly mode. Example:

#+begin_src sqlite :readonly :db /tmp/rip.db
insert into a values (1,2);
select * from a;
#+end_src

This will result in the following error:

Runtime error near line 2: attempt to write a readonly database (8)
[ Babel evaluation exited with code 1 ]

>From 7df14e4ac2dcdc8fbdf647bff31c9e03f33bd73a Mon Sep 17 00:00:00 2001
From: Daniel M German 
Date: Thu, 6 Jun 2024 23:34:28 -0700
Subject: [PATCH] lisp/ob-sqlite.el: add a new parameter called readonly.

If present, the database is open in read-only mode.

This is implemented by passing the parameter -readonly to sqlite
---
 lisp/ob-sqlite.el | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/ob-sqlite.el b/lisp/ob-sqlite.el
index 96d93b815..b15c4f4d3 100644
--- a/lisp/ob-sqlite.el
+++ b/lisp/ob-sqlite.el
@@ -52,7 +52,8 @@
 (line  . :any)
 (list  . :any)
 (separator . :any)
-(nullvalue . :any))
+(nullvalue . :any)
+(readonly  . :any))
   "Sqlite specific header args.")
 
 (defun org-babel-expand-body:sqlite (body params)
@@ -77,10 +78,10 @@ This function is called by `org-babel-execute-src-block'."
 	(separator (cdr (assq :separator params)))
 	(nullvalue (cdr (assq :nullvalue params)))
 	(headers-p (equal "yes" (cdr (assq :colnames params
-	(others (delq nil (mapcar
+(others (delq nil (mapcar
 			   (lambda (arg) (car (assq arg params)))
 			   (list :header :echo :bail :column
- :csv :html :line :list)
+ :csv :html :line :list :readonly)
 (with-temp-buffer
   (insert
(org-babel-eval
@@ -88,7 +89,7 @@ This function is called by `org-babel-execute-src-block'."
 	 "%cmd %header %separator %nullvalue %others %csv %db "
 	 (list
 	  (cons "cmd" org-babel-sqlite3-command)
-	  (cons "header" (if headers-p "-header" "-noheader"))
+  (cons "header" (if headers-p "-header" "-noheader"))
 	  (cons "separator"
 		(if separator (format "-separator %s" separator) ""))
 	  (cons "nullvalue"
-- 
2.45.1




--
Daniel M. German  "A machine --computer-- can only do
   Lady Lovelace ->what we tell it to do"
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .



Re: [BUG] ob-sql should escape the password [9.7.3 (9.7.3-2f1844 @ /home/andrea/.emacs.d/elpa/org-9.7.3/)]

2024-06-06 Thread Phil

* [2024-06-07 00:58] Andrea:

org-babel-execute:sql. This function extracts
the password to connect to your database of choice as dbpassword.
It then uses it like this:



(format "PGPASSWORD=%s " dbpassword)



If the password contains an & character, the execution of a block fails.
I solved like this:
 (format "PGPASSWORD='%s' " dbpassword)


shell-quote-argument is designed for this case.

Phil



Re: [BUG] org-lint: Spurious warning from 'misplaced-heading lint-checker [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]

2024-06-06 Thread Suhail Singh
Ihor Radchenko  writes:

> "Suhail Singh"  writes:
>
>> When there is, say, an "example" result block that is indented (i.e.,
>> the entire block including the delimiters is indented) and it contains
>> some asterisks in the middle, org-lint considers it to be a possible
>> case of misplaced-heading.  Case in point:
>>
>> #+begin_src org
>>   - Some words
>> ,#+begin_example
>>   this is a line with asterisks** in the middle
>> ,#+end_example
>> #+end_src
>>
>> The lint check should guard against occurrences that happen within code
>> blocks.
>
> Makes sense.
> Fixed, on bugfix.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=b8497aa7f

This doesn't seem fixed as of 9.7.3 (the MRE above still shows spurious
warning).  It seems that org-at-block-p returns nil when point is within
the block.

-- 
Suhail



Re: [PATCH] Add support for shortdoc link type

2024-06-06 Thread Bruno Cardoso


On 2024-06-06, 11:53 +, Ihor Radchenko  wrote:
>
> Thanks!
> Applied, onto main, with amendments.
> I re-worded the manual and news entries, moved the news entry to new
> features, addressed compiler warnings, and added a FIXME marking the
> Emacs version check for removal when we drop Emacs 27 support.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=55e8068d6
>
> I also added you to our contributor list.
> https://git.sr.ht/~bzg/worg/commit/392644ae

Thank you!



[BUG] ob-sql should escape the password [9.7.3 (9.7.3-2f1844 @ /home/andrea/.emacs.d/elpa/org-9.7.3/)]

2024-06-06 Thread Andrea
Hello there, thanks for Org Mode!

ob-sql.el has a function org-babel-execute:sql. This function extracts
the password to connect to your database of choice as dbpassword.
It then uses it like this:

(if dbpassword
(format "PGPASSWORD=%s " dbpassword)
  "")

If the password contains an & character, the execution of a block fails.
I solved like this:
(if dbpassword
(format "PGPASSWORD='%s' " dbpassword)
  "")

Hope this is of help,

Andrea


Emacs  : GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, 
cairo version 1.16.0)
 of 2024-03-26, modified by Debian
Package: Org mode version 9.7.3 (9.7.3-2f1844 @ 
/home/andrea/.emacs.d/elpa/org-9.7.3/)



Agenda export to ics file

2024-06-06 Thread John Helly

Aloha.

I'm a long-time user of emacs, org-mode for about 10 years but cannot 
figure out how to export DEADLINE events from org-agenda to 
org-icalendar-export-to-ics.


I've found references to setting the

org-icalendar-use-deadline

variable but haven't yet found the successful incantation to do that.

Can someone please point me in the right direction?  Everything seems to 
lead a dead-end or some other complication.


Mahalo.
J.
--
John Helly / San Diego Supercomputer Center / Scripps Institution of 
Oceanography
https://www.sdsc.edu/~hellyj / 808 205 9882 / 760 8408660




Re: [ANN] Org mode 9.7 is out

2024-06-06 Thread Juergen Fenn



Am 06.06.24 um 17:17 Uhr schrieb Ihor Radchenko:
> Juergen Fenn  writes:
>
>> Am 06.06.24 um 08:20 Uhr schrieb Visuwesh:
>>> Thanks for the analysis.  Given that Alan says GNUStep cannot handle
>>> non-text clipboard items, I cannot propose anything myself.  It would be
>>> nice if a Mac user can write a report and send it to the Emacs
>>> developers.  Perhaps Juergen can do it?
>>
>> Of course, I /could/ do this, but given the fact that you have already
>> found out about /some/ internals wouldn't it be better a macOS/NextStep
>> developer would look into this in the first place and hence write the
>> report with some somre insight?
>
> Unfortunately, there are no MacOS developers among Org mode maintainers.
> I personally do not even have access to MacOS for testing.
>
> Since you at least can test things on MacOS, it would be helpful if you
> can create the recipe suitable for Emacs devs to reproduce the
> problem. They may also ask extra information from your MacOS.
>

I see. Thanks for explaining. So, I will write a bug report that draws
on our discussion and send it to emacs-devel over the weekend.

My switch from Ventura to Sonoma shortly may make things more
complicated, as I cannot foresee in howmuch the two platforms differ
under the hood, but I'm afraid I cannot postpone the upgrade.

Regards,
Jürgen.



Re: [BUG] org-lint: Spurious warning by 'suspicious-language-in-src-block [9.7.2 (release_N/A-N/A-88dd2c @ /home/user/.emacs.d/elpa/org-9.7.2/)]

2024-06-06 Thread Ihor Radchenko
Suhail Singh  writes:

> Ihor Radchenko  writes:
>
>> Indeed. But I wanted to nudge you to do a bit better :)
>
> "Better" here is subjective and we have a difference in opinion, which
> is okay.  While I am not motivated to submit such an alternative patch,
> I also am not aware of any common usecases that would become much more
> complicated as a result of it.

Ok. I thus installed your patch - it is an improvement.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=96eb9f0b4

You are now listed as one of Org mode contributors:
https://git.sr.ht/~bzg/worg/commit/7f498b97

>> Further, the distant goal is to implement integration of org-lint into
>> flycheck/flymake. And we do need user-level config for which checkers
>> should be enabled for "full" org-lint check and for "quick" check on
>> the fly then.
>
> I am unfamiliar with flymake, but since flycheck checkers run in a
> different Emacs process, the patch I sent is sufficient.

They do not have to. And in Org mode case, it is not the best idea -
some checkers behave differently depending on which libraries are loaded
and Org mode syntax may be altered by user settings.

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



Re: ob-sql-mode/session

2024-06-06 Thread Ihor Radchenko
Phil  writes:

> Yes, it is. The re-wiring will need to federate
> and differentiate some command-line options
> without them clashing. Of course it's easier to
> get it operational on databases one is used to work
> with.
> I'll be testing further these new functions in real
> conditions before, and think about a complete test
> coverage on the other DBs.

Feel free to send a patch when you are done.
Also, feel free to ask us anything, if you have questions.

You may find https://orgmode.org/worg/org-contribute.html useful.

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



Re: [BUG] org-capture: %\N template expansion

2024-06-06 Thread Ihor Radchenko
Bruno Cardoso  writes:

> On 2024-06-05, 11:29 +, Ihor Radchenko  wrote:
>
>> See the attached tentative patch.
>>
>> I introduced a new placeholder - %\*N. It refers to _all_ the prompts,
>> unlike %\N. If you have better ideas about syntax, please share.
>>
>
> Thank you, Ihor! I tested it both from `org-capture-templates' and from an 
> Org template file and the patch worked as expected. I'm fine with the 
> proposed syntax.

Applied, onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=266bd1c4a

Fixed.

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



Re: [ANN] Org mode 9.7 is out

2024-06-06 Thread Ihor Radchenko
Juergen Fenn  writes:

> Am 06.06.24 um 08:20 Uhr schrieb Visuwesh:
>> Thanks for the analysis.  Given that Alan says GNUStep cannot handle
>> non-text clipboard items, I cannot propose anything myself.  It would be
>> nice if a Mac user can write a report and send it to the Emacs
>> developers.  Perhaps Juergen can do it?
>
> Of course, I /could/ do this, but given the fact that you have already
> found out about /some/ internals wouldn't it be better a macOS/NextStep
> developer would look into this in the first place and hence write the
> report with some somre insight?

Unfortunately, there are no MacOS developers among Org mode maintainers.
I personally do not even have access to MacOS for testing.

Since you at least can test things on MacOS, it would be helpful if you
can create the recipe suitable for Emacs devs to reproduce the
problem. They may also ask extra information from your MacOS.

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



Re: Very slow getting tags for completion after 9.7 upgrade

2024-06-06 Thread Ihor Radchenko
Christian Moe  writes:

> After upgrading to 9.7 (still on Emacs 27.1), I'm seeing very long waits
> when trying to use tag completion in large files, whether with C-c C-q,
> %^g in capture templates or running (org-get-buffer-tags) directly. This
> applies both to 9.7.1 and 9.7.2 (on two different machines with similar
> environments, both older hardware). On repeated tries I have also had
> several freezes.

May you please record the CPU profile?
You can do
1. M-x profiler-stop
2. M-x profiler-start RET cpu RET
3. Query tags
4. M-x profiler-report
5. M-x profiler-report-write-profile
6. Share the saved file

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



Re: [ANN] Org mode 9.7 is out

2024-06-06 Thread Juergen Fenn



Am 06.06.24 um 08:20 Uhr schrieb Visuwesh:
> Thanks for the analysis.  Given that Alan says GNUStep cannot handle
> non-text clipboard items, I cannot propose anything myself.  It would be
> nice if a Mac user can write a report and send it to the Emacs
> developers.  Perhaps Juergen can do it?

Of course, I /could/ do this, but given the fact that you have already
found out about /some/ internals wouldn't it be better a macOS/NextStep
developer would look into this in the first place and hence write the
report with some somre insight?

> There was a bug report about yank-media failing in Mac yesterday or
> thereabouts so I think the clipboard situation in Mac has a lot to
> improve.  Hopefully with Org's yank-media support the situation will
> improve.

This was the other report yesterday:

https://lists.gnu.org/archive/html/help-gnu-emacs/2024-06/msg00015.html
https://lists.gnu.org/archive/html/help-gnu-emacs/2024-06/msg00017.html

Regards,
Jürgen.



Re: [PATCH] Add support for shortdoc link type

2024-06-06 Thread Ihor Radchenko
Bruno Cardoso  writes:

> The attached patch is now rebased to new Org version.

Thanks!
Applied, onto main, with amendments.
I re-worded the manual and news entries, moved the news entry to new
features, addressed compiler warnings, and added a FIXME marking the
Emacs version check for removal when we drop Emacs 27 support.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=55e8068d6

I also added you to our contributor list.
https://git.sr.ht/~bzg/worg/commit/392644ae

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



Re: Structure templates moving point

2024-06-06 Thread Ihor Radchenko
Psionic K  writes:

> Sorry, I didn't intend to keep digging.  I would need to debug the buffer
> display behavior to find out why frames were being created to make a
> reproduction.

Ok.
Feel free to submit a more detailed bug report if you find a time to
create a reproducer. For now, there is nothing useful I can do on Org
side.

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



Re: Structure templates moving point

2024-06-06 Thread Psionic K
Sorry, I didn't intend to keep digging.  I would need to debug the buffer
display behavior to find out why frames were being created to make a
reproduction.

The fallbacks I removed from `display-buffer-fallback-actions' were the
ones that create frames.


On Thu, Jun 6, 2024 at 7:18 PM Ihor Radchenko  wrote:

> Psionic K  writes:
>
> > I made some changes to my buffer display settings.  When the structure
> > template choice interface does not fall back to creating a frame, it
> > does not exhibit the errant point behavior.
> >
> > In any case, after creating the comment block, the point should
> > probably move inside the block like it does for source blocks.
>
> Ok, but I cannot help without being able to reproduce the problem on my
> side. Please provide detailed instructions how to reproduce the problem
> starting from minimal Emacs config, as described on
> https://orgmode.org/manual/Feedback.html#Feedback and
> https://www.chiark.greenend.org.uk/~sgtatham/bugs.html
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


-- 

남백호
대표 겸 공동 창업자
포지트론


Re: Structure templates moving point

2024-06-06 Thread Ihor Radchenko
Psionic K  writes:

> I made some changes to my buffer display settings.  When the structure
> template choice interface does not fall back to creating a frame, it
> does not exhibit the errant point behavior.
>
> In any case, after creating the comment block, the point should
> probably move inside the block like it does for source blocks.

Ok, but I cannot help without being able to reproduce the problem on my
side. Please provide detailed instructions how to reproduce the problem
starting from minimal Emacs config, as described on
https://orgmode.org/manual/Feedback.html#Feedback and
https://www.chiark.greenend.org.uk/~sgtatham/bugs.html

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



Re: Structure templates moving point

2024-06-06 Thread Psionic K
I made some changes to my buffer display settings.  When the structure
template choice interface does not fall back to creating a frame, it
does not exhibit the errant point behavior.

In any case, after creating the comment block, the point should
probably move inside the block like it does for source blocks.



Re: Doubt about writing before PROPERTIES

2024-06-06 Thread Ihor Radchenko
Kepa  writes:

> I would like to know if this "syntax" is ok or if I shouldn't write anything 
> in the first line after a headline:
>
> EXAMPLE 1:
>
> ** PROY CLIENT
> DEADLINE: <2024-07-03 mi.> (26 weeks excluding week 52, ready)
> :PROPERTIES:

This will happen to work, but I do not recommend.

> ...
> ** PROY CLIENT
> DEADLINE: <2024-07-03 mi.>
> (26 weeks excluding week 52, ready)
> :PROPERTIES:

This will invalidate property drawer.
(M-x lint will warn you about the second example)

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



Doubt about writing before PROPERTIES

2024-06-06 Thread Kepa
Hi

I would like to know if this "syntax" is ok or if I shouldn't write anything in 
the first line after a headline:

EXAMPLE 1:

** PROY CLIENT
DEADLINE: <2024-07-03 mi.> (26 weeks excluding week 52, ready)
:PROPERTIES:
:DIR:  c:/CLIENT
:END:
ETC
*** ETC


EXAMPLE 2:

** PROY CLIENT
DEADLINE: <2024-07-03 mi.>
(26 weeks excluding week 52, ready)
:PROPERTIES:
:DIR:  c:/CLIENT
:END:
ETC
*** ETC

Best regards


Very slow getting tags for completion after 9.7 upgrade

2024-06-06 Thread Christian Moe
Hi,

After upgrading to 9.7 (still on Emacs 27.1), I'm seeing very long waits
when trying to use tag completion in large files, whether with C-c C-q,
%^g in capture templates or running (org-get-buffer-tags) directly. This
applies both to 9.7.1 and 9.7.2 (on two different machines with similar
environments, both older hardware). On repeated tries I have also had
several freezes.

In my largest file, it takes over four minutes. At ~65K lines and loads
of tags, the file is admittedly badly in need of some pruning and
archiving, but still, before the upgrade, Org handled tag completion
here with maybe a couple of seconds of delay at most, and now it's
basically broken for me.

Anyone else seeing this?

Yours,
Christian