Re: [BUG] unexpected behaviour on sub-list

2024-07-11 Thread Ihor Radchenko
Phil  writes:

> I'm reporting this bug on Org mode version 9.7.6.
> It was in already in 9.5.
>
> - here is a list
>   with a sub list
>
>   - like here ;
>
>   and then text (<- this will be deleted)
> x
>
>   1) Trying to insert an other item above,
>  by suppressing the "x", and hitting M-RET,
>  if there's no text after, the command gets stuck
>  in org-list-struct-apply-struct.

Confirmed.
Potentially a duplicate of 
https://list.orgmode.org/orgmode/v3up5d$oc4$1...@ciao.gmane.io/

>  file:~/.emacs.d/repos/org/lisp/org-list.el::1968
>  Very likely, needs to check if forward line returns 0
>  otherwise it will keep looping.
>
>  #+begin_src patch
> - (while (< (point) down)
> + (while (and ( < (point) down) (not(> lines-left-to-move 0)))
> #+end_src
>
>  file:~/.emacs.d/repos/org/lisp/org-list.el::1982
>  #+begin_src patch
>   - (forward-line)))
>   + (setq-local lines-left-to-move (forward-line)
>  #+end_src

Thanks for looking into the causes!
I will look closer into this later.

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



Re: figures not exported properly by ox-latex

2024-07-11 Thread mahmood sheikh
it might've been fixed for figures as its been a while, but shouldnt latex
environments with #+caption: and #+name: above them be exported as figures?
because currently the user has to write \begin{figure} and \end{figure}
explicitly which would work but may not be as practical for other ox
backends like html i think? perhaps im wrong.

On Tue, Jul 9, 2024 at 11:15 PM Karthik Chikmagalur <
karthikchikmaga...@gmail.com> wrote:

> > im on tecosaur's dev branch (version 9.7-pre)
> > i have the following in an org file:
> > ```org
> > #+name: fig-switching-circuit-1
> > #+caption: implementation of \(p\)
> > [[attachment:circuit.svg]]
> > ```
> > it gets turned into this
> > ```
> >
> \includesvg[width=.9\linewidth]{/home/mahmooz/brain/notes/data/9e/5ba2ce-c383-4396-a2cb-891465f14d51/circuit}\\[0pt]
> > ```
>
> Cannot reproduce.  I get the following:
>
> \begin{figure}[htbp]
> \centering
> \includesvg[width=.9\linewidth]{/tmp/circuit}
> \caption{\label{fig-switching-circuit-1}implementation of \(p\)}
> \end{figure}
>
> Perhaps you have customized the LaTeX export process in some way?  Also
> note that we don't touch any of the LaTeX generation code in ox-latex
> except the parts handling LaTeX preview images.
>
> Karthik
>


Re: figures not exported properly by ox-latex

2024-07-11 Thread Ihor Radchenko
mahmood sheikh  writes:

> it might've been fixed for figures as its been a while, but shouldnt latex
> environments with #+caption: and #+name: above them be exported as figures?
> because currently the user has to write \begin{figure} and \end{figure}
> explicitly which would work but may not be as practical for other ox
> backends like html i think? perhaps im wrong.

It looks like your original problem is not reproducible, and you are
talking about a _different_ problem now.

May you please provide an example of what kind of behavior you are
talking about?

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



Re: figures not exported properly by ox-latex

2024-07-11 Thread Karthik Chikmagalur
> it might've been fixed for figures as its been a while, but shouldnt
> latex environments with #+caption: and #+name: above them be exported
> as figures? because currently the user has to write \begin{figure} and
> \end{figure} explicitly which would work

This is not the case.  The LaTeX output I posted in my previous response
was the exported output from your example Org source.  I did not add the
\begin{figure} and \end{figure} tags manually.

Karthik



Re: figures not exported properly by ox-latex

2024-07-11 Thread mahmood sheikh
this is an example of what i mean:
#+begin_src org
  #+name: fig-switching-circuit-kmap-1
  #+caption: karnaugh table of \(p\)
  \begin{tikzpicture}
\karnaughmap[function=, defaultmap=8, omitzeros=false, omitidx,
variables=xyz]{01101001}
  \end{tikzpicture}
#+end_src
i vaguely recall org mode automatically turning captioned
tikzpicture's into figures by wrapping them in a figure environment.
currently, this is what i get when i export to latex:
#+begin_src latex
  \begin{tikzpicture}
\karnaughmap[function=, defaultmap=8, omitzeros=false, omitidx,
variables=xyz]{01101001}
\caption{\label{fig-switching-circuit-kmap-1}karnaugh table of \(p\)}
  \end{tikzpicture}
a tikzpicture environment doesnt expect a \caption and therefore this gives
an error. to avoid this the environment has to be wrapped manually by the
user by a \begin{figure} environment, but i think this may be redundant
because anything that takes a #+caption is expected to be a figure.
also, ox-html doesnt handle those anymore, it used to handle #+caption: and
insert it into the generated html output, it simply ignores that now.
example:
#+begin_src org
  #+name: fig-switching-circuit-1
  #+caption: implementation of \(p\)
  [[attachment:circuit.svg]]
#+end_src
ox-html generates the following html:
#+begin_src html
  
#+end_src
its not a different problem, its basically that after the new overhaul
figures are being handled differently than i recall, but i cant say for
sure. although the report above about the exported circuit.svg img does
make sense even if it wasnt handled the way i'd expect before the overhaul.
thanks

On Thu, Jul 11, 2024 at 11:47 AM Karthik Chikmagalur <
karthikchikmaga...@gmail.com> wrote:

> > it might've been fixed for figures as its been a while, but shouldnt
> > latex environments with #+caption: and #+name: above them be exported
> > as figures? because currently the user has to write \begin{figure} and
> > \end{figure} explicitly which would work
>
> This is not the case.  The LaTeX output I posted in my previous response
> was the exported output from your example Org source.  I did not add the
> \begin{figure} and \end{figure} tags manually.
>
> Karthik
>


Re: org-encrypt-entries is slow (was: org-crypt leaking data when encryption password is not entered twice (was: Please document the caching and its user options))

2024-07-11 Thread Ihor Radchenko
Daniel Clemente  writes:

> I see it's trying to decrypt things (therefore it asks for the
> password). It shouldn't, since I didn't modify any encrypted section.
> I said „it asked me for an encryption password“ because the GPG prompt
> confusingly uses the word „encryption“ („Passphrase for symmetric
> encryption“), though it's actually asking for a decryption password.
> ...
> This is the text "abc" encrypted with password "abc". Use this file:
>
> * hi  
> :nocrypt:
> -BEGIN PGP MESSAGE-
>
> jA0ECQMCVpS/qSoed5f/0joBYoIRWdgt/+PVQCsZh9sg176SdnvP2Wc8tH/CV1Rk
> l2MjAh3Rk19Q2aP2EffpZ5CFeGELTMXCnCYv
> =FNtI
> -END PGP MESSAGE-
>
> Open the file, add a space to the title and save it. The first time it
> works (no questions asked) because there's no tag called :crypt:
> Now change the :nocrypt: to :crypt: and save.  It asks for the
> password. Press C-g to cancel.
> Change again the tag to :nocrypt:. Save. It asks for the encryption
> password; it shouldn't.
> Add a space to the title, save, it keeps asking for the encryption
> password, though there's no :crypt: section.

