How to export to markdown programmatically without the table of contents?

2022-05-01 Thread Marcin Borkowski
Hi fellow Orgers,

I'd like to export a Org-mode formatted string to markdown, but without
the table of contents.

(org-export-string-as my-string 'md t '(toc nil))

didn't work (the ToC was still there).  What am I missing?

TIA,

-- 
Marcin Borkowski
http://mbork.pl



Re: [BUG] Documentation errata [9.5.2 (release_9.5.2-25-gaf6f12 @ /usr/share/emacs/28.1/lisp/org/)]

2022-05-01 Thread Alessandro Bertulli
I feel like it's still not completely clear, but I assume it's just a
problem of mine: if I have been the only one having the problem, then
it's on me, I suppose. Anyway, your patch is an improvement, and you
are certainly more expert than me in producing user documentation, so
green light for me!

In fact, thank you for your patience.

Best,
Alessandro



Re: [PATCH] speed commands: error message when a key is not associated with a command

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

> This would not solve the problem of shadowing.
> It may be better idea to provide a custom variable controlling
> org-babel-speed-command-activate: do nothing or throw an error.
> This custom variable should also be described in the docstring of
> org-speed-command-hook to warn about potential shadowing.
>
> To summarise, your idea will be reasonable if:
> 1. The new behaviour can be customized
> 2. The new behaviour is documented in org-speed-command-hook

