Re: [BUG] org-plot: Unable to use text xtics with type:2d (+ more) [9.7-pre (N/A @ /home/viz/lib/emacs/straight/build/org/)]

2024-06-17 Thread Visuwesh
[திங்கள் ஜூன் 17, 2024] Ihor Radchenko wrote:

> Visuwesh  writes:
>
 - (type (assoc (plist-get params :plot-type)
 -  org-plot/preset-plot-types))
 + (type (cdr (assoc (plist-get params :plot-type)
 +   org-plot/preset-plot-types)))
 gnuplot-script)
>>>
>>> This may break the existing customization.
>>> Later in the function, TYPE is used as an argument for
>>> `org-plot/gnuplot-term-extra' and `org-plot/gnuplot-script-preamble'.
>>> Some users may have these two custom options adjusted to the older
>>> calling convention.
>>>
>>> To not break things, we should pass the full `assoc' to these functions.
>>
>> If you meant org-plot/gnuplot-script eventually calling these functions,
>> then I don't see how the above change will break things.  Even in
>> org-plot/gnuplot-script, TYPE passed to both these user options are
>>
>> (let* ((type-name (plist-get params :plot-type))
>>(type (cdr (assoc type-name org-plot/preset-plot-types
>>
>> so there should be no harm done by the above change since TYPE is not an
>> argument taken by org-plot/gnuplot-script.
>
> Agree. I accidentally moved away from the function that is actually
> being changed to org-plot/gnuplot-script that has nothing to do with
> TYPE binding you are changing in the patch.
>
> So, your code is ok here.

Thanks, so please find attached.

>From 9755ccb636ab8e1d855bbc386bc6bab2203a2cd5 Mon Sep 17 00:00:00 2001
From: Visuwesh 
Date: Tue, 18 Jun 2024 10:39:27 +0530
Subject: [PATCH] org-plot: Respect parameters given in
 `org-plot/preset-plot-types'

* org-plot.el (org-plot/gnuplot-script-preamble)
(org-plot/gnuplot-term-extra): Explain what "plot type" means.
(org-plot/preset-plot-types): Fix docstring and correct the lambda
argument order for the 'grid' plot type.
(org-plot/gnuplot): Merge the parameters given in
`org-plot/preset-plot-types' and the #+PLOT line to ensure the former
is respected everywhere.

Reported-by: Visuwesh 
Link: https://orgmode.org/list/87cypbjw50@gmail.com
---
 lisp/org-plot.el | 24 +++-
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 83483b2..b436613 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -302,9 +302,10 @@ (defgroup org-plot nil
 (defcustom org-plot/gnuplot-script-preamble ""
   "String of function to be inserted before the gnuplot plot command is run.
 
-Note that this is in addition to, not instead of other content generated in
-`org-plot/gnuplot-script'.  If a function, it is called with the plot type as
-the argument, and must return a string to be used."
+Note that this is in addition to, not instead of other content generated
+in `org-plot/gnuplot-script'.  If a function, it is called with the
+parameters used by the current plot type (see
+`org-plot/preset-plot-types'), and must return a string to be used."
   :group 'org-plot
   :type '(choice string function))
 
