[ODT?] (was: how to export an org file, to 2 different locations (in to different formats))

2022-05-27 Thread Uwe Brauer

> Hi Uwe,
> Uwe Brauer writes:


> One (pedestrian) way to achieve it, with this function:
I tried the following 

#+begin_example
#+EXPORT_FILE_NAME: myfile-office


#+begin_src emacs-lisp :exports none :eval never-export :results silent
  (my-org/export-to-path 'html "~/Desktop/" "html")
#+end_src


#+begin_src emacs-lisp :exports none :eval never-export :results silent
  (my-org/export-to-path 'latex "./" "tex")
#+end_src


#+begin_src emacs-lisp :exports none :eval never-export :results silent
  (my-org/export-to-path 'odt "./" "odt")
#+end_src

* Excuses


Jim: Which was? Sir Humphrey: 

#+end_example

But then the export to odt, did not work as expected the file was too small, 
but maybe odt is not the right setting for the export to LO/OO.

Uwe 


smime.p7s
Description: S/MIME cryptographic signature


Re: how to export an org file, to 2 different locations (in to different formats)

2022-05-27 Thread Uwe Brauer
>>> "JMM" == Juan Manuel Macías  writes:

> Juan Manuel Macías writes:
>> One (pedestrian) way to achieve it, with this function:

> I think it can be done better this way, defining an advice around
> 'org-export-output-file-name'.

> In your org file you should add these two local variables:

> # my-latex-export-path: "~/path/to/myfile.tex"
> # my-html-export-path "~/path/to/myfile.html"

> And this is the define-advice code. It should export to one or another 
> path/file every
> time you export your document to LaTeX or html. I haven't tried it much:


Thanks, that looks even more convenient!
I tried to test it with 

#+begin_example
# my-latex-export-path: "./myfile2.tex"
# my-html-export-path "~/Desktop/myfile2.html"

,#+begin_src emacs-lisp :exports none :eval never-export :results silent
  (my-org/export-to-path 'html "~/Desktop/" "html")
,#+end_src


,#+begin_src emacs-lisp :exports none :eval never-export :results silent
  (my-org/export-to-path 'latex "./" "tex")
,#+end_src

,* Excuses


Jim: Which was? Sir Humphrey: 

#+end_example

When I run it I obtain 
if: Symbol’s value as variable is void: my-latex-export-path

Another point is if I decide to export it to ods, I need to modify that
advice, but I agree the new function is more convenient.

Uwe 


smime.p7s
Description: S/MIME cryptographic signature


Re: how to export an org file, to 2 different locations (in to different formats)

2022-05-27 Thread Uwe Brauer

> Hi Uwe,
> Uwe Brauer writes:


> One (pedestrian) way to achieve it, with this function:

> (defun my-org/export-to-path (backend export-path extension)
>   (org-element-map (org-element-parse-buffer) 'keyword
> (lambda (k)
>   (when (string= (org-element-property :key k) "EXPORT_FILE_NAME")
>   (let ((value (org-element-property :value k)))
> (org-export-to-file backend
> (format
>  "%s%s.%s"
>  export-path
>  value extension)))

> And then you could evaluate it inside a block in your document, with the
> chosen arguments. For example:

> #+EXPORT_FILE_NAME: myfile

> #+begin_src emacs-lisp :exports none :eval never-export :results silent
>   (my-org/export-to-path 'html "~/Desktop/" "html")
> #+end_src

Very nice I run a test with 

#+begin_src emacs-lisp :exports none :eval never-export :results silent
  (my-org/export-to-path 'html "~/Desktop/" "html")
#+end_src



#+begin_src emacs-lisp :exports none :eval never-export :results silent
  (my-org/export-to-path 'latex "./" "tex")
#+end_src

And it works nicely, thanks a lot, simplifies my workflow quite a bit.


Uwe 


smime.p7s
Description: S/MIME cryptographic signature


Org mode together with bug-reference-mode

2022-05-27 Thread Paul Kaletta
Hi,

I'm using GNU Emacs 27.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 
3.24.30, cairo version 1.17.4) of 2021-08-07.

This Emacs comes with Org mode version 9.4.4 (release_9.4.4 @ 
/usr/share/emacs/27.2/list/org).

I want to use Emacs bug-reference-mode together in my Org mode
setup.  Here's an example file:


# Local Variables:
# eval: (bug-reference-mode)
# bug-reference-bug-regexp: 
"\\(\\(?:\\(?:SUPPORT\\|support\\)-\\)\\([0-9]+\\)\\)"
# bug-reference-url-format: https://www.example.com/SUPPORT-%s
# End:

* Some stuff
SUPPORT-12348 support-56779

support-12346


Outside of Org mode bug-reference-mode works as I would expect,
but as a minor mode of org-mode it behaves weirdly.  Most
importantly "C-c RET" aka bug-reference-push-button doesn't work
at all.  Besides not all occurrences of "SUPPORT-\d+" are
highlighted automatically.  This changes as soon as one modifies
any character.

This seems to be some interference between bug-reference-mode and
Org mode, or maybe even a bug in Emacs itself.

Best,
Paul



Re: Eev-wconfig.el etc etc, or: "Exercise: Learn Org!"

2022-05-27 Thread Ihor Radchenko
Eduardo Ochs  writes:

> On Fri, 27 May 2022 at 11:30, Ihor Radchenko  wrote:
>> You are discussing too many things at once in one video.
>
> Yes - that's why I made an index for the video:
>
>   (find-1stclassvideoindex "2022eevwconfig")
>   http://angg.twu.net/.emacs.videos.html#2022eevwconfig

Honestly, I cannot navigate that index even after watching the whole
video. Before watching, it had no sense whatsoever.

In short, the video is too hard to understand. The available index does
not help.

Imagine that you don't watch the video and look at the below items:

;; (find-2022eevwconfigvideo   "15:50"   "6.1, 6.2, 6.3, 6.4")
;; (find-2022eevwconfigvideo   "16:03"   "these steps can be replaced")
;; (find-2022eevwconfigvideo   "16:12"   "by these two sexps here")
;; (find-2022eevwconfigvideo   "16:15"   "(require 'eev-wconfig)")
;; (find-2022eevwconfigvideo   "16:23"   "(find-wconfig-links)")
;; (find-2022eevwconfigvideo   "16:37"   "use this to configure eev")
;; (find-2022eevwconfigvideo   "16:40"   "on Windows \"without magic\"")
;; (find-2022eevwconfigvideo   "16:52"   "wconfig means \"Windows config\"")
;; (find-2022eevwconfigvideo   "17:02"   "this is the \"main wconfig\"")
;; (find-2022eevwconfigvideo   "17:15"   "five sub-wconfigs")

What is 6.1..6.4??

"these steps can be replaces" has no context

"by these two sexp here" does not make any sense as a standalone TOC
Item.

"on Windows \"without magic\"" is referring to the term you introduce in
the video itself and does not make sense without watching. (Honestly,
after watching, "without magic" feel like there was a lot of magic going
on).

etc...

>> What is the main point you want to explain in the video? How to
>> download, watch, and annotate a series of videos? If so, you only talk
>> about it in the last minutes of the presentation.
>
> The video has many "main points".

Then, it is not a good idea. Videos/books with many main points not
connected by an easy-to-follow general logic are hard to understand.
They are just a "thought salad".

Note that it would not be a so much of a problem if you recorded this
video as future reference to yourself. But it is unacceptable for
general audience. Public presentations often follow more or less fixed
structure:

(credit: Prof. Evan Ma)
1. what is significant? (aka background)
2. what is the trouble? (why what you tell is important)
3. what is your approach? (explaining the new thing you want to introduce)
4. does it work well? (e.g. real-life demo)
5. can it be employed in other systems? (how other people with different 
systems can use it)

>> Also, do you expect people new to emacs understand all the
>> (commmand args) staff?
>
> Yes, in my view of "what is Emacs" the first thing that people need to
> learn is eval-last-sexp and its more convenient variants. See the page
> 10 of my slides for the EmacsConf2019:
>
>   http://angg.twu.net/LATEX/2019emacsconf.pdf#page=10

Then, your target audience should be the people who are already a bit
familiar to Elisp and you need to state it at the beginning of the
video. Explaining how setq works is not enough to make complete
beginners understand sexps. You should either stop at the beginning and
introduce _all_ the required Elisp concepts or ask people to read Elisp
manual first.

>> I still fail to understand what is the advantage of eev compared to Org
>> or Hyperbole (which also provides context-free actionable links).
>
> Here are my current hypotheses: 1) my brain is wired in an atypical
> way; 2) about 95% of the people find Org "easy" and "fun", and eev
> makes no sense to them - and about 5% of the people find Org very
> hard, and they find eev much "easier" and "more fun" than Org.

This is Org mailing list. I doubt that people here do not find Org
"fun". Yet, you asked feedback to the video. So, I assumed that you
cover us as target audience as well. If not, my feedback may not be too
useful for you. Though I'd say that your presentation is hard to
understand even from general perspective of giving public presentations
(according to my teaching and conference experience).

>> I still fail to understand what is the advantage of eev compared to Org
>> or Hyperbole (which also provides context-free actionable links).

> I explained this in the eev-wconfig video, starting from 33:27:
>
> and sort of summarizes it. Let me copy here the subtitles of that part
> of the eev-wconfig video:
>
>   So: in this video I explained why I have
>   always found Org so hard to learn...
>   and the thing is that many things in Org
>   are implemented in ways that i
>   don't understand,
>   and practically every time that I try to
>   learn more more features of org
>   I get stuck, because I start to ask
>   questions like:
>   hey, how is this implemented?
>   And I get stuck trying to trying to
>   answer these questions, that are not
>   typical user questions...

I still do not see where is the _advantage_ of eev. Is it easier to
understand compared to Org? In w

Re: Proposal: 'executable' org-capture-templaes

2022-05-27 Thread Ihor Radchenko
Arthur Miller  writes:

> Simplicity comes from the org-templates. Me, and I guess other people are
> familiar with org-catpure templates already, and I mean, can it be simpler to
> create a menu of choices then a simple list:
>
> '(("key1" "label1" exec (lambda () ...))
>   ("key2" "label2" exec (labmda () ...))
>...
>)
>
> People are already writing those as part of org-capture, so there is a
> familiarity factor. Transient has to be learned, and the complexity is much
> bigger.

>>   If anything, capture
>> menu might be factored out to a generic menu framework.
>
> Please no. Not every single piece of Emacs has to be a generalized
> framework. Generalized frameworks add an extra layer of complexity, and it 
> this
> case, as you point out, we have other frameworks, so yet another framework is
> *definitely* not what I ask for.

By "generic" I did not mean general-purpose all-functional framework.
We just need something to remove code duplication in
org-export-dispatch, org-agenda, org-capture, org-set-tags-command, etc
They all share pretty similar code to generate dialogues.

As for familiarity, I understand and it is exactly the reason why I
suggested to factor out the menu code from capture templates.

I am strongly not in favor of adding exec to org-capture itself. It's
a bit like if you were to add :activate-func for a link that actually
downloads some file from internet, then generates and exports agenda,
and meanwhile also restarts your remote server. This will also kind of
save the code, but completely out of purpose of :activate-func. Of
course, I am exaggerating here, but just want to make my point clear.

>> We actually had multiple threads discussing possibility to port all the
>> Org dialogues to transient.
>
> I have unfortunately missed those discussions. But as said, I am not in to 
> argue
> for or against transient at all. I would just like to re-use the org-capture
> code, since it is already in-place.

The last one was
https://orgmode.org/list/8c364693bf6856e60cdd3e8b63ab0c9284d16733.ca...@heagren.com
And we had multiple complaints that Org menus are not searchable and do
not allow recursive edit.

>> It seems to be quite out of scope of org-capture.
>
> Maybe, but than what is in scope of org-mode or org-capture or Emacs? We are
> constantly bending code to do what it is not really meant to do. Since to be a
> DNA of Emacs :).

Sure. But another feature of Emacs is being consistent. Emacs does
provide flexible interfaces, but they stick to they purpose. Abusing
them is up to the user (with no guarantees to work in future versions),
but not up to Emacs itself.

If we were to include your suggestion, we would also need to maintain
the new generalized functionality in future. Even if we need to change
some internals of org-capture. Over-generalization will put an extra
burden on future maintenance.

Best,
Ihor




Re: [PATCH] Re: Change in `org-cycle-hook' breaks behavior

2022-05-27 Thread Ihor Radchenko
Tor Kringeland  writes:

>> A more efficient way could be introducing a new customization similar to
>> org-cycle-hide-block-startup. Say, it can be
>> org-cycle-hide-drawer-startup. See the attached patch.
>
>  I can always hide the
> drawers by adding `org-cycle-hide-drawers' to `org-cycle-hook' when I
> call my custom function, but I cannot replicate the behavior of
> `org-cycle' without `org-cycle-hide-drawers' in the hook, which would
> uncoditionally open all the drawers (AFAIK).)

Sure. Now, you need to call a different function to open all the drawers
unconditionally. That function is:

(let* ((headline (save-excursion (org-back-to-heading) (org-element-at-point)))
   (section (org-element-lineage
 (org-element-at-point
  (org-element-property :contents-begin headline))
 '(section
  (when section
(org-fold-region
 (org-element-property :begin section)
 (org-element-property :end section)
 nil 'drawer)))

Though we might also modify org-fold-show-entry to allow what you wish.
I am not sure here.

Best,
Ihor



Re: [BUG] 67275f4 broke evil-search Re: [PATCH 10/35] Implement link folding

2022-05-27 Thread Ihor Radchenko
Tom Gillespie  writes:

> I think we might want to update the documentation to mention
> issue with evil for now

We can, but it will only be required if evil devs don't fix the issue in
a reasonable time frame.

Best,
Ihor



Re: [BUG] 67275f4 broke evil-search Re: [PATCH 10/35] Implement link folding

2022-05-27 Thread Ihor Radchenko
Tom Gillespie  writes:

>> Note that if evil were to comply with the canonical isearch
>> implementation and respect isearch-mode-end-hook, there would be no
>> issue.
>
> I think we might want to update the documentation to mention
> issue with evil for now, and alert the evil devs about this change.
> Then we can approach them about implementing support for
> searching inside invisible regions marked via text properties
> since that is essentially a new feature that is being added to
> org for 9.6, though one that will be on by default. 

Feel free to open an issue in evil repo. I do not use evil, so I will
not be able to test any fixes there.

> The evil-search
> module doesn't seem to support _any_ of the isearch hooks needed
> but while looking into this I think I know generally where it might be
> possible to add them.

Not exactly. Evil does support `isearch-filter-predicate', but not
`isearch-mode-end-hook' and `isearch-mode-hook'.

Basically, Org needs evil to support settings listed in
`org-fold-core--isearch-setup'.

Best,
Ihor



Re: [tip] org-publish to work with (very) large books

2022-05-27 Thread Ihor Radchenko
Juan Manuel Macías  writes:

> Ihor Radchenko writes:
>
>> I am not sure if I understand correctly. Do you mean that you only
>> preview the book parts you are currently working on via latexmk -pvc?
>> What kind of more control are you referring to?
>
> The -pvc flag means that if latexmk detects any modification to any
> document involved in the current job (a subdocument, the .sty file, a
> .bib file, or whatever), it reruns the appropriate builds to bring the
> pdf up to date, and it only stops when everything is up to date. I can
> focus that action on parts of the book by commenting or uncommenting
> elements in the master file.

> Anyway, as they say that a picture is worth a thousand words, I have
> made this short example video. This is a dictionary I produced a year
> ago. Each dictionary entry has its own separate bibliographic list, so I
> had to manage more than 100 separate bib files. I have all these files
> inside an Org document, and I create them using org-babel-tangle. The
> video shows editing a field in a bib file. I've removed the build time
> from the video, as the entire book is almost a thousand pages long.
>
> https://cloud.disroot.org/s/PiSaHqWZr25GfJY

Thanks for the clarification! So, you are previewing the whole book with
some \input statements commented out. It is an ok approach, unless you
need cross-references between chapters.

A more advanced approach would be using
\include + \includeonly instead of \input:

https://web.archive.org/web/20160627050806/http://www.howtotex.com/tips-tricks/faster-latex-part-i-compile-only-parts/

Also, FYI:

https://web.archive.org/web/20160712215709/http://www.howtotex.com:80/tips-tricks/faster-latex-part-iv-use-a-precompiled-preamble/

> The moment one breaks down a large piece of work into specialized parts,
> one gains more control over that piece of work. And org-publish helps
> manage all of that. It is about managing a large book as a website (via
> org-publish). In short, the combination of org-publish, projectile and
> latexmk is quite productive for me in this type of work.

This is a bit confusing. You still keep the book in a single giant Org
file. It indeed does not mean anything given that we can always narrow
to subtree, but I fail to see where you break the book into specialized
parts then (LaTeX performance trickery aside).

Best,
Ihor



Re: [BUG] 67275f4 broke evil-search Re: [PATCH 10/35] Implement link folding

2022-05-27 Thread Tom Gillespie
The workaround from the other thread to
(setq org-fold-core-style 'overlays) is perfect.

> The whole point of the patch is _not_ using overlays. For performance
> reasons.

Yep,  the workaround is sufficient for now, and the note on
performance for large files in the docstring makes it clear
what the tradeoffs are, and why we want the text properties
to be the default. Not need to "restore" the old behavior since
it is just a setq away.

> Note that if evil were to comply with the canonical isearch
> implementation and respect isearch-mode-end-hook, there would be no
> issue.

I think we might want to update the documentation to mention
issue with evil for now, and alert the evil devs about this change.
Then we can approach them about implementing support for
searching inside invisible regions marked via text properties
since that is essentially a new feature that is being added to
org for 9.6, though one that will be on by default. The evil-search
module doesn't seem to support _any_ of the isearch hooks needed
but while looking into this I think I know generally where it might be
possible to add them.

Thanks!
Tom



Re: [PATCH] Re: No mathematics in Texinfo exports

2022-05-27 Thread Ihor Radchenko
Rudolf Adamkovič  writes:

> Ihor Radchenko  writes:
>
>> Do not wait one month. Just 5 working days. Then, do not hesitate to
>> follow up.
>
> And ... done!  So, what happens next?

We are back to the previous comments on the patch itself. You need to
address the problem with older versions of texinfo. What will happen if
one tries to open a document generated with your patch using old texinfo
version? Will it render correctly?

Best,
Ihor



Re: [BUG] 67275f4 broke evil-search Re: [PATCH 10/35] Implement link folding

2022-05-27 Thread Ihor Radchenko
Tom Gillespie  writes:

> Might restoring the invisible overlay text property restore
> the old behavior? Is there a reason it was removed?

The whole point of the patch is _not_ using overlays. For performance
reasons.

You can, however, switch to the old behavior by setting
org-fold-core-style to 'overlays. At the cost of some new features being
disabled.

Note that if evil were to comply with the canonical isearch
implementation and respect isearch-mode-end-hook, there would be no
issue.

Best,
Ihor



Re: [PATCH] org-refile.el: show refile targets with doc. title

2022-05-27 Thread Ihor Radchenko
Mikhail Skorzhinskii  writes:

> Thank you for reviewing the changes. Sorry for the sloppy patch, I've
> retested everything and added a few additional fixes, there were more
> problems.

Thanks! And sorry for the slow review. Your email was lost near the tail
of the todo list.

> I've added a couple of test cases too. (BTW, test framework is awesome
> and really easy to use!)

Great!

> * lisp/org-refile.el (org-refile-use-outline-path): add an option 'title
> * lisp/org-refile.el (org-refile-get-targets): start refile target
> outline with document title (#+title) instead of file name

Note that changes like this should be detailed in etc/ORG-NEWS

> -   (const :tag "Start with buffer name" buffer-name)))
> +   (const :tag "Start with buffer name" buffer-name)
> +   (const :tag "Start with document title" title)))

You also need to document the new option in the docstring.
  
> +  ;; When `org-refile-use-outline-path' is `title' and document do not
> +  ;; have an extracted document title, return just the file name
> +  (should
> +   (org-test-with-temp-text-in-file "* H1"
> + (let* ((filename (buffer-file-name))
> +(org-refile-use-outline-path 'title)
> +(org-refile-targets `(((,filename) :level . 1
> +   (member (file-name-nondirectory filename)
> +   (mapcar #'car (org-refile-get-targets)))

It would also make sense to add a test when document is a temporary
buffer without filename and also does not contain a title.

Finally, your patch is exceeding 15LOC. You need to do copyright
paperwork to get the patch merged. See
https://orgmode.org/worg/org-contribute.html#copyright

Best,
Ihor



Re: org-persist-gc and tramp

2022-05-27 Thread Tom Gillespie
> Off topic: Did you report the issue to evil devs?

Not yet. Needed to understand what is going on.

> alternative workaround could be setting org-fold-core-style to
> 'overlays.

Yes! This fixes the issue, and is consistent with my observations
in the other thread (I will respond with more there).



Re: [BUG] markdown blocks remain visible when they should be folded

2022-05-27 Thread Tom Gillespie
Confirming fixed. Many thanks!
Tom



Re: [BUG] Setting compile command causes fontification error [9.5 (release_9.5-661-g5e0afb @ /home/quintus/.emacs.d/org-mode/lisp/)]

2022-05-27 Thread Ihor Radchenko
"Christopher M. Miles"  writes:

> From the backtrace, seems (buffer-file-name) returned nil, I guess you
> first created a new buffer and have not saved it to file. That caused it
> return nil. Not Org Mode problem. Not saving file is a common problem in
> young programmer as I experienced. No offence.

To clarify, the problem is in the user-defined hook:

(add-hook 'latex-mode-hook (lambda()
 (set (make-local-variable 'compile-command)
  (concat "lualatex " (shell-quote-argument 
(buffer-file-name))

The hook does not work when (buffer-file-name) returns nil, which is
exactly what happens when Org mode tries to fontify the source block.
Org does it inside a temporary buffer not associated with any real file.

One way to fix the problem would be

(add-hook 'latex-mode-hook (lambda()
 (when (buffer-file-name)
 (set (make-local-variable 'compile-command)
  (concat "lualatex " (shell-quote-argument 
(buffer-file-name)))

Best,
Ihor




Re: [BUG] 67275f4 broke evil-search Re: [PATCH 10/35] Implement link folding

2022-05-27 Thread Tom Gillespie
> It appears to respect isearch-filter-predicate, but not
> isearch-mode-end-hook.

This is true only when isearch is used as the module via
(evil-select-search-module 'evil-search-module 'isearch),
and indeed, when using evil search in that way headings
no longer refold. When using evil-search, things won't
even unfold.

I think that I have tracked the issue down to
evil-ex-find-next in a call to isearch-range-invisible
which returns nil for commits < 67275f4, and t for >=.
When isearch-range-invisible returns nil the invisible
overlay is made visible, when it returns t it stays closed.

Might restoring the invisible overlay text property restore
the old behavior? Is there a reason it was removed?

Best,
Tom



Re: [BUG] Setting compile command causes fontification error [9.5 (release_9.5-661-g5e0afb @ /home/quintus/.emacs.d/org-mode/lisp/)]

2022-05-27 Thread Christopher M. Miles

From the backtrace, seems (buffer-file-name) returned nil, I guess you
first created a new buffer and have not saved it to file. That caused it
return nil. Not Org Mode problem. Not saving file is a common problem in
young programmer as I experienced. No offence.

Marvin Gülker  writes:

> Remember to cover the basics, that is, what you expected to happen and
> what in fact did happen.  You don't know how to make a good report?  See
>
>  https://orgmode.org/manual/Feedback.html#Feedback
>
> Your bug report will be posted to the Org mailing list.
> 
>
> Dear all,
>
> trying to access a file with the content shown further below results in
> this message:
>
> Org mode fontification error in # at 31
>
> Trying to export said file to HTML yields this backtrace:
>
> Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
>   substring(nil 0 0)
>   replace-regexp-in-string("[^-0-9a-zA-Z_./\n]" "\\&" nil)
>   shell-quote-argument(nil)
>   (concat "lualatex " (shell-quote-argument (buffer-file-name)))
>   (set (make-local-variable 'compile-command) (concat "lualatex " 
> (shell-quote-argument (buffer-file-name
>   (lambda nil (set (make-local-variable 'compile-command) (concat 
> "lualatex " (shell-quote-argument (buffer-file-name)()
>   run-hooks(change-major-mode-after-body-hook text-mode-hook 
> tex-mode-hook latex-mode-hook)
>   apply(run-hooks (change-major-mode-after-body-hook text-mode-hook 
> tex-mode-hook latex-mode-hook))
>   run-mode-hooks(latex-mode-hook)
>   latex-mode()
>   funcall(latex-mode)
>   (progn (funcall lang-mode) (insert code) (org-font-lock-ensure) 
> (save-excursion (let ((beg (point-min)) (end (point-max))) (goto-char beg) 
> (while (progn (end-of-line) (< (point) end)) (put-text-property (point) (1+ 
> (point)) 'face nil) (forward-char 1 (org-src-mode) (set-buffer-modified-p 
> nil) (let ((org-html-htmlize-output-type output-type) 
> (org-html-htmlize-font-prefix font-prefix)) 
> (org-html-htmlize-region-for-paste (point-min) (point-max
>   (unwind-protect (progn (funcall lang-mode) (insert code) 
> (org-font-lock-ensure) (save-excursion (let ((beg (point-min)) (end 
> (point-max))) (goto-char beg) (while (progn (end-of-line) (< (point) end)) 
> (put-text-property (point) (1+ (point)) 'face nil) (forward-char 1 
> (org-src-mode) (set-buffer-modified-p nil) (let 
> ((org-html-htmlize-output-type output-type) (org-html-htmlize-font-prefix 
> font-prefix)) (org-html-htmlize-region-for-paste (point-min) (point-max 
> (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
>   (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn 
> (funcall lang-mode) (insert code) (org-font-lock-ensure) (save-excursion (let 
> ((beg (point-min)) (end (point-max))) (goto-char beg) (while (progn 
> (end-of-line) (< ... end)) (put-text-property (point) (1+ ...) 'face nil) 
> (forward-char 1 (org-src-mode) (set-buffer-modified-p nil) (let 
> ((org-html-htmlize-output-type output-type) (org-html-htmlize-font-prefix 
> font-prefix)) (org-html-htmlize-region-for-paste (point-min) (point-max 
> (and (buffer-name temp-buffer) (kill-buffer temp-buffer
>   (let ((temp-buffer (generate-new-buffer " *temp*"))) 
> (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (funcall 
> lang-mode) (insert code) (org-font-lock-ensure) (save-excursion (let ((beg 
> ...) (end ...)) (goto-char beg) (while (progn ... ...) (put-text-property ... 
> ... ... nil) (forward-char 1 (org-src-mode) (set-buffer-modified-p nil) 
> (let ((org-html-htmlize-output-type output-type) 
> (org-html-htmlize-font-prefix font-prefix)) 
> (org-html-htmlize-region-for-paste (point-min) (point-max (and 
> (buffer-name temp-buffer) (kill-buffer temp-buffer)
>   (let ((output-type org-html-htmlize-output-type) (font-prefix 
> org-html-htmlize-font-prefix) (inhibit-read-only t)) (let ((temp-buffer 
> (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer 
> temp-buffer) (unwind-protect (progn (funcall lang-mode) (insert code) 
> (org-font-lock-ensure) (save-excursion (let (... ...) (goto-char beg) (while 
> ... ... ...))) (org-src-mode) (set-buffer-modified-p nil) (let 
> ((org-html-htmlize-output-type output-type) (org-html-htmlize-font-prefix 
> font-prefix)) (org-html-htmlize-region-for-paste (point-min) (point-max 
> (and (buffer-name temp-buffer) (kill-buffer temp-buffer))
>   (setq code (let ((output-type org-html-htmlize-output-type) 
> (font-prefix org-html-htmlize-font-prefix) (inhibit-read-only t)) (let 
> ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer 
> (set-buffer temp-buffer) (unwind-protect (progn (funcall lang-mode) (insert 
> code) (org-font-lock-ensure) (save-excursion (let ... ... ...)) 
> (org-src-mode) (set-buffer-modified-p nil) (let (... ...) 
> (org-htm

Re: [BUG] markdown blocks remain visible when they should be folded

2022-05-27 Thread Ihor Radchenko
Tom Gillespie  writes:

> The markdown blocks remain visible and have the invisible
> text property set to nil, when folded #+end_src will turn into
> ... but the markdown remains visible. The whole block will
> be left open if any of the markdown list or heading chars are
> present in the block.
> ...
> * c
> #+begin_src markdown
> # hello
> #+end_src

Fixed on main via 66528468a.

Best,
Ihor



[BUG] markdown blocks remain visible when they should be folded

2022-05-27 Thread Tom Gillespie
One of the commits between
ffdc508429c58716272743c0e0650bb721fd906a (good) and
67275f4664ce00b5263c75398d78816e7dc2ffa6 (bad)
a change was introduced that broke folding for markdown
blocks. I'm not sure of the exact commit because folding
is completely broken for all the commits in between.

Looking at the diff between the two there are so many
changes involving the invisible text property that I have no
idea which one is the culprit.

The markdown blocks remain visible and have the invisible
text property set to nil, when folded #+end_src will turn into
... but the markdown remains visible. The whole block will
be left open if any of the markdown list or heading chars are
present in the block.

Here are some examples that trigger the issue:

* a
#+begin_src markdown
1.
#+end_src
* b
#+begin_src markdown
-
#+end_src
* c
#+begin_src markdown
# hello
#+end_src



Re: how to export an org file, to 2 different locations (in to different formats)

2022-05-27 Thread Juan Manuel Macías
Juan Manuel Macías writes:

> One (pedestrian) way to achieve it, with this function:

I think it can be done better this way, defining an advice around
'org-export-output-file-name'.

In your org file you should add these two local variables:

# my-latex-export-path: "~/path/to/myfile.tex"
# my-html-export-path "~/path/to/myfile.html"

And this is the define-advice code. It should export to one or another 
path/file every
time you export your document to LaTeX or html. I haven't tried it much:

(define-advice org-export-output-file-name (:around (old-func extension &rest 
args))
  (setq old-func (lambda (extension &optional subtreep pub-dir)
   (let* ((visited-file (buffer-file-name (buffer-base-buffer)))
  (base-name
   (concat
(file-name-sans-extension
 (or
  ;; Check EXPORT_FILE_NAME subtree property.
  (and subtreep (org-entry-get nil 
"EXPORT_FILE_NAME" 'selective))
  ;; Check #+EXPORT_FILE_NAME keyword.
  (org-with-point-at (point-min)
(catch :found
  (let ((case-fold-search t))
(while (re-search-forward
"^[ \t]*#\\+EXPORT_FILE_NAME:[ 
\t]+\\S-" nil t)
  (let ((element (org-element-at-point)))
(when (eq 'keyword (org-element-type 
element))
  (throw :found
 (org-element-property :value 
element
  ;; Extract from buffer's associated file, if any.
  (and visited-file
   (file-name-nondirectory
;; For a .gpg visited file, remove the .gpg 
extension:
(replace-regexp-in-string "\\.gpg\\'" "" 
visited-file)))
  ;; Can't determine file name on our own: ask user.
  (read-file-name
   "Output file: " pub-dir nil nil nil
   (lambda (n) (string= extension 
(file-name-extension n t))
extension))
  (output-file
   ;; Build file name.  Enforce EXTENSION over whatever 
user
   ;; may have come up with.  PUB-DIR, if defined, 
always has
   ;; precedence over any provided path.
   (cond
(pub-dir (concat (file-name-as-directory pub-dir)
 (file-name-nondirectory 
base-name)))
((file-name-absolute-p base-name) base-name)
(t base-name
 ;; If writing to OUTPUT-FILE would overwrite original 
file, append
 ;; EXTENSION another time to final name.
 (if (and visited-file (file-equal-p visited-file 
output-file))
 (concat output-file extension)
   output-file
  (if (and my-latex-export-path my-html-export-path)
  (cond ((equal extension ".tex")
 my-latex-export-path)
((equal extension ".html")
 my-html-export-path))
(apply old-func args)))

Best regards,

Juan Manuel 



Re: org-persist-gc and tramp

2022-05-27 Thread Ihor Radchenko
Tom Gillespie  writes:

> I was running a version from back in december due to the evil
> search issues I was having.

Off topic: Did you report the issue to evil devs? Note that an
alternative workaround could be setting org-fold-core-style to
'overlays.

Best,
Ihor



Re: org-persist-gc and tramp

2022-05-27 Thread Tom Gillespie
> Can you confirm that you are using the latest version of Org?

I was running a version from back in december due to the evil
search issues I was having. Updating to the latest version
resolves indeed resolves the org-persist issue.

Thanks!
Tom



Re: Eev-wconfig.el etc etc, or: "Exercise: Learn Org!"

2022-05-27 Thread Eduardo Ochs
Hi Ihor!
Thanks for your questions!

On Fri, 27 May 2022 at 11:30, Ihor Radchenko  wrote:
> You are discussing too many things at once in one video.

Yes - that's why I made an index for the video:

  (find-1stclassvideoindex "2022eevwconfig")
  http://angg.twu.net/.emacs.videos.html#2022eevwconfig

> What is the main point you want to explain in the video? How to
> download, watch, and annotate a series of videos? If so, you only talk
> about it in the last minutes of the presentation.

The video has many "main points".

> Also, do you expect people new to emacs understand all the
> (commmand args) staff?

Yes, in my view of "what is Emacs" the first thing that people need to
learn is eval-last-sexp and its more convenient variants. See the page
10 of my slides for the EmacsConf2019:

  http://angg.twu.net/LATEX/2019emacsconf.pdf#page=10

> I still fail to understand what is the advantage of eev compared to Org
> or Hyperbole (which also provides context-free actionable links).

Here are my current hypotheses: 1) my brain is wired in an atypical
way; 2) about 95% of the people find Org "easy" and "fun", and eev
makes no sense to them - and about 5% of the people find Org very
hard, and they find eev much "easier" and "more fun" than Org.

I explained this in the eev-wconfig video, starting from 33:27:

  (find-2022eevwconfigvideo "33:27")
  http://www.youtube.com/watch?v=Rm29XSdGCXw#t=33m27s

That part mentions this other video,

  Title: Org for Non-Users (2021)
  MP4:   http://angg.twu.net/eev-videos/2021-org-for-non-users.mp4
  YT:http://www.youtube.com/watch?v=Eh5Wz9Vh_XM
  Page:  http://angg.twu.net/2021-org-for-non-users.html
  Comment: On why Org and eev follow opposite principles.
  Date:2021dec11
  Length:  10:08
  Index:   http://angg.twu.net/.emacs.videos.html#2021orgfornonusers
   (find-1stclassvideoindex "2021orgfornonusers")

and sort of summarizes it. Let me copy here the subtitles of that part
of the eev-wconfig video:

  So: in this video I explained why I have
  always found Org so hard to learn...
  and the thing is that many things in Org
  are implemented in ways that i
  don't understand,
  and practically every time that I try to
  learn more more features of org
  I get stuck, because I start to ask
  questions like:
  hey, how is this implemented?
  And I get stuck trying to trying to
  answer these questions, that are not
  typical user questions...
  and
  I get stuck on that instead of
  simply learning how to use the features
  of Org as a user.
  So: I find
  Org confusing because my brain is wired
  in a weird way...
  and, in the language of black boxes what
  happens
  is that when I try to learn Org...
  I try to learn a new feature, I see lots
  of black boxes,
  I try to open these black boxes, and I
  fail miserably... and I get frustrated and
  exhausted I, do not learn the feature and
  I postpone learning the feature
  to another day, and in the other day I try
  it again, I see other black boxes, I try
  to understand them again, and blah blah,
  rinse and repeat...
  and I also have exactly the same
  relationship with M-x customized, that
  the standard way in Emacs to configure
  certain things
  and to customize certain things.
  Let me show how customize works
  We can either type M-x customize or
  run this sexp here, that
  simulates what happens when we type
  M-x customize.
  Customize creates a temporary buffer
  like this one...
  it has this mysterious field here, it
  has parts that are not editable - for
  example, if I type a letter here - oops
  if I type a letter here
  it says "you can't edit this part of the
  Custom buffer"... it has buttons,
  it has different fonts, different colors,
  it has links, and so on...
  and if I follow these links in
  the right way I
  can get to places like this one
  which is a
  sub menu with sub options,
  I can
  get to a place like
  this one
  that
  offers many
  things
  that can be configured, each one with an
  explanation...
  I can execute things like this one, that
  opens this page, in which I can customize
  a
  variable...
  and things like this in which I can
  customize a face to change its color, to
  change its font... and so on -
  and for me all these things - all these
  buttons, this rectangle here, in which I
  can
  put text
  all these things are...
  magic - and they are black boxes that I
  find very hard to open.
  And over the years I have experimented
  with several alternatives to
  customize that "use less magic"...
  I've documented some of my attempts in
  this page here,
  and
  this thing that I'm presenting now -
  eev-wconfig.el - this is
  the next step: it uses all the ideas in
  this page,
  and a few other new ideas.


> I recommend recording a much shorted video demonstrating a singe task
> you perform using eev. No need to side track explaining Elisp syntax. No
> need to show troubleshooting. No need to show things users "are not
> supposed to understan

Re: org-persist-gc and tramp

2022-05-27 Thread Ihor Radchenko
Tom Gillespie  writes:

> While debugging an unrelated issue I noticed that
> tramp was initiating a new connection every time
> save-buffers-kill-emacs ran. I eventually tracked it
> down to org-persist-gc running on kill-emacs-hook.
> ...
> I see a couple potential fixes.
> - skip gc for remote files
> - never persist remote files
> - +only gc remote files when their cache is expired+

This should not happen. See the default value of
org-persist-remote-files.

Can you confirm that you are using the latest version of Org?

Best,
Ihor



org-persist-gc and tramp

2022-05-27 Thread Tom Gillespie
While debugging an unrelated issue I noticed that
tramp was initiating a new connection every time
save-buffers-kill-emacs ran. I eventually tracked it
down to org-persist-gc running on kill-emacs-hook.

It turns out that org-persist--index held a record
for a remote file, and the transparency of tramp
means that emacs will happily open any number
of remote connections to check whether such files
exist on exit. This could produce unexpected and
quite bad behavior for users that edit many remote
org files. It also leaks information that a user has
closed emacs over the network even if they have
not intentionally made any remote connections.

I see a couple potential fixes.
- skip gc for remote files
- never persist remote files
- +only gc remote files when their cache is expired+

I think the last option might be the most reasonable
compromise? Er, nope, I was looking at an old/variant
cache location that still had :expiry values in the plist,
but it looks like the most recent version does not, so
we are left with option 1 or option 2.

Given that the network latency is likely to dominate
accessing such files the time to reparse if we don't
persist (option 2) seems like it will be small?

I think for option 1 to work safely there would need
to be a way to periodically gc remote files, maybe
when another file on that remote was accessed so
an existing tramp connection would be used?

Thoughts?
Tom



Re: how to export an org file, to 2 different locations (in to different formats)

2022-05-27 Thread Juan Manuel Macías
Hi Uwe,

Uwe Brauer writes:

> Hi
>
> Currently I use 
> #+EXPORT_FILE_NAME: /home/oub/Desktop/some-stuff.html
>
> To export my org file in html format to that location.
>
> But I would also like to export it as a latex file to a different
> location, without modifying the above line, or to be more precise to add
> a different location, like
>
> 1. if export to latex use that folder
>
> 2. If export to html use this folder
>
> Anybody know about such a functionality?
>
> Thanks and regards
>
> Uwe Brauer 

One (pedestrian) way to achieve it, with this function:

(defun my-org/export-to-path (backend export-path extension)
  (org-element-map (org-element-parse-buffer) 'keyword
(lambda (k)
  (when (string= (org-element-property :key k) "EXPORT_FILE_NAME")
(let ((value (org-element-property :value k)))
  (org-export-to-file backend
  (format
   "%s%s.%s"
   export-path
   value extension)))

And then you could evaluate it inside a block in your document, with the
chosen arguments. For example:

#+EXPORT_FILE_NAME: myfile

#+begin_src emacs-lisp :exports none :eval never-export :results silent
  (my-org/export-to-path 'html "~/Desktop/" "html")
#+end_src

Best regards,

Juan Manuel 



how to export an org file, to 2 different locations (in to different formats)

2022-05-27 Thread Uwe Brauer



Hi

Currently I use 
#+EXPORT_FILE_NAME: /home/oub/Desktop/some-stuff.html

To export my org file in html format to that location.

But I would also like to export it as a latex file to a different
location, without modifying the above line, or to be more precise to add
a different location, like

1. if export to latex use that folder

2. If export to html use this folder

Anybody know about such a functionality?

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




Re: [BUG] org-open-file immediately termininates when calling xdg-open that calls emacsclient

2022-05-27 Thread Ihor Radchenko
Max Nikulin  writes:

>> With this exact init.el, trying to run
>> (let ((process-connection-type nil))
>>(start-process-shell-command "1" nil "xdg-open ~/.bashrc"))
>
> Does it mean that you can not reproduce it with emacsclient instead of 
> xdg-open? Anyway I can not reproduce it with Emacs-27.1 from 
> Ubuntu-20.04.

I have reported this to Emacs. The more precise steps are in
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=55672 

> - emacs &
> - switch from some info buffer specific to Debian
> - execute the command you provided.
>
> New frame is open and it seems reliable.

>From the discussing in the bug report, it appears that part of the
problem is that my Emacs uses cairo build.

Best,
Ihor



Re: Allow Currency Symbols and Grouping Commas in Table Numbers

2022-05-27 Thread Ihor Radchenko
"Daniel E. Doherty"  writes:

> | Description  | Amount |
> |--+|
> | Mortage  | 125,000.26 |
> | Credit Cards | 6,325.00   |
> | Auto Loan| 14,853.00  |
> |--+|
> | Total| 1323.26|
> #+TBLFM: @5$2=vsum(@I..@II)
>
> Note that the total is wrong.

Well. This is also a caveat from calc, unfortunately.

7.7.2 Grouping Digits
   Please note that grouped numbers will not generally be parsed
correctly if re-read in textual form, say by the use of ‘C-x * y’ and
‘C-x * g’.  (*Note Kill and Yank::, for details on these commands.)  One
exception is the ‘\,’ separator, which doesn’t interfere with parsing
because it is ignored by TeX language mode.

So, you can instead do

| Description  | Amount  |
|--+-|
| Mortage  | 125\,000.26 |
| Credit Cards | 6\,325.00   |
| Auto Loan| 14\,853.00  |
|--+-|
| Total| 146178.26   |
#+TBLFM: @5$2=vsum(@I..@II)

Or with

#+begin_SRC emacs-lisp
(setq org-calc-default-modes
  '( calc-internal-prec 12
 calc-float-format  (float 8)
 calc-angle-modedeg
 calc-prefer-frac   nil
 calc-symbolic-mode nil
 calc-language latex ;; <--- this is new compared to default, enable 
latex symbols
 calc-group-digits t ;; <--- group digits in the results
 calc-group-char "\\,"
 calc-date-format ( "-" MM "-" DD " " Www (" " hh ":" mm))
 calc-display-working-message t))
#+end_SRC

| Description  | Amount  |
|--+-|
| Mortage  | 125\,000.26 |
| Credit Cards | 6\,325.00   |
| Auto Loan| 14\,853.00  |
|--+-|
| Total| 146\,178.26 |
#+TBLFM: @5$2=vsum(@I..@II)

> | Description  | Amount |
> |--+|
> | Mortage  | \dollar 125000.26  |
> | Credit Cards | 6325.00|
> | Auto Loan| 14853.00   |
> |--+|
> | Total| 125000.26 \dollar + 21178. |
> #+TBLFM: @5$2=vsum(@I..@II)
>
> Total is still wrong.

You need 

| Description  | Amount |
|--+|
| Mortage  | \dollar 125000.26  |
| Credit Cards | \dollar 6325.00|
| Auto Loan| \dollar 14853.00   |
|--+|
| Total| 146178.26 \dollar  |
#+TBLFM: @5$2=vsum(@I..@II)


Best,
Ihor



Re: Proposal: 'executable' org-capture-templaes

2022-05-27 Thread Max Nikulin

On 27/05/2022 19:17, Arthur Miller wrote:

Ihor Radchenko writes:


Is there any reason why you dislike transient (now part of Emacs core)?


It is not about me disliking transient, I am sure it is a great library. It is
more about simplicity and efficiency. Entire org-capture is ~2/3 of the size of
transient alone, and as an org user I have org-mode loaded almost always, while
I don't have transient loaded, since I am using magit very, very rarely, which I
believe is the only consumer of transient in my Emacs. So it is more about
lightness and efficiency.

'(("key1" "label1" exec (lambda () ...))
   ("key2" "label2" exec (labmda () ...))
...
)


If you are seeking simplicity, I suppose, `completing-read' should be 
more than enough. TAB shows list of options and it is quite similar to menu.


I have seen `org-mks' function but I am unsure if it will suite for you 
to define capture-like interface.


I do not think, you patch should be applied. Org-capture is a particular 
case of menu-like interface, but its purpose is capture and that should 
not be abused.


I can not say that I really like org-capture UI. It blocks other windows 
and frame. I believe, menu windows should just define own keymap without 
affecting of minibuffer.





Re: Eev-wconfig.el etc etc, or: "Exercise: Learn Org!"

2022-05-27 Thread Ihor Radchenko
Eduardo Ochs  writes:

> I made a video that is mainly for people who are new to Emacs and who
> are using M$ Windows, and it ends with an exercise that is roughly
> this: "...now download a .zip file with Rainer Koenig's videos from
> , unpack it somewhere,
> and use eev to create an index of the video that you've watched, with
> pointers to the parts that you will need to re-watch many times"...

You are discussing too many things at once in one video.

What is the main point you want to explain in the video? How to
download, watch, and annotate a series of videos? If so, you only talk
about it in the last minutes of the presentation.

Also, do you expect people new to emacs understand all the
(commmand args) staff?

I still fail to understand what is the advantage of eev compared to Org
or Hyperbole (which also provides context-free actionable links).
You argue that Org is a "black box", but your code is also a black box
in a sense that one needs to read the "wconfig" files (AFAIU). How is it
different compared to Org written in Elisp following the usual
documentation conventions described in the Elisp manual?

I recommend recording a much shorted video demonstrating a singe task
you perform using eev. No need to side track explaining Elisp syntax. No
need to show troubleshooting. No need to show things users "are not
supposed to understand". No need to show initial configuration with all
possible caveats.

Best,
Ihor



Re: Custom beamer blocks for pros and cons list

2022-05-27 Thread andrés ramírez
Hi Ihor.
> "Ihor" == Ihor Radchenko  writes:

Ihor> Axel Kielhorn  writes:
>> #+begin_problock Pros @@latex:{Probloc}@@ - New.  - Other Pro.  - 
Additional Pro.
>> #+end_problock

Ihor> Also, there is #+attr_latex:

Ihor> #+attr_latex: :options {Problock} #+begin_problock #+end_problock

Right. It works too.

Thanks



Re: Custom beamer blocks for pros and cons list

2022-05-27 Thread andrés ramírez
Hi. Axel.

> "Axel" == Axel Kielhorn  writes:


[...]

>> #+LaTeX_Header: \newenvironment<>{problock}[1]{%

Axel> The =problock= environment takes 1 argument, but you supply none.

Thanks. That part would have been very difficult to realize for a
latex-beginner.

Axel> You can supply an argument #+begin_problock @@latex:{Probloc}@@

Tested. And works.

Axel> This will be ignored for non-LaTeX exporters.
Axel> But even here you have to block environments, the outer environment 
generated by =***
Axel> Pros= and the inner problock environment.

Axel> You can get rid of the outer block environment by removing
Axel>:BEAMER_env: block


The other option could be pasing empty as parameter.

Thanks for the help.

Best Regards



Re: Allow Currency Symbols and Grouping Commas in Table Numbers

2022-05-27 Thread Daniel E. Doherty


On Fri, May 27 2022, Ihor Radchenko wrote:

Ihor, thanks for your thoughts, but this does not solve my problem.

Here is an sample org table that exemplifies the problem:

==
#+begin_SRC emacs-lisp
  (setq org-calc-default-modes
'(calc-internal-prec 12
 calc-float-format  (float 8)
 calc-angle-modedeg
 calc-prefer-frac   nil
 calc-symbolic-mode nil
 calc-language latex ;; <--- this is new compared to default
 calc-date-format ( "-" MM "-" DD " " Www (" " hh ":" mm))
 calc-display-working-message t))
#+end_SRC

#+RESULTS:
| calc-internal-prec | 12 | calc-float-format | (float 8) | calc-angle-mode | 
deg | calc-prefer-frac | nil | calc-symbolic-mode | nil | calc-language | latex 
| calc-date-format | ( - MM - DD   Www (  hh : mm)) | 
calc-display-working-message | t |


| Description  | Amount  |
|--+-|
| Mortage  | $125,000.26 |
| Credit Cards | 6,325.00|
| Auto Loan| 14,853.00   |
|--+-|
| Total| :=vsum(@I..@II) |
#+TBLFM: @5$2=vsum(@I..@II)

-> Error: Invalid field specifier "$125"

| Description  |Amount |
|--+---|
| Mortage  | 125000.26 |
| Credit Cards |   6325.00 |
| Auto Loan|  14853.00 |
|--+---|
| Total| 146178.26 |
#+TBLFM: @5$2=vsum(@I..@II)


| Description  | Amount |
|--+|
| Mortage  | 125,000.26 |
| Credit Cards | 6,325.00   |
| Auto Loan| 14,853.00  |
|--+|
| Total| 1323.26|
#+TBLFM: @5$2=vsum(@I..@II)

Note that the total is wrong.


| Description  | Amount |
|--+|
| Mortage  | \dollar 125000.26  |
| Credit Cards | 6325.00|
| Auto Loan| 14853.00   |
|--+|
| Total| 125000.26 \dollar + 21178. |
#+TBLFM: @5$2=vsum(@I..@II)

Total is still wrong.

>
> You can, for example, do
>
> | 1 USD | 2 USD | 4 USD | 7 USD |
>
> #+tblfm: $4=vsum($1..$3)
>
> Emacs calc is able to work with arbitrary ascii symbols or even units.
> However, calc does not appear work with unicode. If Emacs calc were to
> support unicode, it would automatically work in Org.
>
> Also, you can
>
> enable latex in calc via
> (setq org-calc-default-modes
>   '(calc-internal-prec 12
>  calc-float-format  (float 8)
>  calc-angle-modedeg
>  calc-prefer-frac   nil
>  calc-symbolic-mode nil
>calc-language latex ;; <--- this is new compared to 
> default
>  calc-date-format ( "-" MM "-" DD " " Www (" " hh ":" 
> mm))
>  calc-display-working-message t))
>

But it requires the \dollar on every entry.  The convention if
financial table is to include the currency symbol only on the first
item.

> Then, the following will work
>
> | \dollar1 | \dollar2 | \dollar3 | 6 \dollar |
>
> #+tblfm: $4=vsum($1..$3)

Whatever calc is able to handle, calc is not getting the entries
interpreted as numbers, or at least not the numbers that a human would
understand.

My elisp skills are limited, but it seems that org mode could, as a
matter of course, strip commas and currency symbols from the numbers
before delivering them to calc, and, if the user wants add back the
grouping commas and currency symbol with a format specifier in the
result.

Also, it would be better if the regular expression for recognizing
numbers allowed grouping commas and currency symbols to be included by
default so that financial-type numbers get right-aligned by default.

>
> Best,
> Ihor


--

Daniel E. Doherty
Law Offices of Daniel E. Doherty
7300 W. 110th Street, Suite 930
Overland Park, KS 66210
913.338.7182 (Phone)
913.338.7164 (FAX)
d...@ddoherty.net



Re: [PATCH] Re: Change in `org-cycle-hook' breaks behavior

2022-05-27 Thread Tor Kringeland
Ihor Radchenko  writes:

> I assume that you have org-startup-folded set to 't. Then, what you are
> seeing is caused by org-cycle-set-startup-visibility that folds all the
> drawers unless org-startup-folded is set to 'showeverything.

Yes, that is my customization :)

> A more efficient way could be introducing a new customization similar to
> org-cycle-hide-block-startup. Say, it can be
> org-cycle-hide-drawer-startup. See the attached patch.

That sounds good.  But this would only fold the drawers when starting
org-mode, right?  Basicall my configuration has been to remove
`org-cycle-hide-drawers' from `org-cycle-hook', which opened all the
drawers whenever I called `org-cycle' (bound to TAB).  I also had a
custom function where I added `org-cycle-hide-drawers' back to the hook
and then called `org-cycle' (bound to C-TAB).  This way I could toggle
showing/not showing the drawers when opening a headline in any Org
buffer.  (Both of them would ignore the visibility of the drawers in the
headline and show them/hide them unconditionally.  I can always hide the
drawers by adding `org-cycle-hide-drawers' to `org-cycle-hook' when I
call my custom function, but I cannot replicate the behavior of
`org-cycle' without `org-cycle-hide-drawers' in the hook, which would
uncoditionally open all the drawers (AFAIK).)


Re: Proposal: 'executable' org-capture-templaes

2022-05-27 Thread Arthur Miller
Ihor Radchenko  writes:

> Arthur Miller  writes:
>
>> I was playing with org-capture today, and it strike me that it could be used 
>> as
>> a simple and lightweight alternative to create GUIs for user options, 
>> somewhat
>> resembling the use of well-known hydra/transient or built-in help macro or 
>> easy
>> menu.
>
> Is there any reason why you dislike transient (now part of Emacs core)?

It is not about me disliking transient, I am sure it is a great library. It is
more about simplicity and efficiency. Entire org-capture is ~2/3 of the size of
transient alone, and as an org user I have org-mode loaded almost always, while
I don't have transient loaded, since I am using magit very, very rarely, which I
believe is the only consumer of transient in my Emacs. So it is more about
lightness and efficiency. 

Simplicity comes from the org-templates. Me, and I guess other people are
familiar with org-catpure templates already, and I mean, can it be simpler to
create a menu of choices then a simple list:

'(("key1" "label1" exec (lambda () ...))
  ("key2" "label2" exec (labmda () ...))
   ...
   )

People are already writing those as part of org-capture, so there is a
familiarity factor. Transient has to be learned, and the complexity is much
bigger.

For the record, there are other alternatives to transient that were already in 
Emacs
for example macro 'make-help-screen', as used in Emacs help, but the complexity
is also bigger, I am sure you are aware of it's usage, but for other readers, an
example usage is in help.el, starting on line 238, where help menu is built. It
is not terribly complicated to use, but it is still more involved then
org-capture template would be.

Of course, those are more capapble than org-capture, but most often we need just
a simple choice.

> We actually had multiple threads discussing possibility to port all the
> Org dialogues to transient.

I have unfortunately missed those discussions. But as said, I am not in to argue
for or against transient at all. I would just like to re-use the org-capture
code, since it is already in-place.

>> I would like to propose a small 'feature/change' to org-capture templates, to
>> inlude a new target: 'exec'. It should be followed by a function to be
>> executed.
>>
>> I believe that this is a simple change that does not intrude on anything 
>> else in
>> org-capture, you can see the attached patch. The goal is to just circumwent 
>> the
>> createion of capture buffer, bookmark and other processing done by 
>> org-capture
>> etc. However there might be things I am not aware of, so if someone have more
>> insight, it is welcomed to hear.
>
> It seems to be quite out of scope of org-capture.

Maybe, but than what is in scope of org-mode or org-capture or Emacs? We are
constantly bending code to do what it is not really meant to do. Since to be a
DNA of Emacs :).

>   If anything, capture
> menu might be factored out to a generic menu framework.

Please no. Not every single piece of Emacs has to be a generalized
framework. Generalized frameworks add an extra layer of complexity, and it this
case, as you point out, we have other frameworks, so yet another framework is
*definitely* not what I ask for.

> already have transient achieving the same goal.

Yes, and other alternatives, but to higher cost mentally and computationally.

I just wish to use org-capture for its simplicity and lighntess. Considering
it's five lines of code, and no additional learning required to use it, I think
it is rather "cheap". We also had easy-menu and make-help-screen when we got
org-capture and transient. I can still understand the feeling that it is "out of
scope", but I don't think it is terribly out of org-capture waters.

Anyway, it is a proposal, and if you don't want it in org it is OK. I personally
think it could make life simpler in cases people need a simple choice menus to
fire up an action, and it comes with very small cost.

best regards
/arthur



Re: [BUG] org-open-file immediately termininates when calling xdg-open that calls emacsclient

2022-05-27 Thread Max Nikulin

On 27/05/2022 13:19, Ihor Radchenko wrote:


I managed to narrow down the reproducer with the following minimal
configuration:

~/.emacs.d/init.el
---
(require 'server)
(unless (server-running-p) (server-start))
(setenv "DISPLAY" ":0.0")
(define-key input-decode-map (kbd "C-[") [C-\[])
--

With this exact init.el, trying to run
(let ((process-connection-type nil))
   (start-process-shell-command "1" nil "xdg-open ~/.bashrc"))


Does it mean that you can not reproduce it with emacsclient instead of 
xdg-open? Anyway I can not reproduce it with Emacs-27.1 from 
Ubuntu-20.04. You may try to add before emacsclient command something like


strace -s64 -f -t -o /tmp/emacsclient.strace

or attach strace to the running emacs using -p PID option just before 
executing `start-process-shell-command' and kill strace just after.


My attempt:
- Minimal LXC container, so I had to install xdg-utils and file packages
- Notice
  file --mime-type ~/.bashrc
  /home/ubuntu/.bashrc: text/plain
  so I tried with ~/.bashrc and with a script that is really recognized
  as text/x-shellscript
- ~/.local/share/applications/emacsclient-local.desktop
  from your previous message
- ~/.config/mimeapps.list
 [Added Associations]
 text/x-shellscript=emacsclient-local.desktop
 [Default Applications]
 text/x-shellscript=emacsclient-local.desktop
   without such file xdg-open can not find a handler despite I believed
   that it scans ~/.local/share/applications/ for .desktop files.
   Maybe that part of code works only for x-scheme-handler/...
   MIME types.
- emacs &
- switch from some info buffer specific to Debian
- execute the command you provided.

New frame is open and it seems reliable.

P.S. Likely it is unrelated to your problem:
emacs -Q --daemon

Warning: due to a long standing Gtk+ bug
https://gitlab.gnome.org/GNOME/gtk/issues/221
Emacs might crash when run in daemon mode and the X11 connection is 
unexpectedly lost.
Using an Emacs configured with --with-x-toolkit=lucid does not have this 
problem.

Starting Emacs daemon.




Re: Allow Currency Symbols and Grouping Commas in Table Numbers

2022-05-27 Thread Eric S Fraga
On Friday, 27 May 2022 at 19:17, Ihor Radchenko wrote:
> You are right. However, non-letter symbols do not work. Try, € or ☺️.

Interesting.  Seems rather strange but definitely the case. :-( I guess
I've only ever used Greek symbols if not ASCII.

-- 
: Eric S Fraga, with org release_9.5.3-511-g8e69ad in Emacs 29.0.50



Re: [tip] org-publish to work with (very) large books

2022-05-27 Thread Juan Manuel Macías
Ihor Radchenko writes:

> I am not sure if I understand correctly. Do you mean that you only
> preview the book parts you are currently working on via latexmk -pvc?
> What kind of more control are you referring to?

The -pvc flag means that if latexmk detects any modification to any
document involved in the current job (a subdocument, the .sty file, a
.bib file, or whatever), it reruns the appropriate builds to bring the
pdf up to date, and it only stops when everything is up to date. I can
focus that action on parts of the book by commenting or uncommenting
elements in the master file.

The moment one breaks down a large piece of work into specialized parts,
one gains more control over that piece of work. And org-publish helps
manage all of that. It is about managing a large book as a website (via
org-publish). In short, the combination of org-publish, projectile and
latexmk is quite productive for me in this type of work.

Anyway, as they say that a picture is worth a thousand words, I have
made this short example video. This is a dictionary I produced a year
ago. Each dictionary entry has its own separate bibliographic list, so I
had to manage more than 100 separate bib files. I have all these files
inside an Org document, and I create them using org-babel-tangle. The
video shows editing a field in a bib file. I've removed the build time
from the video, as the entire book is almost a thousand pages long.

https://cloud.disroot.org/s/PiSaHqWZr25GfJY

Best regards,

Juan Manuel 



Re: Opening org-cite links with different application

2022-05-27 Thread Alessandro Bertulli
Thanks to all for your answers!

Max wrote:
> I mean
>(call-process "xdg-open" nil 0 nil url)
> with "sioyek" instead of "xdg-open" if you do not like to set the 
> application as the default handler for PDF files. It will allow to avoid 
> additional settings for shell buffers. Of course, you will loose ability 
> to check command output for errors, it is shoot and forget method 
> suitable for most of viewers however.
Thanks for the suggestion, it works quite well. I can't inspect the
output, but for a PDF viewer that's actually the pretty standard
behaviour, so for me it works fine right now.

To Bruce and Tim: thanks, right now this solution works, but if I figure
out a more clever way to do it (based on your suggestions) I'll give a
shout.

Alessando



Re: Allow Currency Symbols and Grouping Commas in Table Numbers

2022-05-27 Thread Ihor Radchenko
Eric S Fraga  writes:

> On Friday, 27 May 2022 at 16:22, Ihor Radchenko wrote:
>> However, calc does not appear work with unicode. 
>
> Are you sure?  This works just fine for me with embedded Calc:
> ...
> δx := (b - a) / n => 0.01
> ...
> Note use of δ.  I use Greek characters all the time in my Calc formulas.
>
> If it works in embedded Calc, it should work with the rest of Calc?

You are right. However, non-letter symbols do not work. Try, € or ☺.

I tried the following:

1. M-x calc

2. ' C-x 8  small greek delta  + 1 
3. Works
4. ' C-x 8  EURO SIGN  + 1 
5. Error

Best,
Ihor



Re: Allow Currency Symbols and Grouping Commas in Table Numbers

2022-05-27 Thread Eric S Fraga
On Friday, 27 May 2022 at 16:22, Ihor Radchenko wrote:
> However, calc does not appear work with unicode. 

Are you sure?  This works just fine for me with embedded Calc:


--8<---cut here---start->8---
n := 100

a := 0

b := 1.0

δx := (b - a) / n => 0.01

i := 15

xi := a + δx i => 0.15
--8<---cut here---end--->8---

Note use of δ.  I use Greek characters all the time in my Calc formulas.

If it works in embedded Calc, it should work with the rest of Calc?

-- 
: Eric S Fraga, with org release_9.5.3-511-g8e69ad in Emacs 29.0.50



[BUG] Setting compile command causes fontification error [9.5 (release_9.5-661-g5e0afb @ /home/quintus/.emacs.d/org-mode/lisp/)]

2022-05-27 Thread Marvin Gülker
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Dear all,

trying to access a file with the content shown further below results in
this message:

Org mode fontification error in # at 31

Trying to export said file to HTML yields this backtrace:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  substring(nil 0 0)
  replace-regexp-in-string("[^-0-9a-zA-Z_./\n]" "\\&" nil)
  shell-quote-argument(nil)
  (concat "lualatex " (shell-quote-argument (buffer-file-name)))
  (set (make-local-variable 'compile-command) (concat "lualatex " 
(shell-quote-argument (buffer-file-name
  (lambda nil (set (make-local-variable 'compile-command) (concat "lualatex 
" (shell-quote-argument (buffer-file-name)()
  run-hooks(change-major-mode-after-body-hook text-mode-hook tex-mode-hook 
latex-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook text-mode-hook 
tex-mode-hook latex-mode-hook))
  run-mode-hooks(latex-mode-hook)
  latex-mode()
  funcall(latex-mode)
  (progn (funcall lang-mode) (insert code) (org-font-lock-ensure) 
(save-excursion (let ((beg (point-min)) (end (point-max))) (goto-char beg) 
(while (progn (end-of-line) (< (point) end)) (put-text-property (point) (1+ 
(point)) 'face nil) (forward-char 1 (org-src-mode) (set-buffer-modified-p 
nil) (let ((org-html-htmlize-output-type output-type) 
(org-html-htmlize-font-prefix font-prefix)) (org-html-htmlize-region-for-paste 
(point-min) (point-max
  (unwind-protect (progn (funcall lang-mode) (insert code) 
(org-font-lock-ensure) (save-excursion (let ((beg (point-min)) (end 
(point-max))) (goto-char beg) (while (progn (end-of-line) (< (point) end)) 
(put-text-property (point) (1+ (point)) 'face nil) (forward-char 1 
(org-src-mode) (set-buffer-modified-p nil) (let ((org-html-htmlize-output-type 
output-type) (org-html-htmlize-font-prefix font-prefix)) 
(org-html-htmlize-region-for-paste (point-min) (point-max (and (buffer-name 
temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn 
(funcall lang-mode) (insert code) (org-font-lock-ensure) (save-excursion (let 
((beg (point-min)) (end (point-max))) (goto-char beg) (while (progn 
(end-of-line) (< ... end)) (put-text-property (point) (1+ ...) 'face nil) 
(forward-char 1 (org-src-mode) (set-buffer-modified-p nil) (let 
((org-html-htmlize-output-type output-type) (org-html-htmlize-font-prefix 
font-prefix)) (org-html-htmlize-region-for-paste (point-min) (point-max 
(and (buffer-name temp-buffer) (kill-buffer temp-buffer
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer 
(set-buffer temp-buffer) (unwind-protect (progn (funcall lang-mode) (insert 
code) (org-font-lock-ensure) (save-excursion (let ((beg ...) (end ...)) 
(goto-char beg) (while (progn ... ...) (put-text-property ... ... ... nil) 
(forward-char 1 (org-src-mode) (set-buffer-modified-p nil) (let 
((org-html-htmlize-output-type output-type) (org-html-htmlize-font-prefix 
font-prefix)) (org-html-htmlize-region-for-paste (point-min) (point-max 
(and (buffer-name temp-buffer) (kill-buffer temp-buffer)
  (let ((output-type org-html-htmlize-output-type) (font-prefix 
org-html-htmlize-font-prefix) (inhibit-read-only t)) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) 
(unwind-protect (progn (funcall lang-mode) (insert code) (org-font-lock-ensure) 
(save-excursion (let (... ...) (goto-char beg) (while ... ... ...))) 
(org-src-mode) (set-buffer-modified-p nil) (let ((org-html-htmlize-output-type 
output-type) (org-html-htmlize-font-prefix font-prefix)) 
(org-html-htmlize-region-for-paste (point-min) (point-max (and (buffer-name 
temp-buffer) (kill-buffer temp-buffer))
  (setq code (let ((output-type org-html-htmlize-output-type) (font-prefix 
org-html-htmlize-font-prefix) (inhibit-read-only t)) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) 
(unwind-protect (progn (funcall lang-mode) (insert code) (org-font-lock-ensure) 
(save-excursion (let ... ... ...)) (org-src-mode) (set-buffer-modified-p nil) 
(let (... ...) (org-html-htmlize-region-for-paste ... ...))) (and (buffer-name 
temp-buffer) (kill-buffer temp-buffer)))
  (cond ((not (functionp lang-mode)) (org-html-encode-plain-text code)) (t 
(setq code (let ((output-type org-html-htmlize-output-type) (font-prefix 
org-html-htmlize-font-prefix) (inhibit-read-only t)) (let ((temp-buffer 
(generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) 
(unwind-protect (progn ... ... ... ..

Re: Custom beamer blocks for pros and cons list

2022-05-27 Thread Ihor Radchenko
Axel Kielhorn  writes:

> #+begin_problock Pros
> @@latex:{Probloc}@@ 
>  - New.
>  - Other Pro.
>  - Additional Pro.
> #+end_problock

Also, there is #+attr_latex:

#+attr_latex: :options {Problock}
#+begin_problock
#+end_problock

Best,
Ihor



Re: Allow Currency Symbols and Grouping Commas in Table Numbers

2022-05-27 Thread Ihor Radchenko
"Daniel E. Doherty"  writes:

> I often use org table to perform calculations and export those tables
> to LaTeX documents.
>
> One thing I always wished I could do with org tables is get it to
> allow numbers to be decorated with currency symbols, the dollar, euro,
> yen, etc., as well as grouping commas so that the tables are more
> suitable for presentation.

You can, for example, do

| 1 USD | 2 USD | 4 USD | 7 USD |
#+tblfm: $4=vsum($1..$3)

Emacs calc is able to work with arbitrary ascii symbols or even units.
However, calc does not appear work with unicode. If Emacs calc were to
support unicode, it would automatically work in Org.

Also, you can

enable latex in calc via
(setq org-calc-default-modes
  '(calc-internal-prec 12
   calc-float-format  (float 8)
   calc-angle-modedeg
   calc-prefer-frac   nil
   calc-symbolic-mode nil
   calc-language latex ;; <--- this is new compared to 
default
   calc-date-format ( "-" MM "-" DD " " Www (" " hh ":" 
mm))
   calc-display-working-message t))

Then, the following will work

| \dollar1 | \dollar2 | \dollar3 | 6 \dollar |
#+tblfm: $4=vsum($1..$3)

Best,
Ihor



Re: Custom beamer blocks for pros and cons list

2022-05-27 Thread Axel Kielhorn


> Am 26.05.2022 um 23:32 schrieb Andrés Ramírez :
> 

You want something like this as the resulting LaTeX code:

\begin{frame}[label={sec:org5359014}]{Comparisson}
\begin{columns}
\begin{column}{0.45\columnwidth}
\begin{block}{Pros}% <- superfluous environment
\begin{problock}{Problock} % <— argument required
\begin{itemize}
\item New.
\item Other Pro.
\item Additional Pro.
\end{itemize}
\end{problock}
\end{block}
\end{column}

> #+LaTeX_Header: \newenvironment<>{problock}[1]{%

The =problock= environment takes 1 argument, but you supply none.

You can supply an argument 
#+begin_problock
@@latex:{Probloc}@@ 

This will be ignored for non-LaTeX exporters.

But even here you have to block environments, the outer environment generated 
by =*** Pros= and the inner problock environment.

You can get rid of the outer block environment by removing

   :BEAMER_env: block


The resulting org code will look like this:

   :PROPERTIES:
   :BEAMER_col: 0.45
   :END:
#+begin_problock Pros
@@latex:{Probloc}@@ 
 - New.
 - Other Pro.
 - Additional Pro.
#+end_problock

Greetings
Axel




Re: Help with my first elisp

2022-05-27 Thread Orm Finnendahl
Am Mittwoch, den 25. Mai 2022 um 10:24:01 Uhr (+0200) schrieb to...@tuxteam.de:
> 
> Just to avoid confusion: Emacs Lisp does distinguish case. Traditional
> Lisp doesn't. I know you know, but people could misunderstand the above.

Yes, that was a bit imprecise ;-)

Best,
Orm
--
Prof. Orm Finnendahl
Komposition
Hochschule für Musik und Darstellende Kunst
Eschersheimer Landstr. 29-39
60322 Frankfurt am Main

https://www.youtube.com/watch?v=2rWha1HTfFE&list=PLiGfneJSWmNw6dTUvcTHbTkCYOOTiB_N6



signature.asc
Description: PGP signature


[PATCH] Re: Change in `org-cycle-hook' breaks behavior

2022-05-27 Thread Ihor Radchenko
Tor Kringeland  writes:

> In Org 9.5, `org-cycle-hook' includes `org-cycle-hide-drawers', which
> hides the drawer after opening the contents of a headline with
> `org-cycle'.  However, if you removed `org-cycle-hide-drawers' from the
> hook, `org-cycle' would show you the drawers (at least the PROPERTIES
> one).  I relied on this behavior, as I wanted the drawers to be shown
> when I opened a headline.

I assume that you have org-startup-folded set to 't. Then, what you are
seeing is caused by org-cycle-set-startup-visibility that folds all the
drawers unless org-startup-folded is set to 'showeverything.

Previously, the folded drawers (or folded anything) inside folded
headline would be automatically unfolded when you unfold the headline.
Now, the folding state is independent and we don't need to re-fold the
drawers upon unfolding the headline.

> Maybe a function `org-cycle-show-drawers' could be added?  Implicitly it
> seems like `org-cycle' previously did contain this functionality.
> Adding such a function to `org-cycle-hook' would solve my problem.

A more efficient way could be introducing a new customization similar to
org-cycle-hide-block-startup. Say, it can be
org-cycle-hide-drawer-startup. See the attached patch.

Best,
Ihor

>From 2312e9280e5267cdcb72406a24068d6ec0a3696e Mon Sep 17 00:00:00 2001
Message-Id: <2312e9280e5267cdcb72406a24068d6ec0a3696e.1653635423.git.yanta...@gmail.com>
From: Ihor Radchenko 
Date: Fri, 27 May 2022 15:09:16 +0800
Subject: [PATCH] org-cycle.el: New custom setting
 `org-cycle-hide-drawer-startup'

* lisp/org-cycle.el (org-cycle-hide-drawer-startup):
* lisp/org-cycle.el (org-cycle-set-startup-visibility): Add new
customization to control initial folding state of the drawers.
* lisp/org.el (org-startup-options): Provide #+STARTUP option for the
new setting.

Fixes https://list.orgmode.org/m235gww8wg@ntnu.no/T/#u
---
 etc/ORG-NEWS  | 22 ++
 lisp/org-cycle.el | 12 +++-
 lisp/org.el   |  2 ++
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 35af94f92..e1e4beaf0 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -271,6 +271,28 @@ The new variable name is =org-plantuml-args=.  It now applies to both
 jar PlantUML file and executable.
 
 ** Miscellaneous
+*** A new custom setting =org-hide-drawer-startup= to control initial folding state of drawers
+
+Previously, all the drawers were always folded when opening an Org
+file.  This only had an effect on the drawers outside folded
+headlines.  The drawers inside folded headlines were re-folded because
+=org-cycle-hide-drawers= was present inside =org-cycle-hook=.
+
+With the new folding backend, running =org-cycle-hide-drawers= is no
+longer needed if all the drawers are truly folded on startup: [[*Folding
+state of the drawers is now preserved when cycling headline
+visibility]].  However, this has an unwanted effect when a user does
+not want the drawers to be folded (see [[id:1d0e0874-8771-40e4-97ac-6746a0e97438][this bug report]]).
+
+The new custom setting gives more control over initial folding state
+of the drawers.  When set to =nil= (default is =t=), the drawers are
+not folded on startup.
+
+The folding state can also be controlled on per-file basis using
+=STARTUP= keyword:
+
+: #+startup: hidedrawers
+: #+startup: nohidedrawers
 
 *** Styles are customizable in ~biblatex~ citation processor
 
diff --git a/lisp/org-cycle.el b/lisp/org-cycle.el
index b15ead788..fb7ff4749 100644
--- a/lisp/org-cycle.el
+++ b/lisp/org-cycle.el
@@ -119,6 +119,16 @@ (defcustom org-cycle-hide-block-startup nil
   :group 'org-cycle
   :type 'boolean)
 
+(defcustom org-cycle-hide-drawer-startup t
+  "Non-nil means entering Org mode will fold all drawers.
+This can also be set in on a per-file basis with
+
+#+STARTUP: hidedrawers
+#+STARTUP: nohidedrawers"
+  :group 'org-startup
+  :group 'org-cycle
+  :type 'boolean)
+
 (defcustom org-cycle-global-at-bob nil
   "Cycle globally if cursor is at beginning of buffer and not at a headline.
 
@@ -603,7 +613,7 @@ (defun org-cycle-set-startup-visibility ()
 (when org-cycle-hide-block-startup (org-fold-hide-block-all))
 (org-cycle-set-visibility-according-to-property)
 (org-cycle-hide-archived-subtrees 'all)
-(org-cycle-hide-drawers 'all)
+(when org-cycle-hide-drawer-startup (org-cycle-hide-drawers 'all))
 (org-cycle-show-empty-lines t)))
 
 (defun org-cycle-set-visibility-according-to-property ()
diff --git a/lisp/org.el b/lisp/org.el
index 0eb819f23..be9900d68 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3984,6 +3984,8 @@ (defconst org-startup-options
 ("noptag" org-tag-persistent-alist nil)
 ("hideblocks" org-hide-block-startup t)
 ("nohideblocks" org-hide-block-startup nil)
+("hidedrawers" org-hide-drawer-startup t)
+("nohidedrawers" org-hide-drawer-startup nil)
 ("beamer" org-startup-with-beamer-mode t)
 ("entitiespretty" org-pretty-entities t)
 ("enti

Re: [PATCH] Re: No mathematics in Texinfo exports

2022-05-27 Thread Rudolf Adamkovič
Ihor Radchenko  writes:

> Do not wait one month. Just 5 working days. Then, do not hesitate to
> follow up.

And ... done!  So, what happens next?

Rudy
-- 
"The whole science is nothing more than a refinement of everyday
thinking."
-- Albert Einstein, 1879-1955

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