Ok, I agree that this is the most reasonable direction. What do you
think about the idea that I outlined in the last post of this thread
(https://list.orgmode.org/87v8uqmkc0@posteo.net/)?: it consists in
defining a new hook (by default with value nil) where the user can store
those functions that he wants to have a 'strict' behavior: some functions
or all. And then the user should add the
org-speed-command-strict-function to org-speed-command-hook.

If this idea sounds too hacky, I think a defcustom for
org-babel-speed-command-activate, as you suggest, might suffice.

Best regards,

Juan Manuel 



Re: [Bug] incorrect indent of next heading after org-paste-subtree

2022-05-01 Thread Max Nikulin

On 01/05/2022 09:31, Ihor Radchenko wrote:

Max Nikulin writes:


Another old bug with org-paste-subtree.

It make indentation of next heading wrong.

Consider the following document and follow described steps:


I am unable to reproduce on the latest Org.


Thank you, Ihor. I have checked it once more for current main HEAD 
2bd34edb64. I can reproduce it using the provided steps in Emacs-26, but 
not in Emacs-27.


Unless there is a reason to suspect something weird underneath, the 
issue should be considered with rather low priority. Anyway, I have 
added trailing newline to generated content and mostly use org-capture 
with org-protocol for communication between applications.






Emacs launched from Firefox

2022-05-01 Thread Max Nikulin

On 01/05/2022 11:53, Samuel Wales wrote:


[firefox did not offer to allow a command line to run my shell script
which sets up emacs correctly, and idk if it even ran with my .emacs.
does it do -q?  not sure because emacs is too unusable to even find
that out.  so firefox fails to be accessible in that dialog box.


Samuel, I think, firefox does exactly what it can find in MIME 
associations (e.g. ~/.config/mimeapps.list) and in the .desktop file of 
the selected application.


There is an emacsclient.desktop file in Emacs git master that tries to 
connect to the existing Emacs session. It is a relatively new addition, 
so packages for Linux distributions may miss it.


You can either use standard Emacs initialization to get all your 
customization available through default emacs.desktop or create a custom 
.desktop file that contain all CLI options specific to your setup.





Re: [PATCH] Add make target to ease creating reproducers and testing them

2022-05-01 Thread Christopher M. Miles

I agree this idea, this could unify the reproduce steps and help some user save 
time and help
org-mode maintainer get information they want.

Ihor Radchenko  writes:

> Hi,
>
> In the Feedback section of the manual, we provide instructions on how to
> create reproducers: https://orgmode.org/manual/Feedback.html
>
> The instructions are nice, but I was thinking to simplify things for the
> users further.
>
> I propose a new make target: make repro
> It will run the commands we already suggest, but without a need to
> create minimal file, pass all that arguments to emacs, etc
>
> WDYT?
>
> Best,
> Ihor
>
> From 8d5f9f023af18828656df85a0ce4069e004dbf5d Mon Sep 17 00:00:00 2001
> Message-Id: 
> <8d5f9f023af18828656df85a0ce4069e004dbf5d.1651373896.git.yanta...@gmail.com>
> From: Ihor Radchenko 
> Date: Sun, 1 May 2022 10:44:10 +0800
> Subject: [PATCH] mk: Add make target "repro" for easy bug testing
>
> * mk/default.mk (REPRO_DEBUG): New custom variable enabling extra
> debugging facilities in Emacs instance open by make repro.
> (REPRO_ARGS): Extra arguments passed to Emacs by make repro.
> (REPRO_INIT):
> (REPRO): Define Emacs cmd for testing.
> * mk/targets.mk (.PHONY):
> (repro): Add new target.
> * doc/org-manual.org (Feedback): Describe the new make target.
> ---
>  doc/org-manual.org |  8 
>  mk/default.mk  | 21 +
>  mk/targets.mk  |  5 -
>  3 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/doc/org-manual.org b/doc/org-manual.org
> index c0bd853ca..6a574977e 100644
> --- a/doc/org-manual.org
> +++ b/doc/org-manual.org
> @@ -269,6 +269,14 @@ ** Feedback
>  (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp"))
>  #+end_src
>  
> +If you are using Org mode version from Git repository, you can start
> +minimal session using make.
> +
> +: # Bare Emacs
> +: make repro
> +: # or pass extra arguments
> +: make repro REPRO_ARGS="-l /path/to/minimal/config.el /tmp/bug.org"
> +
>  If an error occurs, a "backtrace" can be very useful---see below on
>  how to create one.  Often a small example file helps, along with clear
>  information about:
> diff --git a/mk/default.mk b/mk/default.mk
> index 804089280..33e737da3 100644
> --- a/mk/default.mk
> +++ b/mk/default.mk
> @@ -59,6 +59,11 @@ BTEST_OB_LANGUAGES = awk C fortran maxima lilypond octave 
> perl python
>  # extra packages to require for testing
>  BTEST_EXTRA =
># ess-site  # load ESS for R tests
> +# Whether to activate extra debugging facilities for make repro.
> +REPRO_DEBUG ?= yes
> +# Extra arguments passed to Emacs for make repro.
> +# e.g. -l config.el /tmp/bug.org
> +REPRO_ARGS ?=
>  ##->8---
>  ## YOU MAY NEED TO ADAPT THESE DEFINITIONS
>  ##--
> @@ -93,6 +98,22 @@ BTEST = $(BATCH) $(BTEST_INIT) \
>  # should be useful for manual testing and verification of problems.
>  NOBATCH = $(EMACSQ) $(BTEST_INIT) -l org -f org-version
>  
> +ifeq ($(REPRO_DEBUG), yes)
> +REPRO_INIT = --eval "(setq \
> + debug-on-error t\
> + debug-on-signal nil\
> + debug-on-quit nil\
> + org-element--cache-self-verify 'backtrace\
> + org-element--cache-self-verify-frequency 1.0\
> + org-element--cache-map-statistics t)"
> +else
> +REPRO_INIT =
> +endif
> +
> +# Running a plain emacs with no config, this Org mode loaded, and
> +# debugging facilities activated.
> +REPRO = $(NOBATCH) $(REPRO_INIT) $(REPRO_ARGS)
> +
>  # start Emacs with no user and site configuration
>  # EMACSQ = -vanilla # XEmacs
>  EMACSQ  = $(EMACS)  -Q
> diff --git a/mk/targets.mk b/mk/targets.mk
> index 6de77b1e6..5cba63e21 100644
> --- a/mk/targets.mk
> +++ b/mk/targets.mk
> @@ -41,7 +41,7 @@ endif
>   cleanlisp cleandoc cleandocs cleantest \
>   compile compile-dirty uncompiled \
>   config config-test config-exe config-all config-eol config-version \
> - vanilla
> + vanilla repro
>  
>  CONF_BASE = EMACS DESTDIR ORGCM ORG_MAKE_DOC
>  CONF_DEST = lispdir infodir datadir testdir
> @@ -132,6 +132,9 @@ $(INSTSUB):
>  autoloads: lisp
>   $(MAKE) -C $< $@
>  
> +repro: cleanall autoloads
> + -@$(REPRO) &
> +
>  cleandirs:
>   $(foreach dir, $(SUBDIRS), $(MAKE) -C $(dir) cleanall;)


-- 
[ 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#54764: encode-time: make DST and TIMEZONE fields of the list argument optional ones

2022-05-01 Thread Max Nikulin

On 01/05/2022 09:32, Paul Eggert wrote:

On 4/30/22 04:22, Max Nikulin wrote:


I posted a corrected version of my `org-encode-time' macro, but I did 
not add you to Cc (I sent reply through news.gmane.io), and it has no 
special case to check whether `encode-time' supports 6 elements list 
argument:


As I understand it, org-encode-time is intended to be a compatibility 
function like org-newline-and-indent and org-string-distance. Those are 
in org-compat.el, so I assumed org-encode-time would be there too.


Maybe you are right. I believe that it should do a bit more than just 
ensure compatibility. An additional goal is to avoid pitfall with list 
vs. separate arguments result discrepancy:


(format-time-string
 "%F %T %z %Z"
 (encode-time 0 30 23 31 3 2022 nil nil "Europe/Madrid")
 "Europe/Madrid")
"2022-03-31 23:30:00 +0200 CEST"

(format-time-string
 "%F %T %z %Z"
 (encode-time '(0 30 23 31 3 2022 nil nil "Europe/Madrid"))
 "Europe/Madrid")
"2022-04-01 00:30:00 +0200 CEST"

Also, if the intent is to emulate Emacs 29 encode-time, can't we do 
something like the attached instead? The idea is to implement Emacs 29 
encode-time both on pre-29 Emacs (that don't support lists of length 6) 
and post-29 Emacs (which might drop support for the obsolescent form).



+(if (ignore-errors (encode-time '(0 0 0 1 1 1971)))
+(if (ignore-errors (encode-time 0 0 0 1 1 1971))
+(defalias 'org-encode-time #'encode-time)
+  (defun org-encode-time (time &rest args)
+(encode-time (if args (cons time args) time
+  (defun org-encode-time (time &rest args)
+(if args
+(apply #'encode-time time args)
+  (apply #'encode-time time


1. I would prefer macro since it works at compile or load time, so 
runtime impact is minimal.
2. Your variant may be fixed, but currently I do not like behavior for 
Emacs-27. Compare encode-time and org-encode-time with new calling style:


(format-time-string
 "%F %T %z %Z"
 (encode-time '(0 30 23 31 3 2022 nil nil "Europe/Madrid"))
 "Europe/Madrid")
"2022-04-01 00:30:00 +0200 CEST"

(format-time-string
 "%F %T %z %Z"
 (org-encode-time '(0 30 23 31 3 2022 nil nil "Europe/Madrid"))
 "Europe/Madrid")
"2022-03-31 23:30:00 +0200 CEST"



Org as a workspace (an impromptu reflection)

2022-05-01 Thread Ypo
Same here, I attach a screenshot that leaves an idea of my daily life at 
work.


I can't withstand Windows shortcuts now.



Re: How to export to markdown programmatically without the table of contents?

2022-05-01 Thread Jeremie Juste
Hello Marcin,

On Sunday,  1 May 2022 at 11:20, Marcin Borkowski wrote:

| Optional argument EXT-PLIST, when provided, is a property list
| with external parameters overriding Org default settings, but
| still inferior to file-local settings.

Sorry I don't fully understand what doc means by overriding the Org
default settings.

However I the toc can be removed in this way. 

(org-export-string-as "#+OPTIONS: toc:nil \n\n* test\n1"
'md)

HTH,
Jeremie Juste




Re: How to export to markdown programmatically without the table of contents?

2022-05-01 Thread Berry, Charles



> On May 1, 2022, at 2:20 AM, Marcin Borkowski  wrote:
> 
> Hi fellow Orgers,
> 
> I'd like to export a Org-mode formatted string to markdown, but without
> the table of contents.
> 
> (org-export-string-as my-string 'md t '(toc nil))
> 
> didn't work (the ToC was still there).  What am I missing?


It does seem odd that BODY-ONLY as `t' gives a toc. With latex it does not 
regardless of `:with-toc'.

: (org-export-string-as my-string 'md t '(:with-toc nil))

seems to give what you want.

HTH,
Chuck






Re: How to export to markdown programmatically without the table of contents?

2022-05-01 Thread Jeremie Juste
Hello Chuck,

> On Sunday,  1 May 2022 at 20:01, Berry, Charles wrote:
> It does seem odd that BODY-ONLY as `t' gives a toc. With latex it does not 
> regardless of `:with-toc'.
>
> : (org-export-string-as my-string 'md t '(:with-toc nil))
>
> seems to give what you want.

Many thanks for the insights.

I know where to look now:

(info "(org) Publishing options")

Best regards,
Jeremie



[BUG] folding error during capture

2022-05-01 Thread Skip Collins
Recently, I get an error message when invoking custom capture
templates like this one:
("n" "Note" entry
  (file "~/Documents/org/beorg/capture.org")
  "* %^{note} :note: %(org-set-property \"Created\"
(org-time-stamp-inactive '(16)))" :immediate-finish t)

I invoke the template from the capture dispatcher:
C-c c n

The minibuffer prompts for the note text as expected:
0note:

But the pre-populated *Capture* window contains an error message:
*  :note: %![Error: (error Calling ‘org-fold-core-region’ with missing SPEC)]
:PROPERTIES:...

In the recent past, I was able to invoke functions like
org-set-property in a capture template. Did the interface change?



[PATCH] Re: [BUG] folding error during capture

2022-05-01 Thread Ihor Radchenko
Skip Collins  writes:

> Recently, I get an error message when invoking custom capture
> templates like this one:
> ("n" "Note" entry
>   (file "~/Documents/org/beorg/capture.org")
>   "* %^{note} :note: %(org-set-property \"Created\"
> (org-time-stamp-inactive '(16)))" :immediate-finish t)
>
> ...
> But the pre-populated *Capture* window contains an error message:
> *  :note: %![Error: (error Calling ‘org-fold-core-region’ with missing SPEC)]
> :PROPERTIES:...

Thanks for the report!
This is quite a hacky capture template...
What you are seeing happens because template expansion happens in
fundamental-mode and org-set-property does not work anymore outside
org-mode.

I'd say that setting org-mode during template expansion is reasonable.

The fix is attached.

I do not push the fix just yet. If anyone think that enabling org-mode
during template expansion is undesired, please let me know.

Best,
Ihor

>From 797dfd0c82c68696d8534a9b3103d0b3c622bee6 Mon Sep 17 00:00:00 2001
Message-Id: <797dfd0c82c68696d8534a9b3103d0b3c622bee6.1651450441.git.yanta...@gmail.com>
From: Ihor Radchenko 
Date: Mon, 2 May 2022 08:11:28 +0800
Subject: [PATCH] org-capture: Expand sexps in template with Org mode being
 active

* lisp/org-capture.el (org-capture-fill-template): Enable `org-mode'
in the temporary template expansion buffer.  Update docstring
accordingly.
(org-capture-templates): Clarify that %(sexp) expansion happens in a
temporary Org mode buffer.

Fixes https://orgmode.org/list/CABUh-776V-_+_JAZwcKQm9ATcs0WUV9SmGwjooGFbt=ctwq...@mail.gmail.com
---
 lisp/org-capture.el | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 068e3eda2..9b17fa978 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -309,6 +309,8 @@ (defcustom org-capture-templates nil
   introduced with %[pathname] are expanded this way.
   Since this happens after expanding non-interactive
   %-escapes, those can be used to fill the expression.
+  The evaluation happens with Org mode set as major mode
+  in a temporary buffer.
   %<...>  The result of `format-time-string' on the ... format
   specification.
   %t  Time stamp, date only.  The time stamp is the current
@@ -1572,7 +1574,9 @@ (defun org-capture-fill-template (&optional template initial annotation)
   "Fill a TEMPLATE and return the filled template as a string.
 The template may still contain \"%?\" for cursor positioning.
 INITIAL content and/or ANNOTATION may be specified, but will be overridden
-by their respective `org-store-link-plist' properties if present."
+by their respective `org-store-link-plist' properties if present.
+
+Expansion occurs in a temporary Org mode buffer."
   (let* ((template (or template (org-capture-get :template)))
 	 (buffer (org-capture-get :buffer))
 	 (file (buffer-file-name (or (buffer-base-buffer buffer) buffer)))
@@ -1645,6 +1649,7 @@ (defun org-capture-fill-template (&optional template initial annotation)
   (setq buffer-file-name nil)
   (setq mark-active nil)
   (insert template)
+  (org-mode)
   (goto-char (point-min))
   ;; %[] insert contents of a file.
   (save-excursion
-- 
2.35.1



Re: [PATCH] Re: [BUG] folding error during capture

2022-05-01 Thread Skip Collins
> > ("n" "Note" entry
> >   (file "~/Documents/org/beorg/capture.org")
> >   "* %^{note} :note: %(org-set-property \"Created\"
> > (org-time-stamp-inactive '(16)))" :immediate-finish t)
> ...
> This is quite a hacky capture template...

I'll take that as a compliment.

The general ability to set properties during capture seems very
reasonable. It might be best to have a specific interface as an
alternative to my hack. The use of %(EXP) in capture templates is
intended to insert a string returned by the elisp EXP. I bent the
rules slightly to set the Created property. There already exists a way
to set property values in capture templates via %^{PROP|default}p, but
that results in a user prompt. Perhaps a new template construct like
%^{PROP|value}v could be introduced in order to set a property value
without a prompt. Then I could use %^{Created|%u}v in the template.



Re: [Bug] incorrect indent of next heading after org-paste-subtree

2022-05-01 Thread Samuel Wales
fwiw
[idk if this is useful but here just in case]

iirc, outline mode does not include the final newline for subtrees in
at least one case.

yet, many users and much code assume or ensure that lines are
terminated with a final newline.

this can result in unexpected behavior.  it required code to ensure
compatibility and flexibility, and it required consideration for edge
cases.  sometimes the workarounds would have to be worked around by
the calling code.

core emacs code like sorting assumed/assumes newline.

org would assume or provide none in some [but not all] cases.

user or package code might naturally kill a subtree by killing the
whole line when folded or killing each of the lines.  those include
final newline.  or set require-final-newline.  this is anissue for
things similar to editing source blocks or capture.

the usual bugs were unexpected presence or absence of newlines.  idk
if htat might help you debug or not.


On 11/30/21, Max Nikulin  wrote:
> Another old bug with org-paste-subtree.
>
> It make indentation of next heading wrong.
>
> Consider the following document and follow described steps:
>
>  >8 
> #+STARTUP: indent
> Enable soft indent mode
>
> Put to kill ring some text *without trailing newline*
> that represents a subtree. In my case it is generated
> by a browser extension.
> #+begin_src elisp :results silent
>(kill-new "* Pasted Header\nPasted body")
> #+end_src
>
> Several levels of heading to make the problem apparent:
> * H1
> ** H2
> Ensure that the following "H3" heading is expanded,
> put cursor to this line and try =C-c C-x C-y=
> or [[elisp:(org-paste-subtree)]]
> *** H3
> :PROPERTIES:
> :CUSTOM_ID: h3
> :END:
> Body
>  8< 
>
> Actual result:
>
>  >8 
> Several levels of heading to make the problem apparent:
> * H1
> *** H2
>  Ensure that the following "H3" heading is expanded,
>  put cursor to this line and try =C-c C-x C-y=
>  or elisp:(org-paste-subtree)
> * Pasted Header
>Pasted body
> * H3
>:PROPERTIES:
>:CUSTOM_ID: h3
>:END:
>Body
>  8< 
>
> Expected result
>
>  >8 
> Several levels of heading to make the problem apparent:
> * H1
> *** H2
>  Ensure that the following "H3" heading is expanded,
>  put cursor to this line and try =C-c C-x C-y=
>  or elisp:(org-paste-subtree)
> * Pasted Header
>Pasted body
> * H3
>:PROPERTIES:
>:CUSTOM_ID: h3
>:END:
>Body
>  8< 
>
> Org mode version 9.5 (release_9.5-225-g494c20
>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



Re: Emacs launched from Firefox

2022-05-01 Thread Samuel Wales
thank you.  there is no emacs in my ~/.config/mimeapps.list.  where
are those desktop files found or put?  i use fluxbox.
[i realize this is not org related.  non-list email ok.]


On 5/1/22, Max Nikulin  wrote:
> On 01/05/2022 11:53, Samuel Wales wrote:
>>
>> [firefox did not offer to allow a command line to run my shell script
>> which sets up emacs correctly, and idk if it even ran with my .emacs.
>> does it do -q?  not sure because emacs is too unusable to even find
>> that out.  so firefox fails to be accessible in that dialog box.
>
> Samuel, I think, firefox does exactly what it can find in MIME
> associations (e.g. ~/.config/mimeapps.list) and in the .desktop file of
> the selected application.
>
> There is an emacsclient.desktop file in Emacs git master that tries to
> connect to the existing Emacs session. It is a relatively new addition,
> so packages for Linux distributions may miss it.
>
> You can either use standard Emacs initialization to get all your
> customization available through default emacs.desktop or create a custom
> .desktop file that contain all CLI options specific to your setup.
>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



Re: [PATCH] Re: [BUG] folding error during capture

2022-05-01 Thread Ihor Radchenko
Skip Collins  writes:

>> > ("n" "Note" entry
>> >   (file "~/Documents/org/beorg/capture.org")
>> >   "* %^{note} :note: %(org-set-property \"Created\"
>> > (org-time-stamp-inactive '(16)))" :immediate-finish t)
>> ...
>> This is quite a hacky capture template...
>
> I'll take that as a compliment.

It was not. Your template expansion only works by accident because of
internal details of implementation of org-capture-fill-template.

In particular, org-time-stamp-inactive not only returns a timestamp, but
also _inserts_ it at point (see the screenshot of interim buffer state
while expanding your template). The fact that this inserted timestamp
gets deleted is simply because (1) org-capture-fill template does not
expect the buffer to be changed by other functions; (2) org-capture-fill
internally marks %(sexp) with sticky text property and deletes
everything marked with that property at the end of expansion; (3)
org-time-stamp-inactive respects text property stickiness.


> The general ability to set properties during capture seems very
> reasonable. It might be best to have a specific interface as an
> alternative to my hack. The use of %(EXP) in capture templates is
> intended to insert a string returned by the elisp EXP. I bent the
> rules slightly to set the Created property. There already exists a way
> to set property values in capture templates via %^{PROP|default}p, but
> that results in a user prompt. Perhaps a new template construct like
> %^{PROP|value}v could be introduced in order to set a property value
> without a prompt. Then I could use %^{Created|%u}v in the template.

What about the template below?

("n" "Note" entry
(file "~/Documents/org/beorg/capture.org")
"* %^{note} :note:
:PROPERTIES:
:CREATED: %u
:END:
"
:immediate-finish t)

Best,
Ihor


Re: proposed additions to org-collector code

2022-05-01 Thread Ihor Radchenko
Charles Millar  writes:

> First, I thank Slava Barinov for his proposed patch to appending a 
> #+tblfm line to an org-collector table. Date: 17 Mar 2019 13:22:58 +0300
> Message-ID: <87sgvl4wes@gmail.com> (raw)
>
> Attached is my, in all modesty named, cm-org-collector.el in which I 
> have added code to prepend name and attribute headers to the table, for 
> example:

Thanks for sharing!

Note that org-collector is currently unmaintained.
We are looking to new maintainers for it (and other packages from
https://git.sr.ht/~bzg/org-contrib).

You appear to be actively using org-collector.
Would you be interested to take over the maintenance?

Best,
Ihor



Re: [PATCH] speed commands: error message when a key is not associated with a command

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

> Ok, I agree that this is the most reasonable direction. What do you
> think about the idea that I outlined in the last post of this thread
> (https://list.orgmode.org/87v8uqmkc0@posteo.net/)?: it consists in
> defining a new hook (by default with value nil) where the user can store
> those functions that he wants to have a 'strict' behavior: some functions
> or all. And then the user should add the
> org-speed-command-strict-function to org-speed-command-hook.
>
> If this idea sounds too hacky, I think a defcustom for
> org-babel-speed-command-activate, as you suggest, might suffice.

It is more complex and I do not see a clear benefit of introducing a
whole new hook. It would only be useful for people who define a large
number of extra speed command handlers.

Disclaimer: I do not use speed commands myself, so my opinion is
somewhat theoretical. If other users who are actively using speed
command hook have something to say, I'd encourage them to join the
discussion.

Best,
Ihor



[BUG] Org 9.5.3 fails to display agenda (error "rx form ‘regexp’ requires args satisfying ‘stringp’")

2022-05-01 Thread Edmund Christian Herenz
Dear Developers,

thank you for the hard work on Org-mode.  I recently updated to 9.5.3
using elpa on GNU Emacs 26.1 and suddenly org-mode fails to display
the agenda (Debug message below).  This is not a smooth upgrade
experience, and some tests on core-functionality on supported emacs
versions would be appreciated.

Debugger entered--Lisp error: (error "rx form ‘regexp’ requires args satisfying 
‘stringp’")
  signal(error ("rx form ‘regexp’ requires args satisfying ‘stringp’"))
  error("rx form `%s' requires args satisfying `%s'" regexp stringp)
  rx-check((regexp org-ts-regexp3))
  rx-regexp((regexp org-ts-regexp3))
  rx-form((regexp org-ts-regexp3) |)
  #f(compiled-function (x) #)((regexp org-ts-regexp3))
  mapconcat(#f(compiled-function (x) #) ((regexp 
org-ts-regexp3) (regexp org-element--timestamp-regexp)) "\\|")
  rx-or((or (regexp org-ts-regexp3) (regexp org-element--timestamp-regexp)))
  rx-form((or (regexp org-ts-regexp3) (regexp org-element--timestamp-regexp)))
  rx-to-string((or (regexp org-ts-regexp3) (regexp 
org-element--timestamp-regexp)) t)
  #f(compiled-function (&rest regexps) #)((or (regexp 
org-ts-regexp3) (regexp org-element--timestamp-regexp)))
  (rx (or (regexp org-ts-regexp3) (regexp org-element--timestamp-regexp)))
  (if (eq extended 'agenda) (rx (or (regexp org-ts-regexp3) (regexp 
org-element--timestamp-regexp))) org-ts-regexp3)
  (if extended (if (eq extended 'agenda) (rx (or (regexp org-ts-regexp3) 
(regexp org-element--timestamp-regexp))) org-ts-regexp3) org-ts-regexp2)
  (let* ((regexp (if extended (if (eq extended 'agenda) (rx (or (regexp 
org-ts-regexp3) (regexp org-element--timestamp-regexp))) org-ts-regexp3) 
org-ts-regexp2)) (pos (point)) (match\? (let ((boundaries (org-in-regexp 
regexp))) (save-match-data (cond ((null boundaries) nil) ((eq extended 'lax) t) 
(t (or (and (eq extended 'agenda) (or (org-at-planning-p) (org-at-property-p) 
(and (bound-and-true-p org-agenda-include-inactive-timestamps) 
(org-at-clock-log-p (eq 'timestamp (save-excursion (when (= pos (cdr 
boundaries)) (forward-char -1)) (org-element-type 
(org-element-context))) (cond ((not match\?) nil) ((= pos 
(match-beginning 0)) 'bracket) ((= pos (1- (match-end 0))) 'bracket) ((= pos 
(match-end 0)) 'after) ((org-pos-in-match-range pos 2) 'year) 
((org-pos-in-match-range pos 3) 'month) ((org-pos-in-match-range pos 7) 'hour) 
((org-pos-in-match-range pos 8) 'minute) ((or (org-pos-in-match-range pos 4) 
(org-pos-in-match-range pos 5)) 'day) ((and (or (match-end 8) (match-end 5)) (> 
pos (or (match-end 8) (match-end 5))) (< pos (match-end 0))) (- pos (or 
(match-end 8) (match-end 5 (t 'day)))
  org-at-timestamp-p(agenda)
  org-agenda-get-timestamps(nil)
  org-agenda-get-day-entries("/home/ehere/science_works/calendar.org" (4 25 
2022) :deadline :scheduled :timestamp :sexp)
  apply(org-agenda-get-day-entries "/home/ehere/science_works/calendar.org" (4 
25 2022) (:deadline :scheduled :timestamp :sexp))
  org-agenda-list(nil)
  funcall-interactively(org-agenda-list nil)
  call-interactively(org-agenda-list)
  org-agenda(nil)
  funcall-interactively(org-agenda nil)
  call-interactively(org-agenda nil nil)
  command-execute(org-agenda)

Best regards,
Christian

-- 

Edmund Christian Herenz (ESO Fellow) Office: M152
ESO Vitacura Email:  eher...@eso.org
Alonso de Córdova 3107   Phone:  +56 2 2463 3047  (Office)
Vitacura, Casilla 19001  +56 9 4613 7517  (Mobile)
Santiago de Chile, Chile WWW:http://www.sc.eso.org/~eherenz/




Re: [Bug] incorrect indent of next heading after org-paste-subtree

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

>> I am unable to reproduce on the latest Org.
>
> Thank you, Ihor. I have checked it once more for current main HEAD 
> 2bd34edb64. I can reproduce it using the provided steps in Emacs-26, but 
> not in Emacs-27.
>
> Unless there is a reason to suspect something weird underneath, the 
> issue should be considered with rather low priority. Anyway, I have 
> added trailing newline to generated content and mostly use org-capture 
> with org-protocol for communication between applications.

Thanks for the extra info!
I managed to reproduce using Emacs 26 and it is a real problem with some
edge case in org-indent. The problem is masked by
combine-after-change-calls that is used since Emacs 27 but replaced by a
placeholer in Emacs 26.

The fix is attached. Let me know if it also works on your side.

Best,
Ihor

>From 5dd89d7b36bee94804c7ab631780a4bd020c49cb Mon Sep 17 00:00:00 2001
Message-Id: <5dd89d7b36bee94804c7ab631780a4bd020c49cb.1651463875.git.yanta...@gmail.com>
From: Ihor Radchenko 
Date: Mon, 2 May 2022 11:56:15 +0800
Subject: [PATCH] org-indent: Fix edge case when edited region ends at headline
 leading stars

* lisp/org-indent.el (org-indent-refresh-maybe): Extend affected
region to the whole line after END.

Fixes https://orgmode.org/list/t4lpos$l3p$1...@ciao.gmane.io
---
 lisp/org-indent.el | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lisp/org-indent.el b/lisp/org-indent.el
index 4cca0c35d..7469aba97 100644
--- a/lisp/org-indent.el
+++ b/lisp/org-indent.el
@@ -409,7 +409,13 @@ (defun org-indent-refresh-maybe (beg end _)
 		 (goto-char beg)
 		 (beginning-of-line)
 		 (re-search-forward
-		  (org-with-limited-levels org-outline-regexp-bol) end t)))
+		  (org-with-limited-levels org-outline-regexp-bol)
+  (save-excursion
+(goto-char end)
+;; Extend to headline if END is within its
+;; headline stars.
+(line-end-position))
+  t)))
 	   (let ((end (save-excursion
 			(goto-char end)
 			(org-with-limited-levels (outline-next-heading))
-- 
2.35.1



Re: [BUG] Org 9.5.3 fails to display agenda (error "rx form ‘regexp’ requires args satisfying ‘stringp’")

2022-05-01 Thread Ihor Radchenko
Edmund Christian Herenz  writes:

> thank you for the hard work on Org-mode.  I recently updated to 9.5.3
> using elpa on GNU Emacs 26.1 and suddenly org-mode fails to display
> the agenda (Debug message below).  This is not a smooth upgrade
> experience, and some tests on core-functionality on supported emacs
> versions would be appreciated.
>
> Debugger entered--Lisp error: (error "rx form ‘regexp’ requires args 
> satisfying ‘stringp’")

Thanks for reporting! This has been fixed on main branch, but not on
bugfix. I just backported the fix onto the stable (bugfix) branch. The
problem is serious enough to be considered critical
despite https://orgmode.org/list/87lew0xo8w@gnu.org

Best,
Ihor



Re: [BUG] Warning (org-element-cache): org-element--cache: Org parser error in suma-por-fila.tex::1585. Resetting. [9.5.3 (release_9.5.3-465-gd7dc62 @ /home/oub/emacs/site-lisp/packages/org/)]

2022-05-01 Thread Ihor Radchenko
Uwe Brauer  writes:

> Org-mode git version.
> a3dac4d20a37c51393f191d01e0ec2170bb260a3
>
> Opening a tex file I receive the following error message
> ,
> | Warning (org-element-cache): org-element--cache: Org parser error in 
> suma-por-fila.tex::1585. Resetting.
> |  The error was: (error "rx ‘**’ range error")
> |  Backtrace:
> | "  backtrace-to-string(nil)
> |   org-element-at-point()
> |   org-element-context()
> |   link-message()

Thanks for reporting!
As warning indicates, you are trying to run Org function
(org-element-context) in TeX buffer.
org-element-context does not work anymore in non-Org buffers.

This is most likely done by your personal customisation or by
third-party package (`link-message' function).

Best,
Ihor




Re: How to export to markdown programmatically without the table of contents?

2022-05-01 Thread Daniel Fleischer
Jeremie Juste [2022-05-01 Sun 22:29] wrote:

> I know where to look now:
>
> (info "(org) Publishing options")

That's a good resource!




Re: [BUG] Warning (org-element-cache): org-element--cache: Org parser error in suma-por-fila.tex::1585. Resetting. [9.5.3 (release_9.5.3-465-gd7dc62 @ /home/oub/emacs/site-lisp/packages/org/)]

2022-05-01 Thread Uwe Brauer
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer  writes:
>> Org-mode git version.
>> a3dac4d20a37c51393f191d01e0ec2170bb260a3
>> 
>> Opening a tex file I receive the following error message
>> ,
>> | Warning (org-element-cache): org-element--cache: Org parser error in 
>> suma-por-fila.tex::1585. Resetting.
>> |  The error was: (error "rx ‘**’ range error")
>> |  Backtrace:
>> | "  backtrace-to-string(nil)
>> |   org-element-at-point()
>> |   org-element-context()
>> |   link-message()

> Thanks for reporting!
> As warning indicates, you are trying to run Org function
> (org-element-context) in TeX buffer.
> org-element-context does not work anymore in non-Org buffers.

> This is most likely done by your personal customisation or by
> third-party package (`link-message' function).

I see, most likely orglink (available in melpa)
;; Homepage: https://github.com/tarsius/orglink

Was the culprit, I upgraded the package and have not seen that message so far 
anymore.

Regards

Uwe Brauer 


smime.p7s
Description: S/MIME cryptographic signature


Re: [BUG] Warning (org-element-cache): org-element--cache: Org parser error in suma-por-fila.tex::1585. Resetting. [9.5.3 (release_9.5.3-465-gd7dc62 @ /home/oub/emacs/site-lisp/packages/org/)]

2022-05-01 Thread Ihor Radchenko
Uwe Brauer  writes:

>> This is most likely done by your personal customisation or by
>> third-party package (`link-message' function).
>
> I see, most likely orglink (available in melpa)
> ;; Homepage: https://github.com/tarsius/orglink
>
> Was the culprit, I upgraded the package and have not seen that message so far 
> anymore.

I am not sure. I searched through commit history of orglink and there is
no instance of org-element-context.

So, beware that the observed issue might be related to some other package.

Best,
Ihor



Re: [BUG] Warning (org-element-cache): org-element--cache: Org parser error in suma-por-fila.tex::1585. Resetting. [9.5.3 (release_9.5.3-465-gd7dc62 @ /home/oub/emacs/site-lisp/packages/org/)]

2022-05-01 Thread Uwe Brauer
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer  writes:
>>> This is most likely done by your personal customisation or by
>>> third-party package (`link-message' function).
>> 
>> I see, most likely orglink (available in melpa)
>> ;; Homepage: https://github.com/tarsius/orglink
>> 
>> Was the culprit, I upgraded the package and have not seen that message so 
>> far anymore.

> I am not sure. I searched through commit history of orglink and there is
> no instance of org-element-context.

> So, beware that the observed issue might be related to some other package.

I see, thanks for pointing that out. I run a grep -r in my .emacs.d/elpa
directory and indeed still a lot of packages use that function, but in
my understanding all of them refer to org files. Hm, strange.

I do use a bit old version of org-ref though (since I have difficulties
with the new interface and no time to get acquainted now).

I will try later to dig more into the issue.


smime.p7s
Description: S/MIME cryptographic signature