@@ -349,7 +350,7 @@ (defcustom org-plot/preset-plot-types
 (grid :plot-cmd "splot"
 	  :plot-pre (lambda (_table _data-file _num-cols params _plot-str)
 		  (if (plist-get params :map) "set pm3d map" "set map"))
-	  :data-dump (lambda (table data-file params _num-cols)
+	  :data-dump (lambda (table data-file _num-cols params)
 		   (let ((y-labels (org-plot/gnuplot-to-grid-data
 	table data-file params)))
 			 (when y-labels (plist-put params :ylabels y-labels
@@ -391,8 +392,8 @@ (defcustom org-plot/preset-plot-types
 - :data-dump - Function to dump the table to a datafile for ease of
   use.
 
-  Accepts lambda function.  Default lambda body:
-  (org-plot/gnuplot-to-data table data-file params)
+  Accepts function with arguments:
+  (table data-file num-cols params)
 
 - :plot-pre - Gnuplot code to be inserted early into the script, just
   after term and output have been set.
@@ -541,7 +542,8 @@ (defcustom org-plot/gnuplot-term-extra ""
   "String or function which provides the extra term options.
 E.g. a value of \"size 1050,650\" would cause
 \"set term ... size 1050,650\" to be used.
-If a function, it is called with the plot type as the argument."
+If a function, it is called with the parameters used by the current plot
+type, see `org-plot/preset-plot-types'."
   :group 'org-plot
   :type '(choice string function))
 
@@ -678,8 +680,8 @@ (defun org-plot/gnuplot ( params)
 		tbl))
 	   (num-cols (length (if (eq (nth 0 table) 'hline) (nth 1 table)
 			   (nth 0 table
-	   (type (assoc (plist-get params :plot-type)
-			org-plot/preset-plot-types))
+	   (type (cdr (assoc (plist-get params :plot-type)
+			 org-plot/preset-plot-types)))
gnuplot-script data-file)
 
   (unless type
@@ -693,6 +695,10 @@ (defun org-plot/gnuplot ( params)
   (save-excursion (while (and (equal 0 (forward-line -1))
   (looking-at "[[:space:]]*#\\+"))
 			(setf params (org-plot/collect-options params
+  ;; Ensure that 

[PATCH] [BUG] Support attr_html in source code and fixed-width blocks

2024-06-17 Thread Suhail Singh
Unlike example blocks, source code and fixed-width blocks don't support
the attr_html keyword.  Contrast these outputs:

#+begin_src emacs-lisp :results value replace :wrap src html
  (require 'org)
  (require 'ox-html)

  (org-export-string-as
   "#+attr_html: :class foo
  ,#+begin_src sh :exports code
pwd
  ,#+end_src"
   'html t)
#+end_src

#+RESULTS:
#+begin_src html

pwd


#+end_src

#+begin_src emacs-lisp :results value replace :wrap src html
  (require 'org)
  (require 'ox-html)

  (org-export-string-as
   "#+attr_html: :class foo
  ,#+RESULTS:
  : blah"
   'html t)
#+end_src

#+RESULTS:
#+begin_src html

blah

#+end_src


With the output for example blocks:

#+begin_src emacs-lisp :results value replace :wrap src html
  (require 'org)
  (require 'ox-html)

  (org-export-string-as
   "#+attr_html: :class foo
  ,#+begin_example
hello world!
  ,#+end_example"
   'html t)
#+end_src

#+RESULTS:
#+begin_src html

hello world!

#+end_src


The attached patches are a straight-forward copy-paste of relevant code
from org-html-example-block.  It may be better to refactor this logic
and ensure that it is applied on all relevant AST nodes (others are
probably affected as well).

>From 7a61bb6a7c7e1122199232a1c01885fb270dd370 Mon Sep 17 00:00:00 2001
From: Suhail 
Date: Mon, 17 Jun 2024 21:04:18 -0400
Subject: [PATCH 1/2] ox-html: Add support for attr_html for source code blocks

* lisp/ox-html.el (org-html-src-block): Handle attr_html in a manner
similar to example blocks.

TINYCHANGE
---
 lisp/ox-html.el | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index d1687cf5a..675d85ffe 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -3667,14 +3667,24 @@ (defun org-html-src-block
 contextual information."
   (if (org-export-read-attribute :attr_html src-block :textarea)
   (org-html--textarea-block src-block)
-(let* ((lang (org-element-property :language src-block))
+(let* ((attributes (org-export-read-attribute :attr_html src-block))
+   (lang (org-element-property :language src-block))
 	   (code (org-html-format-code src-block info))
 	   (label (let ((lbl (org-html--reference src-block info t)))
 		(if lbl (format " id=\"%s\"" lbl) "")))
 	   (klipsify  (and  (plist-get info :html-klipsify-src)
 (member lang '("javascript" "js"
 	   "ruby" "scheme" "clojure" "php" "html")
-  (format "\n%s%s\n"
+  (if-let ((class-val (plist-get attributes :class)))
+  (setq attributes (plist-put attributes :class (concat "org-src-container " class-val)))
+(setq attributes (plist-put attributes :class "org-src-container")))
+  (format "\n%s%s\n"
+  (let* ((reference (org-html--reference src-block info))
+		 (a (org-html--make-attribute-string
+			 (if (or (not reference) (plist-member attributes :id))
+			 attributes
+			   (plist-put attributes :id reference)
+		(if (org-string-nw-p a) (concat " " a) ""))
 	  ;; Build caption.
 	  (let ((caption (org-export-get-caption src-block)))
 		(if (not caption) ""
-- 
2.45.2

>From 5d4fa5c3e0a7933d10d8f1ece3e368d35e4838ad Mon Sep 17 00:00:00 2001
From: Suhail 
Date: Mon, 17 Jun 2024 22:00:35 -0400
Subject: [PATCH 2/2] ox-html: Add support for attr_html in fixed-width blocks

* lisp/ox-html.el (org-html-fixed-width): Handle attr_html in a manner
similar to example blocks.

TINYCHANGE
---
 lisp/ox-html.el | 20 +++-
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 675d85ffe..848017f1d 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2728,13 +2728,23 @@ (defun org-html-export-block
 
  Fixed Width
 
-(defun org-html-fixed-width (fixed-width _contents _info)
+(defun org-html-fixed-width (fixed-width _contents info)
   "Transcode a FIXED-WIDTH element from Org to HTML.
 CONTENTS is nil.  INFO is a plist holding contextual information."
-  (format "\n%s"
-	  (org-html-do-format-code
-	   (org-remove-indentation
-	(org-element-property :value fixed-width)
+  (let ((attributes (org-export-read-attribute :attr_html fixed-width)))
+(if-let ((class-val (plist-get attributes :class)))
+(setq attributes (plist-put attributes :class (concat "example " class-val)))
+  (setq attributes (plist-put attributes :class "example")))
+(format "\n%s"
+(let* ((reference (org-html--reference fixed-width info))
+		   (a (org-html--make-attribute-string
+		   (if (or (not reference) (plist-member attributes :id))
+			   attributes
+			 (plist-put attributes :id reference)
+	  (if (org-string-nw-p a) (concat " " a) ""))
+	(org-html-do-format-code
+	 (org-remove-indentation
+	  (org-element-property :value fixed-width))
 
  Footnote Reference
 
-- 
2.45.2



Suhail (2):
  ox-html: Add support for attr_html for source code blocks
  ox-html: Add support for attr_html in 

Re: [ANN] Org mode 9.7 is out

2024-06-17 Thread JD Smith


> On Jun 6, 2024, at 4:41 PM, Juergen Fenn  wrote:
> 
> 
> 
> 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.

A few years ago, I wrote a small package for pasting PNG and PDF data from the 
Mac clipboard into org documents as attachments, which I still use:  
https://github.com/jdtsmith/org-mac-image-paste. 

With the recent work on yank-media I'm hopeful I can retire this package soon.  
I found I could pull PDF data to file from the clipboard via AppleScript (and 
display in the emacs-mac build using its image-io backend), but used 
pngpaste[1] tool for PNG data.  When an image is on the clipboard, PNG data are 
indeed available from the clipboard («class PNGf»), as can be seen via 
AppleScript.  You can use AppleScript to inquire about the state of the 
clipboard.  For example, after taking a screenshot, I see:

% osascript -e "clipboard info"
«class PNGf», 121849, «class 8BPS», 401974, GIF picture, 21636, «class jp2 », 
21831, JPEG picture, 35062, TIFF picture, 369790, «class BMP », 366218, «class 
TPIC», 285265

On copying an image from a website, I get:

% osascript -e "clipboard info"
TIFF picture, 91686, URL, 81, «class urln», 6, «class utf8», 81, «class rtfd», 
2652, «class weba», 5679, «class HTML», 800, «class 8BPS», 103154, GIF picture, 
681, «class jp2 », 5455, JPEG picture, 1059, «class PNGf», 6282, «class BMP », 
44298, «class TPIC», 8066, «class ut16», 164, string, 81, Unicode text, 162

For images grabbed from web-pages, you can actually get the URL information if 
you like and include that in or near the attachment link.  

Here's after copying a GIF file from the Finder:

% osascript -e "clipboard info"
«class furl», 41, «class ut16», 24, «class utf8», 11, «class icns», 1137764, 
Unicode text, 22, string, 11, «class 8BPS», 1295026, GIF picture, 74698, «class 
jp2 », 110628, JPEG picture, 62209, TIFF picture, 4198020, «class PNGf», 
305211, «class BMP », 4194442, «class TPIC», 796024

Notice the file-URL there, which you can get (here using the JXA=javascript 
flavor of AppleScript, with a UTI for the file-url, which is apparently the 
more modern way to do it):

% osascript -l JavaScript -e 'ObjC.import("AppKit"); 
$.NSPasteboard.generalPasteboard.stringForType("public.file-url");'
file:///Users/xxyz/Desktop/output.gif

You can even coerce the clipboard to be in a certain format:

% osascript -e "clipboard info"
TIFF picture, 35766, URL, 37, «class urln», 7, «class utf8», 37, «class rtfd», 
1082, «class weba», 3643, «class HTML», 820, «class 8BPS», 9884, GIF picture, 
434, «class jp2 », 4617, JPEG picture, 1268, «class PNGf», 1527, «class BMP », 
32538, «class TPIC», 2446, «class ut16», 76, string, 37, Unicode text, 74

% osascript -e "set the clipboard to (the clipboard as JPEG picture)"

% osascript -e "clipboard info"  
JPEG picture, 1268, «class 8BPS», 8622, GIF picture, 687, «class jp2 », 4671, 
TIFF picture, 27704, «class PNGf», 2508, «class BMP », 24534, «class TPIC», 4372

My knowledge doesn't go any deeper than that but thought I'd share what I know. 
 

[1] The code for pngpaste might be informative: 
https://github.com/jcsalterego/pngpaste/blob/main/pngpaste.m.   

RE: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-17 Thread Cook, Malcolm
> So, my workaround is to:
> 
> (setq comint-prompt-regexp "myname@myhost> ")
> 
> Then the filtering works perfectly.
> 
> Of course if I change my name, this will fail.  Or, more likely, connect to a
> different host within the shell.
> 
> Or if I change PS1 
> 
> It would be useful to automate this a little.
> 
> The variable needs to be set buffer-local to the shell buffer.
> 
> And it could possibly somehow ask the process for the value of PS1.

FWIW: the following gets at it...

(with-current-buffer "*shell*"  (setq comint-prompt-regexp   
(buffer-substring-no-properties (pos-bol) (pos-eol

> 
> Any more TIPS on doing this?
> 
> Or perhaps advice that I shouldn't want to ...??? 
> 
> Cheers,
> 
> ~ Malcolm



RE: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-17 Thread Cook, Malcolm

>>>TL;DR: It is complicated. When we pull one string out, several more
>>>get entangled.
>>
>> Might there be a solution wherein both the interactive shell buffer and Org 
>> are talking to a common underlying process? I would expect such to be 
>> significantly more complicated, but perhaps better factored? Not that I'm 
>> offering or capable of such a re-write 
>
>comint buffer is doing exactly this - it is sending input (user
>comments) to the underlying shell process and receiving the output from
>that process, putting it back into the comit buffer.
>
>Unfortunately, there is no simple way to distinguish real output, shell
>echoing the submitted command, and shell prompt - shells do not provide
>any such information. The best they can provide is splitting between
>stdout and stderr. Alas.
>
>>>As a practical workaround, just do not use *shell* session names and
>>>session names that are the same as shell buffers you create manually.
>>
>> Is there perhaps another practical workaround you might suggest to me 
>> involving a more intentional setting of the prompt and/or informing Org of 
>> my choice of prompt (e.g. perhaps via setting a regexp to detect exactly my 
>> prompt, and only when it is anchored to beginning of line)?
>
>That's also an option.
>What you need to fiddle with is `comint-prompt-regexp'.

This!  

Since my (bash) shell prompt is a (more or less) constant string (e.g. 
"myname@myhost> ").

So, my workaround is to:

(setq comint-prompt-regexp "myname@myhost> ")

Then the filtering works perfectly.

Of course if I change my name, this will fail.  Or, more likely, connect to a 
different host within the shell.

Or if I change PS1 

It would be useful to automate this a little.

The variable needs to be set buffer-local to the shell buffer.

And it could possibly somehow ask the process for the value of PS1.

Any more TIPS on doing this?

Or perhaps advice that I shouldn't want to ...??? 

Cheers,

~ Malcolm



Re: [BUG] org-refile-get-location a symlinked file [9.7-pre (release_9.6.29-1443-gb4d17c)]

2024-06-17 Thread Al Haji-Ali


On 17/06/2024, Ihor Radchenko wrote:
> Makes sense.
> May you prepare a patch with the proposed change?
> See https://orgmode.org/worg/org-contribute.html#first-patch

It's not really a long patch, just involves calling `file-truename` instead of 
`expand-file-name` in a couple of places.

diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index 20b5fbd02..7c463bc67 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -324,7 +324,7 @@ When `org-refile-use-cache' is nil, just return POS."
 (progn
   (when (bufferp f)
 (setq f (buffer-file-name (buffer-base-buffer f
-  (setq f (and f (expand-file-name f)))
+  (setq f (and f (file-truename f)))
   (when (eq org-refile-use-outline-path 'file)
 (push (list (and f (file-name-nondirectory f)) f nil nil) tgs))
   (when (eq org-refile-use-outline-path 'buffer-name)
@@ -666,7 +666,7 @@ this function appends the default value from
  #'completing-read))
 (extra (if org-refile-use-outline-path "/" ""))
 (cbnex (concat (buffer-name) extra))
-(filename (and cfn (expand-file-name cfn)))
+(filename (and cfn (file-truename cfn)))
 (tbl (mapcar
   (lambda (x)
 (if (and (not (member org-refile-use-outline-path

-- Al



Re: [ANN] Org mode 9.7 is out

2024-06-17 Thread JD Smith


> On Jun 6, 2024, at 4:41 PM, Juergen Fenn  wrote:
> 
> 
> 
> 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.

A few years ago, I wrote a small package for pasting PNG and PDF into org 
documents as attachments, which I still use: org-mac-image-paste:  
https://github.com/jdtsmith/org-mac-image-paste. 

With the recent work on yank-media I'm hopeful I can retire this tool soon (see 
the bottom of that page).  I found I could pull PDF data from the clipboard via 
AppleScript (and display in the emacs-mac build using its image-io backend), 
but had to use the pngpaste tool for PNG data.  PNG data are indeed included on 
the clipboard («class PNGf»), and can be seen via AppleScript.

The code for pngpaste might be informative: 
https://github.com/jcsalterego/pngpaste/blob/main/pngpaste.m.




Re: [BUG] Columnview makes attributes wander [9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)]

2024-06-17 Thread Raffael Stocker
Ihor Radchenko  writes:

> May you please convert the diff into a proper patch, so that I can
> install it under your name?

I gave it a try, please see the attachment.

Cheers,
Raffael

>From a94c25606164678b7887e9cc45c059b025f5140c Mon Sep 17 00:00:00 2001
From: Raffael Stocker 
Date: Mon, 17 Jun 2024 21:09:45 +0200
Subject: [PATCH] lisp/org-colview.el: Prevent repeated indentation of keyword
 lines

* org-colview.el (org-columns-dblock-write-default): left trim keyword
and TBLFM lines to prevent repeated indentation.
---
 lisp/org-colview.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 961ae0fbe..bc93941e4 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1662,7 +1662,7 @@ defun org-columns-dblock-write-default
 	;; Insert affiliated keywords before the table.
 	(when content-lines
 	  (while (string-match-p "\\`[ \t]*#\\+" (car content-lines))
-	(insert (pop content-lines) "\n")))
+	(insert (string-trim-left (pop content-lines)) "\n")))
 	(save-excursion
 	  ;; Insert table at point.
 	  (insert
@@ -1675,7 +1675,7 @@ defun org-columns-dblock-write-default
 	  (let ((case-fold-search t))
 	(dolist (line content-lines)
 	  (when (string-match-p "\\`[ \t]*#\\+TBLFM:" line)
-		(insert "\n" line)
+		(insert "\n" (string-trim-left line))
 		(unless recalc (setq recalc t))
 	(when recalc (org-table-recalculate 'all t))
 	(org-table-align)
-- 
2.45.2



Re: ob-shell: possibly missing initiate-session functions?

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

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

#+begin_src diff
 (put fname 'definition-name 'org-babel-shell-initialize))
  +(let ((fname (intern (concat "org-babel-prep-session:" name
  +  (defalias fname
  +(lambda (session params)
  +   (:documentation
  +   (format "Prepare %s SESSION according to the header arguments 
specified in PARAMS." name))
  +   (let ((explicit-shell-file-name name)
  +(shell-file-name name))
  + (org-babel-prep-session:shell session params
  +  (put fname 'definition-name 'org-babel-shell-initialize))
  +(let ((fname (intern (format "org-babel-%s-initiate-session" name
  +  (defalias fname
  +(lambda (session _params)
  +   (:documentation
  +   (format "Initiate %s session named SESSION." name))
  +   (let ((explicit-shell-file-name name)
  +(shell-file-name name))
  + (org-babel-sh-initiate-session session
  +  (put fname 'definition-name 'org-babel-shell-initialize))
#+end_src

Am I mistaken, or does something still need to be done about
org-babel-shell-initiate-session ?

-- 
Suhail



Re: [BUG] orgalist send bug

2024-06-17 Thread General discussions about Org-mode.
Hello,

Ihor Radchenko  writes:

> I can reproduce. The problem is in
>
> ;; FIXME: Compatibility layer.  Remove when
>  ;; we require at least Emacs 26.1.
>  (funcall (if (fboundp 'org-list-to-lisp)
>   'org-list-to-lisp)
>   'org-list-parse-list)
>
> The `if' has its parenthesis messed up, calling `org-list-to-lisp'
> with DELETE argument.

Fixed. Thank you.

Regards,
-- 
Nicolas Goaziou





RE: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-17 Thread Ihor Radchenko
"Cook, Malcolm"  writes:

>>TL;DR: It is complicated. When we pull one string out, several more
>>get entangled.
>
> Might there be a solution wherein both the interactive shell buffer and Org 
> are talking to a common underlying process?  I would expect such to be 
> significantly more complicated, but perhaps better factored?  Not that I'm 
> offering or capable of such a re-write 

comint buffer is doing exactly this - it is sending input (user
comments) to the underlying shell process and receiving the output from
that process, putting it back into the comit buffer.

Unfortunately, there is no simple way to distinguish real output, shell
echoing the submitted command, and shell prompt - shells do not provide
any such information. The best they can provide is splitting between
stdout and stderr. Alas.

>>As a practical workaround, just do not use *shell* session names and
>>session names that are the same as shell buffers you create manually.
>
> Is there perhaps another practical workaround you might suggest to me 
> involving a more intentional setting of the prompt and/or informing Org of my 
> choice of prompt (e.g. perhaps via setting a regexp to detect exactly my 
> prompt, and only when it is anchored to beginning of line)?

That's also an option.
What you need to fiddle with is `comint-prompt-regexp'.

> Thanks so much for your careful explanation and pointers, and of course all 
> the work you do for Org ecosystem.  Perhaps time for my 1st trip to 
> liberapay... 

Thanks for the kind words.

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



Re: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-17 Thread Ihor Radchenko
Max Nikulin  writes:

> Some shells support "semantic shell" that allows terminal applications 
> e.g. to copy whole command output. It is based on escape sequences.
>
> - 
> https://docs.kde.org/stable5/en/konsole/konsole/semantic-shell-integration.html
> - 
> https://gitlab.freedesktop.org/Per_Bothner/specifications/blob/master/proposals/semantic-prompts.md

I am looking at this gitlab link, and they way it is implemented is
simply setting PROMPT in a way that adds these escape sequences to the
original PROMPT value.

In other words, it is a bit more advanced version of our approach with
setting prompt to a unique string - they surround the prompt with unique
chars instead.

In theory, we can do the same thing, adding some kind of invisible
unicode character around the prompt. We may even do it in the existing
prompts. Although one downside will be that the unicode character we add
may be carried along if the user copies the comint buffer contents.

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



Re: [BUG] html-htmlize-output-type does not work on a per project basis [9.6.15 (release_9.6.15 @ /usr/local/share/emacs/29.3/lisp/org/)]

2024-06-17 Thread Ihor Radchenko
Mehul Sanghvi  writes:

> For patches,  I'll see what I can do, but my emacs-lisp is not very great.
> Also wouldn't I need to sign some
> documents with FSF in order to contribute?

You do, but this particular change should be relatively trivial. If you
can fit things within 15LOC (and there is a good chance that it is
possible), copyright is not needed.

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



Re: [BUG] html-htmlize-output-type does not work on a per project basis [9.6.15 (release_9.6.15 @ /usr/local/share/emacs/29.3/lisp/org/)]

2024-06-17 Thread Mehul Sanghvi
On Sat, Jun 15, 2024 at 9:30 AM Ihor Radchenko  wrote:

> Mehul Sanghvi  writes:
>
> > I would like to be able to set =:html-htmlize-output-type= on a
> > per-project basis.  That does not seem to be working.  If I have
> > ~htmlize.el~ installed and set =:html-htmlize-output-type css=, then I
> > get hardcoded values for the colours being used in the code blocks.  If
> > I don't have ~htmlize.el~ installed, I get plain text.  To get CSS class
> > names, I have to do an explicit =(setq org-html-htmlize-output-type
> > 'css)= which effects all publishing projects.
> >
> >
> > 1.  What exactly did you do?
> >
> > I set =:html-htmlize-output-type css= in the _blog-non-prod_ project.
> > I also set =:html-htmlize-output-type 'css= and then tried both values
> > with =htmlize-output-type= as well.
>
> ox-html does not currently support setting :html-htmlize-output-type
> option. Only variable `org-html-htmlize-output-type' is supported.
> Same for `org-html-htmlize-font-prefix'.
>
> It would be nice to change this, yes.
> Confirmed.
>
> Patches welcome!
>
>
Ihor,  thanks for clarifying that information.  I've made adjustments in my
configs based on that information.

For patches,  I'll see what I can do, but my emacs-lisp is not very great.
Also wouldn't I need to sign some
documents with FSF in order to contribute?


cheers,

mehul


-- 
Mehul N. Sanghvi
email: mehul.sang...@gmail.com


[FR] place a header from an archive file back in its original location

2024-06-17 Thread Ihor Radchenko
JARZz  writes:

> Is there any org-mode function (or even a package) that can place a header 
> back in its original file from an archive based on the:ARCHIVE_FILE:?
>
> I understand this can be done with refile, but this a manual process which 
> also requires the ARCHIVE properties to be cleaned.
>
> for context, I wrote about it on my blog: 
> https://taonaw.com/2024/06/15/rethinking-and-organizing.html

It would be nice to have such a function.
I recall some random gists shared on reddit or other forums, but nobody
ever submitted a patch to Org mode adding such a functionality.

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



Re: [BUG] org-refile-get-location a symlinked file [9.7-pre (release_9.6.29-1443-gb4d17c)]

2024-06-17 Thread Ihor Radchenko
Al Haji-Ali  writes:

> I have `org-refile-use-outline-path` set to t, expecting that when refiling, 
> the filename should not appear in the list. However, because I am opening an 
> org file using a symblink and I have `find-file-visit-truename` set to `t`, 
> the test
>
> `(not (equal filename (nth 1 x)))`
>
> in `org-refile-get-location` always fails and the filename is displayed even 
> when the current buffer and `(nth 1 x)` point to the same file. If I replace 
> this condition by
>
> `(not (equal (file-truename filename) (file-truename (nth 1 x`
>
> The filename is not added to the list of refile targets as I would expect.

Makes sense.
May you prepare a patch with the proposed change?
See https://orgmode.org/worg/org-contribute.html#first-patch

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



Re: [BUG] Columnview makes attributes wander [9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)]

2024-06-17 Thread Ihor Radchenko
Raffael Stocker  writes:

> in columnview dblocks, attribute and tblfm lines wander to the right
> instead of staying in place when the table is re-evaluated (see the
> example file in the appendix).  This could be cured with a couple of
> ‘string-trim-left’ applications in ‘org-columns-dblock-write-default’
> like so:
> ...

Thanks for reporting and providing a diff!
May you please convert the diff into a proper patch, so that I can
install it under your name?
See https://orgmode.org/worg/org-contribute.html#first-patch

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



Re: [BUG] org-plot: Unable to use text xtics with type:2d (+ more) [9.7-pre (N/A @ /home/viz/lib/emacs/straight/build/org/)]

2024-06-17 Thread Ihor Radchenko
Visuwesh  writes:

>>> -  (type (assoc (plist-get params :plot-type)
>>> -   org-plot/preset-plot-types))
>>> +  (type (cdr (assoc (plist-get params :plot-type)
>>> +org-plot/preset-plot-types)))
>>> gnuplot-script)
>>
>> This may break the existing customization.
>> Later in the function, TYPE is used as an argument for
>> `org-plot/gnuplot-term-extra' and `org-plot/gnuplot-script-preamble'.
>> Some users may have these two custom options adjusted to the older
>> calling convention.
>>
>> To not break things, we should pass the full `assoc' to these functions.
>
> If you meant org-plot/gnuplot-script eventually calling these functions,
> then I don't see how the above change will break things.  Even in
> org-plot/gnuplot-script, TYPE passed to both these user options are
>
> (let* ((type-name (plist-get params :plot-type))
>(type (cdr (assoc type-name org-plot/preset-plot-types
>
> so there should be no harm done by the above change since TYPE is not an
> argument taken by org-plot/gnuplot-script.

Agree. I accidentally moved away from the function that is actually
being changed to org-plot/gnuplot-script that has nothing to do with
TYPE binding you are changing in the patch.

So, your code is ok here.

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



Re: [BUG/FR] org-plot: replot on resize [9.7-pre (N/A @ /home/viz/lib/emacs/straight/build/org/)]

2024-06-17 Thread Ihor Radchenko
Visuwesh  writes:

> From a922946b3965e117dc3bbbe5a4f3c67dcc832d68 Mon Sep 17 00:00:00 2001
> From: Visuwesh 
> Date: Sat, 15 Jun 2024 10:25:19 +0530
> Subject: [PATCH] org-plot: Make data-file stable for replot-on-resize

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

Fixed.

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



[BUG] org-refile-get-location a symlinked file [9.7-pre (release_9.6.29-1443-gb4d17c)]

2024-06-17 Thread Al Haji-Ali


I have `org-refile-use-outline-path` set to t, expecting that when refiling, 
the filename should not appear in the list. However, because I am opening an 
org file using a symblink and I have `find-file-visit-truename` set to `t`, the 
test

`(not (equal filename (nth 1 x)))`

in `org-refile-get-location` always fails and the filename is displayed even 
when the current buffer and `(nth 1 x)` point to the same file. If I replace 
this condition by

`(not (equal (file-truename filename) (file-truename (nth 1 x`

The filename is not added to the list of refile targets as I would expect.

-- Al

--
Emacs  : GNU Emacs 29.1 (build 1, aarch64-apple-darwin22.5.0, Carbon Version 
169 AppKit 2299.6)
 of 2023-09-09
Package: Org mode version 9.7-pre (release_9.6.29-1443-gb4d17c)




RE: org-babel-execute-src-block filters characters from :session *shell* output

2024-06-17 Thread Cook, Malcolm

 #+begin_src sh
 printf 'a\nb\nc\n>d\n>>> #+end_src

 #+RESULTS:
 : a
 : b
 : c
 : d
 : >>>
 Huh? what happened to the ">" before the "d"?
>>>
>>>I cannot reproduce.
>>>May it be that you are setting global :session header argument?
>>
>> Yes, of course, so sorry, there is
>>
>> #+PROPERTY: header-args:sh :session *shell* :results output
>>
>> You should now be able to reproduce.
>>
>> Thanks, please let me know if you have a fix, workaround, or lesson for me.
>
>In theory, we may provide a workaround for this kind of problem. But it
>would have pros and cons.
>
>The underlying cause is limitation of Emacs API for interactive shells -
>we cannot easily distinguish command output from prompt and other extra
>staff your shell/other interactive command spits into the buffer.
>So, we have to either filter output the prompts ourselves to get the
>command output reliably or redirect output to files, where nothing
>litters the actual output with prompts.

Yeah, I've noticed this also especially with Org as it relates to R and ESS.

>
>Redirecting output works fine when we do not use sessions and do not
>care what is displayed in the *shell* buffer for users. For sessions, we
>use more complex approach - filter out anything that looks like prompt.
>
>The problem with bash is that prompt is ">", and, as you showed in your
>example, having ">" in the commands output breaks everything.
>
>Again, we know this problem, and we normally force the prompt to be
>something more unique when creating sessions. But we do not touch the
>prompt when you point Org to an existing interactive shell buffer - that
>could be a surprise if Org mode changes the prompts by force in the
>shells you use interactively.
>
>TL;DR: It is complicated. When we pull one string out, several more
>get entangled.

Might there be a solution wherein both the interactive shell buffer and Org are 
talking to a common underlying process?  I would expect such to be 
significantly more complicated, but perhaps better factored?  Not that I'm 
offering or capable of such a re-write 

>As a practical workaround, just do not use *shell* session names and
>session names that are the same as shell buffers you create manually.

Is there perhaps another practical workaround you might suggest to me involving 
a more intentional setting of the prompt and/or informing Org of my choice of 
prompt (e.g. perhaps via setting a regexp to detect exactly my prompt, and only 
when it is anchored to beginning of line)?

Thanks so much for your careful explanation and pointers, and of course all the 
work you do for Org ecosystem.  Perhaps time for my 1st trip to liberapay... 

~ Malcolm

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


Re: [BUG] orgalist send bug

2024-06-17 Thread Ihor Radchenko
Rustom Mody  writes:

> On Sun, Jun 16, 2024 at 5:42 PM Ihor Radchenko  wrote:
>
>>
>> Please follow https://orgmode.org/manual/Feedback.html#Feedback
>>
>>
> 1. make repro
> 2. package-initialize (to get org-alist)

Please do M-: (require 'org-element) RET here.
You are getting a mix of built-in and git Org versions somehow.

> 3. load file shown above
> 4. M-x orgalist-send-list

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



Re: ob-shell: possibly missing initiate-session functions?

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

>> The alias would need to close over "explicit-shell-file-name" like is
>> done with "org-babel-execute:name".
>
> And what should be done in the case of org-babel-shell-initiate-session?
> Should shell-file-name and explicit-shell-file-name remain unaltered
> from their existing settings in that case?

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

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



Re: ob-shell: async support in "shell" vs "bash"

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

>> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=40d1352b
>
> I believe there's a bug in that commit.  Specifically, the commit
> message states:
>
> #+begin_quote
>   Propagate base `org-babel-header-args:shell'
>   to`org-babel-header-args:'.
> #+end_quote
>
> However, the code initializes org-babel-header-args: to nil,
> instead.

Thanks for the analysis!
Fixed, on bugfix.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=e60c7

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



Re: [BUG] Updating first subheading checkbox cookie resets parent cookie

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

> Consider the following tree:
>
> * Task [1/3]
> ** TODO test1 [/]
> - [x] a
> - [ ] b  
> ** DONE test2
> ** TODO test3 [/]
> - [X] x
> - [ ] y
>
> With point at the "test1" heading cookie ("[/]"), after =C-c C-c=, it gets 
> updated to "[1/2]", but it also resets its parent's "Task" cookie to "[0/0]".
>
> This only happens with the first heading of a subtree (updating the "task3" 
> cookie works as expected).

Thanks for reporting!
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=84f9d81ab

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



Re: Strip out #+title in #+include

2024-06-17 Thread Risto Stevcev
I tried that, and it did sort of work, but the problem is that I need to do
that for dozens of org roam files that may or may not have roam_refs, so it
felt really fragile.

On Mon, Jun 17, 2024, 16:34 Fraga, Eric  wrote:

> What I do in such cases is include the file starting at some line number
> that avoids the header information for that file (title, date, author,
> document settings).
>
> Example:
>
>  #+include: "introduction.org" :lines "10-"
>
>
> --
> : Eric S Fraga, with org release_9.7.3-44-g959534 in Emacs 30.0.50


Re: Strip out #+title in #+include

2024-06-17 Thread Fraga, Eric
What I do in such cases is include the file starting at some line number
that avoids the header information for that file (title, date, author,
document settings).

Example:

 #+include: "introduction.org" :lines "10-"


-- 
: Eric S Fraga, with org release_9.7.3-44-g959534 in Emacs 30.0.50


Re: [PATCH] lisp/org-compat.el: Allow using imenu to visit non-leaf headlines

2024-06-17 Thread Ihor Radchenko
Morgan Smith  writes:

>>> With the default `imenu-flatten' value of nil, it is still impossible
>>> to visit non-leaf headlines and no change is perceived.
>>
>> But no regressions, right? Especially in older Emacs versions with
>> `imenu-flatten' not yet available.
>>
>
> No regressions that I can tell from my testing.  Both emacs 29.3 (before
> imenu-flatten) and emacs-master show no change whatsoever (from what I
> can tell) when imenu-flatten is nil.

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

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



[BUG] Set `org-yank-image-save-method` setting affects org-capture errors on Windows systems [9.7.4 (release_9.7.4-7-g165319 @ f:/App/emacs/share/emacs/30.0.50/lisp/org/)]

2024-06-17 Thread ISouthRain


Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Example:
test.el:
;; All code
(add-hook 'org-mode-hook '(lambda ()
(setq-local org-yank-image-save-method (format 
"./attach/%s/" (file-name-nondirectory buffer-file-name)
;; End

Start test emacs:
emacs -q -l test.el
M-x org-capture RET t
Message out: Capture abort: Wrong type argument: stringp, nil

But My friend tested it on a Linux system with no problems.

Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-w64-mingw32)
Package: Org mode version 9.7.4 (release_9.7.4-7-g165319 @ 
f:/App/emacs/share/emacs/30.0.50/lisp/org/)

current state:
==
(setq
 org-agenda-skip-scheduled-if-done t
 org-yank-image-file-name-function 'org-yank-image-autogen-filename
 org-export-headline-levels 6
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-pandoc-epub-rights "Copyright 2024  "
 org-html-format-headline-function 'org-html-format-headline-default-function
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-pretty-entities t
 org-log-into-drawer t
 org-latex-format-inlinetask-function 
'org-latex-format-inlinetask-default-function
 org-babel-tangle-lang-exts '(("latex" . "tex") ("python" . "py") ("D" . "d") 
("C++" . "cpp")
  ("emacs-lisp" . "el") ("elisp" . "el"))
 org-speed-command-hook '(org-speed-command-activate 
org-babel-speed-command-activate)
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-agenda-finalize-hook '(org-agenda-to-appt)
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-yank-image-save-method "./attach/"
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-mode-hook '(page-break-lines-mode flyspell-mode
 #[nil ((if (display-graphic-p) (org-dynamic-bullets-mode))) 
nil] org-indent-mode
 (lambda nil (add-hook 'before-save-hook 
#'my/org-yank-path-replace nil 'local))
 whitespace-mode org-auto-tangle-mode
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-fold-show-all append 
local] 5]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-babel-show-result-all 
append local] 5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-hide-emphasis-markers t
 org-hide-leading-stars t
 org-confirm-shell-link-function 'yes-or-no-p
 org-dynamic-bullets-mode-hook '(org-visual-indent-mode)
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-occur-hook '(org-first-headline-recenter)
 org-ellipsis " ⭍"
 org-edit-src-content-indentation 0
 org-html-format-inlinetask-function 
'org-html-format-inlinetask-default-function
 org-emphasis-alist '(("*" freedom-org-emphasis-bold) ("/" 
freedom-org-emphasis-italic)
  ("_" freedom-org-emphasis-underline) ("=" org-verbatim 
verbatim)
  ("~" org-code verbatim)
  ("+" (freedom-org-emphasis-strike-through :strike-through 
t)))
 org-confirm-babel-evaluate nil
 org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS 
WIDTH)"]
 org-link-from-user-regexp "\\"
 org-priority-faces '((65 . error) (66 . warning) (67 . success))
 org-bibtex-headline-format-function 'org-bibtex-headline-format-default
 org-link-parameters '(("attachment" :follow org-attach-follow :complete 
org-attach-complete-link)
   ("id" :follow org-id-open :store org-id-store-link-maybe)
   ("eww" :follow org-eww-open :store org-eww-store-link)
   ("rmail" :follow org-rmail-open :store 
org-rmail-store-link)
   ("mhe" :follow org-mhe-open :store org-mhe-store-link)
   ("irc" :follow org-irc-visit :store org-irc-store-link 
:export
org-irc-export)
   ("info" :follow org-info-open :export org-info-export 
:store
org-info-store-link :insert-description 
org-info-description-as-command)
   ("gnus" :follow org-gnus-open :store org-gnus-store-link)
   ("docview" :follow org-docview-open :export 
org-docview-export :store
org-docview-store-link)
   ("bibtex" :follow org-bibtex-open :store 
org-bibtex-store-link)
   ("bbdb" :follow org-bbdb-open :export org-bbdb-export 
:complete
 

Re: Please document the caching and its user options

2024-06-17 Thread Daniel Clemente
> > In particular, when setting (setq org-element-cache-persistent nil)
> > org-mode *should not* create an org-persist directory anywhere. And I
> > think it shouldn't activate org-persist timers (it does now) or hooks.
> > The user's preference should be respected.
>
> Nope. "org-persist" directory is not only used by org-element. If some
> other parts of Org need to cache something, they can also store cache
> there.
>

What's the setting then to disable org-persist? I.e. to disable
creating of files like ~/.cache/org-persist/gc-lock.eld
Many people seem to want to disable all creation of org-mode related files.


> > That's a code change.
> > If you just want to update documentation, a starting point can be
> > org-element-cache-persistent's documentation, which is just "Non-nil
> > when cache should persist between Emacs sessions.", and doesn't
> > mention that some files will always be created even if it's nil. It
> > also doesn't explicitly mention that it will create files (better be
> > explicit about this), or where (or how to control where), or which
> > content (i.e. just statistics, or parts of possible private org
> > files).
>
> May you suggest an alternative docstring?
>

I don't know org-persist or org-element-cache-persistent so this needs
your input. I can start with a template, and you can fine-tune it,
expand it or rewrite it:

(defvar org-element-cache-persistent t
  "Non-nil when Org element cache should persist between Emacs sessions.
Cache files are written to disk at `org-persist-directory'.
The cache will be updated regularly (as controlled by
`org-element-cache-sync-idle-time') and when Emacs is closed.

Persisting the cache to disk can speed up (startup?
file opening time?, agendas? ...).. especially if you open
...(large files? mostly unmodified files? multiple emacs
instances?).
It is not recommended if (you edit the same files from
different emacs instances? if the Org files include sensitive
data?) If you use `org-crypt', note that the persisted cache may
temporarily store unencrypted data after decrypting a header.

Use `org-element-use-cache' instead to use a memory-only cache.")




I mentioned I don't know org-element-cache-persistent, I mean that as a user.
It's explained in developer terms („make the cache persistent“).
But as an user I don't know: is it good? will things be faster? are
there risks involved? can it corrupt my files? will it leave traces of
my files in other places? who should enable it? what's the downside?
etc.
My own experience, very subjective and it may be an edge case, is that
enabling org-element-cache-persistent didn't make loading my org files
faster; on the contrary, it made some things slower (including closing
Emacs).


> > I suggest making an explicit difference between "caching in memory"
> > and "caching by storing files on disk".
> > For instance:
> > (defvar org-element-use-cache t
> >   "Non-nil when Org parser should cache its results.")
> > From that description, it's not clear to a new user whether they're
> > creating files on disk (as caches often do) or not.
>
> Do you mean something like
>
> "Non-nil when Org parser should cache its results.
>
> The cache is stored in-memory and may also be stored on disk if
> `org-element-cache-persistent' is non-nil (the default)."
>
> ?

This seems better.



Re: [PATCH] oc-csl: New custom option `org-cite-csl-sentence-case-bibtex-titles'

2024-06-17 Thread Ihor Radchenko
Ihor Radchenko  writes:

>> I'm a bit unsure about naming the option:
>> Perhaps `org-cite-csl-sentence-case-bibtex-titles-without-langid'
>> would be more precise but I found it absurdly long and technical, as
>> most users are probably unaware of the existence of langid fields.
>
> Maybe org-cite-csl-sentence-case-english-titles?
>
> Also, it would be nice to point out the CSL and Bibtex have different
> conventions for the title field.

Andras, it has been a month since the last message in this thread.
May I know about the status of the patch?

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



[BUG] Columnview makes attributes wander [9.7.4 (9.7.4-1387e3 @ /home/rst/.emacs.d/elpa/org-9.7.4/)]

2024-06-17 Thread Raffael Stocker

Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Hello fellow org-modists,

in columnview dblocks, attribute and tblfm lines wander to the right
instead of staying in place when the table is re-evaluated (see the
example file in the appendix).  This could be cured with a couple of
‘string-trim-left’ applications in ‘org-columns-dblock-write-default’
like so:

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 961ae0fbe..bc93941e4 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1662,7 +1662,7 @@ defun org-columns-dblock-write-default
 	;; Insert affiliated keywords before the table.
 	(when content-lines
 	  (while (string-match-p "\\`[ \t]*#\\+" (car content-lines))
-	(insert (pop content-lines) "\n")))
+	(insert (string-trim-left (pop content-lines)) "\n")))
 	(save-excursion
 	  ;; Insert table at point.
 	  (insert
@@ -1675,7 +1675,7 @@ defun org-columns-dblock-write-default
 	  (let ((case-fold-search t))
 	(dolist (line content-lines)
 	  (when (string-match-p "\\`[ \t]*#\\+TBLFM:" line)
-		(insert "\n" line)
+		(insert "\n" (string-trim-left line))
 		(unless recalc (setq recalc t))
 	(when recalc (org-table-recalculate 'all t))
 	(org-table-align)

Regards,
Raffael

Emacs  : GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, 
cairo version 1.18.0)
Package: Org mode version 9.7.4 (9.7.4-1387e3 @ 
/home/rst/.emacs.d/elpa/org-9.7.4/)


* Overview

  The ~ATTR_LATEX~ and ~TBLFM~ lines will wander to the right with every ‘C-c C-c’
  on the columnview.

  #+BEGIN: columnview :hlines 1 :id "tasks"
  #+ATTR_LATEX: :width \textwidth
  | <40>  |  |   |   |
  | Task  | Estimated Effort | Actual Effort |   |
  |---+--+---+---|
  | Tasks |20:00 |   | 20.00 |
  | Foo   | 8:00 |   |  8.00 |
  | Bar   |12:00 |   | 12.00 |
  #+TBLFM: $4=$2;t
  #+END:

  
* Tasks
  :PROPERTIES:
  :ID: tasks
  :END:
  
** TODO Foo
   :PROPERTIES:
   :Effort:   8:00
   :END:
  
** TODO Bar
   :PROPERTIES:
   :Effort:   12:00
   :END: