bug#45915: 28.0.90; deletechar distorts org-table

2021-12-28 Thread Tak Kunihiro
Dear Ihor

Thank you for the patch.  I applied the patch to org-table.el on Emacs
28.0.90.

And I still see the problem there.  Is the problem solved by the patch
on your environment?

Tak

Ihor Radchenko  writes:

> Tak Kunihiro  writes:
>
>> I confirm that there still is the problem with org-table on Emacs
>> 28.0.90 pretest with org-version 9.5.1.
>>
>> Here is a recipe to reproduce the problem.  I still have to stick to
>> 26.3.
>
> I was able to reproduce. Can you try the attached fix?
>
> Best,
> Ihor
>
> From 7b1a7d43e090292b6bd821c65a644f8c599b2044 Mon Sep 17 00:00:00 2001
> Message-Id: 
> <7b1a7d43e090292b6bd821c65a644f8c599b2044.1639918362.git.yanta...@gmail.com>
> From: Ihor Radchenko 
> Date: Sun, 19 Dec 2021 20:49:54 +0800
> Subject: [PATCH] org-table.el: Fix orgtbl-mode not remapping delete key
>
> * lisp/org-table.el (orgtbl-setup): Remap `delete-forward-char' in
> addition to `deleta-char'.  The former is called in Emacs >26.
>
> Fixes 
> https://orgmode.org/list/1ad1b9b7-5a15-4f86-9274-b04b83694...@misasa.okayama-u.ac.jp
> ---
>  lisp/org-table.el | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lisp/org-table.el b/lisp/org-table.el
> index 1546cd563..0560e32a1 100644
> --- a/lisp/org-table.el
> +++ b/lisp/org-table.el
> @@ -5290,6 +5290,7 @@ (defun orgtbl-setup ()
>(org-remap orgtbl-mode-map
>'self-insert-command 'orgtbl-self-insert-command
>'delete-char 'org-delete-char
> + 'delete-forward-char 'org-delete-char
>'delete-backward-char 'org-delete-backward-char)
>(org-defkey orgtbl-mode-map "|" 'org-force-self-insert))
>  t))





Re: C-c C-, in a terminal?

2021-12-28 Thread Samuel Banya
Hey Annsi,

Awesome reply, just was lurking in this thread, and wanted to actually provide 
a link to what you mentioned since it looks like a cool package I might even 
want to try as well:
- https://melpa.org/#/free-keys

Reason being is that I actually wanted to explore running Emacs in purely a 
terminal setup since I actually don't use images that much compared to most 
people.

I know there are benefits to maybe inserting screenshots in notes, or viewing 
images via 'eww' but I don't really actually need it for my workflow, so 
running Emacs in 'xterm' or even something as heavy as Cool Retro Term sounds 
mega fun.

Anyway, didn't know about that package above, thanks for mentioning that one!

I also agree though that the exact replacement for the default keybinding is a 
hard topic.

I'm not sure if this helps, but I'm including a bunch of links I was able to 
research on this topic just in case this helps you out:
- https://aliquote.org/post/emacs-in-terminal/
- https://x86blog.com/emacs-an-ide-for-the-terminal/
- 
https://www.quora.com/Whats-the-best-way-to-use-Emacs-as-a-GUI-application-or-running-in-the-terminal?share=1
- 
https://www.linuxquestions.org/questions/linux-software-2/emacs-in-a-terminal-problems-with-ctrl-815964/
- https://github.com/purcell/exec-path-from-shell

Not sure if this totally relates, but since you're trying to use your terminal 
as an all-in-one, you might even want to check out 'Twin' as well since it can 
act as a Desktop Environment:
- https://github.com/cosmos72/twin

Sincerely,

Sam

On Tue, Dec 28, 2021, at 6:58 PM, Tim Cross wrote:
> 
> Anssi Saari  writes:
> 
> > Hi all, while it's not an ORG mode question exactly, I have a problem
> > with org-insert-structure-template and it's default shortcut, C-c C-, in
> > terminals.
> >
> > As C-, isn't usually a control character in a terminal, terminals send
> > just the comma if I hit C-,. Some terminals (at least wsltty) do send
> > some kind of control sequence but I don't know if mapping other
> > terminals to do the same (Konsole and urxvt at least) and changing the
> > keys for Emacs makes sense. I'd have to do it for every terminal I ever
> > use.
> >
> > Alternatively, any suggestions for a more terminal friendly key
> > combination for org-insert-structure-template in Emacs?
> 
> It is almost impossible to suggest an alternative key binding because
> there are just too many variables involved. What you can use will depend
> on what window manager you use and the key shortcuts it uses (which will
> 'steal' keys before Emacs get to see them) and on the terminal emulator
> and the remote access protocol (i.e. ssh, telnet, tmux, screen etc) you
> use. Then there is differences depending on what Emacs packages you are
> using and what (if any) key bindings you have already defined and
> whether they are global or local definitions etc.
> 
> My suggestion would be to use something like the free-keys (available in
> melpa) package to identify what key bindings are available when in an
> org buffer and select one of those. It may also be worthwhile
> considering using something like hydra. You could define an org specific
> hydra and associate all your preferred bindings to that hydra. Org can
> be particularly challenging because it already has some complex key
> bindings, so avoiding unexpected side effects when adding/changing
> bindings can be a challenge. 
> 
> 
> 


Re: [SOLVED]

2021-12-28 Thread Ihor Radchenko
Uwe Brauer  writes:

>> Hmm. I suspect that org-real might not be the problem by itself. Rather
>> you may load it too early and pull-in built-in org.
>
> Well I don't load anything, that is all done by the package system.

I was just guessing. But do you really have init.el with no requires?

Best,
Ihor



Re: [BUG] org-element-cache "rx '**' range error" [9.6 (9.6-??-8f50ea2d6 @ /home/samc/.emacs.d/.local/straight/build-27.2/org/)]

2021-12-28 Thread Ihor Radchenko
Samuel Crawford  writes:

> Every time I try to open a particular pdf I'm inundated with "Org parser
> error"s, all looking like this:
>
>>  Warning (org-element-cache): org-element--cache: Org parser error in
> thesis.pdf::316345. Resetting.
>>  The error was: (error "rx ‘**’ range error")
>
> Is there any way I can disable org-element-cache on pdfs as a
> workaround?

AFAIU, something is calling org-mode function outside of org-mode (which
is wrong, even though it could work by accident in earlier versions of
Org). Can you check your hooks ran when you load the problematic pdf?

Best,
Ihor



[BUG] org-element-cache "rx '**' range error" [9.6 (9.6-??-8f50ea2d6 @ /home/samc/.emacs.d/.local/straight/build-27.2/org/)]

2021-12-28 Thread Samuel Crawford
Every time I try to open a particular pdf I'm inundated with "Org parser
error"s, all looking like this:

