Re: [BUG] Incorrect LaTeX export when using images in a table to display them side-by-side. [9.7.5 (release_9.7.5 @ /home/dadinn/.emacs.d/straight/build/org/)]

2025-02-27 Thread Pedro Andres Aranda Gutierrez
Thanks!
I see that the list of possibilities growing quite quickly.. Could we
please start by defining the possible cases?

1. Image embedded in  text in a paragraph

This file:image.png could be an emoticon

2. Images in a plain table

| file:image1.png | file:image2.png |

3. Images in a table controlled with attributes (your example)

#+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l
| file:image1.png | file:image2.png |

Any more?

Thx, /PA

On Thu, 27 Feb 2025 at 19:32, Ihor Radchenko  wrote:

> Pedro Andres Aranda Gutierrez  writes:
>
> > this is a quick fix for image inlining. It would be nice to have it
> checked
> > by more people.
> > ...
>
> > - (cond ((not (org-string-nw-p options)) "")
> > + (cond ((null attr) "") ;; this is a plain image with
> no attrs
> > +  ((not (org-string-nw-p options)) "")
>
> This will not work, for example in
>
> #+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l
> | file:image1.png | file:image2.png |
>
> --
> Ihor Radchenko // yantar92,
> Org mode maintainer,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet
Year 1 of the New Koprocracy


Select a region and yank a URL to create a link

2025-02-27 Thread General discussions about Org-mode.
Lately I've noticed more applications supporting a method of creating a link by 
pasting a URL. The flow works like this:
1. write some text
2. select the text you want to linkify
3. paste a URL to turn the selected text into a named link

This feature is supported many places (including Matrix, Zulip, GitLab, and 
many others) and I've found it to be convenient. To that end, I've created a 
proof of concept package called yank-dwim[1] that implements a yank-dwim-org[2] 
command, which when used as a replacement for yank in org-yank-generic, 
produces the effect I'm looking for.

What do you think about adding this capability to org-mode? Since many 
plain-text writing interfaces are offering it, I'm sure other users will 
appreciate if Emacs does the same.

If you're open to a patch, how do you like my implementation in the linked 
package? I'm happy to take a different approach if you prefer something else.

Cheers!
Ryan


[1] https://github.com/ryanprior/yank-dwim
[2] https://github.com/ryanprior/yank-dwim/blob/main/yank-dwim.el#L85



Re: [RFC] The best way to choose an "action" at point: context-menu-mode, transient, which-key or embark?

2025-02-27 Thread Tor-björn Claesson
Hi!

I'm making progress, macrostep is great, thanks:-) Here is a new patch with
my progress so far.

It adds om.el, which contains the start of a simple menu system, and uses
this to define org-cite-basic-follow.
Most of the work is done in org-menu-define.

Docstrings and the commit message are mostly placeholders, neither does it
so far support menu system other than transient.

I have a problem I do not understand: The definition of
org-cite-basic-follow using org-menu-define in oc-basic.el does not work
unless i evaluate it manually, otherwise org-cite-basic-follow is nil when
I try to follow citations.

Cheers
Tor-björn



Den lör 22 feb. 2025 kl 21:41 skrev Tor-björn Claesson :

> Thanks again, I'll be back :-)
>
> Cheers,
> Torbjörn
>
> Den lör 22 feb. 2025 16.18Ihor Radchenko  skrev:
>
>> Tor-björn Claesson  writes:
>>
>> >> 1. I am looking at C-- C-u prefix, and I am not sure if it is ideal
>> >>What I think might be better is:
>> >>- make a short C-- ('- argument) the switch
>> >>- make the switch customizable (if users do not like C--)
>> >>
>> >
>> > I tried simply changing the switch from "-4" to "'", but this does not
>> > work.
>> > My google skills fail me here, and I would be grateful for some advice
>> on
>> > how to proceed.
>>
>> Try this toy example:
>>
>> (defun yant/test (arg)
>>   (interactive "P")
>>   (if (eq arg '-)
>>   (message "Detected C-- !")
>> (message "other arg: %S" arg)))
>>
>> >> 4. Moving towards my item (2) in the plan, we need to generalize
>> >>(transient-define-prefix org-cite-basic-follow ...) into a macro
>> that
>> >>can work for arbitrary command; not just for
>> `org-cite-basic-follow'.
>> >>Let me know if you want my help on how to write such a macro.
>> >
>> > I'm trying to make this work. Is it OK to use (eval
>> > `(transient-define-prefix ...)) here?
>> > Also, I find it a bit easier to write this as a function rather than a
>> > macro, but this makes calling it a bit uglier.
>> > Should I try define this as a macro, or is a function acceptable?
>>
>> Macro will be better, but you can write is as a function first. We can
>> easily change it into a macro later.
>>
>> If you have troubles understanding macro expansion, I recommend playing
>> around with macrostep package.
>>
>> --
>> Ihor Radchenko // yantar92,
>> Org mode maintainer,
>> Learn more about Org mode at .
>> Support Org development at ,
>> or support my work at 
>>
>
From 1d7610767a74fbc2a7c8673071ba10c16862700e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tor-bj=C3=B6ron?= 
Date: Thu, 27 Feb 2025 20:30:07 +0200
Subject: [PATCH] lisp/om.el: Org-menu, a simple menu system for org.

* lisp/oc-basic.el (require 'om): Pull in om.
(org-cite-basic-follow-actions): New customization option, that
specifies the contents of the transient menu.
(org-cite-basic--get-key): New function. Get citation key from
citation or citation reference.
(org-cite-basic-goto): Use org-cite-basic--get-key.
(org-cite-register-processor 'basic): Update the basic citation
processor to follow citations using `org-cite-basic-follow'.

This change was co-authored with much support from Ihor Radchenko and
Jonas Bernoulli, thanks!
---
 lisp/oc-basic.el |  77 ++---
 lisp/om.el   | 145 +++
 2 files changed, 213 insertions(+), 9 deletions(-)
 create mode 100644 lisp/om.el

diff --git a/lisp/oc-basic.el b/lisp/oc-basic.el
index 32a99e987..95aa4c070 100644
--- a/lisp/oc-basic.el
+++ b/lisp/oc-basic.el
@@ -74,10 +74,12 @@
 (require 'map)
 (require 'oc)
 (require 'seq)
+(require 'om)
 
 (declare-function org-open-at-point "org" (&optional arg))
 (declare-function org-open-file "org" (path &optional in-emacs line search))
 
+(declare-function org-element-context "org-element" (&optional element))
 (declare-function org-element-create "org-element-ast" (type &optional props &rest children))
 (declare-function org-element-set "org-element-ast" (old new &optional keep-props))
 
@@ -140,6 +142,53 @@
   :type 'face
   :safe #'facep)
 
+(defcustom org-cite-basic-follow-actions
+  '[["Open"
+ ("b" "bibliography entry" (org-cite-basic-goto !object !prefix))]
+["Copy"
+ ("d" "DOI"
+  (let ((doi (org-cite-basic--get-field
+  'doi
+  (org-cite-basic--get-key !object
+(if (not (s-blank? doi))
+(kill-new doi)
+  (user-error "No DOI for `%s'" (org-cite-basic--get-key !object)
+ ("u" "URL"
+  (let ((url (org-cite-basic--get-field
+  'url
+  (org-cite-basic--get-key !object
+(if (not (s-blank? url))
+(kill-new url)
+  (user-error "No URL for `%s'" (org-cite-basic--get-key !object)]
+["Browse"
+ ("w" "Browse URL/DOI"
+  (let ((url (org-cite-basic--get-field
+  'url
+  (org-c

Re: [PATCH] lisp/org-collector.el: Add support for TBLFM

2025-02-27 Thread Ihor Radchenko
Slava Barinov  writes:

> Okay, let's merge this one, so it'll be available if someone wants to use it.

Sure.
Applied.
https://git.sr.ht/~bzg/org-contrib/commit/f1f6b6ec812803ff9969325a82960fb3545a

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



Re: Org Crypt problems

2025-02-27 Thread David Masterson
Leo Butler  writes:

> On Tue, Feb 25 2025, David Masterson  wrote:
>
>> 1.   If you enter a bad password (even a blank password) to
>>  org-decrypt-ent*, how do you tell Emacs to forget the password so
>>  that you can enter the right one?
>
> Does
>
> M-x auth-source-forget-all-cached RET
>
> work for you?

Hmm.

This would work for me, but what about people who might encrypt
different entries in Org with different passwords (or, for that matter,
people using gpg elsewhere as well)?  It seems to hit a little nail with
a big sledgehammer.

I'll have to look at org-crypt.el some more.

-- 
David Masterson



Re: [BUG] Incorrect LaTeX export when using images in a table to display them side-by-side. [9.7.5 (release_9.7.5 @ /home/dadinn/.emacs.d/straight/build/org/)]

2025-02-27 Thread Ihor Radchenko
Pedro Andres Aranda Gutierrez  writes:

> this is a quick fix for image inlining. It would be nice to have it checked
> by more people.
> ...

> - (cond ((not (org-string-nw-p options)) "")
> + (cond ((null attr) "") ;; this is a plain image with no 
> attrs
> +  ((not (org-string-nw-p options)) "")

This will not work, for example in

#+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l
| file:image1.png | file:image2.png |

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



agenda-custom-commands: tags-todo resetting sorting-strategy?

2025-02-27 Thread mailinglists

Hello,

I have noticed, that the sorting of custom agenda views, does not work 
as expected.


(setq org-agenda-custom-commands
  '(("n" "Agenda and all TODOs"
 ((tags-todo "LAST_REVIEW<>{.+}")
  (alltodo))
 )))

here, both blocks obviously use different sorting strategy, (alltodo) 
sorts the Prio #C to the bottom. On the other hand, (tags-todo) seems to 
reset the org-agenda-sorting-strategy, thus sorting Prio #C to the top.


(setq org-agenda-custom-commands
  '(("n" "Agenda and all TODOs"
 ((tags-todo "LAST_REVIEW<>{.+}" ((org-agenda-sorting-strategy 
'(priority-down

  (alltodo))
 )))

fixes that (at least for priority sorting).

My questions:
- Is it intended behavior for (tags-todo) to reset 
org-agenda-sorting-strategy?
- What is the best way to reuse the value, besides copying the lengthy 
default value of org-agenda-sorting-strategy?


Best Thanks,
Florian



Re: [PATCH] Add code element inside src-block in ox-html

2025-02-27 Thread Rudolf Adamkovič
Nikolaos Chatzikonstantinou  writes:

> Shouldn't the source blocks be using the  element?
>
> This patch is untested, I can pay more attention to it if first the
> maintainer(s) agree with my opinion. I thought the  tag is good
> for semantics.

This makes sense in the light of the HTML spec for `code':

  
https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-code-element

BTW, the example puts the `class' on `code' and not `pre':

  var i: Integer;
  begin
 i := 1;
  end.

Further, `code' is supported in the older HTML 4 too:

  https://www.w3.org/TR/html4/struct/text.html#edef-CODE

Rudy
-- 
"'Obvious' is all too often a synonym for 'wrong'."
--- Jeff Erickson, Algorithms, 2019

Rudolf Adamkovič  [he/him]
http://adamkovic.org



[BUG] Update to emacs 30.1/org-mode 9.7 changed agenda sort [9.7.11 (release_9.7.11 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)]

2025-02-27 Thread Doug Harris
(for better formatting and screenshots, see this discussion on reddit:
https://www.reddit.com/r/orgmode/comments/1iy6hrf/update_to_emacs_301orgmode_97_changed_agenda_sort/
)

I have a custom agenda "work" view for showing my agenda and some, but not
all of my todos:

(setq org-agenda-custom-commands
  '(("n" "Agenda and all TODOs"
 ((agenda "" nil)
  (alltodo "" nil))
 nil)
("w" "Work stuff"
 ((agenda "" nil)
  (tags-todo "-holding-CATEGORY=\"personal\"" nil))
 nil)
))

I updated emacs to 30.1 which brought along org-mode 9.7

Before the upgrade, the todos were sorted so that todos with priority set
were shown first, and, within those, those with priority A were shown first
followed by those with B and C.

Now the todos seem to be sorted first by filename and then by location
within the file.

I see the note in the 9.7 release notes (
https://orgmode.org/Changes.html#:%7E:text=%22Priority%22%20used%20to%20sort%20items%20in%20agenda%20is%20renamed%20to%20%22urgency%22)
that says:

> "Priority" used to sort items in agenda is renamed to "urgency"
Previously, priority-up and priority-down in org-agenda-sorting-strategy
used a composite rank depending on item's priority ([#A], [#B], [#C], etc)
and overdue time to order agenda items (see "11.4.3 Sorting of agenda
items" section of Org manual).
>
> Now, this composite rank is renamed to urgency and the relevant sorting
strategies are renamed to urgency-up and urgency-down. priority-up and
priority-down sort by item's priority only.
>
> Users relying on the previous composite ranking should adjust their
agenda sorting settings.

But I have not explicitly set any agenda sorting and this note doesn't
discuss default sort behavior (I don't think).

Discussion on r/org-mode suggests that this is not an expected change



Emacs  : GNU Emacs 30.1 (build 1, aarch64-apple-darwin21.6.0, NS
appkit-2113.65 Version 12.7.6 (Build 21H1320))
 of 2025-02-24
Package: Org mode version 9.7.11 (release_9.7.11 @
/Applications/Emacs.app/Contents/Resources/lisp/org/)


[PATCH] Fix (org-babel-remove-result-one-or-many) to remove results of call lines as well

2025-02-27 Thread Momchil Ivanov
Hi,

the function (org-babel-remove-result-one-or-many) does not remove results
of call lines when called with prefix argument. The attached patch makes
it do so.

I have attached two simple test cases as well.

Regards,
Momchil>From 7ff68b05d3fa0f06439b58ee9a7e980235d52d45 Mon Sep 17 00:00:00 2001
From: Momchil Ivanov 
Date: Thu, 27 Feb 2025 12:15:29 +0100
Subject: [PATCH] lisp/ob-core.el: Fix org-babel-remove-result-one-or-many

* lisp/ob-core.el (org-babel-remove-result-one-or-many): This function
removes results from source blocks when called with prefix
argument. Make it remove results of call lines in this case as well.

TINYCHANGE
---
 lisp/ob-core.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 27e652558..2f66ab17d 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2881,7 +2881,9 @@ If called with prefix argument ARG, remove all result blocks in the
 buffer."
   (interactive "P")
   (if arg
-  (org-babel-map-src-blocks nil (org-babel-remove-result))
+  (progn
+(org-babel-map-src-blocks nil (org-babel-remove-result))
+(org-babel-map-call-lines nil (org-babel-remove-result)))
 (org-babel-remove-result)))
 
 (defun org-babel-result-end ()
-- 
2.39.5
Define a source code block named ~f~ and evaluate it to produce a
=RESULTS= block:

#+name: f
#+begin_src sh :var x="a" :eval yes :results output
  echo "${x}"
#+end_src

Call the named source code block ~f~ to produce another =RESULTS=
block:

#+call: f(x="b")

#+RESULTS:
: b

Try to remove all results blocks.

#+begin_src emacs-lisp :results none
  (org-babel-remove-result-one-or-many t)
#+end_srcDefine a source code block named ~f~ and evaluate it to produce a
=RESULTS= block:

#+name: f
#+begin_src sh :var x="a" :eval yes :results output
  echo "${x}"
#+end_src

Call the named source code block ~f~ to produce another =RESULTS=
block:

#+call: f(x="b")

Fix function ~org-babel-remove-result-one-or-many~ to remove results
of call lines as well:

#+begin_src emacs-lisp :results none
  (defun org-babel-remove-result-one-or-many (x)
"Remove the result of the current source block.
  If called with a prefix argument, remove all result blocks
  in the buffer."
(interactive "P")
(if x
(progn
  (org-babel-map-src-blocks nil (org-babel-remove-result))
  (org-babel-map-call-lines nil (org-babel-remove-result)))
  (org-babel-remove-result)))
#+end_src

Try to remove all results blocks.

#+begin_src emacs-lisp :results none
  (org-babel-remove-result-one-or-many t)
#+end_src

Re: [PATCH] lisp/org-collector.el: Add support for TBLFM

2025-02-27 Thread Slava Barinov
Hello,

Okay, let's merge this one, so it'll be available if someone wants to use it.

And I'll spend some time to set up the correct environment, prepare package,
tests and so on. Will be back in a while when the package has an appropriate
state.

Best Regards,
Slava Barinov

Ihor Radchenko  writes:

> Slava Barinov  writes:
>
>> Okay, agreed.  
>
> Thanks!
> I have no further comments.
> Do you want me to commit this to org-contrib, or maybe you prefer to
> create the new repository for org-collector and continue from there?