Re: empty/nil in table cells

2020-07-10 Thread Michael Brand
Hi Mario

For such cases I use ~subseq~ to take the running window out of the
complete range ~@I$2..@II$2~:

|  date | measure | running avg |
|---+-+-|
| 01-27 | 604 | |
| 01-28 | 314 | |
| 01-29 | 636 | |
| 01-30 | 305 | |
| 01-31 | 760 | |
| 02-01 | 531 | |
| 02-02 | 331 |  497.29 |
| 02-03 |  77 |  422.00 |
| 02-04 | 621 |  465.86 |
| 02-05 | 406 |  433.00 |
| 02-06 | 621 |  478.14 |
| 02-07 | 975 |  508.86 |
| 02-08 | 252 |  469.00 |
| 02-09 | 794 |  535.14 |
| 02-10 |  36 |  529.29 |
#+TBLFM: $3 = '(let ((len 7)) (if (> @# len) (format "%.2f" (/ (apply
#'+ (subseq '(@I$2..@II$2) (- @# 1 len) (- @# 1))) (float len))) ""));
N

Michael



Re: Error (args out of range) when editing list

2020-07-10 Thread Nicolas Goaziou
Hello,

Jarmo Hurri  writes:

> * Demo of some sort of error
>   1. (take your cursor on top of the letter X after the closing
>  parenthesis)X
>   2. then press Alt-Enter
>  1. you will notice
>  2. an error
>   3. saying something like args out of range

Could you try with latest master? I cannot reproduce it.

Regards,
-- 
Nicolas Goaziou



Re: Error (args out of range) when editing list

2020-07-10 Thread Jarmo Hurri


Hi there!

Nicolas Goaziou  writes:

>> * Demo of some sort of error
>>   1. (take your cursor on top of the letter X after the closing
>>  parenthesis)X
>>   2. then press Alt-Enter
>>  1. you will notice
>>  2. an error
>>   3. saying something like args out of range
>
> Could you try with latest master? I cannot reproduce it.

I think I am running the latest (stable) master:

Org mode version 9.3.7 (release_9.3.7-13-ge62ca4)

Then it has to be something in my system. Great. As a cry for help, here
is what I get with debug-on-error:

Debugger entered--Lisp error: (args-out-of-range -1 3)
  replace-match("2. " nil nil nil 1)
  #f(compiled-function (struct old-struct item) #)(((30 2 
"1. " nil nil nil 112) (112 2 "2. " nil nil nil 119) (120 2 "1. " nil nil nil 
187) (146 5 "1. " nil nil nil 170) (170 5 "2. " nil nil nil 187) (187 2 "2. " 
nil nil nil 232)) ((30 2 "1. " nil nil nil 112) (112 2 "1. " nil nil nil 119) 
(120 2 "2. " nil nil nil 187) (146 5 "1. " nil nil nil 170) (170 5 "2. " nil 
nil nil 187) (187 2 "3. " nil nil nil 232)) 187)
  org-list-struct-apply-struct(((30 2 "1. " nil nil nil 112) (112 2 "2. " nil 
nil nil 119) (120 2 "1. " nil nil nil 187) (146 5 "1. " nil nil nil 170) (170 5 
"2. " nil nil nil 187) (187 2 "2. " nil nil nil 232)) ((30 2 "1. " nil nil nil 
112) (112 2 "1. " nil nil nil 119) (120 2 "2. " nil nil nil 187) (146 5 "1. " 
nil nil nil 170) (170 5 "2. " nil nil nil 187) (187 2 "3. " nil nil nil 232)))
  org-list-write-struct(((30 2 "1. " nil nil nil 112) (112 2 "2. " nil nil nil 
119) (120 2 "1. " nil nil nil 187) (146 5 "1. " nil nil nil 170) (170 5 "2. " 
nil nil nil 187) (187 2 "2. " nil nil nil 232)) ((30) (112) (120) (146 . 120) 
(170 . 120) (187)))
  org-insert-item(nil)
  funcall-interactively(org-insert-item nil)
  call-interactively(org-insert-item)
  org-meta-return(nil)
  funcall-interactively(org-meta-return nil)
  call-interactively(org-meta-return nil nil)
  command-execute(org-meta-return)

All the best,

Jarmo




Couple of issues with org block meta lines faces

2020-07-10 Thread Sébastien Miquel

Hi,

If you start emacs as follows, making sure emacs picks up the latest org 
from org-plus-contrib, and with file.org being the content of this mail,


#+BEGIN_SRC sh :async
emacs -q \
  --eval "(defface org-block-begin-line '((t (:background \"blue\" 
:height 0.8))) \"\")" \

  --eval "(setq org-fontify-whole-block-delimiter-line t)" \
  file.org
#+END_SRC