>  Warning (org-element-cache): org-element--cache: Org parser error in
thesis.pdf::316345. Resetting.
>  The error was: (error "rx ‘**’ range error")
>  Backtrace:
> nil
>  Please report this to Org mode mailing list (M-x org-submit-bug-report).
> Error (pdf-view-mode-hook): Error running hook
"pdf-tools-enable-minor-modes" because: (error rx ‘**’ range error)

I had a similar problem with the .tex source for the pdf too briefly. I
have a sneaking suspicion that it's to do with the fact that I recently
removed a large chunk from each document. (The line thesis.pdf::316345
doesn't exist.)

Is there any way I can disable org-element-cache on pdfs as a
workaround?

Thanks,
Sam

Emacs  : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.27, cairo version 1.17.4)
 of 2021-03-26
Package: Org mode version 9.6 (9.6-??-8f50ea2d6 @
/home/samc/.emacs.d/.local/straight/build-27.2/org/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-fontify-whole-heading-line t
 org-link-shell-confirm-function 'yes-or-no-p
 org-mode-local-vars-hook '(+org-init-gifs-h eldoc-mode)
 org-babel-after-execute-hook '(org-redisplay-inline-images)
 org-insert-heading-respect-content t
 org-after-refile-insert-hook '(save-buffer)
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-refile-targets '((nil :maxlevel . 3) (org-agenda-files :maxlevel . 3))
 org-enforce-todo-dependencies t
 org-special-ctrl-a/e t
 org-imenu-depth 6
 org-persist-before-write-hook '(org-element--cache-persist-before-write)
 org-agenda-files '("~/org/")
 org-reveal-start-hook '(org-decrypt-entry)
 org-modules '(ol-bibtex)
 org-startup-folded nil
 org-blocker-hook '(org-block-todo-from-children-or-siblings-or-parent)
 org-mode-hook '((closure ((hook . org-mode-hook) (--dolist-tail--) t)
( _)
  (add-hook 'before-save-hook 'org-encrypt-entries nil t))
 (closure ((hook . org-mode-hook) (--dolist-tail--) t)
( _)
  (add-hook 'before-save-hook 'org-encrypt-entries nil t))
 (closure ((hook . org-mode-hook) (--dolist-tail--) t)
( _)
  (add-hook 'before-save-hook 'org-encrypt-entries nil t))
 (closure ((hook . org-mode-hook) (--dolist-tail--) t)
( _)
  (add-hook 'before-save-hook 'org-encrypt-entries nil t))
 (closure ((hook . org-mode-hook) (--dolist-tail--) t)
( _)
  (add-hook 'before-save-hook 'org-encrypt-entries nil t))
 (closure ((hook . org-mode-hook) (--dolist-tail--) t)
( _)
  (add-hook 'before-save-hook 'org-encrypt-entries nil t))
 er/add-org-mode-expansions
+lookup--init-org-mode-handlers-h
 (closure ((hook . org-mode-hook) (--dolist-tail--) t)
( _)
  (add-hook 'before-save-hook 'org-encrypt-entries nil t))
 #[0 "\300\301\302\303\304$\207" [add-hook
change-major-mode-hook org-show-all append local] 5]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook
org-babel-show-result-all append local] 5]
 org-babel-result-hide-spec org-babel-hide-all-hashes
 #[0 "\301\211.\207" [imenu-create-index-function
org-imenu-get-tree] 2] turn-on-cdlatex
 org-fragtog-mode doom-disable-show-paren-mode-h
doom-disable-show-trailing-whitespace-h
 +org-enable-auto-reformat-tables-h
+org-enable-auto-update-cookies-h +org-make-last-point-visible-h
 org-fancy-priorities-mode org-superstar-mode evil-org-mode
toc-org-enable org-cdlatex-mode
 embrace-org-mode-hook org-eldoc-load)
 org-clock-persist 'history
 org-outline-path-complete-in-steps nil
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-agenda-finalize-hook '(+org-exclude-agenda-buffers-from-workspace-h
+org-defer-mode-in-agenda-buffers-h)
 org-startup-indented t
 org-clock-history-length 20
 org-reverse-note-order t
 org-journal-mode-hook '(#[0 "\301 \302\303\304$\207"
   [org-journal-encrypt-on add-hook
org-journal-encryption-hook nil t] 5]
 )
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-startup-with-latex-preview t
 org-bibtex-headline-format-function #[257 "\300.\236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-agenda-deadline-faces '((1.001 . error) (1.0 . org-warning) (0.5 .
org-upcoming-deadline)
 (0.0 . org-upcoming-distant-deadline))
 org-babel-pre-tangle-hook '(save-buffer)
 org-file-apps '((remote . emacs) (auto-mode . emacs) (directory . emacs)

ob-lisp determining package

2021-12-28 Thread Alan Ruttenberg
Currently, ob-lisp expects a package as a header argument. This is
inconvenient and often unnecessary. Slime (or sly) provides a function to
determine the current package: slime-current-package (sly-current-package).
The function used to do the evaluation in lisp is slime-eval (sly-eval) and
this function takes a second argument which is the package.

The current code determining the package is (in org-babel-execute:lisp),
(cdr (assq :package params)). As I understand it, on entry to
org-babel-execute:lisp, the current buffer is the org buffer, and the point
is at the beginning of the #+begin_src line. slime/sly-current-package
works just fine in that context.

I propose that the package determination be changed to

(or (cdr (assq :package params)) (funcall org-babel-lisp-package-fn))

