[BUG] org-capture-kill: doesn't remove the right text region

2022-07-14 Thread Caleb Chase
I discovered a bug with org-capture and org-capture kill when
canceling an item or plain type template on a heading that has only an
empty line for content. Minimal reproduction is as follows:

1. Add the following to =/tmp/capture-bug-init.el=:
   #+begin_src emacs-lisp :noeval t
 (require 'org)
 (setq org-capture-templates
   '(("i" "Repro: item type" item (file+headline
"/tmp/test-capture.org" "Foo") nil :unnarrowed t)
 ("p" "Repro: plain type" plain (file+headline
"/tmp/test-capture.org" "Foo") "Plain capture: %?" :unnarrowed t)))

 (with-temp-buffer
   ;; FIXME BUG: occurs with empty line between headings.
   (insert "* Foo\n\n* Bar\n")
   ;; FIXME WORKING: no empty line between headings.
   ;; (insert "* Foo\n* Bar\n")
   ;; FIXME WORKING: existing item between headings.
   ;; (insert "* Foo\n- Some note\n* Bar\n")
   (write-file "/tmp/test-capture.org"))
 (find-file "/tmp/test-capture.org")
 (org-capture nil "i")
   #+end_src
2. Run Emacs: =emacs -Q --load /tmp/capture-bug-init.el=
3. Cancel the capture with =C-c C-k=
4. Bug occurs: the dash is left behind, so the last line is now =-*
Bar= instead of =* Bar=.

You can also reproduce this bug with the plain type template I have
above. Notice the different commented-out variants illustrating when
it behaves properly. This bug occurs when there is a single blank
empty line between the two headings, but does not occur if there is
not empty line or if there is an existing item.

---
*POSSIBLE ROOT CAUSE*
I suspect the =:begin-marker= capture marker is determined incorrectly
for plain and item capture types. I haven't dug into the relevant
functions, =org-capture-place-item= and =org-capture-place-plain-text=
closely enough to know exactly what is going on, but here's a
workaround I came up with. It's obviously not the Right Solution (TM),
but at least it illustrates the problem:

