Re: Confused about source code blocks evaluation when exporting

2022-07-13 Thread Rudolf Adamkovič
"Fraga, Eric"  writes:

> By default, the results of a src block evaluation is the value of the
> src block which is typically the value returned by the last statement.

The value of the last expression, not the last statement.

Rudy
-- 
"Strange as it may sound, the power of mathematics rests on its evasion
of all unnecessary thought and on its wonderful saving of mental
operations."
-- Ernst Mach, 1838-1916

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



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

2022-07-13 Thread No Wayman


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



Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ 
Version 3.24.34, cairo version 1.17.6)

of 2022-06-28
Package: Org mode version 9.6 (9.6-gc66bdb @ 
/home/n/.emacs.d/elpaca/builds/org/)


>From 6bf0e44615d174281452df57260b0ff591539ffb Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer 
Date: Thu, 14 Jul 2022 00:37:26 -0400
Subject: [PATCH] * lisp/ob-core.el: Fix docstring quote usage

(org-babel-default-header-args): escape syntactic single quote in docstring
(org-babel-result-to-file): escape syntactic single quote in docstring
---
 lisp/ob-core.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index f1a98b7d0..ac9af5d24 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -487,7 +487,7 @@ evaluates to a string.
 A closure is evaluated when the source block is being
 evaluated (e.g. during execution or export), with point at the
 source block.  It is not possible to use an arbitrary function