You may observe the following issues:

 1) begin-line applies to both begin and end lines. This might be 
intended. If you define an org-block-end-line face, it gets applied instead.
 2) org-fontify-whole-block-delimiter-line is ignored. I'm aware I can 
set the :extend t property to the face. If it does nothing, maybe this 
variable should be removed.

 3) The following block has no face applied.
    - This only happens when the line with # at the top is empty
    - The :height part of the face seems to be responsible
    - It also works fine with default org version
 4) If you go to the end of the fontified end_src line (first src 
block), then press enter a couple of times the buffer position has the 
org-block-begin-line face applied (move cursor to see it).


#
#+BEGIN_SRC elisp
auie
auriaest
#+END_SRC

Regards,




unexpected behaviour in org beamer export

2020-07-10 Thread Eric S Fraga
Hello all,

I have some slides that I would normally export to beamer.  However, I
need, in one case, to export these slides to HTML as well.  I don't
expect to get the same functionality in this case, of course.

In any case, if I use the  directives in beamer for exposing parts
of a slide at different times, these  constructs get exported to the
HTML verbatim.  So, I thought I would protect them within @@latex:...@@
constructs.  Although that works for HTML export (i.e. they no longer
appear), the LaTeX export is now broken: the directives are followed but
they are also exported as text in the slide.

The minimal example org file that illustrates this is attached.

(org recent from git yesterday)

Thank you,
eric

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-682-geac255
#+title: The title of the talk

* this works for LaTeX 
but not HTML:
1. Draw something
2. <2-> Draw some more
3. <3-> Add some labels
* this works for HTML 
but not LaTeX:
1. Draw something
2. @@latex:<2->@@ Draw some more
3. @@latex:<3->@@ Add some labels


Re: Error (args out of range) when editing list

2020-07-10 Thread Nicolas Goaziou
Jarmo Hurri  writes:

> I think I am running the latest (stable) master:

Note: stable ≠ master, so you just wrote an oxymoron ;)

> Org mode version 9.3.7 (release_9.3.7-13-ge62ca4)

This is not quite HEAD. Mine is release_9.3.7-683-g95eaab.



Re: empty/nil in table cells

2020-07-10 Thread Nicolas Goaziou
Hello,

Mario Frasca  writes:

> I think we really need a bug-tracking mechanism, you know?

H...

I had read about the message you've sent again. However, even if we
don't have a bug-tracking mechanism, you can still group messages
related to the same issue in the same thread. It would be more helpful
than starting a new thread with a, IMO, rather cryptic message.

Unfortunately, your message above only answers some of my questions.
"Where?", "What do you mean?" and "How so?" still apply, AFAICT. IOW,
I suggest to be more explicit if you want to have comments about your
suggestion.

Regards,
-- 
Nicolas Goaziou



Re: unexpected behaviour in org beamer export

2020-07-10 Thread Eric S Fraga
On Friday, 10 Jul 2020 at 11:00, Eric S Fraga wrote:
> So, I thought I would protect them within @@latex:...@@ constructs.

Ignore noise (although I'm still wondering...): if I use @@beamer:...@@,
everything is fine.

Thank you,
eric

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-682-geac255



Re: Error (args out of range) when editing list

2020-07-10 Thread Jarmo Hurri


Nicolas Goaziou  writes:

>> I think I am running the latest (stable) master:
>
> Note: stable ≠ master, so you just wrote an oxymoron ;)

Oops, exactly. :) I now pulled the latest _master_, and it does not have
the same issue branch _stable_ has. So I guess stable will also contain
the fix at some point.

Thanks, and all the best,

Jarmo




heads up: org-eldoc (contrib) may not work with recent Emacs (28.0.x)

2020-07-10 Thread Eric S Fraga
Hello,

I am not entirely sure but I believe that recent changes in Emacs's
eldoc.el make org-eldoc (found in the contrib directory for org) no
longer work.  At first glance, an argument is now required for
org-eldoc-documentation-function but this only postpones the error...

Probably only an issue if you are tracking Emacs as I am.

Thank you,
eric

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-682-geac255



Re: Couple of issues with org block meta lines faces

2020-07-10 Thread Kévin Le Gouguec
Hi!

Some points I think I can help with:

Sébastien Miquel  writes:

>   1) begin-line applies to both begin and end lines. This might be 
> intended. If you define an org-block-end-line face, it gets applied instead.

Yup, by default org-block-end-line :inherits from org-block-begin-line.

>   2) org-fontify-whole-block-delimiter-line is ignored. I'm aware I can 
> set the :extend t property to the face. If it does nothing, maybe this 
> variable should be removed.

See emacs bug#42184[1].


[1]: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42184




looking for suggestions: adding a notes page to title page on org beamer export

2020-07-10 Thread Eric S Fraga
Hello all,

TL;DR: is there an easy (more elegant) way to add notes to the title
page for beamer export?  Ideally, something that would allow me to write
in org for the contents of that title notes page, e.g. with lists etc.

(sorry for the onslaught of posts to this list today: I'm working on
lecture slides for next academic year, having to adapt to the COVID-19
situation and be prepared for any contingency...)

Beamer export has a really nice feature: being able to add notes to any
slide and have these appear as a separate page in the exported PDF.  I'm
looking at screen capture for creating pre-recorded lectures.  Using (on
Debian) =simplescreenrecorder=, I can grab just part of the
screen.  Therefore, what works well is to have my slides shown in dual
page mode with each slide on the left and corresponding notes on the
right.  For this to work, I need to have notes for every slide,
including the title page, although I could create a dummy slide, of
course.  In any case, notes for the title page are useful.

However, /out-of-the-box/, there appears to be no way to add notes to
the title page.  My solution has been to overload the =\maketitle= LaTeX
command:

#+latex_header: \let\oldmaketitle\maketitle
#+latex_header: \renewcommand{\maketitle}{\oldmaketitle%
#+latex_header: \note{This is a note.}}

The reason for this convoluted LaTeX intervention is that the LaTeX
=\note= must come before the =\begin{document}= in the LaTeX generated
by ox-beamer to come after the title page but before any subsequent
slides.

Thank you,
eric

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.7-682-geac255



Re: empty/nil in table cells

2020-07-10 Thread Mario Frasca

On 09/07/2020 16:59, Nicolas Goaziou wrote:

and it simplifies a lot writing functions.

How so?


thank you Michael, for answering Nicolas' question, in a different and 
much structured way than I did in my original message.


the formula you provided —I reduced it slightly, hard coding a constant— 
looks like this:


(if (> @# 4) (format "%.2f" (/ (apply '+ (subseq '(@I$2..@II$2) (- @# 1 
4) (- @# 1))) 4.0)) ""));N


my impression is this programs in the spreadsheet something that should 
be part of the org-table software.


if we let references leading outside the table return 'nil instead of 
raising an error, and represent 'nil by the empty string, then this is 
enough:


(when (> @# 4) (/ (+ @-3$2..$2) 4.0));L%0.2f

my suggestion is to associate 'nil with empty cells "both ways", in the 
sense that a formula returning 'nil causes an empty org-table cell (see 
above), and that the empty cell, through the L filter evaluates to nil 
and not to the empty string.  this for symmetry, and for uniformity with 
reference leading outside the table.


regards,

MF



Re: Wring case when using org-insert-structure-template

2020-07-10 Thread Nick Dokos
Nicolas Goaziou  writes:

>> Second question: I couldn't find any configuration variable or
>> function to change the default behaviour. Is there a way to do so?
>
> You can customize `org-structure-template-alist'. I don't remember if
> that's possible in Org 9.1.9, tho.
>
But you cannot change the case of the begin/end that way, so it would be entered
in mixed case:

#+begin_SRC ...
..
#+end_SRC

(I think - but I have not tested.)
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Superscript and non-blank character

2020-07-10 Thread Bo Grimes

Emacs 26.3, Org-mode 9.1.9, Kubuntu 20.04, 5.4.0-39-generic

Hi,

I've tried my hardest to find an answer in the manuals (print book and 
on-line), this list, Reddit, and Stack Exchange with no luck.  I use 
Emacs for org-mode, and I don't code or know Elisp. I have no use for or 
interest in learning LaTeX.  I never use subscript, and I only use 
superscript in poetry/prose (mostly quotes, not original), and I don't 
foresee (but admit I may) a need to export.


I understand that:

^2H is not recognized as superscript _on purpose_. Per Org syntax, you 
have to add a non-blank character before the caret. Otherwise, there 
would be ambiguity between underline (e.g., _under_) and subscript 
(_under). And superscript syntax follows subscript's. [1]


That makes sense to me as a default [2], given that so many org-mode 
users use both in math, science, and literate coding context, so I 
wouldn't think to suggest it to be changed.  All I want to know is how I 
can change it for *me*.


I would like to org-toggle-pretty-entities in a buffer and see 
superscript before, say, a poetry line or Bible verse I'm quoting in a 
note or journal entry, and not see the non-blank character.


Can this be done via customize or with an Elisp snippet in init.el?

Thanks!

[1] https://lists.gnu.org/archive/html/emacs-orgmode/2014-06/msg01022.html

[2] Though I wish it were made explicit in the manuals 
https://orgmode.org/manual/Subscripts-and-Superscripts.html#Subscripts-and-Superscripts 
(Org Mode 9 Reference Manual p 132). It took me a while to figure out 
why it wasn't working at all.