This should be fixed now.
May you try yet again?

>> > - Org spends around 20 seconds trying to save the file, in a loop,
>> > reporting:  (error "org-crypt: Encryption failed.  Not saving the
>> > buffer. Error: GPG error: \"Encrypt failed\", \"Canceled; Exit\"")
>>
>> This is curious, but I again have no clue. Maybe the new version of the
>> branch works a bit better.
>>
>
> Since this error can happen because of a problem in a different buffer
> (not the current one), would it be good to mention the file name in
> that error message?

Yes. Done now on the branch.

> I didn't see this particular problem again. But I see others, which
> are hard to report and reproduce. For instance I had an encrypted
> section under a :crypt: header (I see „BEGIN PGP“ and hex codes), I
> save, and saving *UNencrypts* the header before saving, without
> asking. It should never decrypt when saving, but it does. This happens
> with the same small example I posted above (but using the :crypt:
> tag).

The other problem you reported had something to do with incorrectly
cycling encryption state during save. I hope that fixing one also fixed
another.

-- 
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/sensible-tick-num when range is a power of 10

2024-07-11 Thread Ihor Radchenko
Brice Waegenire  writes:

> I've found a bug in =org--plot/sensible-tick-num=, when a plot has a
> range of a power of 10  (1, 10, 100, ...).
>
> To reproduce, run =org-plot/gnuplot= on the following plot:
> #+plot: type:radar min:0 max:10
> | Metric  | Value |
> |-+---|
> | alpha   | 2 |
> | beta| 4 |
> | gamma   | 6 |
> | delta   | 8 |
> | epsilon |10 |
>
> It produce the error: =let*: Wrong type argument: number-or-marker-p, nil=.

Confirmed.
I am completely lost in the intended logic of how the tics are
determined.
CCing the author.

Timothy, I feel that the logic is pretty much off for ranges with powers
of 10 and for single value column.

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



Re: multipage html output

2024-07-11 Thread Ihor Radchenko
Orm Finnendahl  writes:

> If org-export-as returns just one string, then it will reparse the
> parse tree each time it needs to generate an output string. But as you
> say below, you rather think org-export-as returns a list of strings
> for the multipage case.

Got it now.

>> What I have in mind is that `org-export-as' will return a list of
>> strings + INFO. INFO will contain data about which files to use for
>> saving the strings. Then, the caller does the saving and whatever is
>> necessary. If we write to files from `org-export-as' it will be a
>> massive breaking change in the expected behavior.
>
> ok, that's what you mean. I can do this, but don't you think it'd be
> more consistent with the general layout of ox, if org-export-as uses a
> callback function to call on each generated string with the filename
> as argument nad we agree on names for multipage file output which have
> to get implemented by multipage backends?

This sounds like some kind of extension to :filter-final-output.
I think it should also be an ok option.

> Whatever, both ways will do what's needed, just let me know what you
> prefer and I will provide a suggestion, ok? I try to find time on the
> weekend, otherwise I'll have time after the end of next week.

I am ok with what you propose. So, please go ahead.

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



Re: figures not exported properly by ox-latex

2024-07-11 Thread mahmood sheikh
im fairly certain that at the time i sent this email, ox-latex was failing
to insert \label and \caption too after images in latex exports (like
ox-html to html exports). but perhaps someone made a change that fixed that.
the fact that ox-latex even inserts \caption and \label tells me that it
was the intention of the maintainer of ox-latex to handle latex blocks
preceded by a `#+caption` as figures. so it would be natural if org
inserted the figure environment itself like it does with images preceded by
`#+caption`. i hope this reasoning does make sense to you?
in ox-html, the function `org-html--wrap-image` is used to wrap an exported
image with a `` html environment with a caption and label, but it
doesnt happen for me.
after some more digging, i think inserting the `figure` environments
automatically in latex exports may be undesired behavior and it would be
preferred that the user do that themselves in the org document, because
`org-latex--caption/label-string` checks for a `figure` or `listing`
environment apparently, which tells me that the author expected the user to
insert the figure environment themselves. another reason is that the user
may use another, differently environment that accepts a \caption too.
thanks
p.s. sorry i keep hitting the "forward" button instead of the "forward all"
button so you may receive duplicate emails.

On Thu, Jul 11, 2024 at 11:59 AM mahmood sheikh 
wrote:

> this is an example of what i mean:
> #+begin_src org
>   #+name: fig-switching-circuit-kmap-1
>   #+caption: karnaugh table of \(p\)
>   \begin{tikzpicture}
> \karnaughmap[function=, defaultmap=8, omitzeros=false, omitidx,
> variables=xyz]{01101001}
>   \end{tikzpicture}
> #+end_src
> i vaguely recall org mode automatically turning captioned
> tikzpicture's into figures by wrapping them in a figure environment.
> currently, this is what i get when i export to latex:
> #+begin_src latex
>   \begin{tikzpicture}
> \karnaughmap[function=, defaultmap=8, omitzeros=false, omitidx,
> variables=xyz]{01101001}
> \caption{\label{fig-switching-circuit-kmap-1}karnaugh table of \(p\)}
>   \end{tikzpicture}
> a tikzpicture environment doesnt expect a \caption and therefore this
> gives an error. to avoid this the environment has to be wrapped manually by
> the user by a \begin{figure} environment, but i think this may be redundant
> because anything that takes a #+caption is expected to be a figure.
> also, ox-html doesnt handle those anymore, it used to handle #+caption:
> and insert it into the generated html output, it simply ignores that now.
> example:
> #+begin_src org
>   #+name: fig-switching-circuit-1
>   #+caption: implementation of \(p\)
>   [[attachment:circuit.svg]]
> #+end_src
> ox-html generates the following html:
> #+begin_src html
>   
> #+end_src
> its not a different problem, its basically that after the new overhaul
> figures are being handled differently than i recall, but i cant say for
> sure. although the report above about the exported circuit.svg img does
> make sense even if it wasnt handled the way i'd expect before the overhaul.
> thanks
>
> On Thu, Jul 11, 2024 at 11:47 AM Karthik Chikmagalur <
> karthikchikmaga...@gmail.com> wrote:
>
>> > it might've been fixed for figures as its been a while, but shouldnt
>> > latex environments with #+caption: and #+name: above them be exported
>> > as figures? because currently the user has to write \begin{figure} and
>> > \end{figure} explicitly which would work
>>
>> This is not the case.  The LaTeX output I posted in my previous response
>> was the exported output from your example Org source.  I did not add the
>> \begin{figure} and \end{figure} tags manually.
>>
>> Karthik
>>
>