#+begin_src emacs-lisp :noeval t
  (defun capture-cancel-bug-fix ()
(let ((begin (org-capture-get :begin-marker 'local)))
  (unless (equal (char-before begin) (string-to-char "\n"))
(setq org-capture-current-plist
  (plist-put org-capture-current-plist
 :begin-marker (1- begin))
  (add-hook 'org-capture-mode-hook #'capture-cancel-bug-fix)
#+end_src

---
*CONTEXT*
- Emacs version: 28.1
- Org version: 9.5.4. More specifically, tested on current bugfix
branch revision 6dc785288d3514af4071f210dac0a18c14a6c45b and current
main branch revision d9479887226ad79a1a8de739e7be0fc1fffec536.



Re: [tip/offtopic] A function to describe the characters of a word at point

2022-07-14 Thread Juan Manuel Macías
Hi, Marcin and Samuel, thanks for your comments,

Marcin Borkowski writes:

> You might want to extend it and create a minor mode which would display
> data about the current character in the echo area, Eldoc-style, or in
> a tooltip when you hover the mouse pointer over a character.  Depending
> on what exactly you need, these ideas might be more or less useful, of
> course.

I also have written a smaller function to display a quick information of
a single character at point, something much simpler and not as verbose
as describe-char. But it had never occurred to me to do something
eldoc-like with it. In my case, although for those contexts I prefer
quick information (describe-char also has its relaxing moment), I don't
feel such an urgency :-).

In any case, something quick and dirty, just as a proof of concept,
could be this:

(define-minor-mode char-info-at-point-mode
  "TODO"
  :init-value nil
  :lighter ("chinfo")
  (if char-info-at-point-mode
  (add-hook 'post-command-hook #'char-name-at-point nil t)
(remove-hook 'post-command-hook #'char-name-at-point 'local)))

(defun char-name-at-point ()
  (interactive)
  (let* ((char-name (get-char-code-property (char-after (point)) 'name))
 (code (format "#%x" (char-after (point
 (dec (get-char-code-property (char-after (point)) 'decomposition))
 (info (concat
char-name
" / "
code
" / descomp: "
dec
"\s"
(mapconcat (lambda (cod)
 (format "#%x" cod))
   dec "\s+\s"
(message info)))

Best regards,

Juan Manuel 



[BUG] org-colview tests fail in Emacs 29 because of wrong org-colview's assumptions about current-column [9.5.4 (release_9.5.4-626-g45f9d8.dirty @ /home/yantar92/.emacs.d/straight/build/org/)]

2022-07-14 Thread Ihor Radchenko
Hi,

On Emacs 29, make test will fail on both bugfix and main:

5 unexpected results:
   FAILED  test-org-colview/columns-move-left
   FAILED  test-org-colview/columns-move-right
   FAILED  test-org-colview/columns-new
   FAILED  test-org-colview/columns-next-allowed-value
   FAILED  test-org-colview/columns-update

This happens since Emacs commit
4243747b1b8c3b7e3463822804b32e83febe2878:

;; Fix 'current-column' in the presence of display strings

;; * src/indent.c (check_display_width): Support calculation of width
;; of 'display' properties whose values are strings.  This fixes the
;; value returned by 'current-column' when display strings are
;; present between BOL and point.  (Bug#53795)

There is nothing wrong in this Emacs commit.
However, org-colview.el, and particularly

(nth (current-column) org-columns-current-fmt-compiled)
statements, e.g. in org-columns-update (also in other places)

rely on current-column ignoring overlays and display properties.

To see the issue interactively, one can use the following example
recipe:

1. Run Emacs 29 master loading the latest bugfix/main Org branch
2. Open the following file:

* H
:PROPERTIES:
:A: 1
:END:
** S
:PROPERTIES:
:A: 2
:END:

3. Put point at the beginning of the first heading
4. Run M-: (let ((org-columns-default-format "%A %A{min}")) (org-columns))
5. Run M-: (org-columns-update "A")
6. Observe (error "Invalid column specification format: nil") caused by
   org-columns-update trying to retrieve the column format using the
   sexp relying of (current-column).

Note that fixing this bug will probably require checking the logic of
org-colview - one may need to dive deeply into that code.

Best,
Ihor


Re: [tip/offtopic] A function to describe the characters of a word at point

2022-07-14 Thread Samuel Wales
good idea for command.  i like the additional ideas too like the help
text [i hae that put in echo area even in gui].

for even more blue sky stuff, i was thinking along the lines of
information about characters, such as en/locale meanings for cjk.  or
furigana [ruby text] for the echo area.  requires lookup though.  (to
go along with meanings for input method. :))


On 7/14/22, Marcin Borkowski  wrote:
>
> On 2022-07-13, at 12:49, Juan Manuel Macías  wrote:
>
>> Sorry for the slight offtopic.
>
> Not off-topic at all, as far as I'm concerned!  (Though sending this to
> help-gnu-emacs might be an even better idea.)  I use `C-u C-x =' pretty
> often, so I fully understand why someone might want to code something
> like this.  Very nice, thanks for sharing!
>
> You might want to extend it and create a minor mode which would display
> data about the current character in the echo area, Eldoc-style, or in
> a tooltip when you hover the mouse pointer over a character.  Depending
> on what exactly you need, these ideas might be more or less useful, of
> course.
>
> Also, since the answer to quite a few org-related issues seems to be
> "just insert a zero-width space", making those stand out (like
> non-breaking spaces already are) could also be useful.  FWIW, I have
> this function in my init.el:
>
> (defun insert-zero-width-space ()
>   "Insert Unicode character \"zero-width space\"."
>   (interactive)
>   (insert "​"))
>
> (of course, the 0-width space is invisible between the quotes).
>
> Best,
> mbork
>
>
>
>> Since Unicode and character issues come up here from time to time, I'm
>> sharing this 'homemade' function that I wrote a long time ago for my
>> work, in case someone finds it useful. It Shows a brief descriptive list
>> of all characters in a word at point. Each character includes the
>> Unicode name, code, and canonical decomposition. Example:
>>
>> ἄρχοντα >>
>>
>> ἄ (#1f04) ... GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA ... descomp:
>> #1f00 #301
>> ρ (#3c1) ... GREEK SMALL LETTER RHO ... descomp: #3c1
>> χ (#3c7) ... GREEK SMALL LETTER CHI ... descomp: #3c7
>> ο (#3bf) ... GREEK SMALL LETTER OMICRON ... descomp: #3bf
>> ν (#3bd) ... GREEK SMALL LETTER NU ... descomp: #3bd
>> τ (#3c4) ... GREEK SMALL LETTER TAU ... descomp: #3c4
>> α (#3b1) ... GREEK SMALL LETTER ALPHA ... descomp: #3b1
>>
>>
>> #+begin_src emacs-lisp
>>   (defun describe-chars-word-at-point ()
>> (interactive)
>> (setq chars-in-word nil)
>> (if
>> (not (current-word t t))
>> (error "Not in a word at point...")
>>   (let
>>   ((word (current-word t t)))
>> (save-excursion
>>   (with-temp-buffer
>> (insert word)
>> (goto-char (point-min))
>> (while (re-search-forward "\\(.\\)" nil t)
>>   (let* ((char-name (save-excursion
>>   (backward-char)
>>   (get-char-code-property (char-after
>> (point)) 'name)))
>>  (char-desc (save-excursion
>>   (backward-char)
>>   (get-char-code-property (char-after
>> (point)) 'decomposition)))
>>  (char-format (concat (match-string 1) "\s" "("
>>   (format "#%x" (string-to-char
>> (match-string 1)))
>>   ")\s...\s" char-name
>> "\s...\sdecomp:\s"
>>   (mapconcat (lambda (cod)
>>(format "#%x"
>> cod))
>>  char-desc " "
>> (push char-format chars-in-word)))
>> (when (get-buffer "*chars in word*")
>>   (kill-buffer "*chars in word*"))
>> (get-buffer-create "*chars in word*")
>> (set-buffer "*chars in word*")
>> (insert (mapconcat 'identity
>>(reverse chars-in-word) "\n"))
>> (view-mode)
>> (temp-buffer-window-show "*chars in word*"
>>  '((display-buffer-below-selected
>> display-buffer-at-bottom)
>>(inhibit-same-window . t)
>>(window-height .
>> fit-window-to-buffer
>>   (pop-to-buffer "*chars in word*")
>> #+end_src
>
>
> --
> Marcin Borkowski
> http://mbork.pl
>
>


-- 
The Kafka Pandemic

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



Re: [PATCH] ox-latex.el: Unify in one single list Babel and Polyglossia languages alists

2022-07-14 Thread Juan Manuel Macías
Juan Manuel Macías writes:

> In any case, I personally think that org-latex-language-alist, as it is
> now in this patch, is sufficient.

By the way, Maxim. I have been doing some tests with pdfLaTeX. I've
known for a while now that it's no longer necessary to load the inputenc
package. But it seems that it is not even necessary to load fontenc with
the encoding of each language. Try compiling this:

#+begin_src latex
  \documentclass{article}
  \usepackage[russian,polutonikogreek]{babel}

  \begin{document}

  \today

  Δαρείου καὶ Παρυσάτιδος γίγνονται παῖδες δύο, πρεσβύτερος μὲν Ἀρταξέρξης, 
νεώτερος δὲ
  Κῦρος· ἐπεὶ δὲ ἠσθένει Δαρεῖος καὶ ὑπώπτευε τελευτὴν τοῦ βίου, ἐβούλετο τὼ 
παῖδε ἀμφοτέρω
  παρεῖναι.

  \selectlanguage{russian}

  \today

  Emacs написан на двух языках: C и Emacs Lisp (Elisp, диалект Лиспа). При этом 
сам редактор
  является интерпретатором Elisp. По сути дела, большая часть Emacs написана на 
языке Elisp,
  и её можно рассматривать как расширение к основной программе.

  \end{document}
#+end_src

In TeX live 2022 the compilation is correct (I think). It seems that
Babel (or russian/greek.ldf) loads the font encodings according to the
declared languages. From the log:

#+begin_src sh
(/usr/share/texmf-dist/tex/latex/cyrillic/t2aenc.def
(/usr/share/texmf-dist/tex/latex/base/t2aenc.dfu)))
(/usr/share/texmf-dist/tex/generic/babel-greek/greek.ldf
(/usr/share/texmf-dist/tex/latex/greek-fontenc/lgrenc.def
(/usr/share/texmf-dist/tex/latex/greek-inputenc/lgrenc.dfu)
(/usr/share/texmf-dist/tex/latex/greek-fontenc/greek-fontenc.def
(/usr/share/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def) (./fontenc.aux
 (/usr/share/texmf-dist/tex/generic/babel/locale/es/babel-spanish.tex)
(/usr/share/texmf-dist/tex/latex/cbfonts-fd/lgrcmr.fd))
(/usr/share/texmf-dist/tex/latex/cyrillic/t2acmr.fd) [1{/var/lib/texmf/fonts/ma
p/pdftex/updmap/pdftex.map}] (./fontenc.aux) ){/usr/share/texmf-dist/fonts/enc/
dvips/cm-super/cm-super-t2a.enc}

Re: [PATCH] ox-latex.el: Unify in one single list Babel and Polyglossia languages alists

2022-07-14 Thread Juan Manuel Macías
Max Nikulin writes:

>> Subject: [PATCH] * lisp/ox-latex.el: New variable `org-latex-language-alist'
> Writing the previous message I forgot that currently there is no
> default option for the fontenc package (PdfLaTeX), e.g. T2A for
> Cyrillic. As a result it is not enough to specify just language to
> generate PDF file.  From my point of view it is better to have single
> map from language code to various localization options (babel,
> polyglossia, fontenc). Unfortunately plain list
> `org-latex-language-alist' does not allow further extensions. Property
> list would make initialization not so concise, but it would make the
> map more flexible.

Sorry, I hadn't seen your other message and I ignored it...

What you say makes sense. If I'm not mistaken, there is now nothing like
an hypothetical 'org-latex-guess-fontenc', and org defaults to the T1
option. If I remember correctly (because I haven't used pdfLaTeX in
ages), the fontenc option for Greek is LGR. And I imagine there will be
many more cases. If you or anyone wants to implement that on top of my
patch, that's fine with me. I don't have much time to do it right now.
However, my opinion is the following: I think we should focus our
efforts on finding a satisfactory solution for luatex, according to
everything that has been commented in the different sub-threads on the
subject of fonts and fallback fonts. And leave the related to pdfLaTeX
in second place, if in the end LuaTeX is going to be set as the default
engine.

In any case, I personally think that org-latex-language-alist, as it is
now in this patch, is sufficient.

Best regards,

Juan Manuel 



Re: [tip/offtopic] A function to describe the characters of a word at point

2022-07-14 Thread Marcin Borkowski


On 2022-07-13, at 12:49, Juan Manuel Macías  wrote:

> Sorry for the slight offtopic.

Not off-topic at all, as far as I'm concerned!  (Though sending this to
help-gnu-emacs might be an even better idea.)  I use `C-u C-x =' pretty
often, so I fully understand why someone might want to code something
like this.  Very nice, thanks for sharing!

You might want to extend it and create a minor mode which would display
data about the current character in the echo area, Eldoc-style, or in
a tooltip when you hover the mouse pointer over a character.  Depending
on what exactly you need, these ideas might be more or less useful, of
course.

Also, since the answer to quite a few org-related issues seems to be
"just insert a zero-width space", making those stand out (like
non-breaking spaces already are) could also be useful.  FWIW, I have
this function in my init.el:

(defun insert-zero-width-space ()
  "Insert Unicode character \"zero-width space\"."
  (interactive)
  (insert "​"))

(of course, the 0-width space is invisible between the quotes).

Best,
mbork



> Since Unicode and character issues come up here from time to time, I'm
> sharing this 'homemade' function that I wrote a long time ago for my
> work, in case someone finds it useful. It Shows a brief descriptive list
> of all characters in a word at point. Each character includes the
> Unicode name, code, and canonical decomposition. Example:
>
> ἄρχοντα >>
>
> ἄ (#1f04) ... GREEK SMALL LETTER ALPHA WITH PSILI AND OXIA ... descomp: #1f00 
> #301
> ρ (#3c1) ... GREEK SMALL LETTER RHO ... descomp: #3c1
> χ (#3c7) ... GREEK SMALL LETTER CHI ... descomp: #3c7
> ο (#3bf) ... GREEK SMALL LETTER OMICRON ... descomp: #3bf
> ν (#3bd) ... GREEK SMALL LETTER NU ... descomp: #3bd
> τ (#3c4) ... GREEK SMALL LETTER TAU ... descomp: #3c4
> α (#3b1) ... GREEK SMALL LETTER ALPHA ... descomp: #3b1
>
>
> #+begin_src emacs-lisp
>   (defun describe-chars-word-at-point ()
> (interactive)
> (setq chars-in-word nil)
> (if
> (not (current-word t t))
> (error "Not in a word at point...")
>   (let
>   ((word (current-word t t)))
> (save-excursion
>   (with-temp-buffer
> (insert word)
> (goto-char (point-min))
> (while (re-search-forward "\\(.\\)" nil t)
>   (let* ((char-name (save-excursion
>   (backward-char)
>   (get-char-code-property (char-after 
> (point)) 'name)))
>  (char-desc (save-excursion
>   (backward-char)
>   (get-char-code-property (char-after 
> (point)) 'decomposition)))
>  (char-format (concat (match-string 1) "\s" "("
>   (format "#%x" (string-to-char 
> (match-string 1)))
>   ")\s...\s" char-name 
> "\s...\sdecomp:\s"
>   (mapconcat (lambda (cod)
>(format "#%x" cod))
>  char-desc " "
> (push char-format chars-in-word)))
> (when (get-buffer "*chars in word*")
>   (kill-buffer "*chars in word*"))
> (get-buffer-create "*chars in word*")
> (set-buffer "*chars in word*")
> (insert (mapconcat 'identity
>(reverse chars-in-word) "\n"))
> (view-mode)
> (temp-buffer-window-show "*chars in word*"
>  '((display-buffer-below-selected 
> display-buffer-at-bottom)
>(inhibit-same-window . t)
>(window-height . 
> fit-window-to-buffer
>   (pop-to-buffer "*chars in word*")
> #+end_src


-- 
Marcin Borkowski
http://mbork.pl



Re: Ignore, skip, omit headline when exporting to LaTeX

2022-07-14 Thread Max Nikulin

On 08/07/2022 12:04, Ihor Radchenko wrote:

ed...@openmail.cc writes:


(defun org-export-ignore-headlines-latex (data backend info)
  "Hack of `org-export-ignore-headlines' for LaTeX: add a
conditional for the latex backend and replace 'ignore' with 'ignoreltx'"
  (when (org-export-derived-backend-p backend 'latex)
(org-element-map data 'headline
  (lambda (object)
(when (member "ignoreltx" (org-element-property :tags object))
...
  (org-element-extract-element object)))
  info nil)
data))


Note that this modified version of the function is derived from
org-export-ignore-headlines from ox-extra.el [1]
...
[1] https://git.sr.ht/~bzg/org-contrib


It looks like almost verbatim copy of 
https://orgmode.org/worg/org-faq.html#org11adb66 FAQ: 18.1. How do I 
ignore a headline?

added in 2014 (eb56c1ab34)




Re: [BUG] org-auto-repeat-maybe: error "Can’t expand minibuffer to full frame" and missing log note

2022-07-14 Thread Bhavin Gandhi
On Mon, 11 Jul 2022 at 07:26, Ihor Radchenko  wrote:
>
> Bhavin Gandhi  writes:
>
> >> A better fix may relate to the fact that org-add-log-setup is usually
> >> used to run org-add-log-note at the end of current command. y-or-n-p or
> >> any other kind of command (e.g. added via advice) will break this
> >> assumption we use. So, org-add-log-setup could also store
> >> `this-command', say, in `org-log-note-this-command' and
> >> `org-add-log-note' can then execute only when `this-command' is the same
> >> with `org-log-note-this-command'. WDYT?
> >
> > I had something similar in my mind, something like we check if
> > this-command is org-* (not very robust). Your idea makes sense to
> > me. But this won't work when read-from-minibuffer is called as it
> > doesn't seem to change this-command when it runs.
>
> Then, we will also need to save (recursion-depth) value and check for it
> in addition to this-command.

Thanks for the idea, I'm exploring (recursion-depth),
(minibuffer-depth). I will come up with a patch to fix this bug.

Seems like soon I will cross the TINYCHANGE limit, so I will get the
FSF copyright assignment done.

-- 
Bhavin Gandhi (bhavin192) | https://geeksocket.in



Re: [PATCH] ox-latex.el: Unify in one single list Babel and Polyglossia languages alists

2022-07-14 Thread Max Nikulin

On 14/07/2022 19:34, Juan Manuel Macías wrote:

Subject: [PATCH] * lisp/ox-latex.el: New variable `org-latex-language-alist'
Writing the previous message I forgot that currently there is no default 
option for the fontenc package (PdfLaTeX), e.g. T2A for Cyrillic. As a 
result it is not enough to specify just language to generate PDF file. 
From my point of view it is better to have single map from language 
code to various localization options (babel, polyglossia, fontenc). 
Unfortunately plain list `org-latex-language-alist' does not allow 
further extensions. Property list would make initialization not so 
concise, but it would make the map more flexible.





Re: Recent folding issues

2022-07-14 Thread Ihor Radchenko
Jack Kamm  writes:

>> Can you try the attached patch set?
>
> Thanks for the very prompt patchset!
>
> Testing on the minimal example, the patchset solves the problem I
> reported.
>
> After some brief testing with my usual config, it solves the problem of
> headlines running together after capture, and also solves the problem of
> unfolding the above headline when calling evil-open-above (vim's "O"
> key).

Thanks for testing!
Applied onto main via a79a742cb, f29ccf316, and 8e2fed82e.

I haven't looked into the other problem yet. Too tired today.

Best,
Ihor



Re: [PATCH] ob-core.el: Fix docstring single quotes [9.6 (9.6-gc66bdb @ /home/n/.emacs.d/elpaca/builds/org/)]

2022-07-14 Thread Ihor Radchenko
No Wayman  writes:

> Emacs 29's byte compiler warns about single quotes in docstring 
> examples.

Thanks!
Applied onto main via d94798872.

Best,
Ihor



Re: Alternatives or org-capture?

2022-07-14 Thread Greg Minshall
ypuntot,

by the way, i use =doct= to express org-capture templates:

https://github.com/progfolio/doct


in case that might seem more "intuitive" for you.

cheers, Greg



Re: [PATCH] ox-latex.el: Unify in one single list Babel and Polyglossia languages alists

2022-07-14 Thread Juan Manuel Macías
Ihor Radchenko writes:

> Thanks!
> This looks like an improvement.
> However, we may need to preserve the old defconsts for the time being
> and declare them obsolete.

Hi, Ihor,

I attach the new version of the patch with both variables declared
obsolete.

If everything is ok, I can add what is necessary to NEWS and to the Org Manual.

Best regards,

Juan Manuel

>From 9ff77e71a8cd89b883d5ead37909c887178e4402 Mon Sep 17 00:00:00 2001
From: Juan Manuel Macias 
Date: Thu, 14 Jul 2022 13:42:50 +0200
Subject: [PATCH] * lisp/ox-latex.el: New variable `org-latex-language-alist'

(org-latex-language-alist): Unify in a single list
`org-latex-polyglossia-language-alist' and
`org-latex-babel-language-alist', and make the two variables obsolete.
---
 lisp/ox-latex.el | 173 ---
 1 file changed, 74 insertions(+), 99 deletions(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 1aab8ffd5..9e97f38db 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -172,144 +172,115 @@
 
 ;;; Internal Variables
 
-(defconst org-latex-babel-language-alist
-  '(("af" . "afrikaans")
-("bg" . "bulgarian")
-("ca" . "catalan")
-("cs" . "czech")
-("cy" . "welsh")
-("da" . "danish")
-("de" . "germanb")
-("de-at" . "naustrian")
-("de-de" . "ngerman")
-("el" . "greek")
-("en" . "english")
-("en-au" . "australian")
-("en-ca" . "canadian")
-("en-gb" . "british")
-("en-ie" . "irish")
-("en-nz" . "newzealand")
-("en-us" . "american")
-("es" . "spanish")
-("et" . "estonian")
-("eu" . "basque")
-("fi" . "finnish")
-("fr" . "french")
-("fr-ca" . "canadien")
-("gl" . "galician")
-("hr" . "croatian")
-("hu" . "hungarian")
-("id" . "indonesian")
-("is" . "icelandic")
-("it" . "italian")
-("la" . "latin")
-("ms" . "malay")
-("nl" . "dutch")
-("nb" . "norsk")
-("nn" . "nynorsk")
-("no" . "norsk")
-("pl" . "polish")
-("pt" . "portuguese")
-("pt-br" . "brazilian")
-("ro" . "romanian")
-("ru" . "russian")
-("sa" . "sanskrit")
-("sb" . "uppersorbian")
-("sk" . "slovak")
-("sl" . "slovene")
-("sq" . "albanian")
-("sr" . "serbian")
-("sv" . "swedish")
-("ta" . "tamil")
-("tr" . "turkish")
-("uk" . "ukrainian"))
-  "Alist between language code and corresponding Babel option.")
-
-(defconst org-latex-polyglossia-language-alist
-  '(("am" "amharic")
+(make-obsolete-variable 'org-latex-babel-language-alist
+"set `org-latex-language-alist' instead." "9.6")
+
+(make-obsolete-variable 'org-latex-polyglossia-language-alist
+"set `org-latex-language-alist' instead." "9.6")
+
+(defconst org-latex-language-alist
+  '(("am" "amharic" "*")
 ("ar" "arabic")
-("ast" "asturian")
+("ast" "asturian" "*")
 ("bg" "bulgarian")
-("bn" "bengali")
-("bo" "tibetan")
+("bn" "bengali" "*")
+("bo" "tibetan" "*")
 ("br" "breton")
 ("ca" "catalan")
-("cop" "coptic")
+("cop" "coptic" "*")
 ("cs" "czech")
 ("cy" "welsh")
 ("da" "danish")
-("de" "german" "german")
-("de-at" "german" "austrian")
-("de-de" "german" "german")
-("dsb" "lsorbian")
-("dv" "divehi")
+("de" "ngerman" "german" "german")
+("de-at" "naustrian" "german" "austrian")
+("dsb" "lsorbian" "*")
+("dv" "divehi" "*")
 ("el" "greek")
-("en" "english" "usmax")
-("en-au" "english" "australian")
-("en-gb" "english" "uk")
-("en-nz" "english" "newzealand")
-("en-us" "english" "usmax")
+("el-polyton" "polutonikogreek" "greek" "polytonic")
+("en" "american" "english" "usmax")
+("en-au" "australian" "english" "australian")
+("en-gb" "british" "english" "uk")
+("en-nz" "newzealand" "english" "newzealand")
+("en-us" "american" "english" "usmax")
 ("eo" "esperanto")
 ("es" "spanish")
+("es-mx" "spanishmx" "spanish" "mexican")
 ("et" "estonian")
 ("eu" "basque")
 ("fa" "farsi")
 ("fi" "finnish")
 ("fr" "french")
-("fu" "friulan")
+("fr-ca" "canadien" "french" "canadian")
+("fur" "friulan")
 ("ga" "irish")
 ("gd" "scottish")
 ("gl" "galician")
 ("he" "hebrew")
 ("hi" "hindi")
 ("hr" "croatian")
-("hsb" "usorbian")
+("hsb" "uppersorbian" "sorbian" "upper")
 ("hu" "magyar")
-("hy" "armenian")
+("hy" "armenian" "*")
 ("ia" "interlingua")
-("id" "bahasai")
+("id" "bahasai" "*")
 ("is" "icelandic")
 ("it" "italian")
-("kn" "kannada")
-("la" "latin" "modern")
-("la-classic" "latin" "classic")
-("la-medieval" "latin" "medieval")
-("la-modern" "latin" "modern")
-("lo" "lao")
+("kn" "kannada" "*")
+("la" "latin")
+("la-classic" "classiclatin" "latin" "classic")
+("la-medieval" "medievallatin" "latin" "medieval")
+("la-ecclesiastic" "ecclesiasticlatin" "latin" 

Re: [Question]: Parsing attribute string

2022-07-14 Thread General discussions about Org-mode.
Thank Ihor, this did the trick! 
-- 
 Sent with Tutanota, enjoy secure & ad-free emails. 



Jul 14, 2022, 12:53 by yanta...@gmail.com:

> emacs--- via "General discussions about Org-mode."
>  writes:
>
>> I have a quick question about parsing a string containing attributes.
>> My string has the following form
>> (setq my-string ":caption the caption :label fig-1 :width 10cm :something 
>> this is an extra option")
>> I'm looking for a function which produces an alist or plist with the option 
>> value pair.
>> (:caption "the caption"
>>  :label "fig-1"
>>  :width "10cm
>>  :something "this is an extra option")
>>
>
> org-babel-parse-header-arguments
>



Re: [Question]: Parsing attribute string

2022-07-14 Thread Ihor Radchenko
emacs--- via "General discussions about Org-mode."
 writes:

> I have a quick question about parsing a string containing attributes.
> My string has the following form
> (setq my-string ":caption the caption :label fig-1 :width 10cm :something 
> this is an extra option")
> I'm looking for a function which produces an alist or plist with the option 
> value pair.
> (:caption "the caption"
>  :label "fig-1"
>  :width "10cm
>  :something "this is an extra option")

org-babel-parse-header-arguments




[Question]: Parsing attribute string

2022-07-14 Thread General discussions about Org-mode.
 Dear list, 

I have a quick question about parsing a string containing attributes.
My string has the following form
(setq my-string ":caption the caption :label fig-1 :width 10cm :something this 
is an extra option")
I'm looking for a function which produces an alist or plist with the option 
value pair.
(:caption "the caption"
 :label "fig-1"
 :width "10cm
 :something "this is an extra option")

As org handels these string a lot when exporting, it seems to me 
that there must exist a build in function to solve this task.

Kind regards, 
Bob


Re: org-capture and fast selection of tags

2022-07-14 Thread Christian Heinrich
Hi Ihor,

thanks for your reply.

I looked at the code and came up with a patch that works for me (see below). 
However, this may
change behavior for others:

1. The original %^g will work on non-headlines, but if (org-set-tags-command) 
is called as I do,
this is no longer possible and would need to be checked (what would be a good 
way here?)

2. Can I really deduce from (org-use-fast-tag-selection) being non-nil that 
fast selection should be
used in capture templates as well? Does it actually make sense to incorporate 
this into %^g/G?

I am neither a lisp programmer nor acquainted with the org codebase; this is a 
draft I came up
with. If you can provide me with further feedback, I'm willing to make this 
more stable.


Best regards 
Christian



diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 9ef160d16..a2a05c69d 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -72,6 +72,7 @@
 (defvar crm-separator)
 (defvar org-end-time-was-given)
 (defvar org-keyword-properties)
+(defvar org-use-fast-tag-selection)
 (defvar org-remember-default-headline)
 (defvar org-remember-templates)
 (defvar org-store-link-plist)
@@ -1751,7 +1752,10 @@ Expansion occurs in a temporary Org mode buffer."
 (org-global-tags-completion-table
  (cond ((equal key "G") (org-agenda-files))
(file (list file))
-   (t nil
+   (t nil)
+(if (and (boundp 'org-use-fast-tag-selection) (not (null 
org-use-fast-tag-
selection)))
+  (org-set-tags-command)
+  (let* (
(org-add-colon-after-tag-completion t)
(ins (mapconcat
  #'identity
@@ -1765,7 +1769,7 @@ Expansion occurs in a temporary Org mode buffer."
 (unless (eq (char-before) ?:) (insert ":"))
 (insert ins)
 (unless (eq (char-after) ?:) (insert ":"))
-(when (org-at-heading-p) (org-align-tags)
+(when (org-at-heading-p) (org-align-tags)))
((or "C" "L")
 (let ((insert-fun (if (equal key "C") #'insert
 (lambda (s) (org-insert-link 0 s)


On Mon, 2022-07-11 at 10:02 +0800, Ihor Radchenko wrote:
> Christian Heinrich  writes:
> 
> > Today, I went through your init.org on github (it's ... huge) and couldn't 
> > find anything there
> > either.
> 
> That's because I rarely need to set standard tags when capturing staff.
> So, I am content with entering tags manually.
> 
> > ... Do you have an idea
> > on how to use fast selection of tags (using shortcuts) when capturing an 
> > entry?
> > ...
> > I first thought that using %(org-set-tags-command) should work; but the 
> > capture-buffer is
> > narrowed
> > (i.e., no tags are available),...
> 
> %(org-with-wide-buffer (org-set-tags-command)) may work.
> 
> Of course, we may also implement a proper capture selection for %^g
> template. As usual, patches are welcome.
> 
> Best,
> Ihor
> 


signature.asc
Description: This is a digitally signed message part


Re: Confused about source code blocks evaluation when exporting

2022-07-14 Thread Fraga, Eric
On Thursday, 14 Jul 2022 at 10:09, alain.coch...@unistra.fr wrote:
> #+begin_src emacs-lisp
> (setq org-latex-pdf-process )
> #+end_src
>
> which I want to be evaluated during export but I want neither the code
> not its results to appear on the exported pdf file.
>
> Maybe there are smarter ways to achieve this goal, but it was an
> opportunity for me anyway to start understanding this evaluation
> business.

For this kind of setting, I use file local variables and #+bind:.
Evaluating this code snippet during the export process is probably not
what you want.  You want it set prior to exporting?

-- 
Eric S Fraga, @ericsfraga:matrix.org, GnuPG: 0xc89193d8fffcf67d


Re: Confused about source code blocks evaluation when exporting

2022-07-14 Thread Alain . Cochard
Fraga, Eric writes on Thu 14 Jul 2022 07:06:
 > On Wednesday, 13 Jul 2022 at 23:06, alain.coch...@unistra.fr wrote:
 > > Now I start again, but I do 'C-c C-e l o' instead.  I am _not_ asked
 > > whether I want to evaluate, and the 'foo' file is still there.  But
 > > the pdf file does display
 > >
 > > rm -f foo
 > >
 > > Does this still qualify as "evaluation"?  I thought not, hence my
 > > conclusion that evaluation was not performed by default upon export,
 > > but you made me doubt it...
 > 
 > If you do not specify either ":exports results" or ":exports both",
 > then the exporter doesn't output the results and hence there is no
 > need to evaluate the src block.

Why "there is no need"?  It was not a theoretical issue for me.
Without latexmk installed, I had to setq a different value for
org-latex-pdf-process depending on whether I used

#+cite_export: natbib plainnat

or

#+cite_export: biblatex

Sure, I can do this is in the emacs init file but then I don't how any
better than to restart emacs.  So I tried to do it on the fly with an
src block of the form

#+begin_src emacs-lisp 
(setq org-latex-pdf-process )
#+end_src

which I want to be evaluated during export but I want neither the code
not its results to appear on the exported pdf file.

Maybe there are smarter ways to achieve this goal, but it was an
opportunity for me anyway to start understanding this evaluation
business.

There are other instances where this could be useful: evaluate some
shell block for deleting a file on the system before evaluating some
fortran code depending on this code.

 > The manual is indeed a bit vague about this so suggestions for
 > improvements are always welcome.

How about changing

   Org evaluates source code blocks in an Org file during export.

to

   Org generally evaluates source code blocks in an Org file during
   export.

But ideally it would be expanded, perhaps with something like
"depending on the value of some header arguments (see xxx)".

Also, how about a 'yes' option to the eval header argument to call for
unconditional evaluation?  Sorry if this would not make sense, I'm
trying...

Thank you all and best wishes.

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




Re: index for HTML export

2022-07-14 Thread Fraga, Eric
On Thursday, 14 Jul 2022 at 09:18, Jens Lechtenboerger wrote:
> That is strange.  File theindex.inc should contain the index entries.
> I believe that “:makeindex t” on the Org source files with #+INDEX:
> entries should do the job.

Well, it seems that index generation by publishing works with "emacs -Q"
so there's something in my configuration that is stopping things
working.  Time to drill down in my init files...

Thank you,
eric
-- 
: Eric S Fraga, with org release_9.5.4-623-gc66bdb in Emacs 29.0.50

Re: index for HTML export

2022-07-14 Thread Jens Lechtenboerger
On 2022-07-14, Fraga, Eric wrote:

> On Thursday, 14 Jul 2022 at 08:13, Jens Lechtenboerger wrote:
>>   (list "index-terms"
>
> [...]
>
>> :preparation-function 'oer-reveal--add-advice-link
>> :completion-function 'oer-reveal--remove-advice-link
>> :publishing-function '(org-html-publish-to-html)
>> :publishing-directory "./public")
>>
>> So, do you see theindex.org and theindex.inc?  Do you publish the
>> former?
>
> Yes, I do see theindex.org and theindex.inc but there are no index
> entries.

That is strange.  File theindex.inc should contain the index entries.
I believe that “:makeindex t” on the Org source files with #+INDEX:
entries should do the job.

> What do the first two functions listed above do?

They adapt the link format for my specific export backend (to point
to slides of presentations).  That is not relevant in your case.

Best wishes
Jens


smime.p7s
Description: S/MIME cryptographic signature


Re: Confused about source code blocks evaluation when exporting

2022-07-14 Thread Fraga, Eric
On Wednesday, 13 Jul 2022 at 23:06, alain.coch...@unistra.fr wrote:
> Now I start again, but I do 'C-c C-e l o' instead.  I am _not_ asked
> whether I want to evaluate, and the 'foo' file is still there.  But
> the pdf file does display
>
> rm -f foo
>
> Does this still qualify as "evaluation"?  I thought not, hence my
> conclusion that evaluation was not performed by default upon export,
> but you made me doubt it...

If you do not specify either ":exports results" or ":exports both", then
the exporter doesn't output the results and hence there is no need to
evaluate the src block.

The manual is indeed a bit vague about this so suggestions for
improvements are always welcome.

-- 
Eric S Fraga, @ericsfraga:matrix.org, GnuPG: 0xc89193d8fffcf67d


Re: index for HTML export

2022-07-14 Thread Fraga, Eric
On Thursday, 14 Jul 2022 at 08:13, Jens Lechtenboerger wrote:
>   (list "index-terms"

[...]

> :preparation-function 'oer-reveal--add-advice-link
> :completion-function 'oer-reveal--remove-advice-link
> :publishing-function '(org-html-publish-to-html)
> :publishing-directory "./public")
>
> So, do you see theindex.org and theindex.inc?  Do you publish the
> former?

Yes, I do see theindex.org and theindex.inc but there are no index
entries.  What do the first two functions listed above do?

-- 
: Eric S Fraga, with org release_9.5.4-623-gc66bdb in Emacs 29.0.50


Re: Confused about source code blocks evaluation when exporting

2022-07-14 Thread Alain . Cochard
Rudolf Adamkovič writes on Thu 14 Jul 2022 08:06:
 > alain.coch...@unistra.fr writes:
 > 
 > > Org evaluates source code blocks in an Org file during export.
 > 
 > I have just tried to export the following document:
 > 
 > #+begin_src emacs-lisp :exports both
 > (+ 1 1)
 > #+end_src
 > 
 > The exported HTML file contains the expression '(+ 1 1)' along with
 > '2', its value.  It follows that Emacs does evaluate source blocks
 > on export.

Yes, but it is because you used ':exports both'.  Without that, I only
have '(+ 1 1)'.  Would you not still speak about the "exported HTML
file"?

a.

(Thanks for the other precisions.)


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




Re: [rounding (ceil in matlab)]

2022-07-14 Thread Uwe Brauer
>>> "RA" == Rudolf Adamkovič  writes:

> Uwe Brauer  writes:
>> […] the matlab command `ceil' for example does this, I can't find
>> anything similar in the documentation.

> How about the 'ceiling' function?  See '?ceiling'.  For example:

> ceiling(quantile(c(1, 2, 3), c(1 / 3, 2 / 3, 1)))

Thanks! That solved the problem

-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 


smime.p7s
Description: S/MIME cryptographic signature


Re: [rounding (ceil in matlab)] (was: calculating quartils, tercils (or percentiles) Using R?)

2022-07-14 Thread Rudolf Adamkovič
Uwe Brauer  writes:

> […] the matlab command `ceil' for example does this, I can't find
> anything similar in the documentation.

How about the 'ceiling' function?  See '?ceiling'.  For example:

ceiling(quantile(c(1, 2, 3), c(1 / 3, 2 / 3, 1)))

Rudy
-- 
"One can begin to reason only when a clear picture has been formed in
the imagination."
-- Walter Warwick Sawyer, Mathematician's Delight, 1943

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



Re: index for HTML export

2022-07-14 Thread Jens Lechtenboerger
On 2022-07-13, Fraga, Eric wrote:

> Publishing works, in the sense that my org file is exported to HTML just
> fine.  An index file is created but is not populated with any index
> links.  What am I missing?  The info page is less than helpful
> unfortunately.  Are index lines, e.g.
>
> #+index: test!org publishing
>
> processed in any way?

Over here, yes: https://oer.gitlab.io/OS/index-terms.html

I use this in my publish code:

   (list "org-presentations"
 :base-directory "."
 :base-extension "org"
 :makeindex oer-reveal-publish-makeindex
 :exclude 
"index\\|backmatter\\|config\\|course-list\\|license-template\\|imprint\\|privacy\\|README\\|CONTRIBUTING\\|CHANGELOG"
 :publishing-function 
oer-reveal-publish-org-publishing-functions
 :publishing-directory "./public")

where oer-reveal-publish-makeindex is t and my publish.el makes sure
to publish to HTML:
https://gitlab.com/oer/OS/-/blob/master/elisp/publish.el

  (list "index-terms"
:base-directory "."
;; A file theindex.org (which includes theindex.inc)
;; is created due to assignment to
;; oer-reveal-publish-makeindex above.
;; Using that setting, the file is automatically published with
;; org-re-reveal, which is useless.
;; Thus, publish as HTML here.  For this to work, index-terms.org
;; is a manually created file including theindex.inc.
;; The preparation and completion functions below set up an
;; advice on org-html-link to rewrite links into presentations
;; using org-re-reveal's anchor format.
:include '("index-terms.org")
:exclude ".*"
:preparation-function 'oer-reveal--add-advice-link
:completion-function 'oer-reveal--remove-advice-link
:publishing-function '(org-html-publish-to-html)
:publishing-directory "./public")

So, do you see theindex.org and theindex.inc?  Do you publish the
former?

Best wishes
Jens



Re: Confused about source code blocks evaluation when exporting

2022-07-14 Thread Rudolf Adamkovič
alain.coch...@unistra.fr writes:

> Org evaluates source code blocks in an Org file during export.

I have just tried to export the following document:

#+begin_src emacs-lisp :exports both
(+ 1 1)
#+end_src

The exported HTML file contains the expression '(+ 1 1)' along with '2',
its value.  It follows that Emacs does evaluate source blocks on export.

(Note that Org did not add RESULTS to the Org file during export, for no
export should ever modify the source file in any way.)

> why does '#+RESULTS:' show 'bar' and not 'foo'?

By default, the Org mode captures the value of the last expression.  In
your case, the last expression has the value of 'bar'.

If you want to capture something else for the result, such as standard
output, you must tell Org Babel about it with the ':results' argument.
It makes sense, if you think about it.  The computer cannot possibly
know what you want to capture.

Rudy
-- 
"The introduction of suitable abstractions is our only mental aid to
organize and master complexity."
-- Edsger Wybe Dijkstra, 1930-2002

Rudolf Adamkovič  [he/him]
Studenohorská 25
84103 Bratislava
Slovakia



exporting timestamps to html, day of the week is not exported.

2022-07-14 Thread Uwe Brauer



Hi

I only now realized that the day of the week of week in a org timestamp
is not exported.

Look at these


<2022-07-14 Do>

<2022-07-14 Thu>

<2022-07-14 jue>

Time stamps, when I export them

I see that 
org-export-filter-timestamp-functions is a variable defined in ‘ox.el’.

Its value is
(endless/filter-timestamp org-export-filter-timestamp-remove-brackets)

These functions I found somewhere in the web or were provided in the
mailing list, I cannot remember.

The point is, does somebody know about a filter function that also
exports the day of the week?


Regards

Uwe Brauer 

-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine.