Re: Migrating from HUGO to org-publish

2020-12-09 Thread Alejandro Alcalde
Hello, at the end I manage to migrate without losing all hugo content.

https://elbauldelprogramador.com/org-posts/migrating-from-hugo-to-org-mode.html


Alejandro Alcalde  schrieb am Di. 12. Mai 2020 um 14:40:

> Hello, I am looking to migrate from Hugo to org-publish, is there an easy
> way? I’ve have found several guides to migrate from jekyll, like this one:
> https://duncan.codes/posts/2019-09-03-migrating-from-jekyll-to-org/index.html
> 2
> 
>
> Unfortunately I do not know how to do it smoothly with my set up.
>
> I have some posts written in plain org, that is no problem. But I also
> have the majority of my blog posts written in markdown (With YAML header
> and TOML header), since I once migrated from Jekyll to Hugo.
>
> I though maybe pandoc could help me in the process, but when converting a
> markdown file to org, I am loosing all TOML or YAML headers, so the
> resulting org file have no #+ properties.
>
> Any suggestions? I could write some python code that read YAML and TOML
> headers and output, but I have lots of custom headers (
> https://github.com/elbaulp/algui91-hugo/blob/master/content/post/create-deploy-telegram-bot.en.md)
> like url that will cause 404 errors when migrating to org-publish
>
> Thanks and Have a nice day.
>
>
> *-- Alejandro Alcalde - elbauldelprogramador.com
> *
>
-- 
*-- Alejandro Alcalde - elbauldelprogramador.com
*


Re: [PATCH] org-refile.el: Add org-refile-reverse which toggles org-reverse-note-order

2020-12-09 Thread Kyle Meyer


Thanks for the patch.

Adam Spiers writes:

> This is useful for prepending to the start of the target headline
> instead of appending to the end, or vice-versa depending on
> org-reverse-note-order.

It sounds like Bastien and Amin would also find this useful.  I would
have liked to see a few more people chime in because I'm lukewarm on it
myself, as I tend to think things like this are better suited for
personal customization.

In any case, I think we should go forward with it.  Could you add a
changelog entry to the commit message?

> diff --git a/doc/org-manual.org b/doc/org-manual.org
> index 3eb745b5d..e499367b7 100644
> --- a/doc/org-manual.org
> +++ b/doc/org-manual.org
> @@ -7190,6 +7190,16 @@ special command:
>Copying works like refiling, except that the original note is not
>deleted.
>  
> +- {{{kbd(C-c C-M-w)}}} (~org-refile-reverse~) ::
> +
> +  #+kindex: C-c C-M-w
> +  #+findex: org-refile-reverse
> +  Works like refiling, except that it temporarily toggles how the

It seems a bit odd to say it "works like refiling" when it _is_
refiling.  Perhaps "Works like ~org-refile~ ..." or the common "Like X
but ..." pattern?

> +  value of ~org-reverse-note-order~ applies to the current buffer.  So

I think the "applies to the current buffer" (here and in other spots)
doesn't add anything while possibly confusing the reader into thinking
that the toggling isn't in effect when refiling an entry to another
buffer.

[...]
> +;;;###autoload
> +(defun org-refile-reverse ( arg default-buffer rfloc msg)
> +  "Invoke `org-refile', but temporarily toggling how
> +~org-reverse-note-order~ applies to the current buffer.  So if

s/~org-reverse-note-order~/`org-reverse-note-order'/

The first line of the docstring should be self-contained for apropos and
friends.  Perhaps

  Invoke `org-refile' with `org-reverse-note-order' inverted.

However, there's also the question of what toggling means for users that
have configured org-reverse-note-order to a set of regular expressions.
I think it's worth noting in the docstring that this case is treated the
same as t (i.e. any non-nil value is mapped to nil).

> +`org-refile' would append the entry as the last entry under the
> +target heading, ~org-refile-reverse~ will prepend it as the first
> +entry, and vice-versa."

s/~org-refile-reverse~/`org-refile-reverse'/

> +  (interactive "P")
> +  (let ((org-reverse-note-order (not (org-notes-order-reversed-p
> +(org-refile arg default-buffer rfloc msg)))
> +
>  ;;;###autoload
>  (defun org-refile ( arg default-buffer rfloc msg)
>"Move the entry or entries at point to another heading.
> -- 
> 2.27.0



Re: Bug: Having '%p" in frame-title-format makes org-mode to freeze [9.4 (release_9.4-134-g0d525c @ /home/massimo/bugreport/org-mode/lisp/)]

2020-12-09 Thread Kyle Meyer


Massimo Lauria writes:

> Hi all,
>
> I recently came across this weird issue using org-mode. Essentially
> when I fold/unfold/fold some header in org-mode, pressing tab three
> times,
> I expect the section to fold again at the third keypress, and instead
> emacs freezes. By detective work I discovered that it has to do with
> having the '%p' option in
> frame-title-format. The bug disappeared when I took "%p" option away
> from frame-title-format.

Very nice detective work.  Thank you.

> * Steps to reproduce the bug
[...]

Yep, I can reproduce it on my end.

The culprit is a8e812e60 (org.el: Restore the scroll position after
cycling, 2020-09-05).  However, at the time of that commit, the change
didn't trigger the hang with the default Org settings.  However, once
that commit was merged to master (5beeb094a), it started to trigger it
with the standard Org settings because the default value of
org-startup-folded changed to showeverything (88f5ed91c).

Anyway, this is fixed (on my end, at least) by 4f8ac0a7a.



Unhealthy Haskell babel

2020-12-09 Thread Lawrence Bottorff
I'm looking into Haskell (latest ghci) again on org-mode. This

#+begin_src haskell :results verbatim :exports both
:set +m
doubleSmallNumber x = if x > 100
  then x
  else x*2
#+end_src

works, but still the :set +m is necessary for it to see the whole. But this

#+begin_src haskell :results verbatim :exports both
:set +m
factorial :: Int -> Int
factorial 0 = 1
factorial n = n * factorial (n - 1)
#+end_src

results in this on the REPL side:

Prelude> :set +m
factorial :: Int -> Int
factorial 0 = 1
factorial n = n * factorial (n - 1)
"org-babel-haskell-eoe"
Prelude>
:26:1-23: error:
• No instance for (Show (Int -> Int)) arising from a use of ‘print’
(maybe you haven't applied a function to enough arguments?)
• In a stmt of an interactive GHCi command: print it
Prelude> Prelude> Prelude> "org-babel-haskell-eoe"

which is the same behavior if I try to feed the program into the REPL one
line at a time, i.e.,

Prelude> factorial :: Int -> Int

:40:1-23: error:
• No instance for (Show (Int -> Int)) arising from a use of ‘print’
(maybe you haven't applied a function to enough arguments?)
• In a stmt of an interactive GHCi command: print it

So the :set +m trick (take multiple lines) doesn't help here. Obviously,
Haskell is not ready to be used with Babel. Can it be fixed? BTW, this does
work with the regular ghci REPL and haskell-mode. If it helps, Standard ML,
which has very similar syntax (it was Haskell's parent), works fine.

LB


Re: Bring up a screen giving option to open a series of orgmode files

2020-12-09 Thread Ihor Radchenko


A side note: As Alan Schmitt pointed earlier, org-pdftools package
allows creating links to specific pdf page or annotation on the page or
to search string. It requires pdf-tools package as pdf viewer.

Best,
Ihor



Re: stability of toc links

2020-12-09 Thread Samuel Wales
just so everybody is on the same page, i think carsten is talking
about tec's code that generates html id's that are then used in urls?

imo great idea.


On 12/9/20, Carsten Dominik  wrote:
> I think we should merge this code into Org.
>
> Kind regards
>
> Carsten
>
> On Wed, Dec 9, 2020 at 3:54 AM TEC  wrote:
>
>>
>> Hi Sam, link stability is a concern I've had too. I currently have a fix
>> (or at the very least, an improvement) for this in my config where I
>> overwrite org-export-get-reference. (see:
>> https://tecosaur.github.io/emacs-config/config.html#nicer-generated-heading
>> ).
>>
>> I raised this on the list a while ago ---
>> https://orgmode.org/list/e1jxajq-0004dk...@lists.gnu.org/ but there
>> didn't seem to be much interest.
>>
>> All the best,
>> Timothy
>>
>> Samuel Wales  writes:
>>
>> > when you link to a section using toc, you get a link like
>> >
>> >
>> https://thekafkapandemic.blogspot.com/2020/02/crimes-against-humanity_3.html#org080f0ab
>> >
>> > will these links break if somebody copies them and pastes them
>> > elsewhere?  what if you add a section?
>> >
>> > there doesn't seem to be a perfect solution, short of adding custom id
>> > or id to everything, but perhaps a fuzzy hash of the header and
>> > contents of the section could be used?  or a strict hash of the
>> > header?  is anything like this being done?  just curious.
>>
>>
>>
>


-- 
The Kafka Pandemic

Please learn what misopathy is.
https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html



Time Slots in Org-Agenda

2020-12-09 Thread Christopher Dimech
It would be good if the following org-agenda problem could be addressed.

Here is a section of a diary

Dec 05, 2020
06:13-08:34 Gnu Hackers Meeting
10:21-12:00 Richard Stallman Talk
12:00-12:34 Lunch
14:21-17:34 Hacking Session

This gives the following in Org-Agenda.


Saturday 5 December 2020
5:06.. now - - - - - - - - - - - - - - - - - - - - - - - - -
Diary: 7:55- 9:34 Gnu Hackers Meeting *
8:00.. 
10:00.. 
Diary: 10:21-12:00 Richard Stallman Talk
12:00.. 
Diary: 12:00-12:34 Lunch
14:00.. 
Diary: 14:21-17:34 Hacking Session *
16:00.. 
18:00.. 
20:00.. 


Loking at the entries with a star, end later than the
next time thresholds of 08:00 and 16:00, yet the entries
are not being populated for the later times.

I would be grateful if the slots at the later times would
also be filled. For instance, according to the setup below
(see the ** entries)

Saturday 5 December 2020
5:06.. now - - - - - - - - - - - - - - - - - - - - - - - - -
Diary: 7:55- 8:00 Gnu Hackers Meeting **
8:00.. 
Diary: 8:00- 9:34 Gnu Hackers Meeting **
10:00.. 
Diary: 10:21-12:00 Richard Stallman Talk
12:00.. 
Diary: 12:00-12:34 Lunch
14:00.. 
Diary: 14:21-16:00 Hacking Session **
16:00.. 
Diary: 17:00-17:34 Hacking Session **
18:00.. 
20:00.. 





Re: LaTeX fragments not being generated due to extra * in tikz env

2020-12-09 Thread Jeremie Juste
Hello,

Thanks for reporting. Indeed this is an issue that hasn't been fixed
yet. This is the case for most latex environments  

My solution is here
https://www.mail-archive.com/emacs-orgmode@gnu.org/msg129974.html

but consider also the idea behind the star
https://www.mail-archive.com/emacs-orgmode@gnu.org/msg129976.html

I will try to submit a patch soon.

Best regards,
Jeremie

On Tuesday,  8 Dec 2020 at 20:57, 10cadr wrote:
> I was trying out the new option tex:dvipng. The HTML result was a image
> with the tikz code.
>
> Turns out, debugging and telling the fragment processor not to delete the
> files, what org generates for the tikz fragment is:
>
> \begin{tikzpicture*}
>
> Removing the astherisk would make it work without any workarounds.
>
> How I got around this was
>
> #+LATEX_HEADER: \usepackage{environ,amsmath,multicol}
> #+LATEX_HEADER:
> \NewEnviron{tikzpicture*}[1][]{\begin{tikzpicture}[#1]\BODY\end{tikzpicture}}
>
> Possibly fixing this issue, will make cross formats much easier.

-- 
Jeremie Juste



Re: Bring up a screen giving option to open a series of orgmode files

2020-12-09 Thread Maxim Nikulin

2020-12-09 Jean Louis wrote:

* Maxim Nikulin [2020-12-09 18:04]:

bind ctrl-o any endSelection "run(pdfcapture '%f' '%p' '%x' '%y' '%X' '%Y'
'%u')"


Thank you, I just do not see where the file is writing it to? You may
see the screenshot attached, I am somebody who has thousands of
finel granular PDF references. When you already made it, let me have it.


In my variant last line of script calls `xsel -b` to copy the note to 
clipboard. I have not tried to use emacs-client to invoke org-capture.


The following capture template pulls the note from clipboard without 
intermediate file:


"* %(org-get-x-clipboard 'CLIPBOARD)
"


#!/bin/bash
set -e
set -o pipefail

getmeta() {

...

# FIXME obtain page height using pdfinfo
page_height=792

...

pdftotext -layout -f "$page" -l "$page" \
-x "$sel_x" -y "$((page_height - sel_Y))" -W 
"$((sel_X-sel_x))" -H

  ^sel_y









Re: Bring up a screen giving option to open a series of orgmode files

2020-12-09 Thread Jean Louis
* Maxim Nikulin  [2020-12-09 18:04]:
> bind ctrl-o any endSelection "run(pdfcapture '%f' '%p' '%x' '%y' '%X' '%Y'
> '%u')"

Thank you, I just do not see where the file is writing it to? You may
see the screenshot attached, I am somebody who has thousands of
finel granular PDF references. When you already made it, let me have it.

> Certainly named options should be added to the script besides obtaining of
> actual page height. I have not checked if the script is resistant in respect
> to specially crafted file names and other such things. Do not know if
> terminal control sequences could appear in selection. Xpdf has known
> problems with handling of text encodings.
> 
> > > #!/bin/bash
> > > set -e
> > > set -o pipefail
> > > 
> > > getmeta() {
> ...
> > >   # FIXME obtain page height using pdfinfo
> > >   page_height=792
> ...
> > >   pdftotext -layout -f "$page" -l "$page" \
> > >   -x "$sel_x" -y "$((page_height - sel_Y))" -W 
> > > "$((sel_X-sel_x))" -H
>  ^sel_y



Re: Bug: Footnotes on Headers and LaTeX export [9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)]

2020-12-09 Thread Juan Manuel Macías
You're welcome ;-)

Charis Michelakis  writes:

> Thank you :)
>
> On 12/9/20 5:06 PM, Juan Manuel Macías wrote:
>> Hello,
>>
>> Charis Michelakis  writes:
>>
>>> There is a potential bug regarging how footnotes on headers are
>>> converted to LaTeX.
>>>
>>> Consider the following org file:
>>> --start-of-file---
>>>
>>> #+AUTHOR: Me
>>> #+LATEX_HEADER: \usepackage{titlesec}
>>>
>>> * Header1[fn:1]
>>>
>>> * Footnotes
>>>
>>> [fn:1]Lorem ipsum
>> It is a LaTeX problem, as the footnote command is a 'fragile' command and 
>> should not
>> be put in a section. Try this:
>>
>> * Header1[fn:1]
>>:PROPERTIES:
>>:ALT_TITLE: Header1
>>:END:
>>
>> * Footnotes
>> [fn:1]Lorem ipsum
>>
>> in latex it is exported as
>>
>> \section[Header1]{Header1\footnote{Lorem ipsum}}
>>
>> Regards,
>>
>> Juan Manuel
>




Re: Bug: Footnotes on Headers and LaTeX export [9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)]

2020-12-09 Thread Juan Manuel Macías
Hello,

Charis Michelakis  writes:

> There is a potential bug regarging how footnotes on headers are
> converted to LaTeX.
>
> Consider the following org file:
> --start-of-file---
>
> #+AUTHOR: Me
> #+LATEX_HEADER: \usepackage{titlesec}
>
> * Header1[fn:1]
>
> * Footnotes
>
> [fn:1]Lorem ipsum

It is a LaTeX problem, as the footnote command is a 'fragile' command and 
should not
be put in a section. Try this:

* Header1[fn:1]
  :PROPERTIES:
  :ALT_TITLE: Header1
  :END:

* Footnotes
[fn:1]Lorem ipsum

in latex it is exported as

\section[Header1]{Header1\footnote{Lorem ipsum}}

Regards,

Juan Manuel 



Re: Bring up a screen giving option to open a series of orgmode files

2020-12-09 Thread Maxim Nikulin

2020-12-09 Jean Louis wrote:

* Maxim Nikulin [2020-12-02 19:49]:


Personally I am considering something like (not ready to use, just quick and
dirty proof of concept)


That is great and now I came to it. Please send me your .xpdfrc
settings.


bind ctrl-o any endSelection "run(pdfcapture '%f' '%p' '%x' '%y' '%X' 
'%Y' '%u')"


Certainly named options should be added to the script besides obtaining 
of actual page height. I have not checked if the script is resistant in 
respect to specially crafted file names and other such things. Do not 
know if terminal control sequences could appear in selection. Xpdf has 
known problems with handling of text encodings.



#!/bin/bash
set -e
set -o pipefail

getmeta() {

...

# FIXME obtain page height using pdfinfo
page_height=792

...

pdftotext -layout -f "$page" -l "$page" \
-x "$sel_x" -y "$((page_height - sel_Y))" -W 
"$((sel_X-sel_x))" -H

 ^sel_y





bug#42484: 26.1: org-mode should display value of links in minibuffer

2020-12-09 Thread Boruch Baum
This update improves the solution so that it doesn't step on other
minibuffer echo-area messages when it has nothing to report

(defun my-org-mode-post-command-hook ()
  "Show POINT's \"help-echo\" information in the echo area.
This could be information about an org-link at POINT, or some other data."
  (let ((message-log-max) ; suppress output to *Messages* buffer
(msg (get-text-property (point) 'help-echo)))
(when msg
  (ignore-errors
(message "%s" (url-unhex-string msg) nil t)

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0





Re: Bring up a screen giving option to open a series of orgmode files

2020-12-09 Thread Jean Louis
* Maxim Nikulin  [2020-12-02 19:49]:

> Personally I am considering something like (not ready to use, just quick and
> dirty proof of concept)

That is great and now I came to it. Please send me your .xpdfrc
settings.


> #!/bin/bash
> set -e
> set -o pipefail
> 
> getmeta() {
>   file="$1"
>   page="$2"
>   sel_x="${3:-0}"
>   sel_x="${sel_x%.*}"
>   sel_y="${4:-0}"
>   sel_y="${sel_y%.*}"
>   sel_X="${5:-0}"
>   sel_X="${sel_X%.*}"
>   sel_Y="${6:-0}"
>   sel_Y="${sel_Y%.*}"
>   url="${7:-}"
> 
>   # FIXME obtain page height using pdfinfo
>   page_height=792
> 
>   echo "[[${file}#page=${page}]]"
>   pdfinfo "$file" | sed -n -e
> 's/^\(CreationDate\|ModDate\|Author\|Title\|Subject\):\s*\([^ ]\)/- \1 ::
> \2/p'
>   if [ -n "$sel_Y" ] ; then
>   echo "#+begin_quote"
>   pdftotext -layout -f "$page" -l "$page" \
>   -x "$sel_x" -y "$((page_height - sel_Y))" -W 
> "$((sel_X-sel_x))" -H
> "$((sel_y-sel_Y))" "$file" - \
>  | sed -e 's/^[#*]/,&/' -e 's/\s*$//'
>   echo "#+end_quote"
>   fi
>   if [ -n "$url" ] ; then
>   echo -e "\n- Link: [[$url]]"
>   fi
> }
> 
> if [ -z "$1" ] || [ -z "$2" ] ; then
>   echo "No file or page" 1>&2
>   exit 1
> fi
> 
> # or emacsclient calling org-capture
> getmeta "$@" | xsel -b
> ->8-



Re: org-mac-link patch

2020-12-09 Thread Jan Lübke
Good morning,

this is my first time submitting a patch, here. I hope I did everything right. 
If I made a mistake, please let me know. If you have any questions, feel free 
to ask.

Not sure if this is even an official bug, yet. However here is a fix for a 
strange behaviour: Links to mail.app don’t open any more after upgrading to 
macOS 11.

Thank you for making orgmode!

Jan Lübke



0001-contrib-module-org-mac-link.el-open-links-from-Mail..patch
Description: Binary data


LaTeX fragments not being generated due to extra * in tikz env

2020-12-09 Thread 10cadr
I was trying out the new option tex:dvipng. The HTML result was a image
with the tikz code.

Turns out, debugging and telling the fragment processor not to delete the
files, what org generates for the tikz fragment is:

\begin{tikzpicture*}

Removing the astherisk would make it work without any workarounds.

How I got around this was

#+LATEX_HEADER: \usepackage{environ,amsmath,multicol}
#+LATEX_HEADER:
\NewEnviron{tikzpicture*}[1][]{\begin{tikzpicture}[#1]\BODY\end{tikzpicture}}

Possibly fixing this issue, will make cross formats much easier.


bug#45091: 27.1; M-x org-table-paste-rectangle

2020-12-09 Thread Tak Kunihiro
> Tak Kunihiro, what is in your opinion the deciding character of these
> files? I.e. what did you change from the first file (where I couldn't
> reproduce) to the second?

The difference between the first and the second files is, the existence
of plain sentences after the second org-table.

I see the problem randomly when I make a LaTeX table using org-mode
radio-table.

I was writing a recipe with the two org-tables.  I thought that
org-tables are the essence of the problem; however, it seems that
org-tables followed by plain sentences seems to be the source of the
problem.

Again, I do not see problem on 26.3.





bug#45091: 27.1; M-x org-table-paste-rectangle

2020-12-09 Thread João Távora
> I apologize that the file I posted is NG.  Please try the following file
> as shown below.

Thanks, now I did reproduce... something.  I get the "Marker does not
point anywhere" error you describe, but also mentions to other broken
functionality, not only the "antiblink":

Error in post-command-hook (jit-lock--antiblink-post-command): (error
"Marker does not point anywhere")
primitive-undo: Marker does not point anywhereError during redisplay:
(jit-lock-function 772) signaled (error "Marker does not point
anywhere")
Error during redisplay: (jit-lock-function 1272) signaled (error
"Marker does not point anywhere")
Error during redisplay: (jit-lock-function 1772) signaled (error
"Marker does not point anywhere")
Error during redisplay: (jit-lock-function 2272) signaled (error
"Marker does not point anywhere")
Error during redisplay: (jit-lock-function 2772) signaled (error
"Marker does not point anywhere")

If I turn on debug-on-error, I also get the stacktrace below
on RET, which runs newline.
It seems the problem comes from "syntax-ppss", which is also
called from "antiblink". I cannot always reproduce this, and
often I can reproduce without needing the "undo".

I'll keep investigating: I still don't know which marker the message
is referring to.  It could be antiblink's marker, but it could be
anything else.

João

Debugger entered--Lisp error: (error "Marker does not point anywhere")
  syntax-ppss()
  electric-indent-post-self-insert-function()
  self-insert-command(1)
  newline(nil 1)
  funcall-interactively(newline nil 1)
  call-interactively(newline)
  (let (orgtbl-mode) (call-interactively (or (key-binding "\15")
(key-binding [(return)]) 'orgtbl-error)))
  (if (org-at-table-p) (call-interactively 'orgtbl-ret) (let
(orgtbl-mode) (call-interactively (or (key-binding "\15") (key-binding
[(return)]) 'orgtbl-error
  orgtbl-hijacker-command-101(1)
  funcall-interactively(orgtbl-hijacker-command-101 1)
  call-interactively(orgtbl-hijacker-command-101 nil nil)
  command-execute(orgtbl-hijacker-command-101)





bug#45091: 27.1; M-x org-table-paste-rectangle

2020-12-09 Thread João Távora
João Távora  writes:

> I'll keep investigating: I still don't know which marker the message
> is referring to.  It could be antiblink's marker, but it could be
> anything else.
>
> João

I've now reproduced after setting

  (setq jit-lock-antiblink-grace nil)

Which turns off the antiblink feature _almost_ entirely.  I've also been
able to reproduce it from the command line via:

~/Source/Emacs/emacs-27/src/emacs -Q ~/tmp/taks-file.latex  
   \
  --eval "(progn
   \
   (require 'org)   
   \
   (require 'org-table) 
   \
   (orgtbl-mode)
   \
   (remove-hook 'post-command-hook  
   \
'jit-lock--antiblink-post-command t))"

Which _completely_ turns off the antiblink feature.

It doesn't need a window system, -nw is fine to reproduce.

This was with a fresh build of the Emacs 27.1 tag.

It's hard to reproduce sometimes, but iterating the undo/paste rectangle
cycle eventually gets one there.  It has to be done on the very same
file that Tak Kunihiro posted.  Sometimes I mess the file slightly (in
ways that I can't tell) and it doesn't happen again.

Tak Kunihiro, what is in your opinion the deciding character of these
files? I.e. what did you change from the first file (where I couldn't
reproduce) to the second?

I'm quite lost as to why this happens, of course, but it seems it's
always coming from syntax-ppss.  When I evaluate that definition (rather
than compiling), I get more clues:

Debugger entered--Lisp error: (error "Marker does not point anywhere")
  >(# 2919)
  (and old-pos (> old-pos pos))
  (if (and old-pos (> old-pos pos)) (setq old-pos nil))
  (let* ((cell (syntax-ppss--data)) (ppss-last (car cell)) (ppss-cache (cdr 
cell)) (old-ppss (cdr ppss-last)) (old-pos (car pps$
  (progn (set-syntax-table (or syntax-ppss-table (syntax-table))) (let* ((cell 
(syntax-ppss--data)) (ppss-last (car cell)) (pps$
  (unwind-protect (progn (set-syntax-table (or syntax-ppss-table 
(syntax-table))) (let* ((cell (syntax-ppss--data)) (ppss-last $
  (let ((table (syntax-table)) (buffer (current-buffer))) (unwind-protect 
(progn (set-syntax-table (or syntax-ppss-table (synta$
  syntax-ppss()

I'll keep looking a bit, but at this point it doesn't seem to have
anything to do with the antiblink feature.  I might be wrong, but I
think that only shows up first in the messages buffer because it's
unlucky enough to be one of the first users of syntax-ppss after a
command.

João











Bug: Footnotes on Headers and LaTeX export [9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)]

2020-12-09 Thread Charis Michelakis

There is a potential bug regarging how footnotes on headers are
converted to LaTeX.

Consider the following org file:
--start-of-file---
#+AUTHOR: Me
#+LATEX_HEADER: \usepackage{titlesec}
* Header1[fn:1]

* Footnotes

[fn:1]Lorem ipsum
--end-of-file--

When converting to LaTeX the header is exported as:
\section{Header1\footnote{Lorem ipsum}}

I believe the proper output should be:
\section{Header1}\footnote{Lorem ipsum}

Notice that the footnote is placed after the closing bracket segment
instead of being part of the header section. Excuse me for my ignorance of
LaTeX, for I cannot definitively say which one is correct(maybe they
both are) but the second output seems more logical.

Both versions get compiled correctly, however when adding the package
"titlesec" the first version results in failed compilation (the
following error message seems to signify some kind of infinite
recursion/loop):

-error-message-during-compilation-
Package hyperref Warning: Token not allowed in a PDF string 
(PDFDocEncoding):

(hyperref)    removing `\@ifnextchar' on input line 32.

! TeX capacity exceeded, sorry [input stack size=5000].
\reserved@a ->\def \reserved@a
   *{\ttl@assign@i {\@tempskipb }}\reserved@a
l.32 \section{Header1\footnote{Lorem ipsum}}

!  ==> Fatal error occurred, no output PDF file produced!
--

If both versions are correct then the bug obviously lies in the
"titlesec" package. However, as I previously said, I don't know if that
is the case. It is possible that this happens with other packages too. I
have not tested any other packages that deal with headers.

I have also tested this on org version 9.4 and the same output is
produced.

I have attached the org file, the tex output file that leads to the bug
and the output log of the compilation process.

==
Emacs  : GNU Emacs 27.1 (build 1, x86_64-redhat-linux-gnu, X toolkit, 
cairo version 1.16.0, Xaw3d scroll bars)

 of 2020-08-21
Package: Org mode version 9.3 (release_9.3 @ 
/usr/share/emacs/27.1/lisp/org/)


current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)

 org-link-shell-confirm-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 org-html-format-inlinetask-function 
'org-html-format-inlinetask-default-function

 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-mode-hook '(#[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)
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 
"\n\n(fn ENTRY)"]

 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-babel-pre-tangle-hook '(save-buffer)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)
 org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME 
CONTENTS WIDTH)"]

 org-occur-hook '(org-first-headline-recenter)
 org-cycle-hook '(org-cycle-hide-archived-subtrees 
org-cycle-show-empty-lines org-optimize-window-after-visibility-change)
 org-speed-command-hook '(org-speed-command-activate 
org-babel-speed-command-activate)
 org-odt-format-inlinetask-function 
'org-odt-format-inlinetask-default-function

 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("attachment" :follow org-attach-open-link 
:export org-attach-export-link :complete org-attach-complete-link)
           ("id" :follow org-id-open) ("eww" :follow eww :store 
org-eww-store-link)

           ("rmail" :follow org-rmail-open :store org-rmail-store-link)
           ("mhe" :follow org-mhe-open :store org-mhe-store-link)
           ("irc" :follow org-irc-visit :store org-irc-store-link 
:export org-irc-export)
           ("info" :follow org-info-open :export org-info-export 
:store org-info-store-link)

           ("gnus" :follow org-gnus-open :store org-gnus-store-link)
           ("docview" :follow org-docview-open :export 
org-docview-export :store org-docview-store-link)
           ("bibtex" :follow org-bibtex-open :store 
org-bibtex-store-link)
           ("bbdb" :follow org-bbdb-open :export org-bbdb-export 
:complete org-bbdb-complete-link :store

            

Re: org-table change time from UTC to other timezones

2020-12-09 Thread Tim Cross


Alan E. Davis  writes:

> I have been pleased to learn that I can add / subtract hours in org-table
> to shift time zones.  I am making tables of  lunar/solar parameters
> relevant to tides.  Org-table is a convenient way to enter data in a
> tabular format that can be printed via LaTeX.  So each year, for several
> time zones, I enter these times by hand.
>
> It's very, very easy, I have learned, to collect all of these times (at
> most, maybe 12 per month) for UTC, and add or subtract to generate a column
> of times for a new time zone.  Very Slick!
>
> Except that when I add, for example. 09:00 to 23:33, I guess it is pretty
> obvious what is going to happen: it would be the same day, but at 32:33 !!
>
> I have tripped up on trying to test for whether the sum is greater than or
> equal to 24:00, and then doing something interesting with it.  It's
> actually pretty easy to go through all the months and find the exceptions,
> and make manual changes.  But, as I usually have done, I would rather spend
> a few hours coming up with some programmatic method for making this work
> automatically!
>
> The other problem is the change of the day.  I suppose I could use 0, 1,
> 2... for Sunday, Monday, Tuesday...  (I am living in the United States).
>
> Has someone solved this problem?
>

Org tables support formulas which use the Emacs 'calc' program. Calc has
pretty good support for adding, subtracting, multiplying and otherwise
manipulating dates and times (this is how the org clocktable works). It
should be pretty straight forward to have a column of date + time
values, a time offset representing a timezone and a 3rd column which is
the new date/time after applying the offset. Have a look at the secton
in the org manual on table formulas and the calc manual in info.

--
Tim Cross



Re: [org-save-all-org-buffers] Saving is not reliable?

2020-12-09 Thread Eric S Fraga
On Wednesday,  9 Dec 2020 at 11:16, Mikhail Skorzhisnkii wrote:
> It's kind of reproduction scenario. Basically I need to
> modify buffer from search-type agenda. 

In the past, anecdotally I have seen something similar: adjust the
scheduled date for an entry via the agenda view and ask to save all org
buffers.  The change to the scheduled date is sometimes forgotten.  I
haven't tried with emacs -Q so it could, as in Mikhail's case, be
configuration dependent and it's also not entirely reproducible (i.e. it
sometimes happens, sometimes doesn't).

But I've not seen this happen recently so maybe it was a bug along the
way.  Sorry for vagueness but I thought I'd chime in just in case it
helps.
-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4-160-g7c8dce



org-table change time from UTC to other timezones

2020-12-09 Thread Alan E. Davis
I have been pleased to learn that I can add / subtract hours in org-table
to shift time zones.  I am making tables of  lunar/solar parameters
relevant to tides.  Org-table is a convenient way to enter data in a
tabular format that can be printed via LaTeX.  So each year, for several
time zones, I enter these times by hand.

It's very, very easy, I have learned, to collect all of these times (at
most, maybe 12 per month) for UTC, and add or subtract to generate a column
of times for a new time zone.  Very Slick!

Except that when I add, for example. 09:00 to 23:33, I guess it is pretty
obvious what is going to happen: it would be the same day, but at 32:33 !!

I have tripped up on trying to test for whether the sum is greater than or
equal to 24:00, and then doing something interesting with it.  It's
actually pretty easy to go through all the months and find the exceptions,
and make manual changes.  But, as I usually have done, I would rather spend
a few hours coming up with some programmatic method for making this work
automatically!

The other problem is the change of the day.  I suppose I could use 0, 1,
2... for Sunday, Monday, Tuesday...  (I am living in the United States).

Has someone solved this problem?

Thank you,

Alan Davis

-- 
  "This ignorance about the limits of the earth's ability to absorb
   pollutants should be reason enough for caution in the release
   of polluting substances."
   ---Meadows et al.   1972.  Limits to Growth
.
(p. 81)


Re: [org-save-all-org-buffers] Saving is not reliable?

2020-12-09 Thread Mikhail Skorzhisnkii

Hi, Kyle,

Thank you for finding time to take a look at this. I have 
experienced data loss once again, so you're right. This is not 
indirect buffers, i.e. my fix is not working. I was just lucky.


Fortunately I managed to capture the moment in emacs when it 
happens. It's kind of reproduction scenario. Basically I need to 
modify buffer from search-type agenda. For example, search for 
tags and then change TODO state or add a note. Then use 
`org-save-all-org-buffers`. Function will report that it is done 
its job and buffers will be marked as non-modified. But in fact 
they are modified and unsaved.


I can't reproduce this in emacs without my configuration (i.e. 
only emacs and most recent org-mode). So it must be something that 
interfere with buffer "modified" state. I guess I need to review 
every hook related to buffer saving. I think (but unsure) it is 
start happening when I have start enabling follow-mode in agenda 
from start up.


For the time being I have applied advice from this stack overflow 
question: 
https://stackoverflow.com/questions/3215866/how-to-force-emacs-to-save-even-if-it-thinks-no-changes-need-to-be-saved


 (defadvice save-buffer (before save-buffer-always activate)
   "always save buffer"
   (set-buffer-modified-p t))

It looks like it helps me. I'll report back to this thread when I 
find the offender. I guess I'm calling (set-buffer-modified-p nil) 
somewhere unknowingly.


Mikhail Skorzhinskii

Kyle Meyer  writes:


Mikhail Skorzhisnkii writes:


Hello forum,

I start noticing some time ago that saving org-mode buffers 
works

unreliably in my setup. Most of the time I am using function
`org-save-all-org-buffers' from core org.


Unreliable in that some Org buffers are left in a modified 
state?


[...]
Possibly there is something wrong in my customisations. But 
without a
reproduction scenario, I don't see a way to prove it. However, 
after I
made a tiny change to the function, I stopped seeing these 
problems at

all. Here is the fix I have applied:

,
| diff --git a/lisp/org.elf b/lisp/org.el
| index df3f377f6..448dc4a88 100644
| --- a/lisp/org.el
| +++ b/lisp/org.el
| @@ -15229,7 +15229,9 @@ The value is a list, with zero or 
more of the symbols `effort', `appt',

|"Save all Org buffers without user confirmation."
|(interactive)
|(message "Saving all Org buffers...")
| -  (save-some-buffers t (lambda () (derived-mode-p 
'org-mode)))

| +  (save-some-buffers t (lambda ()
| + (and (derived-mode-p 'org-mode)
| +  (not (buffer-base-buffer)
|(when (featurep 'org-id) (org-id-locations-save))
|(message "Saving all Org buffers... done"))
`

My theory was that `save-some-buffers' may work unreliably with 
indirect
buffers, so I've excluded them from the saving. Again, I have 
tried to
prove it by using indirect buffer and saving it instead of base 
buffer.
But it worked without a problem. So even if my theory is 
correct, bug
not reproducing every time. Nevertheless I am having this 
change already
for two weeks and I don't have reproduction of this bug. 
Previously I've

noticed loosing data every day or so.


Hmm, I may be completely missing something, but for what it's 
worth, I'd
be surprised if indirect buffers are the culprit.  When you save 
an
indirect buffer directly, it should just save the base buffer. 
And in
any case, save-some-buffers should skip indirect buffers.  Here 
is the
relevant handling from save-some-buffers, with the key line 
marked:


(setq files-done
  (map-y-or-n-p
   (lambda (buffer)
 (and (buffer-live-p buffer)
  (buffer-modified-p buffer)
  (not (buffer-base-buffer buffer))  ; <- skip 
  indirect buffers

  (or
   (buffer-file-name buffer)
   (with-current-buffer buffer
 (or (eq buffer-offer-save 'always)
 (and pred buffer-offer-save
  (> (buffer-size) 0)
  (or (not (functionp pred))
  (with-current-buffer buffer (funcall 
  pred)))

  (if arg
  t
(setq queried t)
(if (buffer-file-name buffer)
(format "Save file %s? "
(buffer-file-name buffer))
  (format "Save buffer %s? "
  (buffer-name buffer))
   (lambda (buffer)
 (with-current-buffer buffer
   (save-buffer)))
   (buffer-list)
   '("buffer" "buffers" "save")
   save-some-buffers-action-alist))



--
---
Mikhail Skorzhinskii



Re: stability of toc links

2020-12-09 Thread Carsten Dominik
I think we should merge this code into Org.

Kind regards

Carsten

On Wed, Dec 9, 2020 at 3:54 AM TEC  wrote:

>
> Hi Sam, link stability is a concern I've had too. I currently have a fix
> (or at the very least, an improvement) for this in my config where I
> overwrite org-export-get-reference. (see:
> https://tecosaur.github.io/emacs-config/config.html#nicer-generated-heading
> ).
>
> I raised this on the list a while ago ---
> https://orgmode.org/list/e1jxajq-0004dk...@lists.gnu.org/ but there
> didn't seem to be much interest.
>
> All the best,
> Timothy
>
> Samuel Wales  writes:
>
> > when you link to a section using toc, you get a link like
> >
> >
> https://thekafkapandemic.blogspot.com/2020/02/crimes-against-humanity_3.html#org080f0ab
> >
> > will these links break if somebody copies them and pastes them
> > elsewhere?  what if you add a section?
> >
> > there doesn't seem to be a perfect solution, short of adding custom id
> > or id to everything, but perhaps a fuzzy hash of the header and
> > contents of the section could be used?  or a strict hash of the
> > header?  is anything like this being done?  just curious.
>
>
>


[PATCH] Fix org-in-archived-heading-p when tag contains ARCHIVE as a substring

2020-12-09 Thread Ihor Radchenko
>From c62cbd6ac6cf6a845703b3f7cfb64fa68e39079a Mon Sep 17 00:00:00 2001
From: Ihor Radchenko 
Date: Wed, 9 Dec 2020 16:59:58 +0800
Subject: [PATCH] Fix org-in-archived-heading-p

* lisp/org.el (org-in-archived-heading-p): When called on a heading
with a tag containing org-archive-tag string as a substring, that
heading was incorrectly recognised as archived.  Changed matching
against the whole :tag1:tag2:...: string to matching against tag list
as returned by `org-get-tags'.
* testing/lisp/test-org.el (test-org/in-archived-heading-p): Add test
when one of the heading tags contains org-archive-tag as a substring.
---
Range-diff:
1:  c62cbd6ac = 1:  c62cbd6ac Fix org-in-archived-heading-p

 lisp/org.el  | 5 ++---
 testing/lisp/test-org.el | 7 ++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index d4fb18465..e44cdf1ca 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19285,10 +19285,9 @@ This function also checks ancestors of the current headline,
 unless optional argument NO-INHERITANCE is non-nil."
   (cond
((org-before-first-heading-p) nil)
-   ((let ((tags (nth 5 (org-heading-components
+   ((let ((tags (org-get-tags nil 'local)))
   (and tags
-	   (let ((case-fold-search nil))
-	 (string-match-p org-archive-tag tags)
+	   (cl-some (apply-partially #'string= org-archive-tag) tags
(no-inheritance nil)
(t
 (save-excursion (and (org-up-heading-safe) (org-in-archived-heading-p))
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 5172afeec..a18d42a98 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -2103,7 +2103,12 @@
   (should-not
(org-test-with-temp-text "* Headline :ARCHIVE:\n** Level 2\nBody"
  (goto-char (point-max))
- (org-in-archived-heading-p t
+ (org-in-archived-heading-p t)))
+   ;; Archive tag containing ARCHIVE as substring
+   (should-not
+(org-test-with-temp-text "* Headline :NOARCHIVE:\n** Level 2\nBody"
+ (goto-char (point-max))
+ (org-in-archived-heading-p
 
 (ert-deftest test-org/entry-blocked-p ()
   ;; Check other dependencies.
-- 
2.26.2




Re: stability of toc links

2020-12-09 Thread Diego Zamboni
In case it's useful, I have put together (just last week) some config to
help in creating and using human-readable CUSTOM_IDs in conjunction with
`counsel-org-link`, but which could just as easily be used to apply the IDs
to every heading in the current document:
https://github.com/zzamboni/dot-doom/blob/master/doom.org#capturing-and-creating-internal-org-links

Now I have to look at TEC's ID-generation code, seems much nicer :)

--Diego


On Wed, Dec 9, 2020 at 3:54 AM TEC  wrote:

>
> Hi Sam, link stability is a concern I've had too. I currently have a fix
> (or at the very least, an improvement) for this in my config where I
> overwrite org-export-get-reference. (see:
> https://tecosaur.github.io/emacs-config/config.html#nicer-generated-heading
> ).
>
> I raised this on the list a while ago ---
> https://orgmode.org/list/e1jxajq-0004dk...@lists.gnu.org/ but there
> didn't seem to be much interest.
>
> All the best,
> Timothy
>
> Samuel Wales  writes:
>
> > when you link to a section using toc, you get a link like
> >
> >
> https://thekafkapandemic.blogspot.com/2020/02/crimes-against-humanity_3.html#org080f0ab
> >
> > will these links break if somebody copies them and pastes them
> > elsewhere?  what if you add a section?
> >
> > there doesn't seem to be a perfect solution, short of adding custom id
> > or id to everything, but perhaps a fuzzy hash of the header and
> > contents of the section could be used?  or a strict hash of the
> > header?  is anything like this being done?  just curious.
>
>
>