Re: [BUG] List: org-shiftright brake list by indentation. Patch. [9.6.28 ( @ /home/u/.emacs.d/elpa/org-9.6.28/)]

2024-07-11 Thread Ihor Radchenko
[ Adding Org mailing list back to CC to keep the conversation public ]

Vitaliy Chepelev  writes:

> I made much better patch for my org-9.6.28/org-list.el, now indentation
>  is working and list don't breaks:

May you please explain in more details what is better in the proposed
patch compared to the already installed fix?

> diff --git a/org-list.el b/org-list.el
> index 502e61b..27617c5 100644
> --- a/org-list.el
> +++ b/org-list.el
> @@ -1813,6 +1813,14 @@ This function modifies STRUCT."
>  (setq end-list (sort end-list (lambda (e1 e2) (< (cdr e1) (cdr e2)
>  (org-list-struct-assoc-end struct end-list)))
>
> +(defcustom org-list-static-bullet-length t
> +  "Assume that bullet length always equal one character.
> +Oterwise indent list items according to calculated length of
> +bullet."
> +  :group 'org-plain-lists
> +  :group 'org-cycle
> +  :type 'boolean)
> +
>  (defun org-list-struct-apply-struct (struct old-struct)
>"Apply set difference between STRUCT and OLD-STRUCT to the buffer.
>
> @@ -1900,8 +1908,12 @@ Initial position of cursor is restored after the 
> changes."
>  (ind-old (org-list-get-ind pos old-struct))
>  (bul-pos (org-list-get-bullet pos struct))
>  (bul-old (org-list-get-bullet pos old-struct))
> -(ind-shift (- (+ ind-pos (length bul-pos))
> -  (+ ind-old (length bul-old
> +(ind-shift (if org-list-static-bullet-length
> +  (- (+ ind-pos 1)
> + (+ ind-old 1))
> +  ;; else
> +  (- (+ ind-pos (length bul-pos))
> + (+ ind-old (length bul-old)
>  (end-pos (org-list-get-item-end pos old-struct)))
> (push (cons pos ind-shift) itm-shift)
> (unless (assq end-pos old-struct)

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



Re: Q: Attachments and IDs?

2024-07-11 Thread Ihor Radchenko
David Masterson  writes:

> It's taking awhile to get through my hard head, but I think I'm
> beginning to understand the directory structure of attachments.
>
>   org-attach-id-dir/IDx/attachment-file
>
> I don't understand the value of IDx. I would think that "attachment:"
> could simply reference 'org-attach-id-dir' (drop 'id'?) unless
> overridden by a DIR property.  I think I'm missing something that would
> help my understanding of attachments.  Am I?

> Is there a section of the Org manual that talks about IDs?

10.2.2 Attachment options

‘org-attach-id-to-path-function-list’
 When ‘ID’ is used for attachments, the ID is parsed into a part of
 a directory-path.  See ‘org-attach-id-uuid-folder-format’ for the
 default function.  Define a new one and add it as first element in
 ‘org-attach-id-to-path-function-list’ if you want the folder
 structure in any other way.  All functions in this list will be
 tried when resolving existing ID's into paths, to maintain backward
 compatibility with existing folders in your system.

For IDs, we use `org-attach-id-uuid-folder-format' by default - it puts
attachments under

///attached-file

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



Re: Capture, template expansion and keyword for link type

2024-07-11 Thread Ihor Radchenko
Sébastien Gendre  writes:

> I was reading the Org-mode manual, at section "10.1.3.2 Template
> expansion":
> https://orgmode.org/manual/Template-expansion.html
>
> And I was a little bit confused by the "%:keyword". The manual say:
> "Specific information for certain link types, see below."
>
> Where did this link come from ?

> When is it defined, and from/to where ?

> To be able to use the "%:keyword" in a capture: Do I need to store a
> link before calling org-capture ? Or do the call of org-capture will
> automatically store a link to where my point is before the call ?

> The manual page of template expansion did not explain it.
>

1. If there is %a placeholder in the template, org-capture stores link
   to the location from where you called org-capture

2. If there is no placeholder, the last stored link is used

> Also, if a capture template is selected after an org-protocol call, the
> documentation say that only 3 keywords are available: %:link’,
> ‘%:description’ and ‘%:annotation’.
>
> Is it possible to passe more keyword through an org-protocol call ?

Not directly. Additional keywords are stored inside undocumented %:query
keyword value.

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



Re: Capture from Firefox to Org-mode

2024-07-11 Thread Ihor Radchenko
Sébastien Gendre  writes:

> How to capture data from a web page to Org-mode ?
>
> * What I need
>
> I want to be able to capture different kind of information :
>
> - Article, to read later
>
> - Book, with all its metadata (title, author, subject, etc)
>
> - Magazin, to buy later (title, editor, price, etc)
>
> - IRL event, that I want to go
>
>
> For each case, different kind of data is needed to be extracted from the
> web page and passed to Org-capture.

I wrote https://github.com/yantar92/org-capture-ref to do exactly
this. 

> * Capture Protocol
>
> I know it exist an org-protocol for capture, but after reading the
> manual (section 17.16.2 The capture protocol), there is something
> I did not understand.
>
> On the URL of the capture protocol, key value pairs can be specified.
> But are they a predefined set of keys, independent to the capture
> template, or are they related to the capture template special words (ex:
> %a) ?
>
> Is it possible, with Org-protocol, to pass data to be stored into org entry
> properties, or an arbitrary string ?

Yes, but passing non-standard data is an undocumented feature. (It is
stored in :query property that you may need to extract via
%(plist-get (org-capture-get :query) :my-keyword) placeholder or
something similar.

> I have seen a typo in the manual "17.16.2 The capture protocol":
> https://orgmode.org/manual/The-capture-protocol.html
>
> At the end of the first phrase, it miss a space between the "a" and
> "capture". Instead of "a capture", we have "acapture".

This has been already fixed in de775a36d, but thanks for the heads-up anyway.

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



Re: Capture, template expansion and keyword for link type

2024-07-11 Thread Max Nikulin

On 11/07/2024 13:59, Sébastien Gendre wrote:

I was reading the Org-mode manual, at section "10.1.3.2 Template
expansion":
https://orgmode.org/manual/Template-expansion.html

And I was a little bit confused by the "%:keyword". The manual say:
"Specific information for certain link types, see below."

Where did this link come from ?

When is it defined, and from/to where ?


See the "Link type, Available keywords" table in this section. 
`org-capture' may be executed in various Emacs buffers and available 
keywords may depend on major mode.



Is it possible to passe more keyword through an org-protocol call ?


Some time ago I tried %(exp) elisp snippets in templates (untested)

  "* [[%:link][%:description]]
#+BEGIN_QUOTE
%i
#+END_QUOTE
%(let ((bla (plist-get (plist-get org-store-link-plist :query) :bla)))
   (or bla "No bla"))"

emacsclient 
'org-protocol:/capture?template=s&title=Hello&body=World&url=http:%2F%2Fexample.com&bla=foo'




Re: [ANN] tchanges.el: Collaborate with word processor (docx) users using 'track changes'

2024-07-11 Thread Ihor Radchenko
James Thomas  writes:

> The import part in my package is merely a frill.
>
>> but with an added feature to automatically display diffs.

What about comments? Are they stored into Org mode file or separately?

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



Re: Capture from Firefox to Org-mode

2024-07-11 Thread Max Nikulin

On 09/07/2024 23:45, Morgan Willcock wrote:

Just to mention another option, I use this one:

https://addons.mozilla.org/en-US/firefox/addon/linkremark/


In its current state it does not extract metadata specific to books or 
events. Dublin Core or other similar metadata are on TODO list, but with 
low priority. The extension may give priority to doi: links and it may 
be starting point to fetch an entry from some database.


If "magazin to buy" page contains schema.org/Product metadata (LD-JSON 
or microdata) then it may work.


I wonder what is expected capture result for events and what metadata 
are available?


Currently the primary issue is compatibility with recently enforced 
Chrome requirements. More asynchronous code required to perform similar 
tasks (combination of async-await, callbacks and messages between 
extension components).


I have not tried it, but the following package has extractors for some 
sites:






Re: [BUG] List: org-shiftright brake list by indentation. Patch. [9.6.28 ( @ /home/u/.emacs.d/elpa/org-9.6.28/)]

2024-07-11 Thread Ihor Radchenko
Vitaliy Chepelev  writes:

> Hi, In the first version I disabled indentation completely,
>  but this breaks sub-list items, as I found out later. In
>  the second version I disabled calculation of bullet lengths
>  ( 1. 1) = 2 (- +) = 1, all = 1 now, this works for text
>  formatted with fill-paragraph like this one that you read
>  now. I assume that bullet lenght calculated only for case
>  when user set custom bullets like: (First., Second.,
>  Third.).

FYI, I have already fixed the bug you reported. So, your patch should
not be necessary, unless you think that my fix is not sufficient.
See https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f7ef4071b

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



Re: Q: Attachments and IDs?

2024-07-11 Thread Daniel Fleischer


You can override the ID generation and the ID-to-path function to create
an attachment hierarchy of your liking, e.g.

ATTACH-DIR/year/month-day/*files*

Checkout `org-attach-id-to-path-function-list' and `org-id-new'.

Daniel



Re: Capture, template expansion and keyword for link type

2024-07-11 Thread Sébastien Gendre
Max Nikulin  writes:
> See the "Link type, Available keywords" table in this section.
> `org-capture' may be executed in various Emacs buffers and available
> keywords may depend on major mode.

Is it necessary to call "org-store-link" before calling "org-capture" to
extracet the informations used by theses keywords ?

Or did I missundertant how it work ?

I found the documentation unclear about this.

Is there a way to discover the keywords that a major mode provide to a
capture template ?



Max Nikulin  writes:
> Some time ago I tried %(exp) elisp snippets in templates (untested)
>
>   "* [[%:link][%:description]]
> #+BEGIN_QUOTE
> %i
> #+END_QUOTE
> %(let ((bla (plist-get (plist-get org-store-link-plist :query) :bla)))
>(or bla "No bla"))"
>
> emacsclient
> 'org-protocol:/capture?template=s&title=Hello&body=World&url=http:%2F%2Fexample.com&bla=foo'

A new parameter added to the org-protocol url is only accessible through
the ":query" key ? It will not create a new "%:keywoard" automatically ?



What I would love to do, is creating a Firefox extension that can
extract different metadata from known well known web site and pass them
to an Org-mode capture through org-protocol.

For example, for a book, extracting author, title, year, etc.

And then, I could simply create a capture template that would use the
keywords "%:author", "%:title", etc.

I was also thinking, instead of a Firefox extension, creating an Elisp
function that take a web page URL as parameter, extract the metadata
from the web page and then call Org-capture providing the keywords
"%:author", "%:title", etc, to the template.

But I don't know how to do the last part and I cant found documentation
about it. And with this second solution, I don't know how to make it
work with org-protocol. As an org-protocol call result directly in an
Org-capture call. And extracting metadata from Firefox give more
flexibility on manually selecting information to extract on the web page.



signature.asc
Description: PGP signature


Re: Capture, template expansion and keyword for link type

2024-07-11 Thread Sébastien Gendre

Thank you for your reply.

I have write more, after the quotes below.

Ihor Radchenko  writes:
> 1. If there is %a placeholder in the template, org-capture stores link
>to the location from where you called org-capture
>
> 2. If there is no placeholder, the last stored link is used

But how the "%:keyword" information are built ?

What I have understand from the documentation, it has something to do
with a "link". But I found the documentation unclear about this.


The text help for "%:keyword" only say:
"Specific information for certain link types, see below."

And bellow it say:
"For specific link types, the following keywords are defined:"

And the footnote say:
"If you define your own link types (see Adding Hyperlink Types), any
property you store with org-store-link-props can be accessed in capture
templates in a similar way."

As I didn't plan to define custom link, and read all the manual part
about it, as a simple org-capture user I have difficulties to understand
how the "%:keywords" are generated and how I can know which ones a
available in which condition.

At least, based on what the section "10.1.3.2 Template expansion" of
Org-mode documentation tell me.

Mak Nikulin say that these "%:keyword" are created by major modes.


Ihor Radchenko  writes:
> Not directly. Additional keywords are stored inside undocumented %:query
> keyword value.

So, I would need to use the "%(EXP)", and as "EXP", I need to write
Elisp code that will extract supplemental data passed on the
org-protocol url during the call ?


Best regards

---
Gendre Sébastien


signature.asc
Description: PGP signature


Re: Capture from Firefox to Org-mode

2024-07-11 Thread Sébastien Gendre

Thank you for your replies.

I wrote more after the quotes below.

Ihor Radchenko  writes:
> I wrote https://github.com/yantar92/org-capture-ref to do exactly
> this. 

Is it meant to be used with org-ref ?

I didn't plan to build a bibliography with bibtex (at least for now). I
just plan to built a simple book reading tracker with Org-mode. But I
keep a note about your suggestion, it could be very helpful in the
future.

Thank you very much.

Ihor Radchenko  writes:
> Yes, but passing non-standard data is an undocumented feature. (It is
> stored in :query property that you may need to extract via
> %(plist-get (org-capture-get :query) :my-keyword) placeholder or
> something similar.

Thank you for the info. I will take a note about it.


signature.asc
Description: PGP signature


Re: Capture from Firefox to Org-mode

2024-07-11 Thread Sébastien Gendre
Thank you for the suggestions, I will take a look.

Chris Keschnat  writes:

> Sébastien Gendre  writes:
>
> Hi,
> I'm not actively using this but I had it configured and just tested that
> it works. It might not answer you're questions directly, but I hope it helps.
>
>> How to capture data from a web page to Org-mode ?
>>
>> * What I need
>> I want to be able to capture different kind of information :
>> - Article, to read later
>> - Book, with all its metadata (title, author, subject, etc)
>> - Magazin, to buy later (title, editor, price, etc)
>> - IRL event, that I want to go
>>
>> For each case, different kind of data is needed to be extracted from the
>> web page and passed to Org-capture.
>
> This should all be possible.
>
>> * Capture Protocol
>>
>> I know it exist an org-protocol for capture, but after reading the
>> manual (section 17.16.2 The capture protocol), there is something
>> I did not understand.
>>
>> On the URL of the capture protocol, key value pairs can be specified.
>> But are they a predefined set of keys, independent to the capture
>> template, or are they related to the capture template special words (ex:
>> %a) ?
>>
>> Is it possible, with Org-protocol, to pass data to be stored into org entry
>> properties, or an arbitrary string ?
>
> Capturing the selection works.
>
> Sample capture templates:
> #+begin_src emacs-lisp
>   ("p" "Protocol" entry (file+headline ,(concat my-org-dir "inbox.org") 
> "Inbox")
>"* %^{Title}\nSource: %u, %c\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?")
>
>   ("L" "Protocol Link" entry (file+headline ,(concat my-org-dir "inbox.org") 
> "Inbox")
>"* %? [[%:link][%:description]] \nCaptured On: %U")
> #+end_src
>
>> * Firefox extension for Org capture
>>
>> I have found 2 extensions for capturing to Org-mode from Firefox:
>>
>> - Org Capture (by Kosta):
>>   https://addons.mozilla.org/fr/firefox/addon/org-capture/
>>
>> - org-protocol (by Wojciech Siewierski):
>>   https://addons.mozilla.org/fr/firefox/addon/org-protocol/
>>
>> Which one do you suggest ?
>
> I'm using this one instead.
>
> Extension: https://github.com/Stebalien/org-capture-extension
> Image of configured extension: https://0x0.st/XMHN.png
>
> PS:
> I had also used this in the past. If you're willing to have a local
> python script listening on a port instead of using org-protocol,
> it might be an alternative.
>
> https://github.com/karlicoss/grasp


signature.asc
Description: PGP signature


Re: Capture from Firefox to Org-mode

2024-07-11 Thread Sébastien Gendre


Morgan Willcock  writes:
> Just to mention another option, I use this one:
>
> https://addons.mozilla.org/en-US/firefox/addon/linkremark/
>
> I took the easy option and just use the default "integration" which uses
> the clipboard, but I think org-protocol is supported as well.

A very nice suggestion. I will look at it.

Thank you very much.


signature.asc
Description: PGP signature


Re: Capture from Firefox to Org-mode

2024-07-11 Thread Sébastien Gendre

Thank you for your reply.

I write wore after the quotes below.


Max Nikulin  writes:
> On 09/07/2024 23:45, Morgan Willcock wrote:
>> Just to mention another option, I use this one:
>> https://addons.mozilla.org/en-US/firefox/addon/linkremark/
>
> In its current state it does not extract metadata specific to books or
> events. Dublin Core or other similar metadata are on TODO list, but
> with low priority. The extension may give priority to doi: links and
> it may be starting point to fetch an entry from some database.
>
> If "magazin to buy" page contains schema.org/Product metadata (LD-JSON
> or microdata) then it may work.
>
> I wonder what is expected capture result for events and what metadata
> are available?

For an event, I was thinking of extracting event title, date, place and
organization of an event announced on a Mobilizon web site.


Max Nikulin  writes:
> I have not tried it, but the following package has extractors for some
> sites:
> 

I was already suggested this package on another message, but it seems
too much for what I need.


signature.asc
Description: PGP signature


Re: [ANN] tchanges.el: Collaborate with word processor (docx) users using 'track changes'

2024-07-11 Thread James Thomas
Ihor Radchenko wrote:

> James Thomas:
>
>> The import part in my package is merely a frill.
>>
>>> but with an added feature to automatically display diffs.
>
> What about comments? Are they stored into Org mode file or separately?

They're loaded on import and view/edit/add-able before re-exporting. A
'Save WIP' feature for writing to disk until then is on the TODO list.

--



in 28, massive slowness in capture, folding, and org-show-context

2024-07-11 Thread Samuel Wales
* NAKA capture, folding, and org-show-context slow in 28
folding and unfolding in a large .org is slow.
*** results for capture
capture takes many seconds usually before the capture buffer
comes up.  idk if these results are useful.  here are
results for capturing one regular and one with selection.
* capture slow cpu
18018  99% - command-execute
   18018  99%  - call-interactively
   18018  99%   - apply
   18018  99%- call-interactively@ido-cr+-record-current-command
   18018  99% - let
   18018  99%  - apply
   18018  99%   - #
   18018  99%- funcall-interactively
   17488  96% - #
   17488  96%  - org-capture
   17434  96%   - org-capture-place-template
   17398  96%- org-fold-show-all
   17370  96% - org-fold-region
   11415  63%  - org-fold-core-get-regions
   11371  62%   - org-fold-core-next-folding-state-change
  16   0%- mapcar
   8   0%   #
   4   0%   #
   4   0%  mapc
  20   0%   - org-fold-core-get-folding-spec
   4   0%  org-fold-core-get-folding-spec-from-alias
   8   0% org-fold-core-get-region-at-point
5911  32%  - org-fold-core--property-symbol-get-create
   4   0% org-fold-core--property-symbol-get-create
  20   0%font-lock-flush
  16   0%- pop-to-buffer
  16   0% - display-buffer
  16   0%  - org-display-buffer-split
  16   0% display-buffer-pop-up-window
   8   0%  org-capture-get-indirect-buffer
   8   0%- org-capture-place-entry
   4   0% - org-paste-subtree
   4   0%org-map-region
   4   0%- org-capture-mode
   4   0%   substitute-command-keys
  54   0%   - org-capture-fill-template
  24   0%- org-mode
   8   0% - org-set-regexps-and-options
   4   0%  - org-collect-keywords
   4   0%   - org--collect-keywords-1
   4   0%- org-make-options-regexp
   4   0% - regexp-opt
   4   0%  - regexp-opt-group
   4   0%   - regexp-opt-group
   4   0%- regexp-opt-group
   4   0% - regexp-opt-group
   4   0%  - regexp-opt-group
   4   0%   - regexp-opt-group
   4   0%- regexp-opt-group
   4   0% - regexp-opt-group
   4   0%  - regexp-opt-group
   4   0%   - regexp-opt-group
   4   0%  regexp-opt-group
   4   0%  - regexp-opt
   4   0%   - regexp-opt-group
   4   0%- regexp-opt-group
   4   0% - regexp-opt-group
   4   0%  - regexp-opt-group
   4   0%   - regexp-opt-group
   4   0%- regexp-opt-group
   4   0% - regexp-opt-group
   4   0%  - regexp-opt-group
   4   0%   - regexp-opt-group
   4   0%- regexp-opt-group
   4   0%   regexp-opt-group
   4   0% - org-install-agenda-files-menu
   4   0%org-agenda-files
   4   0% - outline-mode
   4   0%  - add-hook
   4   0%   - #
   4   0%  alist-get
  11   0%- switch-to-buffer-other-window
  11   0% - pop-to-buffer
  11   0%  - display-buffer
  11   0%   -
display-buffer--maybe-pop-up-frame-or-window
  11   0%- display-buffer--maybe-pop-up-window
  11   0%   display-buffer-pop-up-window
   7   0%- org-get-x-clipboard
   7   0% - gui-get-selection
   7   0%  - gui-backend-get-selection
   7   0%   - apply
   7   0%  #
   4   0%  org-fold-core--fix-folded-region
   4   0%  org-clone-local-variables
   4   0%- org-capture-expand-embedded-elisp
   4   0% - org-fold-core--fix-folded-region
   4   0%org-fold-core-region-folded-p
 295  

Re: [Bug] org-update-dblock randomly broken for more than 10 columns and larger files

2024-07-11 Thread Jakob Schöttl

Thanks for the reproducer!
I committed a fix onto main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=58c5c5882


Hi Ihor, do you know anything on the merge progress of your fix into emacs?

I just tested with GNU Emacs 29.4 with --no-init-file and the minimal 
example still doesn't produce a correct table.


- Jakob