Re: what is the purpose of "This link has already been stored"?

2023-06-29 Thread Samuel Wales
or to [/mere brainstorm alert/] get really fancy, to be able to mark a
place where links are to be inserted [perhas to become a plain list or
so] then collect llinks from all over, then hit store and they all go
to the place you marked.  crash-proof.


On 6/29/23, Samuel Wales  wrote:
> although i just store and insert now, i'd also welcome the ability to
> collect links from various places and have them someplace like a
> register where they can be pasted all at once.  or even edit the list
> in the register, clear it, etc.
>
>
> On 6/29/23, Ihor Radchenko  wrote:
>> Anthony Carrico  writes:
>>
 Makes sense. It is a +1 for a defcustom.
 Although I still believe that we should change the current default,
 even
 if leaving an option to fall back to previous behaviour.
>>>
>>> I don't think there is much reason to complicate the interface with a
>>> defcustom. The current default is an error, so changing the default
>>> doesn't break the workflow of anyone using it the way Samuel describes
>>> (unless I'm missing something).
>>
>> What Samuel described is a sequence of M-x org-store-link followed by
>> M-x org-insert-all-links. With such workflow, user can expect that the
>> links are going to be stored in order. If we are instead shuffle the
>> stored links, M-x org-insert-all-links may result in unexpected
>> behaviour.
>>
>> Currently, when link to place is already stored, not error is thrown, a
>> message is displayed, no link is stored, and the stored link list is not
>> altered.
>>
>> --
>> Ihor Radchenko // yantar92,
>> Org mode contributor,
>> Learn more about Org mode at .
>> Support Org development at ,
>> or support my work at 
>>
>>
>
>
> --
> The Kafka Pandemic
>
> A blog about science, health, human rights, and misopathy:
> https://thekafkapandemic.blogspot.com
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



Re: what is the purpose of "This link has already been stored"?

2023-06-29 Thread Samuel Wales
although i just store and insert now, i'd also welcome the ability to
collect links from various places and have them someplace like a
register where they can be pasted all at once.  or even edit the list
in the register, clear it, etc.


On 6/29/23, Ihor Radchenko  wrote:
> Anthony Carrico  writes:
>
>>> Makes sense. It is a +1 for a defcustom.
>>> Although I still believe that we should change the current default, even
>>> if leaving an option to fall back to previous behaviour.
>>
>> I don't think there is much reason to complicate the interface with a
>> defcustom. The current default is an error, so changing the default
>> doesn't break the workflow of anyone using it the way Samuel describes
>> (unless I'm missing something).
>
> What Samuel described is a sequence of M-x org-store-link followed by
> M-x org-insert-all-links. With such workflow, user can expect that the
> links are going to be stored in order. If we are instead shuffle the
> stored links, M-x org-insert-all-links may result in unexpected
> behaviour.
>
> Currently, when link to place is already stored, not error is thrown, a
> message is displayed, no link is stored, and the stored link list is not
> altered.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



Re: Export Documentation Confusions

2023-06-29 Thread Ihor Radchenko
Matt  writes:

> Changes have been pushed

Thanks!

For future reference:
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=1b5451a10504ad5d17453e15bba5ea1cb0394399
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=9da248ccd2e2fb86a37009bb0e672cb8419dc30c
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=88c572de25894a7a012eee9c7316998135cf8f13

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

Applied.



Re: Export Documentation Confusions

2023-06-29 Thread Matt
Changes have been pushed



Re: Export Documentation Confusions

2023-06-29 Thread Ihor Radchenko
Matt  writes:

>  > "Convert region" may be still confusing. Maybe something like
>  > "Convert Org region to other markup syntax"?
>
> How about renaming the section to "Export Region"?

Reasonable.

>  > We can also create more intuitive function aliases.
>
> How about `org-export-region-to-...`?  This would correspond nicely with 
> options given by `org-export-dispatch`.

+1.

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



Re: Export Documentation Confusions

2023-06-29 Thread Matt


  On Thu, 29 Jun 2023 12:24:12 +0200  Ihor Radchenko  wrote --- 

 > > - Section 13.18: Export in Foreign Buffers
 > >
 > > The section uses the term "foreign buffer" without providing a definition. 
 > >
 > > Proposed solution: Change wording from "foreign buffers" to "Convert 
 > > Region" and "non-Org" buffer. 
 > 
 > "Convert region" may be still confusing. Maybe something like
 > "Convert Org region to other markup syntax"?

How about renaming the section to "Export Region"?  I was getting ahead of 
myself.  The confusion was about "foreign buffers" and not the meaning of 
"export".

 > > - Section 13.18: Export in Foreign Buffers
 > >
 > > There was confusion caused by the function names.
 > 
 > We can also create more intuitive function aliases.

How about `org-export-region-to-...`?  This would correspond nicely with 
options given by `org-export-dispatch`.



Re: [BUG] org-store-link on document title

2023-06-29 Thread Anthony Carrico

On 6/29/23 11:54, Ihor Radchenko wrote:

You can set :store property for "file" links in `org-link-parameters' to
adjust for your personal use case.

That is good advice.

--
Anthony Carrico





Re: [BUG] Source block indentation does not work properly for yaml-mode [9.6.6 ( @ /home/user/.emacs.d/elpa/org-9.6.6/)]

2023-06-29 Thread Sébastien Miquel

Hi Ihor,

Thank you for the feedback.

Ihor Radchenko writes:

+  ;; Apply WRITE-BACK function on edit buffer contents.
+  (goto-char (point-min))
+  (when (functionp write-back) (save-excursion (funcall write-back)))
(set-marker marker nil

`save-excursion' is no longer necessary here.


Done.


  (defun org-src--edit-element
@@ -1150,7 +1149,14 @@ Throw an error when not at such a table."
 (lambda ()
 ;; Blank lines break things, replace with a single newline.
 (while (re-search-forward "\n[ \t]*\n" nil t) (replace-match "\n"))
-;; If within a table a newline would disrupt the structure,
+ ;; Trim contents.

It would be nice to have a bit more context about the purpose in the
comment here.


I was confused. We need only trim the beginning of the result, for the
indentation added by `org-src--contents-for-write-back'. I've added an
explanation.


  ...
- (skip-chars-forward " \t")
-  (when (or (not (eolp))   ; not a blank 
line
-(and (eq (point) (marker-position marker)) ; current line
+  (when (or (not (eolp)) ; not an empty line
+;; If the current line is empty, we may
+;; want to indent it.
+(and (eq (point) (marker-position marker))
   preserve-blank-line))

Do we still need this dance with special case for current line?


Yes. This is fragile, but what it does is, if the line from which the
original edit was called was blank and not empty, and the line from
which the edit is ended is empty, we assume these two lines are the
same, and we add the common block indentation to this empty line.
This, and the pre-indentation in =org-indent-line=, make `TAB` work
to indent an empty line.

The logic in =org-edit-element= can now be simplified though, see the
third patch attached.


+;; Display tab indentation characters preceded by spaces as spaces
+(unless org-src-preserve-indentation

unless? Don't we rather want to preserve the original indentation
alignment when `org-src-preserve-indentation' is t?

+  (save-excursion
+(goto-char start)
+(while (re-search-forward "^[ ]+\\([\t]+\\)" end t)

Why just tabs at indentation? It would make sense to preserve width of
all the tabs.

+  (let* ((b (match-beginning 1))
+ (e (match-end 1))
+ (s (make-string (* (- e b) native-tab-width) ? )))
+(add-text-properties b e `(display ,s))

Will the actual tab width be always equal to native-tab-width? What
about tab stops? May it be more reliable to use different of column
numbers in the src mode buffer after/before the tab?


I was trying to be conservative. When =org-src-preserve-indentation=
is t, I guess we can do the same, for consistency.

As you say, the tabs at the beginning of indentation are the only ones
we can be somewhat sure of the width, if we assume the native
indentation was done sanely (using tabs then spaces). I'm inclined to
only deal with those.

To get the true tab widths, we'd need to get the columns numbers in
yet a third different buffer, with the common indentation removed. I
don't think that's worth it.

Anyway, what I wrote doesn't deal correctly with the case where the
org indentation may use tabs. I've updated the patch: I use the value
of what should be the org indentation, and only change the display of
the following consecutive tabs.


@@ -318,19 +318,21 @@ This is a tab:\t.
argument2))
#+END_SRC"
(setq-local indent-tabs-mode t)
-  (let ((org-edit-src-content-indentation 2)
+  (let ((tab-width 8)
+(org-edit-src-content-indentation 2)

Why is setting tab-width necessary? 8 is the default value.


Removed, though I have left an instance of =(setq-local tab-width 8)=,
for clarity.


#+BEGIN_SRC emacs-lisp
-(progn\n  (function argument1\n\t\targument2))
+(progn\n  (function argument1\n\targument2))

I think it would be a bit more readable to convert this string into
actual multi-line, where the alignment is visible when reading the test
source.


I've left it this way. I think the tests using tab characters are
often written this way, so as to be understandable without whitespace
mode.

--
Sébastien MiquelFrom d024fe96ad889097d025a87dae3316acc44299f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= 
Date: Sun, 25 Jun 2023 13:38:21 +0200
Subject: [PATCH] org-src--contents-for-write-back: simplify the case of LaTeX
 fragments

* lisp/org-src.el (org-src--contents-for-write-back): Extract special
case logic for LaTeX fragments.
(org-edit-latex-fragment): Trim the contents to be inserted in the
original buffer.
---
 lisp/org-src.el | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index f15ba8e99..121e59241 100644
--- a/lisp/org-src.el
+++ 

Re: [BUG] org-store-link on document title

2023-06-29 Thread Ihor Radchenko
Anthony Carrico  writes:

> On 6/29/23 09:20, Ihor Radchenko wrote:
>> Sure. And if it were a plain file link, there would be no reason to
>> assign TITLE as description. Because the link would be to a generic line
>> in file.
>
> What? The title is the perfect description for the file!

That's because you expect Org to create a link to file.
But what Org does (by default) is a link to specific _line_ in file.

> I would say that 90% of the links in my org notes are file links with 
> the title as the description. I tend to use *deft* to search a lot of 
> small pages without deep outlines.

You can set :store property for "file" links in `org-link-parameters' to
adjust for your personal use case.

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



Re: [BUG] org-store-link on document title

2023-06-29 Thread Anthony Carrico

On 6/29/23 09:20, Ihor Radchenko wrote:

Sure. And if it were a plain file link, there would be no reason to
assign TITLE as description. Because the link would be to a generic line
in file.


What? The title is the perfect description for the file!

I would say that 90% of the links in my org notes are file links with 
the title as the description. I tend to use *deft* to search a lot of 
small pages without deep outlines.


--
Anthony Carrico




Re: org-todo-state-tags-triggers not working with regexp?

2023-06-29 Thread Ypo

Solved, thanks! :-)

;;;_ borrar todas las etiquetas al cambiar el estado a HECHO
(defun borrar-etiquetas-tareas-hechas (plist)
  "Borra todas las etiquetas al cambiar una tarea a =HECHO=."
  (when (eq (plist-get plist :type) 'todo-state-change)
    (when (string= (plist-get plist :to) "HECHO")
  (org-set-tags-to nil

(add-hook 'org-trigger-hook 'borrar-etiquetas-tareas-hechas)

El 27/06/2023 a las 14:05, Ihor Radchenko escribió:

Ypo  writes:


I have tried gptel inside emacs (I'm sorry, but I need to tell it) and I
got this code:

#+begin_src emacs-lisp
(defun my-org-trigger-function (state)
    "Remove all tags when state changes to 'DONE'"
    (when (string= state "DONE")
...
(add-hook 'org-trigger-hook 'my-org-trigger-function)
#+end_src

Surprisingly 8-) it doesn't work. Any help?

org-trigger-hook is a variable defined in org.el.

Documentation
Hook for functions that are triggered by a state change.

Each function gets as its single argument a property list with at
least the following elements:

  (:type type-of-change :position pos-at-entry-start
   :from old-state :to new-state)

Depending on the type, more properties may be present.


Re: [BUG] org-store-link on document title

2023-06-29 Thread Ihor Radchenko
Anthony Carrico  writes:

> #+begin_example
> [[id:5f4cdb46-d18d-41bb-914e-da7faa12][test org title link]]
> #+end_example
>
> ...hmm, you are correct that this option does add the proper default 
> description, but this is not a just plain file link anymore.

Sure. And if it were a plain file link, there would be no reason to
assign TITLE as description. Because the link would be to a generic line
in file.

That said, existence of hard-coded parts of `org-store-link' are not
ideal. We should ideally make things more flexible. Patches welcome!

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



Re: what is the purpose of "This link has already been stored"?

2023-06-29 Thread Ihor Radchenko
Anthony Carrico  writes:

>> Makes sense. It is a +1 for a defcustom.
>> Although I still believe that we should change the current default, even
>> if leaving an option to fall back to previous behaviour.
>
> I don't think there is much reason to complicate the interface with a 
> defcustom. The current default is an error, so changing the default 
> doesn't break the workflow of anyone using it the way Samuel describes 
> (unless I'm missing something).

What Samuel described is a sequence of M-x org-store-link followed by
M-x org-insert-all-links. With such workflow, user can expect that the
links are going to be stored in order. If we are instead shuffle the
stored links, M-x org-insert-all-links may result in unexpected
behaviour.

Currently, when link to place is already stored, not error is thrown, a
message is displayed, no link is stored, and the stored link list is not
altered.

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



Re: [BUG] org-store-link on document title

2023-06-29 Thread Anthony Carrico

On 6/28/23 16:16, Ihor Radchenko wrote:> It has been added back in Org 9.5.

Thanks, I'm on 9.5.5, so I can test it...


You can set `org-id-link-to-org-use-id' to non-nil (4.5 Handling Links).
Then, Org will store link to current file/heading instead of more
generic link. Latest version of Org will also auto-assign TITLE as the
link description.


#+begin_example
:PROPERTIES:
:ID:   5f4cdb46-d18d-41bb-914e-da7faa12
:END:
#+TITLE: test org title link
#+end_example

#+begin_example
[[id:5f4cdb46-d18d-41bb-914e-da7faa12][test org title link]]
#+end_example

...hmm, you are correct that this option does add the proper default 
description, but this is not a just plain file link anymore.


--
Anthony Carrico



Re: what is the purpose of "This link has already been stored"?

2023-06-29 Thread Anthony Carrico

On 6/29/23 06:28, Ihor Radchenko wrote:

Samuel Wales  writes:

if you move the recent one to top of list, that would work for my
mindless store/insert, but it might not work for a user who has
carefully cultivated a set of links that are all to be inserted, or
such.  although idk if the mechanism supports.


Makes sense. It is a +1 for a defcustom.
Although I still believe that we should change the current default, even
if leaving an option to fall back to previous behaviour.


I don't think there is much reason to complicate the interface with a 
defcustom. The current default is an error, so changing the default 
doesn't break the workflow of anyone using it the way Samuel describes 
(unless I'm missing something).


--
Anthony Carrico




Re: [PATCH] org-faq.org: Inline comments

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

>>> Could it be possible to make inline comments (# something like this) ?
> ...
>> Previous discussion:
> ...
>
> I think, it is time to add a FAQ entry, see the attachment.

The proposed FAQ entry is overwhelming. It would work fine as a blog,
but not as a quick answer to a question. I recommend leaving only the
@@comment:...@@ part - it is what we use ourselves in WORG sources.

> To my taste FAQ is rather long already. If you have an idea of another 
> place on Worg where such tricks may be added then, please, share it.

FAQ is probably fine. We may add a CSS there that will fold the
answers by default.

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



Re: what is the purpose of "This link has already been stored"?

2023-06-29 Thread Ihor Radchenko
Samuel Wales  writes:

> i am not sure i am using store/insert to their full actual or
> potential potential.
>
> if you move the recent one to top of list, that would work for my
> mindless store/insert, but it might not work for a user who has
> carefully cultivated a set of links that are all to be inserted, or
> such.  although idk if the mechanism supports.

Makes sense. It is a +1 for a defcustom.
Although I still believe that we should change the current default, even
if leaving an option to fall back to previous behaviour.

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



Re: Export Documentation Confusions

2023-06-29 Thread Ihor Radchenko
Matt  writes:

> - Section 13.18. 1: Bare HTML may be better placed under Section 13.9 HTML 
> Export.  The information in this section appears unrelated to Exporting in 
> non-Org buffers.  In fact,  the settings given for a minimal HTML export do 
> not apply when converting a region.  For example, when converting a region 
> containing an Org table to HTML, a preamble is not inserted even when the 
> variable `org-html-preamble` is t.
>
> https://orgmode.org/manual/Bare-HTML.html
>
> Proposed solution: Move Section 13.18.1 nearer the sections on HTML export.

Approved.

> - Section 13.18: Export in Foreign Buffers
>
> The section uses the term "foreign buffer" without providing a definition.  
> It appears to mean a buffer without "org-mode" enabled.  The section 
> describes functions which allow users to write Org mode syntax in non-Org 
> buffers and use various functions to convert the Org syntax to other 
> syntaxes, like HTML, Markdown, etc.
>
> https://orgmode.org/manual/Export-in-Foreign-Buffers.html
>
> Proposed solution: Change wording from "foreign buffers" to "Convert Region" 
> and "non-Org" buffer.   The functionality is really about conversion rather 
> than anything to do with non-Org buffers.  If fact, Org respects users' 
> freedom to run the program as they wish–it does not prevent them from 
> converting Org formatted text within an Org buffer to a non-Org format, no 
> matter how absurd it may appear :)

"Convert region" may be still confusing. Maybe something like
"Convert Org region to other markup syntax"?

> - Section 13.18: Export in Foreign Buffers
>
> There was confusion caused by the function names.  Specifically, the 
> "namespace" (such as "org-ascii-" or "org-texinfo-") is confusing to users 
> who are not familiar with Org function naming conventions. For example, one 
> participant thought `org-ascii-convert-region-to-utf8` might convert non-utf8 
> ascii to utf8 and was confused why `org-texinfo-convert-region-to-texinfo` 
> would convert texinfo to texinfo.  Of course, this is not a correct 
> understanding of the function behavior.
>
> https://orgmode.org/manual/Export-in-Foreign-Buffers.html
>
> Proposed solution:  ...

We can also create more intuitive function aliases.

> -The export backends in Org often include commands to convert selected
> -regions.  A convenient feature of this in-place conversion is that the
> -exported output replaces the original source.  Here are such
> -functions:
> +Some export backends include commands to convert a region of Org
> +formatted text to another format, such as HTML or LaTeX.  The
> +conversion replaces the original source.  Here are such functions:

While we are at it, "Here are such *commands*:"

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