-symbol (e.g. 'some-func), since org uses lexical binding.  To
+symbol (e.g. \\='some-func), since org uses lexical binding.  To
 achieve the same functionality, call the function within a
 closure (e.g. (lambda () (some-func))).
 
@@ -514,7 +514,7 @@ functionality is also supported for default header arguments by
 providing the header argument multiple times in the alist.  For
 example:
 
-'((:var . \"foo=\\\"bar\\\"\")
+\\='((:var . \"foo=\\\"bar\\\"\")
   (:var . \"bar=\\\"foo\\\"\"))")
 
 (put 'org-babel-default-header-args 'safe-local-variable
@@ -2627,7 +2627,7 @@ in the buffer."
 If the `default-directory' is different from the containing
 file's directory then expand relative links.
 
-If the optional TYPE is passed as 'attachment` and the path is a
+If the optional TYPE is passed as \\='attachment and the path is a
 descendant of the DEFAULT-DIRECTORY, the generated link will be
 specified as an an \"attachment:\" style link."
   (when (stringp result)
-- 
2.37.0



Re: index for HTML export

2022-07-13 Thread Ihor Radchenko
"Fraga, Eric"  writes:

> I know (well, I believe as I haven't tried yet) I can /publish/ a
> project and generate an index using the #+index entries in the org
> files.  However, for a single file, is it possible to generate the index
> as part of the export process directly (or even separately from the
> export process)?  I can do this when I export to LaTeX, for instance.

Timothy is working on this feature. See
https://github.com/tecosaur/org-glossary

Best,
Ihor



Re: Alternatives or org-capture?

2022-07-13 Thread Christopher M. Miles

ypuntot  writes:

> Thanks for your template! 
> Maybe it would be nice to have it on the MELPA documentation? 
> I couldn't find other documentation. 
>

org-capture template is just a personal usage scene, people will want to
define their own org-capture template. So no need to add this to documentation.

> I tried to reach you via email, I don't know if it's possible to export :ORG: 
> property to vcard 3.0. I am starting to use
> your maintained package and I would like to use it the best way possible. 
>

If you want to export contacts has only specific property, you might
want to try org mode sparse tree filtering. I'm not sure whether it
works as expected for exporting.

> Best regards! 
>
>  I'm currently maintaining org-contacts (well, inactively) 
>
>  Here is my own org-contacts' org-capture template, maybe you want to check 
> out 
>  as reference: 
>
>  #+begin_src emacs-lisp 
>  (add-to-list 'org-capture-templates 
> `("C" ,(format "%s\tContacts" 
>(all-the-icons-material "contacts" :face 
>  'all-the-icons-blue-alt)) 
>   entry (file (lambda () (car org-contacts-files))) 
>   "* %^{NAME} 
>  :PROPERTIES: 
>  :DIR:  %\\1 
>  :DATE: %^U 
>  :AVATAR: %^{Avatar} 
>  :NICK: %^{Nick} 
>  :NAME(Chinese): %^{Name(Chinese)} 
>  :NAME(English): %^{Name(English)} 
>  :GENDER: %^{Gender|Transgender|Male|Female} 
>  :RELATIONSHIP: %^{Relationship|Internet|Meet|Friend|Good Friend|Boy 
> Friend|Girl 
>  Friend|Workmate|Classmate|Schoolmate} 
>  :FIRST-MEET: %^U  %^{How is the first-time meet? when? where? how?} 
>  :MOBILE: %^{Mobile Phone} 
>  :EMAIL: %^{Email} 
>  :GitHub: %^{GitHub} 
>  :ADDRESS(home): %^{address(home)} 
>  :ADDRESS(live): %^{address(live)} 
>  :LANGUAGES: %^{Languages|Chinese|Chinese, English|English|Japanese|Korean} 
>  :EDUCATION: %^{Education} 
>  :School(university): 
>  :SKILLS: %^{Skills|Programming|Economy} 
>  :Programming-Skills: %^{Programming Skills|Emacs|Web|Computer System|Cloud 
>  Computation} 
>  :Programming-Languages: %^{Programming Languages|LISP|Common 
> Lisp|Clojure|Emacs 
>  Lisp|Java|C/C++|Python|Ruby|PHP} 
>  :OCCUPATION: %^{Occupation|Programmer|Freelancer|Businessman|Servant|Arter} 
>  :HOBBIES: %^{Hobbies|Reading|Music|Movie|Travel} 
>  :END:" 
>   :empty-lines 0 
>   :jump-to-captured t) 
> :append) 
>  #+end_src 
>
>  -- 
>  [ stardiviner ] 


-- 
[ stardiviner ]
   I try to make every word tell the meaning that I want to express.

   Blog: https://stardiviner.github.io/
   IRC(freenode): stardiviner, Matrix: stardiviner
   GPG: F09F650D7D674819892591401B5DF1C95AE89AC3


signature.asc
Description: PGP signature


Re: Alternatives or org-capture?

2022-07-13 Thread ypuntot
Thanks, Tim!
I will try it.


> Recommend you get to know/understand org-capture first and the rest will
> become much clearer.



Re: Confused about source code blocks evaluation when exporting

2022-07-13 Thread Alain . Cochard


Fraga, Eric writes on Wed 13 Jul 2022 10:57:

 > No, you used the word correctly.  My point was that this was your
 > main issue!  Understanding what is the "result" of a src block
 > evaluation is key.

Thank you for the clarification.  I can see that I am still very
confused.

 > > Thank you both, I made progress; but the behavior is still very so
 > > unintuitive to me.  For example, I haven't found a way to have this
 > > block:
 > >
 > > #+begin_src emacs-lisp 
 > >   (message "foo")
 > >   (message "bar")
 > > #+END_SRC
 > 
 > If you want output, maybe use "print" instead of "message".  However,
 > you will get quotes around the strings.  The best alternative would be
 > to have a single elisp statement that returns what you want output:
 > 
 > #+begin_src emacs-lisp :results value
 >   (concat "Foo"
 >   "\n"
 >   "Bar")
 > #+end_src

I can now also see that the issue is coupled to my unfamiliarity with
the lisp language, so below I switch to something hopefully simpler
for me.

 > > Finally I still tend to consider that the sentence "Org evaluates
 > > source code blocks in an Org file during export" is confusing.  But
 > > maybe that's just I who interpret this as "code evaluation is the
 > > default behavior upon export".
 > 
 > I do not quite understand the difference.  Evaluation happens (subject
 > to confirmation).  What may happen with that evaluation, however, might
 > not be what you want by default.  What is it you want on export?  If you
 > want the code and the results, add ":exports both" to the begin_src
 > line.  Straightforward?

Nah, sorry.  Maybe I don't understand what "evaluation" is.

I have the file with only the following block in it:

#+begin_src shell
rm -f foo
#+end_src

I load it with 'emacs -Q -l ~/.emacs.git' 

where '~/.emacs.git' only contains

(add-to-list 'load-path "~/Org/Coch-git/org-mode/lisp")
(org-babel-do-load-languages
 'org-babel-load-languages 
 '((shell . t)))

I do 'C-c C-c' within the block; I am asked "Evaluate this shell code
block on your system?", I say 'yes', and I can see that that the file
'foo', which I had just created, is no longer there.  This makes sense
to me.  "evaluation" here seems to me to be a synonym for "execution".

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...

Regards.  Hope you appreciated your beer.


Org mode version 9.5.4 (release_9.5.4-623-gc66bdb @
/home/cochard/Org/Coch-git/org-mode/lisp/) 

-- 
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-13 Thread Fraga, Eric
(apologies for flurry of emails)

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?

Thank you,
eric

PS -it's a lovely day here in the SE of England so time to enjoy a beer
in the garden!  Talk to you all tomorrow. :-)

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


Re: index for HTML export

2022-07-13 Thread Fraga, Eric
So publishing cannot have the target directory be the same as the source
directory, it would seem?  Having a different directory for
:publishing-directory makes publishing work.  I still do not understand
the error, however.

My original question remains: can we create an index for HTML export
without using publishing?

Thank you,
eric

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


Re: Recent folding issues

2022-07-13 Thread Jack Kamm
Hi Ihor,

> 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).

I'm still having some issues with evil-open-below (vim's "o" key). I
don't have a minimal config for this yet -- it requires the 3rd party
package evil, and I'm not sure if emacs has a built-in equivalent to
evil-open-below. But here's a description of what I observe.

Suppose I have an org file like this:

> * Headline 1
> ** Headline 1a
> ** Headline 1b
> *** Headline 1b1
> 
> Stuff
> 
> * Headline 2

Then I collapse the buffer to look like this:

> * Headline 1...
> * Headline 2

If I put the cursor on Headline 1 and call evil-open-below, I don't
immediately see a new line, and the buffer looks as above, but with the
pointer "inside" the elipses. As soon as I start typing, it will unfold
the last subheading of Headline 1, and the buffer looks like this after
I finished typing:

> * Headline 1
> *** Headline 1b1
>
> Stuff
>
> * New typing here
> * Headline 2

And also I got the message:

> org-fold-check-before-invisible-edit--text-properties: Edit in invisible 
> region aborted, repeat to confirm with text visible

Whereas with org-fold-core-style set to "overlays", I get the old
behavior -- after typing "o" on Headline 1, I see this:

> * Headline 1...
>  
> * Headline 2

With the pointer on the new line, and after typing I see:

> * Headline 1...
> * New typing here 
> * Headline 2



Re: index for HTML export

2022-07-13 Thread Fraga, Eric
... and following up on this, when trying to /publish/ instead of just
export, I am failing miserably.  I created a simple project definition
but every time I try to publish either a specific file or the project, I
get (with file name partly elided):

--8<---cut here---start->8---
Debugger entered--Lisp error: (wrong-type-argument stringp 101)
expand-file-name(101 "/home/ucecesf/...")
  #f(compiled-function (f) #)(101)
  mapcar(#f(compiled-function (f) #) "export.org")
  #f(compiled-function (p) #)(("test" 
:base-directory "/home/ucecesf/..." :publishing-function 
org-html-publish-to-html :publishing-directory "/home/ucecesf/..." :include 
"export.org" :makeindex t))
  cl-some(#f(compiled-function (p) #) (("test" 
:base-directory "/home/ucecesf/..." :publishing-function 
org-html-publish-to-html :publishing-directory "/home/ucecesf/..." :include 
"export.org" :makeindex t)))
  org-publish-get-project-from-filename("/home/ucecesf/...")
  org-publish-file("/home/ucecesf/...")
  org-publish-current-file(nil nil)
  org-export-dispatch(nil)
  funcall-interactively(org-export-dispatch nil)
  command-execute(org-export-dispatch)
--8<---cut here---end--->8---

I will try to create a minimal example and with emacs -Q later but I
have used publishing fine in the past for my website.  The example here
is based on the very simple example in the org info manual.

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


index for HTML export

2022-07-13 Thread Fraga, Eric
Hello all,

I know (well, I believe as I haven't tried yet) I can /publish/ a
project and generate an index using the #+index entries in the org
files.  However, for a single file, is it possible to generate the index
as part of the export process directly (or even separately from the
export process)?  I can do this when I export to LaTeX, for instance.

Thank you,
eric

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


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

2022-07-13 Thread Uwe Brauer
>>> "JJ" == Jeremie Juste  writes:

> Hello Uwe,

>> On Sunday, 22 May 2022 at 08:40, Uwe Brauer wrote:

>> but I can't not find a way to calculate other percentiles, like
>> terciles or so. Does anybody know about this, or a org-function doing
>> it?


> I would recommend checking the R documentation. 

>  #+begin_src R :colnames t :var t1=TC :results output
>   ?quantile
>  #+end_src

>  #+tblname: TC
>  | Data |

>  |--|
>  |5 |
>  |   10 |
>  |   12 |
>  |   15 |
>  |   20 |
>  |   24 |
>  |   27 |
>  |   30 |
>  |   35 |

> Consider also the R mailing list r-h...@r-project.org. The community is
> quite active. 

> I believe that you might be looking for the following.

>  #+begin_src R :colnames t :var t1=TC 
>   quantile(t1$Data,c(1/3,2/3,1))
>  #+end_src

As I said that works nicely, however it turns out that I need to round
the result in a specific way, always round toward positive infinity, 
the matlab command `ceil' for example does this, I can't find anything
similar in the documentation. You recommend to use the R mailing list,
which I will do, but maybe you know it by heart?

Thanks and regards

Uwe 


smime.p7s
Description: S/MIME cryptographic signature


Re: Confused about source code blocks evaluation when exporting

2022-07-13 Thread Fraga, Eric
On Tuesday, 12 Jul 2022 at 23:13, alain.coch...@unistra.fr wrote:
> I guess I didn't use 'incidental' correctly.  I meant it as "not my
> main concern".  Anyway, thank you; I could check that if I switch the
> 2 lines I indeed get '#+RESULTS:' to show foo'.

No, you used the word correctly.  My point was that this was your main
issue!  Understanding what is the "result" of a src block evaluation is
key.

> Thank you both, I made progress; but the behavior is still very so
> unintuitive to me.  For example, I haven't found a way to have this
> block:
>
> #+begin_src emacs-lisp 
>   (message "foo")
>   (message "bar")
> #+END_SRC

If you want output, maybe use "print" instead of "message".  However,
you will get quotes around the strings.  The best alternative would be
to have a single elisp statement that returns what you want output:

#+begin_src emacs-lisp :results value
  (concat "Foo"
  "\n"
  "Bar")
#+end_src

> Finally I still tend to consider that the sentence "Org evaluates
> source code blocks in an Org file during export" is confusing.  But
> maybe that's just I who interpret this as "code evaluation is the
> default behavior upon export".

I do not quite understand the difference.  Evaluation happens (subject
to confirmation).  What may happen with that evaluation, however, might
not be what you want by default.  What is it you want on export?  If you
want the code and the results, add ":exports both" to the begin_src
line.  Straightforward?

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


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

2022-07-13 Thread Juan Manuel Macías
Sorry for the slight offtopic.

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



bug#45915: 28.1; delete-char deletes two letters

2022-07-13 Thread Tak Kunihiro
As Ihor pointed out, delete-char deletes two letters.

Can someone take a look and evaluate if this is issue with delete-char?
I simplified the recipes as shown below.

#+begin_src emacs-lisp
(defun emacs-bug-reproduce-45915 ()
  "Reproduce bug#45915."
  ;; (gnus-read-ephemeral-emacs-bug-group 45915)
  (interactive)
  (with-current-buffer (get-buffer-create "*temp buffer*")
(erase-buffer)
(require 'org)
(orgtbl-mode 1)
(insert (format "emacs-version: %s, org-version: %s\n" emacs-version 
org-version))
(insert "| 1 |"))
  (switch-to-buffer-other-window "*temp buffer*")
  (execute-kbd-macro (kbd "M-< C-n C-f C-f"))
  (message "I will hit .")
  (sit-for 2)
  (execute-kbd-macro (kbd ""))
  (sit-for 2)
  (message "I will hit .")
  (sit-for 2)
  (execute-kbd-macro (kbd ""))
  (message "Two letters were deleted unexpectedly."))
;;; (call-interactively 'emacs-bug-reproduce-45915)
#+end_src





Re: [External] : Re: missing a character / font in agenda?

2022-07-13 Thread Max Nikulin

On 13/07/2022 07:26, Stefan Kangas wrote:

Ihor Radchenko writes:


I think this should be considered a bug, since the glyph used (LEFTWARDS
TRIANGLE-HEADED ARROW / #2b60) is not present in most fonts.


If that is true (I don't know) then maybe we should just use a more
ubiquitous glyph?


Disclaimer: I am not an expert in Unicode.

DejaVuSansMono has at least
- "\u{21fd}" "⇽" LEFTWARDS OPEN-HEADED ARROW 
https://util.unicode.org/UnicodeJsps/character.jsp?a=21fd
- "\u{2190}" "←" LEFTWARDS ARROW 
https://util.unicode.org/UnicodeJsps/character.jsp?a=2190

from https://en.wikipedia.org/wiki/Arrows_(Unicode_block)



Re: [External] : Re: missing a character / font in agenda?

2022-07-13 Thread Juan Manuel Macías
Stefan Kangas writes:

> If that is true (I don't know) then maybe we should just use a more
> ubiquitous glyph?

I have done a quick test with some fonts that are ---I believe--- quite
popular. This character is missing from DejaVu Sans Mono, Iosevka,
Source Pro, Fira Code and Hack. JuliaMono does include it:

https://i.imgur.com/O3urnxa.png

I think LEFTWARDS ARROW / #2190 of the 'arrows' Unicode block is much
more common:

https://i.imgur.com/h0NQXvG.png

Best regards,

Juan Manuel 



Re: [External] : Re: missing a character / font in agenda?

2022-07-13 Thread Greg Minshall
for what it's worth, without the symbola font on my machine (though i've
now added it), i seem to see the left-arrow 2b60 rendered using:

ftcrhb:-GNU-Unifont-normal-normal-normal-Sans-Serif-16-*-*-*-c-80-iso10646-1 
(#x2B61)

(if i'm interpreting the output of [C-u C-x =] correctly.)

cheers, Greg