Re: bug#59882: Multiple versions of Org in load-path problem

2023-02-20 Thread Richard Stallman
[[[ To any NSA and FBI agents reading my email: please consider]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > >> I don't run Debian or Ubuntu anymore. However, I do recall that debian
  > >> does use a modified Emacs startup which is not part of the standard
  > >> Emacs distribution. They do this to enable the ability to have multiple
  > >> versions of Emacs installed at the same time.

Would we like to add a feature like that to Emacs?
I don't know how much work it would be, but I think
it would be a desirable change if it is easy.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





Re: feature request: easy embedding of images

2023-02-20 Thread Jude DaShiell
To help accessibility it would be useful when an image was dragged into
org-mode if the user got prompted for an image description that gets
associated with the image in org-mode.  Some images are art work and those
should get alt="" tags if a user fails to provide a description but only
after asking if this image is art work or something that needs a
description.  If a description is provided that should go between the
quotes in the alt="" tag.



Jude  "There are four boxes to be used in
defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)

.

On Mon, 20 Feb 2023, Russell Adams wrote:

> On Sat, Feb 18, 2023 at 04:22:33PM -0800, Alexis Gallagher wrote:
> > Hello, my fellow org-mode lovers,
> >
> > This is a feature request ? or failing that, a request for advice on
> > a settings configuration which could produce this functionality now.
>
> Have you looked at org-attach-screenshot?
>
> https://github.com/dfeich/org-screenshot
>
> It uses org-attach and calls out to take a screenshot.
>
> I do the same with some local function's I wrote a while ago. It works
> very well for me. I run M-x my/org-screenshot, and after 3 seconds it
> will use Imagemagick's "import" command to allow me to select a region
> to screenshot and saves it to a filename I prepared.
>
> I do this daily, many times each day.
>
> > I wish org-mode had the ability to attach images to notes, display
> > them inline, and have that work well. By ?work well? I mean a few
> > specific things:
> >
> > ?   the image is automatically resized to maintain aspect ratio and
> > ?   fit horizontally with a civilized margin, so that I can resize
> > ?   my emacs window without the image disappearing or swamping the
> > ?   other content.
>
> This is Emacs, not Org. Perhaps someone knows how to adjust that.
>
> > ?   you can still scroll the window one line height unit at a time,
> > ?   without the entire image being scrolled as if it were one giant
> > ?   line, breaking scrolling, as seems to happen on my emacs
> > ?   (version 28.x on Linux)
>
> Mine jumps too, but again that's Emacs, not Org.
>
> > ?   drag and drop, so I can add the image by dragging it in, for
> > ?   instance from a screenshot tool or from an image on a web page.
>
> I can't answer that. Drag and drop functions depend on your
> platform. Does anything else in Emacs use drag and drop?
>
> > ?   sensible defaults for storing the images bundled with notes and
> > ?   keeping the two associated, so that I don't subsequently live in
> > ?   fear of ever moving my org files
>
> I do save all of mine to the same directory as my org file in
> .org/Filename.org.screenshotMMDDHHMMSS.png. It means I can easily
> know what files below to my org document.
>
> > Why is this valuable, to me at least? I use org to take notes all
> > day, during meetings, on reading matter, in the development of my
> > own thoughts. Embedding images would let me collect every kind of
> > resource I can't reproduce by typing or copy and pasting text ?
> > photos of slides during presentations, photos of whiteboard, key
> > snippets from websites, handwritten notes and equations, etc..
>
> Of course it's valuable, and already implemented. I think you're
> asking more about refining how you use it.
>
> --
> Russell Adamsrlad...@adamsinfoserv.com
> https://www.adamsinfoserv.com/
>
>



Re: feature request: easy embedding of images

2023-02-20 Thread Daniel Fleischer
Alexis Gallagher [2023-02-18 Sat 16:22] wrote:

> This is a feature request — or failing that, a request for advice on a 
> settings configuration which could produce this
> functionality now. 

Russell mentioned a package and pointed to the image issues related to
Emacs, not Org.

I want to suggest the package https://github.com/abo-abo/org-download
which I use all time, for dragging and dropping images and for taking
screeshots. 

-- 
Daniel Fleischer



Re: feature request: easy embedding of images

2023-02-20 Thread Russell Adams
On Sat, Feb 18, 2023 at 04:22:33PM -0800, Alexis Gallagher wrote:
> Hello, my fellow org-mode lovers,
>
> This is a feature request — or failing that, a request for advice on
> a settings configuration which could produce this functionality now.

Have you looked at org-attach-screenshot?

https://github.com/dfeich/org-screenshot

It uses org-attach and calls out to take a screenshot.

I do the same with some local function's I wrote a while ago. It works
very well for me. I run M-x my/org-screenshot, and after 3 seconds it
will use Imagemagick's "import" command to allow me to select a region
to screenshot and saves it to a filename I prepared.

I do this daily, many times each day.

> I wish org-mode had the ability to attach images to notes, display
> them inline, and have that work well. By “work well” I mean a few
> specific things:
>
>   •   the image is automatically resized to maintain aspect ratio and
>   •   fit horizontally with a civilized margin, so that I can resize
>   •   my emacs window without the image disappearing or swamping the
>   •   other content.

This is Emacs, not Org. Perhaps someone knows how to adjust that.

>   •   you can still scroll the window one line height unit at a time,
>   •   without the entire image being scrolled as if it were one giant
>   •   line, breaking scrolling, as seems to happen on my emacs
>   •   (version 28.x on Linux)

Mine jumps too, but again that's Emacs, not Org.

>   •   drag and drop, so I can add the image by dragging it in, for
>   •   instance from a screenshot tool or from an image on a web page.

I can't answer that. Drag and drop functions depend on your
platform. Does anything else in Emacs use drag and drop?

>   •   sensible defaults for storing the images bundled with notes and
>   •   keeping the two associated, so that I don't subsequently live in
>   •   fear of ever moving my org files

I do save all of mine to the same directory as my org file in
.org/Filename.org.screenshotMMDDHHMMSS.png. It means I can easily
know what files below to my org document.

> Why is this valuable, to me at least? I use org to take notes all
> day, during meetings, on reading matter, in the development of my
> own thoughts. Embedding images would let me collect every kind of
> resource I can't reproduce by typing or copy and pasting text —
> photos of slides during presentations, photos of whiteboard, key
> snippets from websites, handwritten notes and equations, etc..

Of course it's valuable, and already implemented. I think you're
asking more about refining how you use it.

--
Russell Adamsrlad...@adamsinfoserv.com
https://www.adamsinfoserv.com/



Re: RFC on implementation adding buttons beside headings

2023-02-20 Thread Bruno Barbier
pareto optimal  writes:

> I found the only way to place the button where I wanted was to insert
> some blank space after the heading. Is that expected and best practice
> or is there some other way to do it?

FWIW, instead of inserting some blank spaces, you could overlay existing
characters, you'll just need to re-inject them at display time so that
the display doesn't change. That way, you don't modified the text.


Here is a way to add a button, in place, without modifying the
buffer.  The trick is to overlay the EOL and to re-inject an EOL
using the "after-string" property.


 (with-current-buffer (generate-new-buffer "=test")
   (cl-flet ((run (f) (lambda ( args) (interactive) (funcall f
 (let (pos)
   (insert "* My title\n")
   (setq pos (1- (point)))
   (insert "An amazing note.\n\n")
   (insert "** My 2 title\n")
   (insert "An even more amazing note.\n")
   (org-mode)
   (make-button pos (1+ pos)
'before-string "\n\n"
'display '((height 2) "Click me!")
'after-string "\n\n"
'face 'custom-button
'action (run (lambda () (message "Thanks!")))
)))
   (pop-to-buffer (current-buffer))
   )
   
Note that the above expression requires lexical-binding.


Bruno



[BUG] C-S-up/down on first timestamp in clock malfunctioning [9.6.1 (release_N/A-N/A-747e60 @ /Users/[]/.emacs.d/elpa/org-9.6.1.0.20230218.123114/)]

2023-02-20 Thread sting . startup-0y


Consider:

* Test
:LOGBOOK:
CLOCK: [2023-02-19 Sun 22:30]--[2023-02-20 Mon 00:35] =>  2:05
:END:

Hitting C-S-up/down in the first time stamp does not preserver duration, and 
can lead to negative durations, which "break" the clock.  The same keystrokes 
work as intended in the second timestamp.



Emacs  : GNU Emacs 28.2 (build 1, x86_64-apple-darwin21.6.0, Carbon Version 165 
AppKit 2113.6)
of 2022-11-01
Package: Org mode version 9.6.1 (release_N/A-N/A-747e60 @ 
/Users/[]/.emacs.d/elpa/org-9.6.1.0.20230218.123114/)

current state:
==
(setq
org-link-elisp-confirm-function 'yes-or-no-p
org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
org-persist-after-read-hook '(org-element--cache-persist-after-read)
org-export-before-parsing-hook '(org-attach-expand-links)
org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
org-archive-hook '(org-attach-archive-delete-maybe)
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines
  org-cycle-optimize-window-after-visibility-change
  org-cycle-display-inline-images)
org-persist-before-read-hook '(org-element--cache-persist-before-read)
org-mode-hook '(#[0 "\301\211\207"
   [imenu-create-index-function org-imenu-get-tree] 2]
 #[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-confirm-shell-link-function 'yes-or-no-p
outline-isearch-open-invisible-function 'outline-isearch-open-invisible
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
org-confirm-elisp-link-function 'yes-or-no-p
org-speed-command-hook '(org-speed-command-activate
  org-babel-speed-command-activate)
org-persist-directory 
"/var/folders/by/19mt78cj63v5_tslqh826g7wgn/T/org-persist-XBsel1"
org-fold-core-isearch-open-function 'org-fold--isearch-reveal
org-persist-before-write-hook '(org-element--cache-persist-before-write)
org-tab-first-hook '(org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
org-link-shell-confirm-function 'yes-or-no-p
org-babel-pre-tangle-hook '(save-buffer)
org-agenda-loop-over-headlines-in-active-region nil
org-occur-hook '(org-first-headline-recenter)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-link-parameters '(("attachment" :follow org-attach-follow :complete
org-attach-complete-link)
   ("id" :follow org-id-open)
   ("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 org-bbdb-complete-link :store
org-bbdb-store-link)
   ("w3m" :store org-w3m-store-link)
   ("doi" :follow org-link-doi-open :export
org-link-doi-export)
   ("file+sys") ("file+emacs")
   ("shell" :follow org-link--open-shell)
   ("news" :follow
#[514 "\301\300\302Q\"\207"
  ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
   ("mailto" :follow
#[514 "\301\300\302Q\"\207"
  ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
   ("https" :follow
#[514 "\301\300\302Q\"\207"
  ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"]
)
   

org-latex foreground color in svg is controlled by org-latex-and-related

2023-02-20 Thread Wei-Ting Lin
Recently I found the foreground color of the latex-preview in org-mode is
controlled by "org-latex-and-related".

There is another option called "org-format-latex-options", which can also
set the foreground color, but it has no effect for the svg output.

I don't know if this behavior is by design or a bug, but I hope we can have
an option to have different colors for them.

WTL


feature request: easy embedding of images

2023-02-20 Thread Alexis Gallagher
Hello, my fellow org-mode lovers,

This is a feature request — or failing that, a request for advice on a settings 
configuration which could produce this functionality now. 

I wish org-mode had the ability to attach images to notes, display them inline, 
and have that work well. By “work well” I mean a few specific things:

•   the image is automatically resized to maintain aspect ratio and 
fit horizontally with a civilized margin, so that I can resize my emacs window 
without the image disappearing or swamping the other content. 
•   you can still scroll the window one line height unit at a time, 
without the entire image being scrolled as if it were one giant line, breaking 
scrolling, as seems to happen on my emacs (version 28.x on Linux)
•   drag and drop, so I can add the image by dragging it in, for 
instance from a screenshot tool or from an image on a web page.
•   sensible defaults for storing the images bundled with notes and 
keeping the two associated, so that I don't subsequently live in fear of ever 
moving my org files

Why is this valuable, to me at least? I use org to take notes all day, during 
meetings, on reading matter, in the development of my own thoughts. Embedding 
images would let me collect every kind of resource I can't reproduce by typing 
or copy and pasting text — photos of slides during presentations, photos of 
whiteboard,  key snippets from websites, handwritten notes and equations, etc..

Alexis



Re: Unicode problem with export of literal contents

2023-02-20 Thread Bruno Barbier


Jens Lechtenboerger  writes:

> On 2023-02-20, Bruno Barbier wrote:
>
> However, if I use insert-file-contents-literally with a unicode
> file, I do *not* have to set the coding-system-for-write.  This just
> works:
>
>(with-temp-buffer
>   (insert-file-contents-literally "~/unicode.org")
>   (secure-hash 'md5 (current-buffer)))

Humm. Emacs is amazing: it managed to guess the right encoding, from the
buffer context, probably...

But, what you are giving to 'org-export-string-as' is not the buffer,
it's a string. So, let's try the same without using an org function:

 (with-temp-buffer
   (insert (with-temp-buffer
 (insert-file-contents-literally "~/unicode.org")
 (buffer-string)))
   (secure-hash 'md5 (current-buffer)))
   
And, that fails, requesting an encoding.


> In the context of Org export, secure-hash seems to require a coding
> system.  Why?

I'm not an expert, so, you'll need to confirm with other sources.  But
secure-hash requires an encoding in all cases, to compute the hash of
some text, because it needs the array of bytes that represents that text
to compute its hash.

I don't see any bug in org, and, I don't see any bug in secure-hash either.

You literally shoud stop using "literally" ;-)

And, you might want to read:
   (info "(elisp) Non-ASCII Characters")



Bruno


>
> Best wishes
> Jens



Re: Links to external targets with (or despite) org-ref

2023-02-20 Thread John Kitchin
The quickest thing might be to remove the store properties on the ref
links. This should do it.

#+BEGIN_SRC emacs-lisp
(cl-loop for reflink in '("ref" "pageref" "nameref" "eqref" "autoref"
"cref" "Cref" "crefrange" "Crefrange")
do
(setf (cdr (assoc reflink org-link-parameters))
  (org-plist-delete (cdr (assoc reflink org-link-parameters)) :store)))
#+END_SRC

I guess I don't have that setup quite right in org-ref, it seems like it
should not clobber other ways to store links.

On Sun, Feb 19, 2023 at 10:39 AM Sven Bretfeld 
wrote:

> Hi everybody
>
> I'm looking to create labels/links to specific text positions in org
> files (not line number, not header).
>
> I know that [[file:~/path_to_file::target]] can be used to jump to
> <>. That would be fine and works for me -- IF I write the link
> manually.
>
> However, org-ref which I use for citations seems to overwrite the
> default behaviour of org-store-link and org-insert-link. So when the
> point is on <> and org-store-link is called (C-c l), I get a
> prompt "Store link with (default org-ref-store-ref)". No alternatives
> are offered when TAB is hit. Hiting RET saves the link as
> "Crefrange:target". A corresponding org-insert-link (C-c C-l) produces
> a link of the form [[Crefrange:target]] which, when in another file,
> of course leads nowhere ("search failed"). How to get the file name
> into these links without manually rewriting the link?
>
> I couldn't find anything on this issue in the org-ref manual or on the
> internet.
>
> Thanks for help,
>
> Sven
>
>


Re: [PATCH] Introduce "export features"

2023-02-20 Thread Timothy
Hi All,

Following some feedback I’ve received from a few people (including off-list),
here’s a v2 set of patches.

Notably, I’ve now got a draft manual entry (see the last patch attached), which
should go a long way to better explaining what this is without asking you to
wade through all the code comments :)

All the best,
Timothy

-- 
Timothy (‘tecosaur’/‘TEC’), Org mode contributor.
Learn more about Org mode at .
Support Org development at ,
or support my work at .
>From a8ed768515e4cf305ba52566f372e096f8ed449a Mon Sep 17 00:00:00 2001
From: TEC 
Date: Sun, 19 Feb 2023 12:28:31 +0800
Subject: [PATCH 1/6] org-compat: Add ensure-list as org-ensure-list

* lisp/org-compat.el (org-ensure-list): Add `ensure-list' from Emacs 28,
as `org-ensure-list'.
---
 lisp/org-compat.el | 12 
 1 file changed, 12 insertions(+)

diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index fadb51df6..e11de3639 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -193,6 +193,18 @@   (defun org-format-prompt (prompt default  format-args)
 default)))
  ": ")))
 
+(if (fboundp 'ensure-list)
+(defalias 'org-ensure-list #'ensure-list)
+  (defun org-ensure-list (object)
+"Return OBJECT as a list.
+If OBJECT is already a list, return OBJECT itself.  If it's
+not a list, return a one-element list containing OBJECT.
+
+Compatability substitute for `ensure-list' in Emacs 28."
+(if (listp object)
+object
+  (list object
+
 
 ;;; Emacs < 27.1 compatibility
 
-- 
2.39.1

>From 3a1d9eeb4e77a15f1466bc2377838b38d97d5b22 Mon Sep 17 00:00:00 2001
From: TEC 
Date: Mon, 25 Jul 2022 23:37:13 +0800
Subject: [PATCH 2/6] ox: Introduce conditional/generated preamble

* lisp/ox.el (org-export-detect-features, org-export-expand-features,
org-export-generate-features-preamble): New functions for detecting
features and generating content based on them.
(org-export-conditional-features): Customisation for feature detection.
(org-export-as): Add detected to features to info in the slot :features.
(org-export-update-features): Add a convenience function for users to
edit the feature condition/implementation lists.
(org-export--annotate-info, org-export-detect-features,
org-export-define-derived-backend, org-export-define-backend,
org-export-conditional-features): Refactor backend feature
conditions/implementations into a struct field.  This allows for parent
inheritance to be properly managed, and leads into future work making
features more widely used in the export process.
(org-export-expand-features, org-export-resolve-feature-implementations,
org-export-generate-features-preamble,
org-export-expand-feature-snippets): The main functions for working with
export features.
(org-export-process-features, org-export-update-features): Introduce
`org-export-process-features' to simplify the application of features to
INFO.
---
 lisp/ox.el | 609 -
 1 file changed, 604 insertions(+), 5 deletions(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index 7e4042bb8..7d9c5eb26 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -1030,7 +1030,7 @@ ;;; Defining Back-ends
 
 (cl-defstruct (org-export-backend (:constructor org-export-create-backend)
   (:copier nil))
-  name parent transcoders options filters blocks menu)
+  name parent transcoders options filters blocks menu feature-conditions feature-implementations)
 
 ;;;###autoload
 (defun org-export-get-backend (name)
@@ -1136,6 +1136,62 @@ (defun org-export-get-all-filters (backend)
 	(setq filters (append filters (org-export-backend-filters backend
   filters)))
 
+(defvar org-export-conditional-features)
+
+(defun org-export-get-all-feature-conditions (backend)
+  "Return full feature condition alist for BACKEND.
+
+BACKEND is an export back-end, as return by, e.g,,
+`org-export-create-backend'.  Return value is an alist where keys
+are feature conditions, and values are feature symbols.
+
+Unlike `org-export-backend-feature-conditions', this function
+also returns conditions inherited from parent back-ends, if any."
+  (when (symbolp backend) (setq backend (org-export-get-backend backend)))
+  (and backend
+   (let ((conditions (org-export-backend-feature-conditions backend))
+ parent)
+ (while (setq parent (org-export-backend-parent backend))
+   (setq backend (org-export-get-backend parent))
+   (dolist (condition (org-export-backend-feature-conditions backend))
+ (push condition conditions)))
+ (dolist (condition org-export-conditional-features)
+   (unless (assq (car condition) conditions)
+ (push condition conditions)))
+ conditions)))
+
+(defun org-export-get-all-feature-implementations (backend)
+  "Return full feature implementation alist for BACKEND.
+
+BACKEND is an export back-end, as return by, e.g,,

Re: [PATCH] Async evaluation in ob-shell

2023-02-20 Thread Matt

  On Mon, 20 Feb 2023 06:24:52 -0500  Ihor Radchenko  wrote --- 

 > Why not simply doing the `should' test when the
 > `test-ob-shell/uuid-regex' match fails? Instead of returning `t'. Then,
 > we will not need to use advise.

Great point. I had originally used advice to avoid a loop.  However, when it 
became apparent that the loop was necessary, I overlooked that the advice was 
no longer needed.

I've rewritten the test and updated the patch. 

0001-ob-shell-Add-async-evaluation.patch
Description: Binary data


Re: [PATCH] org-element-timestamp-interpreter: Return daterange anyway, if DATERANGE is non-nil

2023-02-20 Thread Ilya Chernyshov
You suggest to split timestamp types active/inactive-range to 
active/inactive-timerange, active/inactive-daterange?


On February 20, 2023 6:07:19 PM GMT+07:00, Ihor Radchenko  
wrote:
>Ilya Chernyshov  writes:
>
>> So, an option is needed that controls whether to return a 
>> daterange
>> (even it's possible to return a timerange) or a timerange (if the 
>> dates
>> in the range are equal).
>>
>> I wrote a patch that handles this problem, could you please review 
>> the
>> code and give some advice to improve it?
>
>What about recording the type of timestamp range in the parser?
>Then, interpreter can simply examine the range type and emit the correct
>timestamp string.
>
>-- 
>Ihor Radchenko // yantar92,
>Org mode contributor,
>Learn more about Org mode at .
>Support Org development at ,
>or support my work at 


[O] Injecting properties with noweb

2023-02-20 Thread Ken Mankoff
Hello,

Is it possible to set variables using Org Babel inside screen, which does not 
support ":var" header args? I'd actually lke a double-nested screen over ssh, 
and the ability to re-use Babel code blocks under different headings, using 
header args or PROPERTIES to change variables. That is, something like:

* Setup
:SETTINGS:
:FOO: default
:BAR: one
:header-args:screen+: :cmd /bin/bash :session (org-macro--get-property "FOO" "")
:END:

#+NAME: setup
#+BEGIN_SRC screen
if [[ ! $(hostname) =~ "host"* ]]; then ssh host; fi
<>
# eval <> ??
echo $FOO
#+END_SRC

Should print out "one" (the default setting under Setup) in the screen terminal.

** OTHER
:PROPERTIES:
:FOO: two
:END:

#+BEGIN_SRC screen
<>
#+END_SRC

Should print out "two" (the sub-heding adjusted property) in the screen 
terminal.


I'm OK with not being able to inject arbitrary variables, only the ~10 or so 
that I need to be able to set, and having a code block that has these 10 
hard-coded on the LHS, but with some <> or something on the RHS so that 
they value of the variable can be controlled using PROPERTIES under headings 
(better yet, header-args, but I don't think that is possible).  

That's the behavior I'm after, but am having trouble. I thought something like:

#+NAME: get-prop
#+BEGIN_SRC emacs-lisp :var prop="FOO" :noweb yes
(org-macro--get-property prop "")
#+END_SRC

#+NAME: inject_vars
#+BEGIN_SRC shell :noweb yes
# echo <> # testing
echo export FOO=<>
echo export BAR=<>
echo export BAZ=<>
#+END_SRC

#+BEGIN_SRC screen
<>
echo $FOO
#+END_SRC

might work, but it's just printing nil.


Thanks for any suggestions,

  -k.



Help needed with subtree export

2023-02-20 Thread Alain . Cochard


I only recently discovered subtree export, which I thought would be
better suited for me, but I have trouble to switch.

Consider the following file:

   #+SELECT_TAGS: export conditional
   #+EXCLUDE_TAGS: 

   #+OPTIONS: toc:nil title:nil author:nil date:nil tags:nil

   * I  :export:
   ** 1
   ** 2
   ** nth
   *** conditional :conditional:
   * II

If I use 'C-c C-e l o', I have everything under '* I' exported. If I
transfer 'conditional' from '#+SELECT_TAGS:' to '#+EXCLUDE_TAGS:', I
have everything under '* I' except the '*** conditional' headline.
This is want I want: be able to selectively include/exclude the
headlines with the ':conditional:' tag by simply transferring
'conditional'.

Now, if I use 'C-c C-e C-s l o' on '* I', it gives the same as above
when 'conditional' belongs to '#+EXCLUDE_TAGS:' but, after the
transfer of 'conditional' to '#+SELECT_TAGS:', only the '** nth'
headline is exported.

Is there a convenient way to achieve my goal?  Sure, I can put an
':export:' tag on '** 1', '** 2', and '** nth', but it is not very
practical.  I can also introduce a 'fake' headline and subtree export
it instead:

   * fake
   ** I :export:
   *** 1
   *** 2
   *** nth
    conditional :conditional:
   * II

but I don't like this workaround either.

Thanks in advance


PS: I have a minor comment about the manual: when reading the following

   ‘SELECT_TAGS’
The default value is ‘("export")’.  [...]

   ‘EXCLUDE_TAGS’
The default value is ‘("noexport")’.  [...]

I find it difficult to anticipate what will happen when there is no
tag at all.

-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.coch...@unistra.fr
5 rue René Descartes   [bureau 110]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France | [ slot available for rent ]




Re: [RFC] Backend vs. back-end (was: 2 'echo' bash instructions produce a table)

2023-02-20 Thread Alain . Cochard
Ihor Radchenko writes on Mon 20 Feb 2023 10:07:

 > I looked further, and the situation is not as simple.
 > https://grammarhow.com/backend-back-end-or-back-end/, for example,
 > claims that only "back-end" is grammatically correct.
 > 
 > I am now thinking to do the following:
 > 1. Use "backend" in the code symbols
 > 2. Use "back-end" in docstrings and the manual.
 > 
 > Would it make sense?


It is not clear to me why it would be a problem to use 'backend' in
code symbols as well, but the only important thing for me as a user is
that the terminology be consistent throughout the documentation.  So
yes, it makes sense.

The link you provide is very convincing.  Will it still hold in 5 or
10 year from now?  (see end of
https://www-cs-faculty.stanford.edu/~knuth/email.html)

-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.coch...@unistra.fr
5 rue René Descartes   [bureau 110]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France | [ slot available for rent ]




Re: Multiple noweb-ref

2023-02-20 Thread Ihor Radchenko
Théo Maxime Tyburn  writes:

> What I would like to have, when I expand `<>` is to get all the blocks
> under A, and when I expand `<>` I get all the blocks under B. For
> now when I expand `<>` I only get the blocks under A that are not under 
> B.
>
> Is there a way to do this with the current features of org-babel?

No, AFAIK. Not easily at least.

> Anyway I tried to hack my way trough it. It seems there are two things
> to do :
> 1) Enable noweb-ref to contain multiple references.
> 2) Accumulate references when using header-args+ or use tags to set the
> value of noweb-ref
>
> I came up with a quick patch for 1):
> modified   lisp/ob-core.el
> @@ -2910,8 +2910,11 @@ block but are passed literally to the 
> \"example-block\"."
>   (if (org-in-commented-heading-p)
>   (org-forward-heading-same-level nil t)
> (let* ((info (org-babel-get-src-block-info t))
> -  (ref (cdr (assq :noweb-ref (nth 2 info)
> - (push info (gethash ref cache))
> +  (refs (cdr (assq :noweb-ref (nth 2 info)
> +(if refs
> +(dolist (ref (s-split "+" refs))
> +   (push info (gethash ref cache)))
> +  (push info (gethash refs cache)))

+ is a bit awkward.
Space would be more logical as separator.
Though I am wondering if people are using noweb reference names with
spaces in the wild.

> Feedback on the code is of course very welcome. Not sure if using a plus
> sign as a delimiter is clever. Also not sure if using `s-split` is a
> good idea, what would be the builtin alternative?

There is built-in `split-string'.

> For 2) I didn't check in detail how one could achieve this. I have the
> impression it would be easier to use tags. One could define a
> new variable `org-babel-set-noweb-refs-from-tags` that would be used in
> `org-babel-get-src-block-info` to generate the value of noweb-ref we
> would like to have depending on the tags of the headline of the
> block. I'll try this soonish.

I do not like the idea of using tags.

What we might do is:

1. Leave :noweb-ref's current behavior of overwriting the parent
   parameter values.
2. Add a new :noweb-ref+ parameter to accumulate multiple noweb
   reference names. The relevant function to modify is
   `org-babel-merge-params'

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



Re: clock reports, group/rollup by tags, properties?

2023-02-20 Thread Ihor Radchenko
Robert Nikander  writes:

> If I use `:scope agenda`, I get a column called “File” that is used as the 
> top “group by” in the query. I don’t see a way to change that.
>
> I’d like to see my time divided by different criteria, like the type of work, 
> which I would define using properties or tags.
>
> Does org-mode do this now? If not, would people want this feature, or was 
> there a reason it was abandoned?

AFAIK, no.
The patch was forgotten and was never followed up.

If you are interested, you can create and submit patch now.

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



Re: [PATCH] oc-natbib: Provide a fallback bibliography style

2023-02-20 Thread Ihor Radchenko
Ihor Radchenko  writes:

> From f27e5b4f66b7e703f9b2fdaa5c1b5d756d38fd33 Mon Sep 17 00:00:00 2001
> Message-Id: 
> 
> From: Ihor Radchenko 
> Date: Wed, 25 Jan 2023 18:02:49 +0300
> Subject: [PATCH] oc-natbib: Provide a fallback bibliography style

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

I did not add default custom options. We can do it later if necessary.

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



Re: RFC on implementation adding buttons beside headings

2023-02-20 Thread Ihor Radchenko
[ Adding Org ML back to CC ]

pareto optimal  writes:

> Do you mean something like extending https://github.com/alphapapa/org-sidebar 
> to have these instead of directly in the org document?

A bit different.
What I have in mind is something like

(defun yant/insert-interative-button (text window command)
  "Create button named TEXT running COMMAND in WINDOW."
  (insert-button
   text
   'face '(:box t :height 2.0)
   'follow-link t
   'action
   `(lambda (_)
  (select-window ,window)
  (call-interactively #',command

(defun yant/demo-buttons ()
  "Demo of a buffer with touch screen-compatible buttons."
  (interactive)
  (unless (derived-mode-p 'org-mode)
(user-error "Must be in Org mode buffer"))
  (let ((org-window (selected-window)))
(switch-to-buffer-other-window (get-buffer-create "*Touch buttons*"))
(with-silent-modifications
  (erase-buffer))
(yant/insert-interative-button
 "Next heading" org-window 'org-next-visible-heading)
(insert "\n")
(yant/insert-interative-button
 "Previous heading" org-window 'org-previous-visible-heading)
(read-only-mode t)))

> The context menus are great! However it seems some people have a hard time 
> thinking of emacs as a gui applicaiton and right clicking even after I tell 
> them :)

It will be more natural on Android.

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



Re: [PATCH] Async evaluation in ob-shell

2023-02-20 Thread Ihor Radchenko
Matt  writes:

> +(advice-add
> + 'ob-shell-async-chunk-callback
> + :filter-return
> + (lambda ( r)
> +   (let ((result (car r)))
> + (should (string= result "1\n2\n"))  ; expect value
> + result))
> + `((name . ,session-name)))
> ...
> +(catch 'too-long
> +  (while (string-match test-ob-shell/uuid-regex 
> (buffer-string))
> +(progn
> +  (sleep-for 0.01)
> +  (when (time-less-p wait-time (current-time))
> +(throw 'too-long (ert-fail "Took too long to get 
> result from callback")
> +  t)))

Why not simply doing the `should' test when the
`test-ob-shell/uuid-regex' match fails? Instead of returning `t'. Then,
we will not need to use advise.

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



Re: [PATCH] org-element-timestamp-interpreter: Return daterange anyway, if DATERANGE is non-nil

2023-02-20 Thread Ihor Radchenko
Ilya Chernyshov  writes:

> So, an option is needed that controls whether to return a 
> daterange
> (even it's possible to return a timerange) or a timerange (if the 
> dates
> in the range are equal).
>
> I wrote a patch that handles this problem, could you please review 
> the
> code and give some advice to improve it?

What about recording the type of timestamp range in the parser?
Then, interpreter can simply examine the range type and emit the correct
timestamp string.

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



Re: [ANN] orgtbl-fit

2023-02-20 Thread Ihor Radchenko
tbanelwebmin  writes:

>>> Examples & documentation can be read here:
>>> https://github.com/tbanel/orgtblfit/blob/main/README.org
>> Interesting.
>> Could it be somehow integrated with TBLFM formulas?
>> I imagine something like
>>
>> ? +?*year +?*passengers +?*(year-2016)*passengers
>>
>> , when set as a column value in table formula, to be auto-updated with
>> actual coefficients upon re-calculating the table.
>> ...
> We need to specify the target column ("consumption" in this example). 
> Therefore, the formula could be something like that:
>
> $4 = fit (consumption = ? +?*year +?*passengers +?*(year-2016)*passengers)
> It would benefit from other spreadsheet features, like constants and 
> remote references.

Makes sense.

> On the development side, the TBLFM handling is already quite a big chunk 
> of code. We must take care that such an additional feature do not add 
> complexity and maintenance burden.

>From point of view of org-table.el, adding fitting functionality is
mostly delegating the work to GNU Calc. Org side is just parsing the
formula and transforming it to appropriate Calc function call.

So, given that the parsing is extended cleanly, I do not think that
maintenance burden will increase all that much. It may even benefit from
someone taking a fresh look and possibly refactoring org-table TBLFM
parser.

> Orgtbl-fit as-is
> 
>
> It is also possible to include orgtbl-fit as-is into Org Mode core. It 
> would sit side-by-side with the core without changing anything in its 
> code and its unit-tests.

IMHO, it is not sufficiently integrated with org-table.el facilities in
its current state. I'm afraid that we will have code duplication if
include orgtbl-fit as is.

BTW, the dollar replacement is something org-table can benefit from---a
number of people are confused because "$" is treated specially by Calc.

> Data-analysis toolkit
> -
>
>  From a higher perspective, we could give a consistent data-analysis 
> toolkit to Org Mode (and call it org-data-analysis.el).
>
> It would start with fitting, clustering & aggregation. Then, new 
> algorithms would be added upon user requests.
>
> Of course, there should be an interest among Org Mode users for such a 
> toolkit.

We can, but it should be first and foremost added to GNU Calc. On Org
side, we just need appropriate integration. Maintaining generic data
analysis code in Org is out of Org's scope.

Contributing to GNU Calc will also benefit GNU Calc users who don't use
Org mode.

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



Re: Unicode problem with export of literal contents

2023-02-20 Thread Jens Lechtenboerger
On 2023-02-20, Bruno Barbier wrote:

> If you're always using utf-8, here is a way to force it so that
> secure-hash can compute the hash. This should work:
>
>(with-temp-buffer
>   (let ((coding-system-for-write 'utf-8))
> (insert "Lechtenb\303\266rger")
> (secure-hash 'md5 (current-buffer

Yes, that works.

However, if I use insert-file-contents-literally with a unicode
file, I do *not* have to set the coding-system-for-write.  This just
works:

   (with-temp-buffer
  (insert-file-contents-literally "~/unicode.org")
  (secure-hash 'md5 (current-buffer)))

In the context of Org export, secure-hash seems to require a coding
system.  Why?

Best wishes
Jens


smime.p7s
Description: S/MIME cryptographic signature


Re: [RFC] Backend vs. back-end (was: 2 'echo' bash instructions produce a table)

2023-02-20 Thread Ihor Radchenko
Ihor Radchenko  writes:

> I am looking at https://techterms.com/definition/backend, and it looks
> like "backend" is the correct word we need to use here. Am I missing
> something?

I looked further, and the situation is not as simple.
https://grammarhow.com/backend-back-end-or-back-end/, for example,
claims that only "back-end" is grammatically correct.

I am now thinking to do the following:
1. Use "backend" in the code symbols
2. Use "back-end" in docstrings and the manual.

Would it make sense?

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



Re: bug with org-agenda? Doesn't list matches for last entry in #+TODO

2023-02-20 Thread Ihor Radchenko
Kevin Layer  writes:

> I don't see items for @ERRANDS when #+TODO is defined like this:
>
> #+TODO: @NOW @NEXT @WIP @PENDING @ERRANDS

The last item is considered "DONE". See 5.2.5 Setting up keywords for
individual files section of the manual.

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



Re: Unicode problem with export of literal contents

2023-02-20 Thread Bruno Barbier


Jens Lechtenboerger  writes:

> On 2023-02-17, Bruno Barbier wrote:
>
>> Here is a way to reproduce that doesn't use org, in case it might help
>> to manully fix your encoding issue:
>>
>>(with-temp-buffer
>>   (insert "Lechtenb\303\266rger")
>>   (let ((buffer-file-name (make-temp-file "mailtest")))
>> (save-buffer)))
>>
>> Does it work with your old config (with your old org) ?
>
> This also asks for an encoding.

If you're always using utf-8, here is a way to force it so that
secure-hash can compute the hash. This should work:

   (with-temp-buffer
  (let ((coding-system-for-write 'utf-8))
(insert "Lechtenb\303\266rger")
(secure-hash 'md5 (current-buffer

Without setting coding-system-for-write to utf-8, it asks for an
encoding:

   (with-temp-buffer
  (insert "Lechtenb\303\266rger")
  (secure-hash 'md5 (current-buffer)))


I'm still no getting your use case, but, let's hope that this naive hack
is enough for you :-)


Bruno


> Best wishes
> Jens



Re: Unicode problem with export of literal contents

2023-02-20 Thread Jens Lechtenboerger
On 2023-02-17, Ihor Radchenko wrote:

> Jens Lechtenboerger  writes:

>> Also, when I call secure-hash on the literal buffer-string, no
>> problem arises.
>
> Org is calling secure-hash on buffer. Calling on buffer-string would
> require unnecessary memory allocation to create the string.

I can call secure-hash on the buffer with literally inserted
contents without problems.

>> It is not obvious that Org tries to write something here and why
>> that fails now
>
> Org is not trying to write something. In you example, Org is just trying
> to calculate buffer string hash - nothing wrong on Org side. "Something
> wrong with encoding" way my guess. If you think that your case should be
> perfectly fine, I recommend asking Emacs devs by filing a bug report to
> them.

Thank you for the clarifications.  Probably I have to do that.

For the record, if I insert "Lechtenb\303\266rger" as string into a
buffer, secure-hash asks for a decoding.  If I insert that literally
via an UTF-8 encoded file, secure-hash works.

Best wishes
Jens


smime.p7s
Description: S/MIME cryptographic signature


Re: I want minus-key to give me `-' only

2023-02-20 Thread Colin Baxter
> Colin Baxter  writes:

> In an org-mode buffer, I notice a depression of the minus-key `-'
> now also gives an under-bar. I find this very annoying. I never
> insert the subsequent letter `—️' whatever it's called, and I do
> not want it. How do I remove this "feature" such that a depression
> of the minus-key will give me immediately the minus character `-'?

> Colin Baxter.

Forget this request. Idiot me had set the input method to TeX and
forgotten about it!




Re: Unicode problem with export of literal contents

2023-02-20 Thread Jens Lechtenboerger
On 2023-02-17, Bruno Barbier wrote:

> Here is a way to reproduce that doesn't use org, in case it might help
> to manully fix your encoding issue:
>
>(with-temp-buffer
>   (insert "Lechtenb\303\266rger")
>   (let ((buffer-file-name (make-temp-file "mailtest")))
> (save-buffer)))
>
> Does it work with your old config (with your old org) ?

This also asks for an encoding.

> What kind of failure do you get elsewhere if you let Emacs use the
> correct encoding (i.e. if you use `insert-file-contents') ?

I want to be sure to use the file contents in unchanged form, as
promised by insert-file-contents-literally.  For now, I copied part
of the code from insert-file-contents-literally to avoid
after-insert processing and file handlers.  I still do not
understand what is happening differently in my case, though...

Best wishes
Jens


smime.p7s
Description: S/MIME cryptographic signature


Re: I want minus-key to give me `-' only

2023-02-20 Thread General discussions about Org-mode.


Colin Baxter  writes:

> In an org-mode buffer, I notice a depression of the minus-key `-' now
> also gives an under-bar. I find this very annoying. I never insert the
> subsequent letter `—' whatever it's called, and I do not want it. How do
> I remove this "feature" such that a depression of the minus-key will
> give me immediately the minus character `-'?
>
> Colin Baxter.

Not quite sure what "depression" means in your message -- my guess is
the act of "releasing" this key.  Either case, I cannot reproduce your
issue on emacs-29 (8a18369afdc3) with org release_9.6-81-g563a43.

What is your keyboard configuration?  I'm using a US keyboard and I
suspect you are observing something from key composition.  Or maybe from
your Emacs input method like latex.  Attaching the result of this might
help others to investigate:

M-: current-input-method RET

--
Best,


RY



I want minus-key to give me `-' only

2023-02-20 Thread Colin Baxter


In an org-mode buffer, I notice a depression of the minus-key `-' now
also gives an under-bar. I find this very annoying. I never insert the
subsequent letter `—' whatever it's called, and I do not want it. How do
I remove this "feature" such that a depression of the minus-key will
give me immediately the minus character `-'?

Colin Baxter.