with org-babel-lisp-package-fn being bound analogous to how
org-babel-lisp-eval-function is:

 (require (pcase org-babel-lisp-package-fn
(`slime-current-package  'slime)
(`sly-current-pacakge 'sly)))

This (approximately) seems to work fine in my emacs. However, I am using an
older version of emacs/org-mode and so am not submitted a patch, which
would be against slightly different code.

Regards,
Alan


Re: [BUG] Setting org-map-continue from to avoid skipping headings while archiving no longer works [9.5.2 (9.5.2-gd01235 @ /home/john/.emacs.d/straight/build/org/)]

2021-12-28 Thread Ihor Radchenko
John Mathena  writes:

> In Org 9.4.4, you can fix this issue with a snippet like this:
> ...
>  (setq org-map-continue-from (org-element-property :begin
>
> I believe this is a result of recent additions in org-scan-tags - I hit a
> dead end there while trying to determine the exact cause of the change (the
> caching stuff that was added is spooky for a new user like me).
>
> Is the snippet above no longer expected to work in Org 9.5.2 due to the
> logic for mapping over entries having changed, or is this a bug? If it's
> the former, what's the intended way of archiving all DONE tasks in a file
> now?

Hi. Sorry for the inconvenience. The logic has indeed been changed to
speed things up.

I tried to make sure that org-map-continue-from is not broken, but your
scenario is apparently not covered by our tests.

Let me investigate and fix this.

Best,
Ihor



[BUG] ob-python :results value pp does not working

2021-12-28 Thread Christopher M. Miles

The bellowing python source block ~:results value pp~ does not print pprint 
formated result as
expected. I tested with =$ emacs -q= confirmed this problem.

  #+begin_src python :results value pp
  dic = {'key1': 1, 'b': 2}
  dic
  #+end_src
  
  #+RESULTS[(2021-12-29 10:51:14) b1011bfee8a1636204f73e13367d3b6d2cb6a36e]:
  : None


-- 
[ 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: [BUG] ob-python :results value pp does not working

2021-12-28 Thread Christopher M. Miles

"Christopher M. Miles"  writes:

> [[PGP Signed Part:Undecided]]
>
> The bellowing python source block ~:results value pp~ does not print pprint 
> formated result as
> expected. I tested with =$ emacs -q= confirmed this problem.
>
>   #+begin_src python :results value pp
>   dic = {'key1': 1, 'b': 2}
>   dic
>   #+end_src
>
>   
>   #+RESULTS[(2021-12-29 10:51:14) b1011bfee8a1636204f73e13367d3b6d2cb6a36e]:
>   : None

Sorry forget to fill environment information:

- Emacs version: GNU Emacs 28.0.60 (build 1, aarch64-apple-darwin20.6.0, NS 
appkit-2022.60 Version 11.6 (Build 20G165)) of 2021-10-20
- Org mode version: Org mode version 9.3.4 (release_9.3.4-644-g14d358.dirty @ 
/Users/stardiviner/Code/Emacs/org-mode/lisp/)
- System: macOS Big Sur 11.6.1
- Python: Anaconda python3 /Users/stardiviner/opt/anaconda3/bin/python

-- 
[ 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: C-c C-, in a terminal?

2021-12-28 Thread Tim Cross


Anssi Saari  writes:

> Hi all, while it's not an ORG mode question exactly, I have a problem
> with org-insert-structure-template and it's default shortcut, C-c C-, in
> terminals.
>
> As C-, isn't usually a control character in a terminal, terminals send
> just the comma if I hit C-,. Some terminals (at least wsltty) do send
> some kind of control sequence but I don't know if mapping other
> terminals to do the same (Konsole and urxvt at least) and changing the
> keys for Emacs makes sense. I'd have to do it for every terminal I ever
> use.
>
> Alternatively, any suggestions for a more terminal friendly key
> combination for org-insert-structure-template in Emacs?

It is almost impossible to suggest an alternative key binding because
there are just too many variables involved. What you can use will depend
on what window manager you use and the key shortcuts it uses (which will
'steal' keys before Emacs get to see them) and on the terminal emulator
and the remote access protocol (i.e. ssh, telnet, tmux, screen etc) you
use. Then there is differences depending on what Emacs packages you are
using and what (if any) key bindings you have already defined and
whether they are global or local definitions etc.

My suggestion would be to use something like the free-keys (available in
melpa) package to identify what key bindings are available when in an
org buffer and select one of those. It may also be worthwhile
considering using something like hydra. You could define an org specific
hydra and associate all your preferred bindings to that hydra. Org can
be particularly challenging because it already has some complex key
bindings, so avoiding unexpected side effects when adding/changing
bindings can be a challenge. 




Re: Export org to just body HTML

2021-12-28 Thread Thomas Ingram
Kyle Meyer  writes:

> Have you tried selecting "Body only" when exporting to an HTML buffer?
> With the default bindings, that'd be 'C-c C-e C-b h H'.

This is close to what I want, but I lose the title etc..  Ideally I'd
like to keep all information usually printed in the HTML body.

Thanks!




Re: Export org to just body HTML

2021-12-28 Thread Kyle Meyer
Thomas Ingram writes:

> Hello,
>
> I was wondering if there is an easy to export an org file to HTML that
> is just the body of the HTML document.  Or to put it differently, just
> the HTML formatting that is actually displayed on the page and no extra
> metadata (no DOCTYPE, html, head tags etc).
>
> I often need this for inserting HTML into existing documents or for text
> boxes that support HTML formatting.

Have you tried selecting "Body only" when exporting to an HTML buffer?
With the default bindings, that'd be 'C-c C-e C-b h H'.



Export org to just body HTML

2021-12-28 Thread Thomas Ingram


Hello,

I was wondering if there is an easy to export an org file to HTML that
is just the body of the HTML document.  Or to put it differently, just
the HTML formatting that is actually displayed on the page and no extra
metadata (no DOCTYPE, html, head tags etc).

I often need this for inserting HTML into existing documents or for text
boxes that support HTML formatting.

Any help is appreciated, thank you.

--
Thomas Ingram



bug#52545: 29.0.50; Make org-babel-execute-buffer ignore irrelevant src blocks

2021-12-28 Thread General discussions about Org-mode.
Max Nikulin  writes:

> No, it means instruction to unload support of emacs-lisp even it was 
> loaded before.

I see.  Thank you for the explanation!  I misunderstood the (rather
unusual) "org-babel-do-load-languages" API despite having read the
documentation.

> I do not insist that current behavior is the best possible. There are 
> still some reasons behind such choice.

Then, perhaps Ihor had the best idea, where Org would become smart
enough to avoid "executing BibTeX" and similar?

Rudy
-- 
"I love deadlines. I love the whooshing noise they make as they go by."
-- Douglas Adams, The Salmon of Doubt

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





Re: [SOLVED]

2021-12-28 Thread Uwe Brauer
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer  writes:
>> I found the culprit, the recently installed org-real pkg.
>> 
>> I uninstalled it and everything was back to normally.

> Hmm. I suspect that org-real might not be the problem by itself. Rather
> you may load it too early and pull-in built-in org.

Well I don't load anything, that is all done by the package system.


smime.p7s
Description: S/MIME cryptographic signature


[BUG] Setting org-map-continue from to avoid skipping headings while archiving no longer works [9.5.2 (9.5.2-gd01235 @ /home/john/.emacs.d/straight/build/org/)]

2021-12-28 Thread John Mathena
It's a common workflow to iterate over all Org headings in a given file,
archiving those marked with the "DONE" keyword. The only problem is that
archiving changes the structure of the file you're operating on, so if you
have test.org:

* DONE A
* DONE B
* DONE C
* DONE D

A will be archived, moving [B, C, D] up, with point on B. Then, point is
advanced to the next heading, so B gets skipped in favor of C getting
archived. The end result is B and D remaining in the file instead of being
archived.

In Org 9.4.4, you can fix this issue with a snippet like this:

(defun my-org-archive-done-tasks ()
  "Archive all top-level tasks with the DONE keyword in the current file."
  (interactive)
  (org-map-entries
   (lambda ()
 (org-archive-subtree)
 (setq org-map-continue-from (org-element-property :begin
(org-element-at-point
   "LEVEL=1/DONE"
   'file))

...where you set org-map-continue-from in order to avoid skipping every
other heading. However, upon updating to Org 9.5.2-gd01235, this function
no longer works - if you have a file like test.org above, eval
"my-org-archive-done-tasks", and try to run it on the file, every other
heading is still skipped. I verified this by trying this function on
test.org twice, first after running "emacs -Q", and then after doing "emacs
-Q -l ~/.emacs.d/straight/repos/straight.el/bootstrap.el" and "M-x
straight-use-package org"

I believe this is a result of recent additions in org-scan-tags - I hit a
dead end there while trying to determine the exact cause of the change (the
caching stuff that was added is spooky for a new user like me).

Is the snippet above no longer expected to work in Org 9.5.2 due to the
logic for mapping over entries having changed, or is this a bug? If it's
the former, what's the intended way of archiving all DONE tasks in a file
now?

Emacs   : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.27, cairo version 1.17.4) of 2021-03-26
Package: Org mode version 9.5.2 (9.5.2-gd01235 @
/home/john/.emacs.d/straight/build/org/)

(And the function above *does* work in Package: Org mode version 9.4.4
(release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/))

Best,
John


Re: caption width in LateX export

2021-12-28 Thread Eric S Fraga
On Tuesday, 28 Dec 2021 at 09:59, Seb wrote:
> That is strange, as it actually should not work (it still doesn't for me
> with your code).  

Well, it won't work if the figure is to float but will if you ask org to
not float the figure.

> However, I had made a mistake in my original post as I meant to have
> the minipage environment inside the floating figure environment in the
> output, as in:

That makes more sense and, for this case, special blocks cannot work
unfortunately.

I'm glad you did find a working solution but I simply wanted to clarify
that you can indeed pass options to special blocks which your original
post seemed to state was not possible.  I use special blocks all the
time, including minipages but others as well for custom LaTeX
environments.
-- 
: Eric S Fraga, with org release_9.5.1-279-g8908fb in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: caption width in LateX export

2021-12-28 Thread Seb
On Tue, 28 Dec 2021 14:58:35 +,
Eric S Fraga  wrote:

> On Sunday, 26 Dec 2021 at 19:22, Seb wrote:
>> Using a special block, as in:

> [...]

>> fails, as it seems impossible to pass arguments to the special block.

> Not true.  The following seems to create the LaTeX code you wanted:

> #+attr_latex: :options {0.7\textwidth} #+begin_minipage

> #+CAPTION: looong caption.  [[file_path]]

> #+end_minipage

That is strange, as it actually should not work (it still doesn't for me
with your code).  However, I had made a mistake in my original post as I
meant to have the minipage environment inside the floating figure
environment in the output, as in:

------
\begin{figure}[htbp]
  \centering
  \begin{minipage}{0.5\textwidth}
\includegraphics[width=\textwidth]{FILE_PATH}
\caption{\label{ORG_LABEL}Lorem ipsum dolor sit amet, consectetuer
  adipiscing elit.}
  \end{minipage}
\end{figure}
------

which does compile fine.  Apologies for the confusion this may have
caused.

The previous post by Juan Manuel did provide a neat solution, which I'll
be tweaking to implement this as I never need captions running across
the whole page for figures using much less.

-- 
Seb




Re: caption width in LateX export

2021-12-28 Thread Eric S Fraga
On Sunday, 26 Dec 2021 at 19:22, Seb wrote:
> Using a special block, as in:

[...]

> fails, as it seems impossible to pass arguments to the special block.

Not true.  The following seems to create the LaTeX code you wanted:

--8<---cut here---start->8---
#+attr_latex: :options {0.7\textwidth}
#+begin_minipage

#+CAPTION: looong caption.
[[file_path]]

#+end_minipage
--8<---cut here---end--->8---

HTH,
eric

-- 
: Eric S Fraga, with org release_9.5.1-279-g8908fb in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: flyspell overlays removed in comments: does this make sense?

2021-12-28 Thread Eric S Fraga
On Wednesday, 22 Dec 2021 at 22:10, Ihor Radchenko wrote:
> I consider this a bug and mark your report as such.

Thank you.  I'm glad I'm not alone!

-- 
: Eric S Fraga, with org release_9.5.1-279-g8908fb in Emacs 29.0.50
: Latest paper written in org: https://arxiv.org/abs/2106.05096



Re: [SOLVED] (was: [BUG] org-persist [9.5 (release_9.5-194-gdb302d @ /home/oub/emacs/site-lisp/packages/org/)])

2021-12-28 Thread Ihor Radchenko
Uwe Brauer  writes:

> I found the culprit, the recently installed org-real pkg.
>
> I uninstalled it and everything was back to normally.

Hmm. I suspect that org-real might not be the problem by itself. Rather
you may load it too early and pull-in built-in org.

Best,
Ihor



[SOLVED] (was: [BUG] org-persist [9.5 (release_9.5-194-gdb302d @ /home/oub/emacs/site-lisp/packages/org/)])

2021-12-28 Thread Uwe Brauer
>>> "UB" == Uwe Brauer  writes:

> In connection with my earlier bug report, here is the backtrace when starting 
> emacs

> Debugger entered--Lisp error: (void-function org-file-name-concat)

> (void-variable org-descriptive-links)

> You should still send this bug report.


I found the culprit, the recently installed org-real pkg.

I uninstalled it and everything was back to normally.

Regards

Uwe Brauer


smime.p7s
Description: S/MIME cryptographic signature


[BUG] org-persist [9.5 (release_9.5-194-gdb302d @ /home/oub/emacs/site-lisp/packages/org/)]

2021-12-28 Thread Uwe Brauer

In connection with my earlier bug report, here is the backtrace when starting 
emacs
Debugger entered--Lisp error: (void-function org-file-name-concat)
  org-file-name-concat("/home/oub/.cache" "org-persist/")
  byte-code("\301\302\303 \304\1!\203\16\0\10\202\17\0\211\262\1\305\"!\207" 
[user-emacs-directory expand-file-name org-file-name-concat xdg-cache-home 
seq-empty-p "org-persist/"] 5)
  (defvar org-persist-directory (byte-code "\301\302\303 
\304\1!\203\16\0\10\202\17\0\211\262\1\305\"!\207" [user-emacs-directory 
expand-file-name org-file-name-concat xdg-cache-home seq-empty-p 
"org-persist/"] 5) ("/home/oub/emacs/site-lisp/packages/org/org-persist..." . 
175))
  require(org-persist)
  
byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\210\300\311!\210\300\312!\210\300\313!\210\300\314!\207"
 [require avl-tree ring cl-lib ol org org-persist org-compat org-entities 
org-footnote org-list org-macs org-table] 2)
  require(org-element)
  
byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\207"
 [require cl-lib ob-exp oc oc-basic ol org-element org-macro tabulated-list] 2)
  require(ox)
  
byte-code("\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\306\307\310\311\312\313\314\315\316&\10\207"
 [require cl-lib format-spec ox ox-publish table org-export-define-backend html 
((bold . org-html-bold) (center-block . org-html-center-block) (clock . 
org-html-clock) (code . org-html-code) (drawer . org-html-drawer) 
(dynamic-block . org-html-dynamic-block) (entity . org-html-entity) 
(example-block . org-html-example-block) (export-block . org-html-export-block) 
(export-snippet . org-html-export-snippet) (fixed-width . org-html-fixed-width) 
(footnote-reference . org-html-footnote-reference) (headline . 
org-html-headline) (horizontal-rule . org-html-horizontal-rule) 
(inline-src-block . org-html-inline-src-block) (inlinetask . 
org-html-inlinetask) (inner-template . org-html-inner-template) (italic . 
org-html-italic) (item . org-html-item) (keyword . org-html-keyword) 
(latex-environment . org-html-latex-environment) (latex-fragment . 
org-html-latex-fragment) (line-break . org-html-line-break) (link . 
org-html-link) (node-property . org-html-node-property) (paragraph . 
org-html-paragraph) (plain-list . org-html-plain-list) (plain-text . 
org-html-plain-text) (planning . org-html-planning) (property-drawer . 
org-html-property-drawer) (quote-block . org-html-quote-block) (radio-target . 
org-html-radio-target) (section . org-html-section) (special-block . 
org-html-special-block) (src-block . org-html-src-block) (statistics-cookie . 
org-html-statistics-cookie) (strike-through . org-html-strike-through) 
(subscript . org-html-subscript) (superscript . org-html-superscript) (table . 
org-html-table) (table-cell . org-html-table-cell) (table-row . 
org-html-table-row) (target . org-html-target) (template . org-html-template) 
...) :filters-alist ((:filter-options . org-html-infojs-install-script) 
(:filter-parse-tree . org-html-image-link-filter) (:filter-final-output . 
org-html-final-function)) :menu-entry (104 "Export to HTML" ((72 "As HTML 
buffer" org-html-export-as-html) (104 "As HTML file" org-html-export-to-html) 
(111 "As HTML file and open" (lambda (a s v b) (if a ... ...) 
:options-alist ((:html-doctype "HTML_DOCTYPE" nil org-html-doctype) 
(:html-container "HTML_CONTAINER" nil org-html-container-element) 
(:html-content-class "HTML_CONTENT_CLASS" nil org-html-content-class) 
(:description "DESCRIPTION" nil nil newline) (:keywords "KEYWORDS" nil nil 
space) (:html-html5-fancy nil "html5-fancy" org-html-html5-fancy) 
(:html-link-use-abs-url nil "html-link-use-abs-url" org-html-link-use-abs-url) 
(:html-link-home "HTML_LINK_HOME" nil org-html-link-home) (:html-link-up 
"HTML_LINK_UP" nil org-html-link-up) (:html-mathjax "HTML_MATHJAX" nil "" 
space) (:html-equation-reference-format "HTML_EQUATION_REFERENCE_FORMAT" nil 
org-html-equation-reference-format t) (:html-postamble nil "html-postamble" 
org-html-postamble) (:html-preamble nil "html-preamble" org-html-preamble) 
(:html-head "HTML_HEAD" nil org-html-head newline) (:html-head-extra 
"HTML_HEAD_EXTRA" nil org-html-head-extra newline) (:subtitle "SUBTITLE" nil 
nil parse) (:html-head-include-default-style nil "html-style" 
org-html-head-include-default-style) (:html-head-include-scripts nil 
"html-scripts" org-html-head-include-scripts) 
(:html-allow-name-attribute-in-anchors nil nil 
org-html-allow-name-attribute-in-anchors) (:html-divs nil nil org-html-divs) 
(:html-checkbox-type nil nil org-html-checkbox-type) (:html-extension nil nil 
org-html-extension) (:html-footnote-format nil nil org-html-footnote-format) 
(:html-footnote-separator nil nil org-html-footnote-separator) 
(:html-footnotes-section nil nil org-html-footnotes-section) 
(:html-format-drawer-function nil nil 

[BUG] org-compat stops working [9.5 (release_9.5-194-gdb302d @ /home/oub/emacs/site-lisp/packages/org/)]

2021-12-28 Thread Uwe Brauer


Out of a sudden, when starting emacs I obtain various errors that seem to be 
conntected to try to load

org-compat I obtain 



Debugger entered--Lisp error: (error "Don’t know how to make a localized 
variable an alias")
  defvaralias(org-descriptive-links org-link-descriptive nil)
  eval-buffer(# nil 
"/home/oub/ALLES/emacs/site-lisp/packages/org/org-compat.el" nil t)  ; Reading 
at buffer position 23665
  
load-with-code-conversion("/home/oub/ALLES/emacs/site-lisp/packages/org/org-c..."
 "/home/oub/ALLES/emacs/site-lisp/packages/org/org-compat.el" nil nil)
  load("/home/oub/ALLES/emacs/site-lisp/packages/org/org-compat.el" nil nil t)
  load-file("~/ALLES/emacs/site-lisp/packages/org/org-compat.el")
  funcall-interactively(load-file 
"~/ALLES/emacs/site-lisp/packages/org/org-compat.el")
  call-interactively(load-file nil nil)
  command-execute(load-file)



Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo 
version 1.14.6, Xaw3d scroll bars)
 of 2021-11-08
Package: Org mode version 9.5 (release_9.5-194-gdb302d @ 
/home/oub/emacs/site-lisp/packages/org/)

current state:
==
State could not be dumped due to the following error:

(void-variable org-descriptive-links)

You should still send this bug report.



Re: [PATCH] ox-icalendar.el: create alarm at event time

2021-12-28 Thread Mikhail Skorzhinskii
Hi Nicolas,

Thank you for the review, appreciate your comments. I've applied your
suggestions. Please find the fixed file in the attachment to this
letter.

There is one important note that about this patch. There is one corner
case: when we've set org-icalendar-force-alarm variable to nil, org-
icalendar-alarm-time variable to non-nil and the APPT_WARNTIME property
is set to 0, then, with my code, the value of the org-icalendar-alarm-
time would be used.

Basically if user is not forcing the 'zero alarms', and has some non-
zero default value for alarms, the APPT_WARNTIME property will use
default alarm. Which is something, I would say, unexpected. I would
expect that alarm will be shut-off.

However I am just keeping the previous behaviour. I think its worth
fixing, but I'd say we do this in a separate patch.

Let me know what you think.

Thanks,
Mikhail

On Sun, 2021-12-26 at 22:22 +0100, Nicolas Goaziou wrote:
> Hello,
> 
> Mikhail Skorzhinskii  writes:
> 
> > * lisp/ox-icalendar.el (org-icalendar-force-alarm): option to set
> > alarm
> > even if alarm time is set to zero.
> > * lisp/ox-icalendar.el (org-icalendar--valarm): create VALARM at
> > the
> > event start if the alarm time is set to zero and
> > `org-icalendar-force-alarm' is set to true.
> 
> Thanks. Some comments follow.
> 
> > +(defcustom org-icalendar-force-alarm nil
> > +  "Non-nil means alarm will be created even if is set to zero.
> > +
> > +This overrides default behaviour where zero means no alarm. With
>  ^^^
> You need two spaces after full stop.
> 
> > +this set to non-nil and alarm set to zero, alarm will be created
> > +and will fire at the event start."
> > +  :group 'org-export-icalendar
> > +  :type 'bool)
> 
> `boolean' is the valid type.
> 
> You also need to add :package-version '(Org . "9.6") and :safe
> #'booleanp.
> > +    (if org-icalendar-force-alarm
> > +    (if alarm-time
> > +    alarm-time
> > +  org-icalendar-alarm-time)
> > +  (if (zerop alarm-time)
> > +  org-icalendar-alarm-time
> > +    alarm-time))
> 
> I suggest to refactor the above into something like:
> 
> (cond
>  ((> alarm-time 0) alarm-time)
>  ((and (= 0 alarm-time) org-icalendar-force-alarm) alarm-time)
>  (t org-icalendar-alarm-time))
> 
> Could you send an updated patch?
> 
> Regards,
> -- 
> Nicolas Goaziou
From 39b0df3309607f61d108402748d6646939f98696 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Sat, 12 Sep 2020 18:52:39 +0200
Subject: [PATCH 4/5] ox-icalendar.el: create alarm at event time

* lisp/ox-icalendar.el (org-icalendar-force-alarm): option to set alarm
even if alarm time is set to zero.
* lisp/ox-icalendar.el (org-icalendar--valarm): create VALARM at the
event start if the alarm time is set to zero and
`org-icalendar-force-alarm' is set to true.
---
 lisp/ox-icalendar.el | 24 
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 189e35946..1870a72b8 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -66,6 +66,17 @@ for timed events.  If non-zero, alarms are created.
   :version "24.1"
   :type 'integer)
 
+(defcustom org-icalendar-force-alarm nil
+  "Non-nil means alarm will be created even if is set to zero.
+
+This overrides default behaviour where zero means no alarm.  With
+this set to non-nil and alarm set to zero, alarm will be created
+and will fire at the event start."
+  :group 'org-export-icalendar
+  :type 'boolean
+  :package-version '(Org . "9.6")
+  :safe #'booleanp)
+
 (defcustom org-icalendar-combined-name "OrgMode"
   "Calendar name for the combined iCalendar representing all agenda files."
   :group 'org-export-icalendar
@@ -807,8 +818,11 @@ Return VALARM component as a string, or nil if it isn't allowed."
   (let ((alarm-time
 	 (let ((warntime
 		(org-element-property :APPT_WARNTIME entry)))
-	   (if warntime (string-to-number warntime) 0
-(and (or (> alarm-time 0) (> org-icalendar-alarm-time 0))
+	   (if warntime (string-to-number warntime) nil
+(and (or (and alarm-time
+		  (> alarm-time 0))
+	 (> org-icalendar-alarm-time 0)
+	 org-icalendar-force-alarm)
 	 (org-element-property :hour-start timestamp)
 	 (format "BEGIN:VALARM
 ACTION:DISPLAY
@@ -816,8 +830,10 @@ DESCRIPTION:%s
 TRIGGER:-P0DT0H%dM0S
 END:VALARM\n"
 		 summary
-		 (if (zerop alarm-time) org-icalendar-alarm-time alarm-time)
-
+ (cond
+  ((and alarm-time org-icalendar-force-alarm) alarm-time)
+  ((and alarm-time (not (zerop alarm-time))) alarm-time)
+  (t org-icalendar-alarm-time))
 
  Template
 
-- 
2.32.0



Re: [PATCH] ox-icalendar.el: customizable vevent summary prefix

2021-12-28 Thread Mikhail Skorzhinskii
Hi Nicolas,

Thank you for the reviewing my suggestions. I've fixed issues you've
listed. I've attached new patch to this email.

Let me know what you think.

Thanks,
Mikhail

On Sun, 2021-12-26 at 22:26 +0100, Nicolas Goaziou wrote:
> Hello,
> 
> Thanks. Some comments follow.
> 
> Mikhail Skorzhinskii  writes:
> 
> > * lisp/ox-icalendar.el (org-icalendar-scheduled-summary-prepend):
> > configurable prefix for the scheduled headlines
> 
> "New variable" is enough.
> 
> > * lisp/ox-icalendar.el (org-icalendar-deadline-summary-prepend):
> > configurable prefix for the headlines with a deadline
> 
> Ditto.
> 
> > +(defcustom org-icalendar-scheduled-summary-prepend "S: "
> > +  "String used for prepending summary in exported scheduled
> > headlines."
> > +  :group 'org-export-icalendar
> > +  :type 'string)
> > +
> > +
> > +(defcustom org-icalendar-deadline-summary-prepend "DL: "
> > +  "String used for prepending summary in exported deadlines."
> > +  :group 'org-export-icalendar
> > +  :type 'string)
> > +
> 
> Could you add missing :safe and :package-version keywords?
> 
> Regards,
From 6849f0dde1cc8fefbfea0271039e5066a3cb2746 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Sat, 12 Sep 2020 18:27:23 +0200
Subject: [PATCH 3/5] ox-icalendar.el: customizable vevent summary prefix

* lisp/ox-icalendar.el (org-icalendar-scheduled-summary-prepend): new
variable
* lisp/ox-icalendar.el (org-icalendar-deadline-summary-prepend): new
variable
* lisp/ox-icalendar.el (org-icalendar-entry): use a configurable
headline prefixes (see above) instead of hardcoded ones
---
 lisp/ox-icalendar.el | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/lisp/ox-icalendar.el b/lisp/ox-icalendar.el
index 68c5679ea..189e35946 100644
--- a/lisp/ox-icalendar.el
+++ b/lisp/ox-icalendar.el
@@ -84,6 +84,21 @@ keyword."
   :group 'org-export-icalendar
   :type '(repeat (string :tag "Tag")))
 
+(defcustom org-icalendar-scheduled-summary-prepend "S: "
+  "String used for prepending summary in exported scheduled headlines."
+  :group 'org-export-icalendar
+  :type 'string
+  :package-version '(Org . "9.6")
+  :safe #'stringp)
+
+
+(defcustom org-icalendar-deadline-summary-prepend "DL: "
+  "String used for prepending summary in exported deadlines."
+  :group 'org-export-icalendar
+  :type 'string
+  :package-version '(Org . "9.6")
+  :safe #'stringp)
+
 (defcustom org-icalendar-use-deadline '(event-if-not-todo todo-due)
   "Contexts where iCalendar export should use a deadline time stamp.
 
@@ -607,7 +622,7 @@ inlinetask within the section."
 		   (_ (memq 'event-if-not-todo use-deadline)))
 		 (org-icalendar--vevent
 		  entry deadline (concat "DL-" uid)
-		  (concat "DL: " summary) loc desc cat tz class)))
+		  (concat org-icalendar-deadline-summary-prepend summary) loc desc cat tz class)))
 	  (let ((scheduled (org-element-property :scheduled entry))
 		(use-scheduled (plist-get info :icalendar-use-scheduled)))
 	(and scheduled
@@ -618,7 +633,7 @@ inlinetask within the section."
 		   (_ (memq 'event-if-not-todo use-scheduled)))
 		 (org-icalendar--vevent
 		  entry scheduled (concat "SC-" uid)
-		  (concat "S: " summary) loc desc cat tz class)))
+		  (concat org-icalendar-scheduled-summary-prepend summary) loc desc cat tz class)))
 	  ;; When collecting plain timestamps from a headline and its
 	  ;; title, skip inlinetasks since collection will happen once
 	  ;; ENTRY is one of them.
-- 
2.32.0



Re: [PATCH] org-agenda.el: customise outline path in echo area

2021-12-28 Thread Mikhail Skorzhinskii
Hi Ihor,

Thank you for your comments once again. I've changed string= to eq and
it appears to be working OK.

I've also renamed "title" variable to "title-prop" for better
readability. The -prop suffix should show the reader that it was
extracted from the file, and thus cost some CPU/IO.

I've attached an updated version to this email. Would love to hear what
you think.

Thanks,
Mikhail

On Sun, 2021-12-26 at 21:44 +0800, Ihor Radchenko wrote:
> Mikhail Skorzhinskii  writes:
> 
> Thanks for the patch! The addition looks reasonable to me.
> 
> > +    (title (when (and file-or-title (string= file-or-title
> > 'title))
> > ...
> > +  (and file-or-title bfn (concat (if (and (string= file-
> > or-
> > title 'title) title)
> 
> (string= file-or-title 'title) will match FILE-OR-TITLE values
> "title"
> and 'title. I am not sure if it is what you intended to achieve.
> Probably, a simple (eq file-or-title 'title) would be sufficient.
> 
> Best,
> Ihor
From 1a09ea522b51f2a418b58f0f6122c578a836f69f Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Sat, 12 Sep 2020 18:10:05 +0200
Subject: [PATCH 1/5] org-agenda.el: customize outline path in echo area

* lisp/org-agenda.el (org-agenda-show-outline-path): add an option to
show document title in outline path (instead of file name)
* lisp/org.el (org-get-title-from-file): a function to collect the
document title from the org-mode file
* lisp/org.el (org-display-outline-path): add logic that will collect a
document title and put it into the outline path if
org-agenda-show-outline-path set to 'title
---
 lisp/org-agenda.el | 11 ---
 lisp/org.el| 25 ++---
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 721ef2ced..817354659 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -1045,9 +1045,14 @@ current item's tree, in an indirect buffer."
   :type 'boolean)
 
 (defcustom org-agenda-show-outline-path t
-  "Non-nil means show outline path in echo area after line motion."
+  "Non-nil means show outline path in echo area after line motion.
+
+If set to 'title, show document title."
   :group 'org-agenda-startup
-  :type 'boolean)
+  :type '(choice
+	  (const :tag "Don't show outline path in agenda view." nil)
+	  (const :tag "Show outline path with prepended file name." t)
+	  (const :tag "Show outline path with prepended document title. Fallback to file name is no title is present." title)))
 
 (defcustom org-agenda-start-with-entry-text-mode nil
   "The initial value of entry-text-mode in a newly created agenda window."
@@ -9354,7 +9359,7 @@ When called with a prefix argument, include all archive files as well."
 	   (org-agenda-tree-to-indirect-buffer nil)
 	 (org-agenda-show)))
   (and org-agenda-show-outline-path
-	   (org-with-point-at m (org-display-outline-path t))
+	   (org-with-point-at m (org-display-outline-path org-agenda-show-outline-path))
 
 (defun org-agenda-show-tags ()
   "Show the tags applicable to the current item."
diff --git a/lisp/org.el b/lisp/org.el
index ce4e08eab..8790c72ab 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8166,10 +8166,24 @@ the default is \"/\"."
 	(setf (substring fpath (- width 2)) "..")))
 fpath))
 
-(defun org-display-outline-path ( file current separator just-return-string)
+(defun org-get-title-from-file (file)
+  "Collect tilte from the provided `org-mode' FILE."
+  (let (title)
+(when file
+  (with-current-buffer
+	  (get-file-buffer file)
+	(pcase (org-collect-keywords '("TITLE"))
+	  (`(("TITLE" . ,val))
+	   (setq title (car val)
+  title)))
+
+
+(defun org-display-outline-path ( file-or-title current separator just-return-string)
   "Display the current outline path in the echo area.
 
-If FILE is non-nil, prepend the output with the file name.
+If FILE-OR-TITLE is 'title, prepend outline with file title.  If
+it is non-nil or title is not present in document, prepend
+outline path with the file name.
 If CURRENT is non-nil, append the current heading to the output.
 SEPARATOR is passed through to `org-format-outline-path'.  It separates
 the different parts of the path and defaults to \"/\".
@@ -8177,6 +8191,8 @@ If JUST-RETURN-STRING is non-nil, return a string, don't display a message."
   (interactive "P")
   (let* (case-fold-search
 	 (bfn (buffer-file-name (buffer-base-buffer)))
+	 (title-prop (when (and file-or-title (eq file-or-title 'title))
+		  (org-get-title-from-file bfn)))
 	 (path (and (derived-mode-p 'org-mode) (org-get-outline-path)))
 	 res)
 (when current (setq path (append path
@@ -8188,7 +8204,10 @@ If JUST-RETURN-STRING is non-nil, return a string, don't display a message."
 	  (org-format-outline-path
 	   path
 	   (1- (frame-width))
-	   (and file bfn (concat (file-name-nondirectory bfn) separator))
+	   (and file-or-title bfn (concat (if (and (eq file-or-title 'title) title-prop)
+	  title-prop
+	

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

2021-12-28 Thread Mikhail Skorzhinskii
Hi Ihor,

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.

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

I've attached new patch to this email. Let me know what you think.

Thanks,
Mikhail

On Sun, 2021-12-26 at 21:59 +0800, Ihor Radchenko wrote:
> Mikhail Skorzhinskii  writes:
> 
> > * lisp/org-refile.el (org-refile-use-outline-path): add an option
> > 'title
> 
> This is an interesting idea. However, your patch may break things
> quite
> badly. Look at `org-refile-get-location'. It expects a very specific
> format for the refile targets and treats 'file/'full-file-path values
> specially.
> 
> Can you add tests for your new value of org-refile-use-outline-path
> and
> make sure that they do not fail after applying your patch?
> 
> Best,
> Ihor
> 
> 
From e6d3aae4a75e50423924e0eacbcd94cdea7dafe8 Mon Sep 17 00:00:00 2001
From: Mikhail Skorzhinskii 
Date: Mon, 21 Sep 2020 14:53:13 +0200
Subject: [PATCH 2/5] org-refile.el: show refile targets with doc. title

* 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
---
 lisp/org-refile.el   | 18 +++---
 testing/lisp/test-org.el | 29 -
 2 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index 678759e10..644e9f497 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -158,7 +158,8 @@ When `buffer-name', use the buffer name."
 	  (const :tag "Yes" t)
 	  (const :tag "Start with file name" file)
 	  (const :tag "Start with full file path" full-file-path)
-	  (const :tag "Start with buffer name" buffer-name)))
+	  (const :tag "Start with buffer name" buffer-name)
+	  (const :tag "Start with document title" title)))
 
 (defcustom org-outline-path-complete-in-steps t
   "Non-nil means complete the outline path in hierarchical steps.
@@ -317,6 +318,9 @@ converted to a headline before refiling."
 		 (push (list (and (buffer-file-name (buffer-base-buffer))
   (file-truename (buffer-file-name (buffer-base-buffer
  f nil nil) tgs))
+	   (when (eq org-refile-use-outline-path 'title)
+		 (push (list (or (org-get-title-from-file (file-truename (buffer-file-name (buffer-base-buffer
+ (and f (file-name-nondirectory f))) f nil nil) tgs))
 	   (org-with-wide-buffer
 		(goto-char (point-min))
 		(setq org-outline-path-cache nil)
@@ -343,7 +347,15 @@ converted to a headline before refiling."
(and (buffer-file-name (buffer-base-buffer))
 (file-name-nondirectory
  (buffer-file-name (buffer-base-buffer))
-   (`full-file-path
+   (`title (list
+(or
+ (org-get-title-from-file
+  (file-truename
+   (buffer-file-name (buffer-base-buffer
+ (and (buffer-file-name (buffer-base-buffer))
+ (file-name-nondirectory
+  (buffer-file-name (buffer-base-buffer)))
+   (`full-file-path
 (list (buffer-file-name
 	   (buffer-base-buffer
    (`buffer-name
@@ -631,7 +643,7 @@ this function appends the default value from
 	 (tbl (mapcar
 	   (lambda (x)
 		 (if (and (not (member org-refile-use-outline-path
-   '(file full-file-path)))
+   '(file full-file-path title)))
 			  (not (equal filename (nth 1 x
 		 (cons (concat (car x) extra " ("
    (file-name-nondirectory (nth 1 x)) ")")
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 056ea7d87..a6df00baf 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -6435,7 +6435,34 @@ Paragraph"
(org-test-with-temp-text "* H1"
  (let* ((org-refile-use-outline-path 'buffer-name)
 	(org-refile-targets `((nil :level . 1
-   (member (buffer-name) (mapcar #'car (org-refile-get-targets)))
+   (member (buffer-name) (mapcar #'car (org-refile-get-targets))
+  ;; When `org-refile-use-outline-path' is `title', return extracted
+  ;; document title
+  (should
+   (equal '("T" "T/H1")
+  (org-test-with-temp-text-in-file "#+title: T\n* H1"
+(let* ((filename (buffer-file-name))
+   (org-refile-use-outline-path 'title)
+   (org-refile-targets `(((,filename) :level . 1
+  (mapcar #'car 

bug#52545: 29.0.50; Make org-babel-execute-buffer ignore irrelevant src blocks

2021-12-28 Thread Max Nikulin

On 28/12/2021 04:37, Rudolf Adamkovič wrote:

Max Nikulin writes:


Let's consider the following example:

 >8 
Test

#+begin_src elisp
(message "Test")
#+end_src
 8< -

emacs -Q -L ~/src/org-mode/lisp/ --eval "(custom-set-variables
'(org-babel-load-languages '((emacs-lisp . nil" babel-exec.org

Do you agree that "No org-babel-execute function for elisp!" is a
reasonable reaction to `org-babel-execute-buffer`?


The user did ask Org to load "emacs-lisp" but to never execute it.
Thus, I would expect Org to do just that.  What do you think?


No, it means instruction to unload support of emacs-lisp even it was 
loaded before.


See info "(org) Languages" https://orgmode.org/manual/Languages.html and 
`org-babel-do-load-languages' function. The latter may be considered too 
technical for ordinary user, but examples of its usage are excessively 
proliferated, e.g. it is mentioned for every supported language on Worg 
https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-octave.html


The function is called when the value of `org-babel-load-languages' is 
changed through easy customization interface, so (emacs-lisp . nil) is a 
command rather than a declaration.


The use case is to temporary enable support of some language and later 
to disable it again without terminating of emacs session. Just to avoid 
accidental execution of some snippet.


I can not say that your expectation of the effect of nil is a nonsense, 
but changing its interpretation may cause silent failures and as a 
result upset users. Consider that a file that includes source code 
blocks for different languages is moved to another machine (or 
configuration changed since previous execution on the same machine). It 
is better to get explicit error than to copy result in a hurry and to 
discover that it is incomplete some time later. Per-file and per-block 
configuration is safer against such pitfalls.


I do not insist that current behavior is the best possible. There are 
still some reasons behind such choice.






Re: C-c C-, in a terminal?

2021-12-28 Thread Vincent Breton
Hi Anssi Saari,

In my opinion, your first section is about org but reading others it
seams to be a question about terminals so I think your message is one
about setup of terminals or about remote protocols. Your question stay
interesting because that means some people use org-mode with terminals
and have some troubles with them, another large subject but not a
(directly) orgmode subject.  For example, I use regularly remote systems
and terminals (or intermediary parts) are not very friendly with my
IDE... They are very famous (standard) terminals as the VT100 -- on
Windows putty software emulate it -- On Linux, some software as vttest
can hep you to test the compatibility of your terminals but that
interesting subject stay far away of orgmode. You can for example read
https://www.emacswiki.org/emacs/EmacsOnTerminal.

Here a very simple figure (ok, vulgarisation is not probably the true 8)

terminal -> emacs -> orgmode

terminal -> ssh (for example) -> emacs -> orgmode

Sure if your trouble is about orgmode or between emacs and orgmode your
question fullfill this list and my reply too 8).

Best regards

On 28/12/2021 09:25, Anssi Saari wrote:
> Hi all, while it's not an ORG mode question exactly, I have a problem
> with org-insert-structure-template and it's default shortcut, C-c C-, in
> terminals.
>
> As C-, isn't usually a control character in a terminal, terminals send
> just the comma if I hit C-,. Some terminals (at least wsltty) do send
> some kind of control sequence but I don't know if mapping other
> terminals to do the same (Konsole and urxvt at least) and changing the
> keys for Emacs makes sense. I'd have to do it for every terminal I ever
> use.
>
> Alternatively, any suggestions for a more terminal friendly key
> combination for org-insert-structure-template in Emacs?
>
>
>
>







C-c C-, in a terminal?

2021-12-28 Thread Anssi Saari


Hi all, while it's not an ORG mode question exactly, I have a problem
with org-insert-structure-template and it's default shortcut, C-c C-, in
terminals.

As C-, isn't usually a control character in a terminal, terminals send
just the comma if I hit C-,. Some terminals (at least wsltty) do send
some kind of control sequence but I don't know if mapping other
terminals to do the same (Konsole and urxvt at least) and changing the
keys for Emacs makes sense. I'd have to do it for every terminal I ever
use.

Alternatively, any suggestions for a more terminal friendly key
combination for org-insert-structure-template in Emacs?