[PATCH][DOC]: Add footnote on how to enable described functionality

2024-03-22 Thread Nick Dokos
I previously submitted a bug on what I thought was a code bug, but which
turned out to be (partly) a mistake on my part and was canceled:

   
https://list.orgmode.org/878r2b4dpy.fsf@localhost/T/#m48b7ea939117f241069fafbcf3726587837f3e70

But there is still a doc bug: since the default value of
`org-html-head-include-scripts' was changed to `nil' in Org 9.5, the
functionality described in the `Literal Examples' section of the manual
is no longer enabled by default. The attached patch adds a footnote to
describe how to enable that functionality. Thanks to user @JeanPierre on
Emacs SE for the original question and the push for the doc patch:

   
https://emacs.stackexchange.com/questions/80783/org-mode-export-to-html-onmouseover-highlighting-of-referenced-code-lines

>From 127d9628b9b1e8be54cdc715ab4e6bdcc012d716 Mon Sep 17 00:00:00 2001
From: Nick Dokos 
Date: Fri, 22 Mar 2024 09:08:22 -0400
Subject: [PATCH] org-manual: Add footnote on how to enable described
 functionality.

* doc/manual.org (Literal Examples): The functionality of having
`ref:' links remote-highlighted in HTML is disabled by default (since
version 9.5). Add a footnote to explain how to enable it.

Link: https://emacs.stackexchange.com/questions/80783/org-mode-export-to-html-onmouseover-highlighting-of-referenced-code-lines
---
 doc/org-manual.org | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index 211208c424c8..c4f62644f8db 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -11623,9 +11623,12 @@ to determine the starting line number.
 
 In literal examples, Org interprets strings like =(ref:name)= as
 labels, and use them as targets for special hyperlinks like
-=[[(name)]]=---i.e., the reference name enclosed in single parenthesis.
-In HTML, hovering the mouse over such a link remote-highlights the
-corresponding code line, which is kind of cool.
+=[[(name)]]=---i.e., the reference name enclosed in single
+parentheses.  In HTML, hovering the mouse over such a link
+remote-highlights the corresponding code line[fn:: This requires some
+Javascript which is /not/ automatically included in the HTML output:
+you have to customize the variable =org-html-head-include-scripts= to
+~t~ to have it included (it is ~nil~ by default).], which is kind of cool.
 
 You can also add a =-r= switch which /removes/ the labels from the
 source code[fn:: Adding =-k= to =-n -r= /keeps/ the labels in the
-- 
2.43.0


-- 
Nick




Re: [BUG] `org-html-head-include-scripts' default value should be `t' but it's nil instead [9.7-pre (release_9.6.20-1267-gb0c3c9 @ /home/nick/src/emacs/org/org-mode/lisp/)]

2024-03-21 Thread Nick Dokos
Ihor Radchenko  writes:

> Nick Dokos  writes:
>
>> If you load `ox-html`, the default value of
>> `org-html-head-include-scripts` is nil, despite the defcustom:
>>
>> (defcustom org-html-head-include-scripts t ...
>
> Are you sure? What I am seeing in lisp/ox-html.el is
>
> (defcustom org-html-head-include-scripts nil
>   "Non-nil means include the JavaScript snippets in exported HTML files.
> The actual script is defined in `org-html-scripts'."
>   :group 'org-export-html
>   :version "24.4"
>   :package-version '(Org . "8.0")
>   :type 'boolean)
>
> The default value is nil.

You are right (I was playing in an old branch and did not notice it at
the time). And although the theoretical possibility still exists, I
don't know of any other manifestation, so the question is moot at this
point.

Sorry for the noise.
-- 
Nick




[BUG] `org-html-head-include-scripts' default value should be `t' but it's nil instead [9.7-pre (release_9.6.20-1267-gb0c3c9 @ /home/nick/src/emacs/org/org-mode/lisp/)]

2024-03-21 Thread Nick Dokos



If you load `ox-html`, the default value of
`org-html-head-include-scripts` is nil, despite the defcustom:

(defcustom org-html-head-include-scripts t ...

The reason is that `org-expot-define-backend`, which is called earlier
in the file, contains the following line in the options alist:

   (:html-head-include-scripts nil "html-scripts" 
org-html-head-include-scripts)

and the call apparently binds `org-html-head-include-scripts' to nil, so
by the time the defcustom is evaluated, it's too late. I was confused by
that, but the description of `defcustom' in the Emacs Lisp Ref manual
states:

 The argument STANDARD is an expression that specifies the standard
 value for OPTION.  Evaluating the ‘defcustom’ form evaluates
 STANDARD, but does not necessarily bind the option to that value.
 If OPTION already has a default value, it is left unchanged.  If
 the user has already saved a customization for OPTION, the user’s
 customized value is installed as the default value.  Otherwise, the
 result of evaluating STANDARD is installed as the default value.

I verified that if I move the `defcustom' to before the
`org-export-defined-backend' call, everything works as expected.

See

   
https://emacs.stackexchange.com/questions/80783/org-mode-export-to-html-onmouseover-highlighting-of-referenced-code-lines

for the original question and the analysis.

Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, 
cairo version 1.17.8)
 of 2023-12-28
Package: Org mode version 9.7-pre (release_9.6.20-1267-gb0c3c9 @ 
/home/nick/src/emacs/org/org-mode/lisp/)

-- 
Nick





Re: Moving to the next heading does not always work

2024-01-12 Thread Nick Dokos
Rudolf Adamkovič  writes:

> REPRODUCTION STEPS:
>
> 1. Launch 'emacs -Q'.
> 2. Create a new Org file:
>
> * 1
> :PROPERTIES:
> :CUSTOM_ID: foo
> :END:
> * [[#foo][foo]] 2
> * 3
>
> 3. Open the newly created Org file.
> 3. Type M-x org-toggle-link-display RET.
> 4. Move the cursor to the first heading.
> 5. Type C-c C-n.
>
> EXPECTED:
>
>   The cursor moves to the second heading.

That's what happens here. Version: Org mode version 9.7-pre
(release_9.6.14-1019-g5092ec).

What version are you running?

>
> ACTUAL:
>
>   The cursor moves to the end of file.
>
> Rudy

-- 
Nick




[BUG] org-table-eval-formula mishandles semicolons in formulas [9.7-pre (release_9.6.14-1019-g5092ec @ /home/nick/src/emacs/org/org-mode/lisp/)]

2024-01-12 Thread Nick Dokos



Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

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

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


`org-table-eval-formula' interprets *any* semicolon in a formula as the
beginning of a format specifier. So if the formula contains a literal
semicolon that is not a format specifier

#+TBLFM: $3='(concat "COMMENT ON public.layout_forms." $1 " IS " (rc-sq $2) 
";")

The problem is that `org-table-eval-formula' decides that the semicolon
is the beginning of a format specifier very early in the function and
splits off the "specifier" from the rest of the formula, leading to
errors when the truncated formula is evaluated later.

ThHere is a semi-reasonable workaround in that the regexp matches the
*last* semicolon, so we can add a semicolon at the end of the formula,
specifying an empty format, but the formula is not truncated any longer.
If it is decided that the code must not be changed, then maybe the
workaround could be added to the documentation (perhaps as a footnote to
section "Emacs Lisp forms as formulas").

This was reported by user `vfclists' on Emacs SE:


https://emacs.stackexchange.com/questions/80062/is-it-because-this-org-table-formula-contains-double-quotes-it-doesnt-work


Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, 
cairo version 1.17.8)
 of 2023-12-28
Package: Org mode version 9.7-pre (release_9.6.14-1019-g5092ec @ 
/home/nick/src/emacs/org/org-mode/lisp/)
-- 
Nick





Re: Or probably just fix the org-ctags hook functions?

2023-08-11 Thread Nick Dokos
Ihor Radchenko  writes:

> Nick Dokos  writes:
>
>>> ...
>>> Probably the problem is not the side-effects done by loading
>>> =org-ctags=, but rather that these hook function from =org-ctags= try
>>> to do their job when the environment is not really ready for them,
>>> i.e. when there is no known tag file around.
>>> ...
>>
>> I disagree: the changes are done behind my back in an (almost)
>> invisible manner and leave me surprised and mystified. Even if there
>> was a TAGS file around, having links behave differently from one
>> moment to the next, when the only thing I did in-between was ask for
>> help on a completely unrelated Org mode function, is a nasty surprise.
>
> Sure, but we should not reject Jens' proposal just because of this
> argument. We can use the suggestions to improve org-ctags itself, after
> it is explicitly loaded.

Absolutely.

My disagreement was only with the part that I quoted, in particular
the "Probably the problem is not the side-effects done by loading
=org-ctags= ..."  part: from my POV, that is *exactly* the problem
which I would like to see addressed.

-- 
Nick




Re: Or probably just fix the org-ctags hook functions?

2023-08-10 Thread Nick Dokos
Jens Schmidt  writes:

> On 2023-08-08  10:48, Ihor Radchenko wrote:
>
> ...
> Probably the problem is not the side-effects done by loading
> =org-ctags=, but rather that these hook function from =org-ctags= try
> to do their job when the environment is not really ready for them,
> i.e. when there is no known tag file around.
> ...

I disagree: the changes are done behind my back in an (almost)
invisible manner and leave me surprised and mystified. Even if there
was a TAGS file around, having links behave differently from one
moment to the next, when the only thing I did in-between was ask for
help on a completely unrelated Org mode function, is a nasty surprise.

-- 
Nick




Re: [POLL] Should we accept breaking changes to get rid of Org libraries that perform side effects when loading?

2023-08-10 Thread Nick Dokos
Max Nikulin  writes:

> On 08/08/2023 20:29, Bastien Guerry wrote:
>> The definition of a new function is not a side-effect
>> that affects Emacs editing behavior, so Babel and export libs are
>> OK.
>
> Function definition is not side effect when load library is
> requested. However it is a side effect of hitting TAB in Emacs help
> prompt. Completion of a variable or a function should not modify Org
> behavior. Loading of a file is not explicitly requested by the user in
> this case.
>
> I would disregard however function definitions, however changes in key
> bindings and recognized plain text links may be surprising to users
> who just tries to read help.
>
>

A big +1 from me: that's exactly what I was trying to say a few months
ago wrt org-ctags, although I said it badly. Defining functions that
are not used is not much of a problem IMO, but changing behavior behind
the user's back is most definitely a problem. IOW, it's not about
side-effects in general, it's about *specific kinds* of side-effects:
ones that are immediately visible (and confusing) to the user - things
behaving differently from a minute ago even though the only thing the
user did in-between is something as innocuous as asking for help.

One small step forward is to require libraries to have explicit
enable/disable functions[fn:1].  Even if I somehow enable a library by
mistake or misadventure, I should be able to disable it (at least in
the sense described above) without having to restart. Not every
library will need that and it's not even close to a complete solution,
but there is at least the possibility of building something better
(though more complicated) on top of it. If the library could be
organized as a minor mode, it most definitely should be so organized:
enabling/disabling would then be an automatic "requirement satisfied".

I would also recommend that the library *not* call its enable function
in general and leave it to the user to do so explicitly, but that may
be more controversial for "backward compatibility" reasons (with which
I disagree in these particular cases: I view them as bugs that need to
be fixed). And the library should document what changes it unleashes
on the environment (again in the restricted sense discussed above):
changes to "foreign" keymaps/menus/syntax tables/hooks probably
qualify for this kind of documentation, function definitions and
internal-to-the-library changes do not, plus there is probably a swath
of stuff in-between with more ambiguous requirements - all I can say
is start with the obvious things and add as necessary.

[fn:1] E.g. `org-ctags' has `org-ctags-enable' but no `org-ctags-disable', so
my "solution" is to do something like this in my init file:

;;; undo org-ctags obnoxiousness
(with-eval-after-load 'org-ctags (setq org-open-link-functions nil))

It doesn't undo everything but it gets the obnoxious bits out of my
way (at least until *I* decide to call `org-ctags-enable').

My 2-cents/pence/centimes...
-- 
Nick




Re: [BUG] org-babel-tangle: Header arg `:comments org' produces no comment in the output [9.7-pre (release_9.6.6-418-g294a4d @ /home/nick/src/emacs/org/org-mode/lisp/)]

2023-06-26 Thread Nick Dokos
Ihor Radchenko  writes:

> Nick Dokos  writes:
>
>> A couple of nits: maybe the comment that `org-back-to-heading' sets match
>> data should be deleted?  And there is a typo in the initial comment of
>> the test you added (thanks for adding it!): `:commends org' should be
>> `:comments org'.
>
> Thanks!
> Fixed, on bugfix.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=f56ca5009
>
>> Also, I found a couple of places in the code where `org-back-to-heading' is 
>> called
>> and then match data are used. I don't know if there is a problem or not, but 
>> it might
>> be worth double checking to make sure that the usage makes sense:
>>
>> - org.el: l.20792 in `org-forward-heading-same-level'
>> - org-mouse.el: l.976 in `org-mouse-transform-to-outline'
>
> Right.
> Fixed, on bugfix.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=57bb9cada
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=0a842cc94

Thank you!

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: [BUG] org-babel-tangle: Header arg `:comments org' produces no comment in the output [9.7-pre (release_9.6.6-418-g294a4d @ /home/nick/src/emacs/org/org-mode/lisp/)]

2023-06-23 Thread Nick Dokos
Ihor Radchenko  writes:

> Nick Dokos  writes:
>
>> Here's an ECM:
>> ...
>> I narrowed it down to this snippet of code in 
>> `org-babel-tangle-single-block':
>> ...
>> and bisecting fingered this commit:
>> ...
>> Apparently, `org-back-to-heading' sets match data differently now: 
>> `(match-end 0)' gets the end of the line,
>> Before the patch, it got the beginning of the line.
>
> Thanks for the report and for the detailed analysis!
> Fixed, on bugfix.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=79ec91584

Thanks!

A couple of nits: maybe the comment that `org-back-to-heading' sets match
data should be deleted?  And there is a typo in the initial comment of
the test you added (thanks for adding it!): `:commends org' should be
`:comments org'.

Also, I found a couple of places in the code where `org-back-to-heading' is 
called
and then match data are used. I don't know if there is a problem or not, but it 
might
be worth double checking to make sure that the usage makes sense:

- org.el: l.20792 in `org-forward-heading-same-level'
- org-mouse.el: l.976 in `org-mouse-transform-to-outline'

I'll try to test these cases and report back but I can't promise when.
-- 
Nick




Re: ox-coma-letter and org-export-dispatch

2023-06-21 Thread Nick Dokos
Sébastien Gendre  writes:


> Recently I tested the export functions of ox-coma-letter. It work very
> well.
>
> But I cannot found the entries in org-export-dispatch.
>

You probably need to load (or require) the feature. Add this to your
init file:

--8<---cut here---start->8---
(require 'ox-koma-letter)
--8<---cut here---end--->8---

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




[BUG] org-babel-tangle: Header arg `:comments org' produces no comment in the output [9.7-pre (release_9.6.6-418-g294a4d @ /home/nick/src/emacs/org/org-mode/lisp/)]

2023-06-21 Thread Nick Dokos



Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

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

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


Here's an ECM:

--8<---cut here---start->8---
* Function heading

  #+begin_src elisp :tangle "file.el" :comments org
(message "FOO")
  #+end_src
--8<---cut here---end--->8---

Tangling it with `C-c C-v C-t' produces the following:

--8<---cut here---start->8---
(message "FOO")
--8<---cut here---end--->8---

with no comment added.

In 9.5.5, the output is correct:

--8<---cut here---start->8---
;; Function heading


(message "FOO")
--8<---cut here---end--->8---

I narrowed it down to this snippet of code in `org-babel-tangle-single-block':

,
|   ;; From the previous heading or code-block end
|   (funcall
|org-babel-process-comment-text
|(buffer-substring
| (max (condition-case nil
|  (save-excursion
|(org-back-to-heading t) ; Sets match data
|(match-end 0))
|(error (point-min)))
|  (save-excursion
|(if (re-search-backward
| org-babel-src-block-regexp nil t)
|(match-end 0)
|  (point-min
| (point)
`

and bisecting fingered this commit:

--8<---cut here---start->8---
2737128aa778297f41971cc93c464faf17718e34 is the first bad commit
commit 2737128aa778297f41971cc93c464faf17718e34
Author: Ihor Radchenko 
Date:   Tue Sep 13 20:59:13 2022 +0800

org-back-to-heading: Use cache

* lisp/org.el (org-back-to-heading): Use element cache when cache is
active.

 lisp/org.el | 63 -
 1 file changed, 41 insertions(+), 22 deletions(-)
--8<---cut here---end--->8---

Apparently, `org-back-to-heading' sets match data differently now: `(match-end 
0)' gets the end of the line,
Before the patch, it got the beginning of the line.

Emacs  : GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.37, 
cairo version 1.17.6)
 of 2023-06-21
Package: Org mode version 9.7-pre (release_9.6.6-418-g294a4d @ 
/home/nick/src/emacs/org/org-mode/lisp/)
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: [PATCH v2] doc/org-manual.org: Document `org-latex-src-block-backend'

2023-05-30 Thread Nick Dokos

On 5/30/23 11:27, Ihor Radchenko wrote:

Nick Dokos  writes:


Please try to read and let me know if anything is confusing.

To me, it does not seem necessary to include the various descriptions. Just
the first three lines of the patch, perhaps with a prompt to consult
the doc string of the variable which describes these options in
detail, seems enough IMO.

I feel that we at least need to tell people briefly what is possible.
What about the attached, shorter, patch?



LGTM.

--

Nick





Re: [PATCH] doc/org-manual.org: Document `org-latex-src-block-backend'

2023-05-23 Thread Nick Dokos
Ihor Radchenko  writes:

> Attaching tentative manual patch that explains about
> `org-latex-src-block-backend'. There was no explanation about different
> ways to export colored source blocks in the past.
>
> Please try to read and let me know if anything is confusing.

To me, it does not seem necessary to include the various descriptions. Just
the first three lines of the patch, perhaps with a prompt to consult
the doc string of the variable which describes these options in
detail, seems enough IMO.

My $0.02 - feel free to disregard.

-- 
Nick




Re: How to filter a clock table by property value?

2023-05-22 Thread Nick Dokos
Marcin Borkowski  writes:

> On 2023-05-08, at 17:30, Ihor Radchenko  wrote:
>
>> Marcin Borkowski  writes:
>>
>>> #+BEGIN: clocktable :match "property=\"value\""
>>> #+END
>>
>> "+property=\"value\""
>>
>> I just tried #+BEGIN: clocktable :scope subtree :match "+ID=\"Organization\""
>> and it worked.
>
> Thanks!  Still didn't work, it turned out that I didn't set
> `org-use-property-inheritance'.  Then it turned out that I don't even
> need the plus sign.
>

The `+' (or `-') sign is needed for tags matching.

(info "(org)Matching Tags and Properties")

-- 
Nick




Re: org-ctags land grab

2023-03-22 Thread Nick Dokos
Ihor Radchenko  writes:

> Nick Dokos  writes:
>
>> `org-ctags' unilaterally sets the hook `org-open-link-functions' to a
>> bunch of org-ctags functions and enables itself by default. That has
>> the unfortunate consequence of invalidating the documentation for
>> internal CUSTOM_ID links - see
>>
>> https://emacs.stackexchange.com/questions/76351/how-to-follow-an-internal-link-in-recent-org-mode
>
> As documented in the top comment of org-ctags.el, the default behaviour
> of C-c C-o is modified as you observe:
>
> ;; By default, with org-ctags loaded, org will first try and visit the tag
> ;; with the same name as the link; then, if unsuccessful, ask the user if
> ;; he/she wants to rebuild the 'TAGS' database and try again; then ask if
> ;; the user wishes to append 'tag' as a new toplevel heading at the end of
> ;; the buffer; and finally, defer to org's default behavior which is to
> ;; search the entire text of the current buffer for 'tag'.
>
>> I proposed a work-around, but it seems to me that `org-ctags'
>> functionality should be opt-in and there should be a way to turn it
>> off.
>
> It is off by default.

It is off until org-ctags is loaded. *When* it is loaded, it runs
`(org-ctags-enable)' and the behavior changes.

Now I'm not loading it explicitly, but nevertheless, *somebody* does
because it goes ahead and mucks with my `org-open-link-functions'.
One clue was that it does not happen in 28.2 (which is the version
in Fedora 36 and 37) but it *does* happen in a 30.0.50 Emacs built
from upstream sources.

So I ran some tests, all with -Q so my init file is out of the
picture.

It turns out that it is enough to ask for help on an Org variable to
have `org-ctags' loaded!  I put a watch on `org-open-link-functions'
and did `C-h v org-latex-pdf-process': it stopped once on setting it to
nil and it stopped again with this backtrace (I elided long lines but I left
the relevant portion of the one that mentions `org-ctags'):



--8<---cut here---start->8---
Debugger entered--setting org-open-link-functions to (org-ctags-find-tag): 
  debug--implement-debug-watch(org-open-link-functions (org-ctags-find-tag) set 
nil)
  set-default(org-open-link-functions (org-ctags-find-tag))
  add-hook(org-open-link-functions org-ctags-find-tag t)
  org-ctags-enable()
  byte-code("\300 \210\301\302!\207" [org-ctags-enable provide org-ctags] 2)
  load("org-ctags" noerror nomessage)
  help--load-prefixes((("org-" "ox-latex" "ox" "org-src" "org-refile" 
"org-protocol" "org-plot" "org-pcomplete" "org-mouse" "org-macs" "org-list" 
"org-keys" "org-habit" "org-faces" "org-ctags" ...
  help--symbol-completion-table("org-latex-pdf-process" ...
  test-completion("org-latex-pdf-process" help--symbol-completion-table ...
  completion--complete-and-exit(20 41 exit-minibuffer ...
  completion-complete-and-exit(20 41 exit-minibuffer)
  minibuffer-complete-and-exit()
  funcall-interactively(minibuffer-complete-and-exit)
  call-interactively(minibuffer-complete-and-exit nil nil)
  command-execute(minibuffer-complete-and-exit)
  read-from-minibuffer("Describe variable: " nil ...
  completing-read-default("Describe variable: " help--symbol-completion-table 
...
  completing-read("Describe variable: " help--symbol-completion-table ...
  byte-code(...
  call-interactively(describe-variable nil nil)
  command-execute(describe-variable)
--8<---cut here---end--->8---

As you see, `help--load-prefixes' loads `org-ctags'. If you look at
the `help-definition-prefixes' radix tree, `org-ctags' is subsumed
under the `org-' prefix, so any lookup with that prefix will end up
loading it (and therefore enabling it). The reason it does not happen
in 28.2 is that it is only under the `org-ctags` prefix.

It seems to me that `org-ctags' should be registered under the
`org-ctags' prefix only, just like in 28.2 (the registration is in
`org-loaddefs.el' but I don't know how it ends up there. I guess
`org-fixup.el' is doing it, but I didn't chase it any further).

I also think that loading `org-ctags' should not automatically enable
it: it should require the user to explicitly run `org-ctags-enable' to
do that. That way, if there is a mechanism that loads it
surreptitiously, it wouldn't cause the confusion that it causes
now. That would require documentation changes, but it would avoid
unpleasant surprises, and preserve some toes even if users load it
accidentally. Eventually, it might be nice to provide a disabling
function as well, although the workaround in the SE post works well
enough for now. Maybe the thing to do is to turn it into a proper
minor mode.

Thoughts?

-- 
Nick




org-ctags land grab

2023-03-20 Thread Nick Dokos
`org-ctags' unilaterally sets the hook `org-open-link-functions' to a
bunch of org-ctags functions and enables itself by default. That has
the unfortunate consequence of invalidating the documentation for
internal CUSTOM_ID links - see

https://emacs.stackexchange.com/questions/76351/how-to-follow-an-internal-link-in-recent-org-mode

It is also confusing. To quote the unfortunate victim:

  Now, when I click on the link, or C-c C-o, I get a dialog to "visit
  tags table"... ???

I proposed a work-around, but it seems to me that `org-ctags'
functionality should be opt-in and there should be a way to turn it
off. In addition, it needs a better way to interpolate itself into the
link ecosystem: breaking internal link functionality is rather
obnoxious IMO.

WDYT?

-- 
Nick




Re: [BUG] incorrect result with C-c ! to correct (complete) a date [9.7-pre (release_9.6.1-306-ga645a6 @ /home/d/src/git-org-mode/lisp/)]

2023-03-20 Thread Nick Dokos
Do `C-h v org-read-date-force-compatible-dates` and read the doc
string of the variable.  You can customize the variable and set it to
`nil' which will give you a much wider range of dates to choose from
*assuming that your Emacs is compiled for and runs on a system that
can deal with such dates* (this is related to the "2038" problem[1]  where
32-bit (signed) timestamps will not be enough to count the number of seconds
since the "beginning of time" (that's 1970-01-01 at least as far as
Unix is concerned :-)) 

This is a difficult compatibility problem which is being worked on on
many fronts and I think there have been discussions about it on this
list.

But read the doc string, experiment on your system and see if you can
live with the consequences of choosing the "other" value for the
variable.

[1] https://en.wikipedia.org/wiki/Year_2038_problem

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Cannot expand macros through included org file

2023-02-15 Thread Nick Dokos
reza  writes:

> Hi Ihor
>
> Thanks for your quick reply
>
>> What you can do instead is creating a named Org paragraph with macro,
>> like
>>
>> #+name: year
>> {{{year}}}
>
> I tried this approach but it does not seem to work either:
>
> "template.org":
>
>#+TITLE: Report
>#+NAME: year
>
>{{{year}}}
>

There should be no empty line between `#+NAME: year' and `{{{year}}}'.

There is a `+' missing at the end of the python code block.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: org-agenda-files: using variables

2023-01-17 Thread Nick Dokos
"Loris Bennett"  writes:

> Hi,
>
> I have
>
>   (setq lb/org-directory "~/org/"))
>   (setq lb/gtd-file (expand-file-name "gtd.org" lb/org-directory))
>   (setq lb/refile-file (expand-file-name "refile.org" lb/org-directory))
>   (setq org-agenda-files '(lb/gtd-file lb/refile-file))
>
> But generating the agenda fails with
>
>   Wrong type argument: stringp, lb/gtd-file  
>
> What is the correct syntax to use the variables in the list?
>

Quoting quotes everything including symbols, so you either do not
quote or use backquote:

  (setq org-agenda-files (list lb/gtd-file lb/refile-file))
  (setq org-agenda-files `(,lb/gtd-file ,lb/refile-file))

In this case, I'd prefer the first form, but the second form is often
useful - see

  (info "(elisp)Backquote")

-- 
Nick




Re: Setting the default todo priority ?

2023-01-10 Thread Nick Dokos
David Masterson  writes:

> I see that Org treats TODOs without a priority cookie as having a
> priority that is midway between highest and lowest.
>
> Use case: I may have a task type that fully expresses what it's priority
> is.  Example would be SOMEDAY which is going to have the lowest
> priority.  Adding a cookie to all SOMEDAY tasks seems superfluous.
>
> Is there a way of changing the default priority?

C-h v org-priority-{highest,lowest,default}

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: [QUERY] Anyone using multiple org-preview-latex-process-alist commands?

2023-01-10 Thread Nick Dokos
Timothy  writes:

> Hi All,
>
> In my rewrite of the LaTeX preview system, I’m finding it a bit
> annoying dealing with the potential of multiple commands being used
> in the `org-preview-latex-process-alist'’s
> `:latex-compiler'/`:latex-precompiler'/`:image-converter'
> properties.
>
> I’m hence considering adding support for a string value, and
> deprecating support for multiple-command lists.
>
> Does anybody actually use multiple commands? If so, for what
> purpose?
>

I guess I misunderstood you: you are objecting to e.g. the
:latex-compiler value being a list, rather than a single string.

I think that was modeled after `org-latex-pdf-process' which is a list
of commands because LaTeX needed to be run multiple times in various
cases, so originally, this was a list of three invocations of LaTeX
("what I tell you three times is true"). With `latexmk' and similar,
that has thankfully become a thing of the past, so a single command is
enough, but making it not a list is probably going to break backward
compatibility.

OTOH, although I seem to have modified some details of
`org-preview-latex-process-alist', I have not added multiple commands
for any of the above. But it's conceivable that someone has - although
it's probably less likely than with `org-latex-pdf-process' - so you
may hear complaints in some distant future about it :-) 

So assuming that I've understood you correctly this time, I have no
objection to simplifying (at least, I cannot think of any ATM).

-- 
Nick




Re: [QUERY] Anyone using multiple org-preview-latex-process-alist commands?

2023-01-10 Thread Nick Dokos
Timothy  writes:

> Hi All,
>
> In my rewrite of the LaTeX preview system, I’m finding it a bit
> annoying dealing with the potential of multiple commands being used
> in the `org-preview-latex-process-alist'’s
> `:latex-compiler'/`:latex-precompiler'/`:image-converter'
> properties.
>
> I’m hence considering adding support for a string value, and
> deprecating support for multiple-command lists.
>
> Does anybody actually use multiple commands? If so, for what purpose?
>

I have entries for `dvipng', `dvisvgm' and `imagemagick' in that
variable (with different values for the various processors). I use
mostly imagemagick for my purposes, but I've used the other two
occasionally when I had to debug other people's setups.

I find the setup flexible and easy to deal with: what do you find
annoying about it?

-- 
Nick




Re: TODO state for heading intersection?

2023-01-10 Thread Nick Dokos
Jean Louis  writes:

> Is there a way to change TODO state for intersection of headings,
> for example, for some headings by tag to change the TODO state at
> once?

IIUC, you can use `org-map-entries` to apply the function `org-todo`
(or a different function if you want) to a collection of nodes in a
file that are specified through tags/properties matches:

   (org-map-entries #'org-todo "LEVEL=1" 'file)

will apply it to top-level nodes only.

See

   (info "(org)Using the Mapping API")

and

   (info "(org)Matching tags and properties")

-- 
Nick




Re: setting export_file_name during export

2023-01-10 Thread Nick Dokos
Leo Butler  writes:

>>
>> So: if you insert 
>>
>>   :PROPERTIES:
>>   :EXPORT_FILE_NAME: lecture-1.pdf
>>   :END:
>>
>
> Aha! Thank you very much. I had forgotten about using property
> drawers. It would be a simple matter to create a filter to insert that
> property drawer under the heading that contains point.
>

IIUC, you really don't need to insert things dynamically: you can add
an appropriate property drawer after every top-level heading once and
for all.

-- 
Nick





Re: Syntax question: What is BORDER in 4.17. Text Markup?

2022-12-07 Thread Nick Dokos
Jens Lechtenboerger  writes:


> Actually, what about this?  Get rid of both, BORDER and BODY, and
> specify CONTENTS as follows:
> “Either a string (when MARKER represents code or verbatim) or a
> series of objects from the standard set, not spanning more than
> three lines.  In any case, CONTENTS must neither begin nor end with
> whitespace.”
>

The problem is that these things are configurable, so the above is onlyu
true by default. But you can redefine `org-emphasis-regexp-components` in
ways that would make the above untrue: hence the more abstract description.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Supress title on html export

2022-12-02 Thread Nick Dokos
Galaxy Being  writes:

> BTW, this would seem to suggest org-mode has some built-in "master
> CSS". Or, how does org-mode know about the class/ID .title? In my
> case, I use my own CSS that I put in the header, and yes, it has a
> .title. Still, how does bare-bones default html export know about
> .title?
>

Do

   C-h v org-html-style-default

Also do

   C-h i g(org)RET m CSS

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: [BUG] Clipboard text pasted in two windows with a cloned buffer [9.6-pre ( @ /home/chomwitt/.config/emacs/elpa/org-9.6pre0.20221110.85807/)]

2022-11-30 Thread Nick Dokos
Alexandros Prekates  writes:

> On Mon, 28 Nov 2022 10:28:41 +
> Alexandros Prekates  wrote:
>
> I come across another case :
>
>
> WINDOW A --  WINDOW B -
> * FOO1   * FOO1
> ** goo2  ** goo2
> ** zoo2  ** zoo2
> bla
> [[   <--- starting a link
> bla
>
>
> WINDOW A --  WINDOW B -
> * FOO1   * FOO1
> ** goo2  ** goo2
> ** zoo2  ** zoo2...http://foo 
> bla
> [[http://foo  <--- pasting a url
> bla
>

I can confirm the behavior on GNU Emacs 29.0.50 (build 1,
x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4) of
2022-02-02

Although it is confusing and unfortunate, it is "just" a display
error: if you switch to B and press TAB, the URL is in the right
place, and pressing TAB again folds the heading correctly, producing
what you expect.

I suspect that it's not just an Org problem: it is probably caused
when you paste into the middle of text that is invisible in the cloned
buffer. I have not tried it out however.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: How ro delete DONE attemps

2022-10-25 Thread Nick Dokos
Renato Pontefice  writes:

> Hi,
> I’m wondering how can I delete, on my .org file, the line that have:
> - an old Timestamp (i.e. if I set a thing to be done today (<2022-10-24 Mon 
> 17:26>)
> - a TODO item (always with a past date) <2022-10-24 Mon 17:26>
>
> That to have a more clean .org file.
>
> Is it possible?
> How can I obtain it?
>

It's just text: you can use ordinary Emacs commands to modify the
file, e.g. C-k will kill a line, or you can use C-d to delete
characters or M-d to delete words.

-- 
Nick




Re: org-encode-time bug

2022-07-25 Thread Nick Dokos
Ihor Radchenko  writes:

> Morgan Smith  writes:
>
>> I'm using emacs from commit f258f67 (quite recent) and org from commit
>> 39005dc (quite recent).
>>
>> I'm using native compilation and PGTK.
>
>> Debugger entered--Lisp error: (invalid-function org-encode-time)
>>   org-encode-time((0 0 0 21 7 2022 4 t -14400))
>>   org-matcher-time("<2022-07-21 Thu 00:00>")
>>   org-clock-get-table-data(...)
>>   org-dblock-write:clocktable(...)
>>   org-update-dblock()
>>   org-ctrl-c-ctrl-c(nil)
>>   funcall-interactively(org-ctrl-c-ctrl-c nil)
>>   command-execute(org-ctrl-c-ctrl-c)
>
> org-encode-time is defined in org-macs.el in the latest Org, but _not_
> in built-in Org. What you are seeing is most likely caused by "mixed"
> installation of Org when part of Org is loaded from built-in Org
> distribution coming from Emacs.
>
>> I was able to reproduce this with 'emacs -Q'
>>
>> When trying to update a clocktable I get the following backtrace (with a
>> little bit removed).
>
> Could you please detail on what you did to load the latest org with
> Emacs -Q? Using purely emacs -Q cannot trigger the error simply because
> org-encode-time is absent in the built-in Org.
>

In my case, it was caused by an update, followed by `make autoloads',
followed by 'org-reload'. That last part is not guaranteed to work,
particularly on the cutting edge, so restarting emacs is sometimes
necessary - as it was in this case. No problems afterwards.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: The fate of ob-asymptote.el

2022-07-20 Thread Nick Dokos
Jarmo Hurri  writes:

> ...
>
> I would like ob-asymptote.el to be brought back. If there is something I
> can do to help, I will be glad to do so.
>
All you have to do is volunteer to maintain it. Let Bastien know: he will
assign you the maintenance of the file and all the asymptote users will owe
you a debt of gratitude.

See https://orgmode.org/worg/org-contribute.html, the bullet with the title
"Maintain an Org file".

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: [PATCH] org-lint: Fix invocation with C-u prefix argument

2022-06-08 Thread Nick Dokos

On 6/8/22 09:30, Ihor Radchenko wrote:

Nick Dokos  writes:


LGTM! Is there any reason you did not push the patch upstream yourself?


ISTR I used to have push access to the repo, but in some repo move I
think I've lost it and I've never arranged to get it back. At least, I
*think* that was the case - but perhaps given my general state of
discombobulation, you don't want me to be committing things to the
repo in any case :-) Better to have some eyes on patches first...

Ok. AFAIK, after we moved the repo to savannah, you may need to create
an account at https://savannah.gnu.org/ and request access from Bastien.

Note that you don't have to commit without having extra pairs of eyes
on the patches. You can post the patch here, get comments, and then
apply the patch yourself if everything is ok. (Yes, I am lazy to apply
patches from others if I don't have to).

Applied onto main via 9fd5349d0.
I did not apply onto bugfix because Bastien asked not to apply
non-critical fixed until Emacs 28.2 is out.

Best,
Ihor


Thank you! I will try to get commit rights again before posting another 
patch. I appreciate your patience and help (and the enormous 
contribution you have made to Org mode too!)


--

Nick





Re: [PATCH] org-lint: Fix invocation with C-u prefix argument

2022-06-06 Thread Nick Dokos
Ihor Radchenko  writes:

> Nick Dokos  writes:
>
>> `C-u M-x org-lint' was failing to run any checkers, no matter what
>> category was chosen, because the calculation of the list of checkers
>> always returned `nil'.
>
> LGTM! Is there any reason you did not push the patch upstream yourself?
>

ISTR I used to have push access to the repo, but in some repo move I
think I've lost it and I've never arranged to get it back. At least, I
*think* that was the case - but perhaps given my general state of
discombobulation, you don't want me to be committing things to the
repo in any case :-) Better to have some eyes on patches first...

-- 
Nick




[PATCH] org-lint: Fix invocation with C-u prefix argument

2022-06-01 Thread Nick Dokos
`C-u M-x org-lint' was failing to run any checkers, no matter what
category was chosen, because the calculation of the list of checkers
always returned `nil'.

>From b55162adf1250980ad0f42423832aa1aa1045d30 Mon Sep 17 00:00:00 2001
From: Nick Dokos 
Date: Wed, 1 Jun 2022 12:28:23 -0400
Subject: [PATCH] org-lint: Fix invocation with C-u prefix argument

* lisp/org-lint.el (org-lint): Fix the order of the arguments in
the `assoc-string' call when calculating the list of checkers to
invoke.

`C-u M-x org-lint' was failing to run any checkers, no matter what
category of checkers was chosen, because the calculation of the list
of checkers always returned `nil'.
---
 lisp/org-lint.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-lint.el b/lisp/org-lint.el
index cce6fddbd..62a245330 100644
--- a/lisp/org-lint.el
+++ b/lisp/org-lint.el
@@ -321,7 +321,7 @@ ARG can also be a list of checker names, as symbols, to run."
 		nil t)))
 	  (cl-remove-if-not
 	   (lambda (c)
-		 (assoc-string (org-lint-checker-categories c) category))
+		 (assoc-string category (org-lint-checker-categories c)))
 	   org-lint--checkers)))
 	   (`(16)
 	(list
-- 
2.34.1


-- 
Nick


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

2022-05-31 Thread Nick Dokos
Uwe Brauer  writes:

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

org-publish?

You should be able to write a simple publishing config file to do that.

> Thanks and regards
>
> Uwe Brauer 

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Change of behavior of org-meta-return in 9.6/DoomEmacs?

2022-05-18 Thread Nick Dokos
Guillaume MULLER  writes:

> Hi,
>
> I noticed that hitting Meta-Return in org in Doom does not behave as
> in Vanilla Emacs. If I have (with <> being the cursor):
>
> * outline 1
> ** outline 2
>   + no<>te1
>   + note2
>
> In Vanilla Emacs, hitting M-Ret (i.e. calling org-meta-return) resulted in:
>
> * outline 1
> ** outline 2
>   + no
>   + <>te1
>   + note2
>
> In Doom Emacs, it results in:
> * outline 1
> ** outline 2
>   + note1
>   + note2
> ** <>
>

Compare the values of the variable `org-M-RET-may-split-line' in the
two cases: are they the same?

-- 
Nick





Re: [BUG] - Statistics cookie is part of the org heading title

2022-05-04 Thread Nick Dokos
Fabian  writes:

> Hi everybody,
>
> I would like to report his behaviour as a bug:

A crucial piece of information is missing here: this concerns the
behavior of the function `org-heading-components'.

> 
> Example:
>
> * Some Heading Title [0/1]  ;; cursor in this line when executing
> ** TODO Some Todo Item
>
> -> result is "Some Heading Title [0/1]"
>
> -> desired result would be "Some Heading Title"
> 
>
> I don't see any reason why the statistics cookie should be part of
> the title: it should be a separate component.
>
> The Topic has beend posted on Stack here:
> https://emacs.stackexchange.com/questions/71592/extract-org-heading-title-without-task-count-e-g-0-0?noredirect=1#comment115659_71592
>
> Best Regards, 
>
> Fabian
>
>

-- 
Nick

"There are only two hard problems in computer science: cache invalidation, 
naming things, and off-by-one errors." -Martin Fowler




Re: Org as a workspace (an impromptu reflection)

2022-05-02 Thread Nick Dokos
Juan Manuel Macías  writes:

> With Org something curious has happened. I've gotten used to working
> around nodes (regardless of what documents those nodes are in), rather
> than around folders or files. Little by little, a kind of virtual world
> of ideas, objects, etc., all intertwined with each other, is being
> built.

>From my vantage point (of ignorance about it :-) ), this sounds like
org-roam to me: https://www.orgroam.com/

-- 
Nick

"There are only two hard problems in computer science: cache invalidation, 
naming things, and off-by-one errors." -Martin Fowler




Re: [BUG] org-mode #+SETUPFILE not working with properties [9.5.2 (release_9.5.2-378-g98588e @ /home/eros/src/org-mode/lisp/)]

2022-05-02 Thread Nick Dokos
Ihor Radchenko  writes:

> Eros Zaupa  writes:
>
>> I would like to move the properties drawer to a separate file and import it
>> into the main one. To do so I'm using the `#SETUPFILE` property suggested
>> [here][1], but this doesn't seem to work.
>
> Confirmed.
> Though I am not 100% sure.
>
> Org is indeed ignoring top-level property drawer when parsing
> #+SETUPFILE.
>
> Dear All,
> I think that parsing top-level property drawer is simply an omission
> from the time we introduced top-level property drawers into syntax.
>
> We may either implement this support or leave things as is and document
> the current behaviour.
>
> I would be in favour of implementing top-level drawer support in
> SETUPFILE, but there might be alternative opinions. WDYT?

FWIW, I agree that it is a bug and it should be fixed.

-- 
Nick

"There are only two hard problems in computer science: cache invalidation, 
naming things, and off-by-one errors." -Martin Fowler




Re: Name the different types of links in an org file

2022-04-27 Thread Nick Dokos
c.bu...@posteo.jp writes:

> Hello,
>
> I just want to find the correct terms of the different types of links
> an org file can have. This is not only about orgmode but orgroam
> (version 1 and 2) also.
>
> 1. Hyperlinks
> Example: [[https://foo.bar][Link description]]
> This links can also point to files on the local filesystem etc
>

See the following chapter in the manual:

   (info "(org)Hyperlinks")

and in particular, the sections on "Inernal" and "External" links, but
note that the hyperlink system is extensible - you define your own
link types and behavior:

   (info "(org)Adding Hyperlink Types")
   
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




[PATCH] Add missing `provide' in ob-octave test

2022-04-26 Thread Nick Dokos
`make test' has been failing for me with this error:

,
| Error: error ("Loading file
| /home/nick/src/emacs/org/org-mode/testing/lisp/test-ob-octave.el
| failed to provide feature ‘test-ob-octave’")
`

The attached patch provides a fix.

>From dc1ab2a24bfc5a02845c380c60f0c1a7452e639a Mon Sep 17 00:00:00 2001
From: Nick Dokos 
Date: Tue, 15 Mar 2022 12:33:52 -0400
Subject: [PATCH] test-ob-octave: Add missing `provide'

---
 testing/lisp/test-ob-octave.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testing/lisp/test-ob-octave.el b/testing/lisp/test-ob-octave.el
index 7e20add99..6113b40f3 100644
--- a/testing/lisp/test-ob-octave.el
+++ b/testing/lisp/test-ob-octave.el
@@ -63,3 +63,5 @@
   (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba"
 (org-babel-next-src-block 5)
 (should (equal nil (org-babel-execute-src-block)
+
+(provide 'test-ob-octave)
-- 
2.34.1


-- 
Nick

"There are only two hard problems in computer science: cache invalidation, 
naming things, and off-by-one errors." -Martin Fowler


Re: [PATCH] Fix examples of clock tables in the manual

2022-04-26 Thread Nick Dokos
Ihor Radchenko  writes:

> Nick Dokos  writes:
>
>> The syntax is:
>>
>>     #+BEGIN: clocktable ...
>>     #+END:
>>
>> There is no `clocktable' after `#+END:'.
>
> Thanks for the patch! Could you please follow the commit summary
> conventions described in
> https://orgmode.org/worg/org-contribute.html#commit-messages?
>

Yes, I'm very rusty.

> Note that you may need to add TINYCHANGE cookie as you appear to not
> have the copyright assignment with FSF.
>

I'm in there (under "Nicholas Dokos").

> Also, your current patch does not apply onto main:
>
>>> Applying: Fix examples of clock tables in the manual
>>> error: corrupt patch at line 10
>

Mailer mangled it - let me try attaching.

Hope this is better. Thanks!

> Best,
> Ihor

>From 2d32589cb1d1db330067197f91635db7d6bce7ec Mon Sep 17 00:00:00 2001
From: Nick Dokos 
Date: Tue, 26 Apr 2022 16:22:03 -0400
Subject: [PATCH] doc/org-manual.org: Fix clocktable dynamic block examples

---
 doc/org-manual.org | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index af54dc4e8..6768ca98d 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -6665,7 +6665,7 @@ into the buffer by ~org-clock-report~:
 #+cindex: @samp{BEGIN clocktable}
 #+begin_example
 ,#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
-,#+END: clocktable
+,#+END:
 #+end_example
 
 #+vindex: org-clocktable-defaults
@@ -6849,7 +6849,7 @@ day, you could write:
 
 #+begin_example
 ,#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
-,#+END: clocktable
+,#+END:
 #+end_example
 
 #+texinfo: @noindent
@@ -6858,7 +6858,7 @@ To use a specific time range you could write[fn:80]
 #+begin_example
 ,#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
 :tend "<2006-08-10 Thu 12:00>"
-,#+END: clocktable
+,#+END:
 #+end_example
 
 #+texinfo: @noindent
@@ -6866,7 +6866,7 @@ A range starting a week ago and ending right now could be written as
 
 #+begin_example
 ,#+BEGIN: clocktable :tstart "<-1w>" :tend ""
-,#+END: clocktable
+,#+END:
 #+end_example
 
 #+texinfo: @noindent
@@ -6874,7 +6874,7 @@ A summary of the current subtree with % times would be
 
 #+begin_example
 ,#+BEGIN: clocktable :scope subtree :link t :formula %
-,#+END: clocktable
+,#+END:
 #+end_example
 
 #+texinfo: @noindent
@@ -6883,7 +6883,7 @@ last week would be
 
 #+begin_example
 ,#+BEGIN: clocktable :scope agenda :block lastweek :compact t
-,#+END: clocktable
+,#+END:
 #+end_example
 
 *** Resolving idle time and continuous clocking
-- 
2.34.1


>
>

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler


[PATCH] Fix examples of clock tables in the manual

2022-04-26 Thread Nick Dokos

The syntax is:

   #+BEGIN: clocktable ...
   #+END:

There is no `clocktable' after `#+END:'.
---
 doc/org-manual.org | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/doc/org-manual.org b/doc/org-manual.org
index af54dc4e87f9..6768ca98dd7f 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -6665,7 +6665,7 @@ into the buffer by ~org-clock-report~:
 #+cindex: @samp{BEGIN clocktable}
 #+begin_example
 ,#+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file
-,#+END: clocktable
+,#+END:
 #+end_example

 #+vindex: org-clocktable-defaults
@@ -6849,7 +6849,7 @@ day, you could write:

 #+begin_example
 ,#+BEGIN: clocktable :maxlevel 2 :block today :scope tree1 :link t
-,#+END: clocktable
+,#+END:
 #+end_example

 #+texinfo: @noindent
@@ -6858,7 +6858,7 @@ To use a specific time range you could write[fn:80]
 #+begin_example
 ,#+BEGIN: clocktable :tstart "<2006-08-10 Thu 10:00>"
 :tend "<2006-08-10 Thu 12:00>"
-,#+END: clocktable
+,#+END:
 #+end_example

 #+texinfo: @noindent
@@ -6866,7 +6866,7 @@ A range starting a week ago and ending right now 
could be written as


 #+begin_example
 ,#+BEGIN: clocktable :tstart "<-1w>" :tend ""
-,#+END: clocktable
+,#+END:
 #+end_example

 #+texinfo: @noindent
@@ -6874,7 +6874,7 @@ A summary of the current subtree with % times would be

 #+begin_example
 ,#+BEGIN: clocktable :scope subtree :link t :formula %
-,#+END: clocktable
+,#+END:
 #+end_example

 #+texinfo: @noindent
@@ -6883,7 +6883,7 @@ last week would be

 #+begin_example
 ,#+BEGIN: clocktable :scope agenda :block lastweek :compact t
-,#+END: clocktable
+,#+END:
 #+end_example

 *** Resolving idle time and continuous clocking
--
2.34.1




Re: [BUG] Dynamic blocks not recognized by org-element

2022-04-26 Thread Nick Dokos

On 4/26/22 03:14, Ihor Radchenko wrote:


It is to be expected.
Dynamic block syntax is the following (see manual):

#+BEGIN: dynamic_block_name [args]
...
#+END:

You should not put dynamic block name after #+END:


Thanks! I cut-and-pasted out of the documentation, so it is a doc bug instead:

   (info "(org)The clock table")

I'll send in a patch if nobody beats me to it.

--
Nick




[BUG] Dynamic blocks not recognized by org-element

2022-04-26 Thread Nick Dokos
Starting with `emacs -Q', I create a simple file with the following 
contents:


--8<---cut here---start->8---
* Clocktable

#+BEGIN: clocktable :maxlevel 3 :emphasize nil :scope file
#+END: clocktable
--8<---cut here---end--->8---

I position the cursor on the #+BEGIN line and evaluate
`(org-element-at-point)'. I expected to get a dynamic-block, but I get a
paragraph:

(paragraph
 (:begin 15 :end 74 :contents-begin 15 :contents-end 74 :post-blank 0 
:post-affiliated 15 :mode planning :granularity element :parent

 (section
  (:begin 15 :end 92 :contents-begin 15 :contents-end 92 
:robust-begin 15 :robust-end 90 :post-blank 0 :post-affiliated 15 :mode 
section :granularity element :parent

  (headline
   (:raw-value "Clocktable" :begin 1 :end 92 :pre-blank 
1 :contents-begin 15 :contents-end 92 :robust-begin 17 :robust-end 90 
:level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil 
:post-blank 0 :footnote-section-p nil :archivedp nil :commentedp nil 
:post-affiliated 1 :title "Clocktable"))


Looks like a bug to me.


Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.31, cairo version 1.17.4) of 2022-02-12
Package: Org mode version 9.5.3 (release_9.5.3-452-g407104 @ 
/home/nick/src/emacs/org/org-mode/lisp/)

--
Nick





Re: Bug: Order of drawers is important [9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/)]

2022-04-18 Thread Nick Dokos
Olaf Dietsche  writes:

> thank you for the link to the org-repair-property-drawers function.
> This seems much more useful than the non-working "repair" of
> org-set-property.
>

In addition, I expect (but have not tested) that `M-x org-lint` might
be helpful here and in similar situations.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




[BUG] Test failure: testing/lisp/test-ob-octave.el is missing a `provide'

2022-03-15 Thread Nick Dokos
That stopped the `make test' cold with a backtrace. Bug fix attached.

>From 0d7f1b77dfa5cf3f755ea5d3b08943ec696f8bbf Mon Sep 17 00:00:00 2001
From: Nick Dokos 
Date: Tue, 15 Mar 2022 12:33:52 -0400
Subject: [PATCH] test-ob-octave: Add missing `provide'

---
 testing/lisp/test-ob-octave.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testing/lisp/test-ob-octave.el b/testing/lisp/test-ob-octave.el
index 7e20add99..6113b40f3 100644
--- a/testing/lisp/test-ob-octave.el
+++ b/testing/lisp/test-ob-octave.el
@@ -63,3 +63,5 @@
   (org-test-at-id "cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba"
 (org-babel-next-src-block 5)
 (should (equal nil (org-babel-execute-src-block)
+
+(provide 'test-ob-octave)
-- 
2.34.1


-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler


Re: Export (to `LaTeX`) `~⟨code snippet⟩~` into `\lstinline+⟨code snippet⟩+` (just as does `src_⟨language⟩{⟨code snippet⟩}`)

2022-03-11 Thread Nick Dokos
Hi Denis,

Denis Bitouzé  writes:

> Hi,
>
> here is a feature request about the LaTeX export (another one: the
> previous mine, https://list.orgmode.org/87zgmda67z@example.com/,
> sadly didn't get any answer).
>
> With `(setq org-latex-listings t)`, `src_⟨language⟩{⟨code snippet⟩}` is
> exported from `org-mode` to `LaTeX` into
> `\lstinline[language=⟨language⟩]~⟨code snippet⟩~` (here, `~` could be
> almost any token): so far, so good.
>
> But one could expect to get the same export with the usual `org-mode`
> syntax for code snippets: `~⟨code snippet⟩~` (this supposes the ⟨language⟩
> to be declared globally), as in the following example:
>
> #+OPTIONS:   toc:nil title:nil
>
> #+LaTeX_HEADER: \usepackage{xcolor}
> #+LaTeX_HEADER: \usepackage{listings}
> #+LaTeX_HEADER: 
> \lstset{language=[auto]lisp,basicstyle=\ttfamily,keywordstyle=\color{red}}
>
> #+PROPERTY: header-args :padline no :exports both :noweb yes :eval always
>
> src_lisp{defun} is fun!
>
> ~defun~ is fun!
>
>
> For this, it is possible to redefine the `org-latex-code` function:
>
> ;; Inspired by https://emacs.stackexchange.com/q/70720/5267
> (defun org-latex-code (code _contents info)
>   "Transcode a CODE object from Org to LaTeX.
> CONTENTS is nil.  INFO is a plist used as a communication
> channel."
>   (format "\\lstinline+%s+"
>   (org-element-property :value code)))
>
> but, IMHO, this should be the default.
>
> WDYT?

I have no opinion on whether it should be the default or not, but I
wanted to point out a possibility that might have not occurred to you:
it is possible to define what's called a "derived" exporter, an
exporter that shares most of its code with the exporter that it is
derived from and only overrides one or two functions where you need a
change.

See the doc string of the function `org-export-define-derived-backend'
for some details.  There are also many examples where this feature is
used (a simple one is in the doc string itself), but there are
examples in the Org mode code itself, e.g the beamer exporter
(ox-beamer.el) is derived from the LaTex one (ox-latex.el), as is the
koma-letter exporter (ox-koma-letter.el), and the markdown exporter
(ox-md.el) is derived from the HTML exporter in ox-html.el.

Deriving a new back end from the LaTeX exporter and redefining one or
two functions (like `org-latex-code' above) is IMO the best way
forward. You get an exporter that works as you want and the defaults
are left as-is (developers are wary about changing defaults: that
brings out a lot of complaints of the "it was working fine yesterday
but you broke it" variety). And you can publish your derived mode on
e.g Gitlab/Github/whatever and make it available in MELPA for others
to try out.

HTH.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Cannot link to files with no extension

2022-03-10 Thread Nick Dokos
Nick Dokos  writes:

> Check also the value of the system-specific variable
> `org-file-apps-{gnus,windowsnt,macos}' - whichever is applcible to your
> case.

That should be `org-file-apps-{gnu,windowsnt,macos}'.
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Cannot link to files with no extension

2022-03-10 Thread Nick Dokos
Colin Baxter  writes:


> 6. In a.org enter [[file:./z][This is file z]] and save.
>
> 7. Click on the link.
>
> 8. Message "Running less in /path/to/z ... done", but link does not
>open.
>

This sounds like your `org-file-apps' is funny. What is its value?
Check also the value of the system-specific variable
`org-file-apps-{gnus,windowsnt,macos}' - whichever is applcible to your
case.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: ox-publish: Some starting problems

2022-03-10 Thread Nick Dokos
[Answers to some of the questions inline]

c.bu...@posteo.jp writes:

> 1.  Is this mailing list the right place to discuss ox-publish
> related topics? The ox-publish.el only contains two e-mail
> addresses?
>
Yes.

> 2.  Because ox-publish is skipping "unmodified files" I deleted all
> HTML files between the publish-runs just to be sure that there are
> no side effects. But now when my output directory is totally empty
> ox-publish still keeps saying that it is skipping the unmodified
> files. So nothing is generated anymore. How can I handle that? Maybe
> resetting the "unmodified" flag somewhere? Or shouldn't ox-publish
> not only check for modifications but if there is something earlier
> generated content exist?
>
Org mode records the time when a file was published and compares it to
the last modification time to decide whether to publish or not. It
does not have a dependency mechanism like `make' to figure things
out. As you found out, you can force it by calling it with a `t'
argument for the `force' parameter. You can do this interactively with
`C-u M-x org-publish'. See the "Triggering Publication" section of the
manual:

  (info "(org)Triggering Publication")

That section also points you to the variable
`org-publish-use-timestamps-flag': if you set that to `nil', no
timestamp checking is done.

The timestamps are kept in the directory named by the variable
`org-publish-timestamp-directory' whose default value is
"~/.org-timestamps/".

> 4.  ox-publish ignores newlines. Two short lines in the org-file
> becomes one line in the HTML content.
>

That is how HTML export (and publishing) works: the browser does its
own layout of HTML content and you have no say in that (except for
`verbatim' things that are pre-formatted).

> 5.  I am not totally new to Emacs but quit fresh. So I have two
> questions about how to handle the documentation and help
> informations here.  a) I tried to "descrbie" the mode
> "ox-publish". But Emacs only offers me an "describe-mode" which
> describe all currently existing nodes. There is nothing like
> "describe-mode MODENAME". How can I handle that?

There is no such mode: `ox-publish' is (part of) the name of the file
that contains the code that is used for publishing - in particular
it contains the code of the function `org-publish'. You can get
the doc string of the function with `C-h f org-publish'.

> b) I another thread I was pointed to
> https://orgmode.org/manual/Publishing-options.html . There is no
> description about the options they are only listed. This does not
> help me. Maybe there are some useful options that could solve some
> of my problems. But without description I am not able to decide or
> know.
>

Read the first paragraph of that section carefully:

,
| The property list can be used to set many export options for the HTML
| and LaTeX exporters.  In most cases, these properties correspond to
| user variables in Org.  The table below lists these properties along
| with the variable they belong to.  See the documentation string for
| the respective variable for details.
`

So to find out e.g. what the option ‘:archived-trees’ does, you have
to ask for the doc string of the variable ‘org-export-with-archived-trees’.
You can do that with `C-h v org-export-with-archived-trees' or more easily
by putting the cursor on the name and typing `C-h v RET`.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




[PATCH] Fix typo in org-todo-list doc string

2022-03-07 Thread Nick Dokos

Tiny typo fix attached.
From 524e7d8610f42908202a9cbde727ad06c36ae706 Mon Sep 17 00:00:00 2001
From: Nick Dokos 
Date: Mon, 7 Mar 2022 13:11:50 -0500
Subject: [PATCH] Fix typo in doc string

* lisp/org-agenda.el (org-todo-list): Fix typo in doc string.
---
 lisp/org-agenda.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 9bc44a56eb01..356a74da64fe 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -4875,7 +4875,7 @@ Press `\\[org-agenda-manipulate-query-add]', \
 
 ;;;###autoload
 (defun org-todo-list ( arg)
-  "Show all (not done) TODO entries from all agenda file in a single list.
+  "Show all (not done) TODO entries from all agenda files in a single list.
 The prefix arg can be used to select a specific TODO keyword and limit
 the list to these.  When using `\\[universal-argument]', you will be prompted
 for a keyword.  A numeric prefix directly selects the Nth keyword in
-- 
2.34.1



Re: Lisp error: (void-function org-element-keyword-parser)

2021-10-25 Thread Nick Dokos
Eric S Fraga  writes:

> On Thursday, 21 Oct 2021 at 20:54, William Denton wrote:
>> With my usual set up, I can get things working except that any Org files
>> initially loaded up aren't recognized as Org, but if I run =M-x org-mode= it 
>> all
>> kicks in.  
>
> For the record, I have had this or something very similar for a very
> long time (years) now.  All my org-agenda-files which get loaded during
> my initialization, when I set up the appointment handling, are in org
> mode but none of the in-file settings have been applied.  I brought this
> up on the list a long time ago and was told that this was the expected
> behaviour.
>
> Are you sure they are not recognised as org files or is it that your
> specific settings are ignored?

Hi Eric,

I'm pretty sure that that should *NOT* be the case: setting the mode
on the file consists of calling `org-mode'; that calls
`org-set-regexps-and-options' which loops over all the in-buffer
options and sets them.

When you do `C-c C-c' on an in-buffer option after the initialization,
that calls `org-mode-restart' which calls `org-mode' which calls
`org-set-regexps-and-options'.

So the only time an in-buffer setting would not be recognized is
after you've added it to the buffer and before you've restarted Org mode
on it (or closed and reopened which does pretty much the same thing).
If you have unrecognized settings when you open a file and the file is
already in Org mode, that needs to be investigated: it's very much
*un*expected AFAICT.

I haven't gone back to find the previous discussion, but if you can find
it, you might want to resurrect it.

-- 
Nick

"There are only two hard problems in computer science: cache invalidation, 
naming things, and off-by-one errors." -Martin Fowler




Re: Inequalities in math blocks

2021-10-11 Thread Nick Dokos
Rudolf Adamkovič  writes:

> Max Nikulin  writes:
>
>> Though I am a bit surprised that Org did not replace characters to
>>   and  during export. Perhaps, it is possible to define a
>> filter. 
>
> That makes sense, and thank you for the explanation. Ignoring the dead
> link in the Org manual, I wonder how this bug can even exist in Org
> after 15+ years of development. Some people, including the author of
> TeX himself, write TeX without unnecessary whitespace. Strange! Either
> way, rearranging bullet points should never break math without any
> visual sign inside of Emacs. Thus, this represents a bug in Org. R+

No, it does not. Org mode just passes LaTeX directly to MathJax
without changing anything. If you want to blame somebody, you can
blame HTML for choosing < and > as its delimiters: see

   http://docs.mathjax.org/en/latest/input/tex/html.html#html-special-characters

-- 
Nick




Re: 9.5: coping with loss of ditaa.jar

2021-10-11 Thread Nick Dokos
Tim Cross  writes:

> Another alternative which I just found is the ditaa version on github,
> which has SVG support. See https://github.com/stathissideris/ditaa. If
> you click on the 'release' link on the right, there is the most recent
> release, which includes a link to a standalone ditaa.jar file.
>
> I've not tried this version, but suspect it will work fine (assuming
> they use semantic versioning, which indicates the API has not
> changed). 
>
>
>

Perfect! Thank you for pointing that out.

I downloaded that, installed java-11-openjdk from the Fedora repos and
tried the standard example:

--8<---cut here---start->8---
#+begin_src ditaa :file example.svg :results file drawer
++   +---++---+
|| --+ ditaa +--> |   |
|  Text  |   +---+|diagram|
|Document|   |!magic!||   |
| {d}|   |   ||   |
+---++   +---++---+
: ^
|   Lots of work  |
+-+
#+end_src

#+RESULTS:
:results:
[[file:example.svg]]
:end:
--8<---cut here---end--->8---

It worked perfectly on Fedora 34.

Thanks!
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Switching to new Git repositories

2021-09-23 Thread Nick Dokos
FWIW, I get

$ git remote -v
upstreamhttps://git.savannah.gnu.org/git/emacs/org-mode.git (fetch)
upstreamhttps://git.savannah.gnu.org/git/emacs/org-mode.git (push)

$ git tag | wc -l
386

Maybe do

$ git remote update
$ git rebase

and try again?

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: org-table-toggle-column-width turn on for either all tables

2021-09-10 Thread Nick Dokos
Uwe Brauer  writes:

> Hi
>
> I find 
>
> (org-table-toggle-column-width  ARG)
>
> Very very useful, but in the current org version I have to toggle this
> for each and every table. 
>
> So I was wondering, when opening an org file 
>
> 1. Would it be possible to have all tables in an org-file have their
>column toggled.

You mean shrunk? If so, there is a #+STARTUP option for that:

#+STARTUP: shrink

>
> 2. Or with a special variable for single tables, just some of them?
>
I don't know of any such variable.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: [PATCH] Fix match/maxlevel conflict in colview dynblock

2021-08-31 Thread Nick Dokos
Timothy  writes:

> Hi Nick,
>
> Thanks for reporting this issue here, and providing a patch. Unfortunately the
> “main maintainers” seem to be rather busy as of late, leaving you hanging for
> quite a while. I’ve had a look at the issue and your patch, and it the issue
> seems clear, and your patch small and straightforward enough that I feel
> confident pushing it should be fine :) it’s now on master with a small tweak 
> to
> the commit message.
>
> Thanks for your efforts.
>

Hi Timothy,

Thanks and no worries! And thanks for working through the backlog!

--
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Org table: emphasizing calculated cell

2021-08-27 Thread Nick Dokos
Jarmo Hurri  writes:

> Greetings Norwid.
>
> Norwid Behrnd  writes:
>
>> try extending the format of the table formula with asterisks, i.e.
>>
>> ```
>> | quantity |  value |
>> |--+|
>> | A|  1 |
>> | B|  3 |
>> |--+|
>> | *C*  | *0.33* |
>>
>> #+TBLFM:  @4$2=@-2/@-1; *%.2f*
>> ```
>>
>> Subsequently, issue the call ```C-c *``` for an update while the
>> cursor is within the table.  This approach works well enough for me
>> (equally for emphasis with enclosing forward slashes, or underscores)
>> in Emacs' native display (backed by elpa-org 9.4.0) as well as for a
>> subsequent export into .html and display (e.g., in Firefox), or .tex.
>
> Excellent, this is a working solution for the basic case. Much
> appreciated!
>
> This solution seems to change the contents of a cell, not only its
> formatting. So the following, where I try to increase the value of "C"
> by one, leads to an error:
>
> ```
> | quantity | value  |
> |--+|
> | A| 1  |
> | B| 3  |
> |--+|
> | *C*  | *0.33* |
> | D| #ERROR |
>
> #+TBLFM: @4$2=@-2/@-1; *%.2f*::@5$2=@-1+1
> ```
>
> I wonder if there is a way around this effect?
>

The error here is that `*0.33*' is no longer a string that can be converted to 
a number,
so the calculator barfs.

TUrn on formula debugging with `C-c {' and try evaluating it.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: ob-lilypond.el doesn't generate midi files

2021-08-27 Thread Nick Dokos
Michael Maurer  writes:

> On Thu, 26 Aug 2021 at 21:54, Nick Dokos  wrote:

>>
>> Michael Maurer  writes:
>>
>> > On Thu, 26 Aug 2021 at 15:03, Jonathan Gregory  wrote:
>> >>
>> >> Hi
>> >>
>> >> On 26 Aug 2021, Michael Maurer wrote:
>> >>
>> >> > I've installed lilypond and customized ob-lilypond to use the
>> >> > appropriate helper programs, but although it generates & shows
>> >> > pdfs just fine, generating a midi file it does not. I execute
>> >> > tangle on the codeblock, and all I get is "No midi file
>> >> > generated so can't play!". org-version 9.4.6 emacs 27.2 Win 10
>> >>
>> >> Can you also send a MWE of the code you're using to generate the
>> >> score?
>> >>
>> >
>> > I used a test file I copied over from Frescobaldi
>> >
>> > #+begin_src lilypond :file test.pdf
>> > \version "2.18.2"
>> > \score {
>> > \drums {
>> >   \time 2/4
>> >   sn16 sn8 sn16 sn8 sn8:32 ~
>> >   sn8 sn8 sn4:32 ~
>> >   sn4 sn8 sn16 sn16
>> >   sn4 r4
>> > }
>> >   \layout { }
>> >   \midi { }
>> > }
>> > #+end_src
>> >
>> > In Frescobaldi this gets me both midi-output and pdf. In Emacs with
>> > org it does say "Midi output to test.midi", but then there's that "no
>> > midi file generated" message.
>> >
>>
>> What happens if you save the contents of the source block into a file
>> and run lilypond on the file from the command line?
>>
>
> Both pdf and midi files get generated. Btw, ob-lilypond does generate
> the midi file as well, it just doesn't want to play it/recognize it.
> Maybe it's related to what helper app I've configured to open it? (but
> why that doesn't make sense, it's vlc btw).
>
>

Oh, I thought that it did not generate a midi file at all. So you are
saying that the midi file *is* produced and you *can* play it from the
command line with vlc, correct?

If that's the case, check the value of the variable
`org-babel-lilypond-midi-command' and see what happens when you invoke
that command on the midi file. In my case, the command is `xdg-open'
(I'm using Gnome on Fedora 33) and it opens Banshee to play it which
fails because of missing codecs. I installed the missing codecs and
`xdg-open foo.midi' sends the file to Banshee which can play it fine.

Also check if `org-babel-lilypond-arrange-mode' is t or nil: behavior
is very different depending on that.

Final thought: `xdg-open' starts whatever app it is supposed to run
in the background and returns immediately. That may cause problems with
babel. I still don't get anything when processing the file in babel.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: ob-lilypond.el doesn't generate midi files

2021-08-26 Thread Nick Dokos
Michael Maurer  writes:

> On Thu, 26 Aug 2021 at 15:03, Jonathan Gregory  wrote:
>>
>> Hi
>>
>> On 26 Aug 2021, Michael Maurer wrote:
>>
>> > I've installed lilypond and customized ob-lilypond to use the
>> > appropriate helper programs, but although it generates & shows
>> > pdfs just fine, generating a midi file it does not. I execute
>> > tangle on the codeblock, and all I get is "No midi file
>> > generated so can't play!". org-version 9.4.6 emacs 27.2 Win 10
>>
>> Can you also send a MWE of the code you're using to generate the
>> score?
>>
>
> I used a test file I copied over from Frescobaldi
>
> #+begin_src lilypond :file test.pdf
> \version "2.18.2"
> \score {
> \drums {
>   \time 2/4
>   sn16 sn8 sn16 sn8 sn8:32 ~
>   sn8 sn8 sn4:32 ~
>   sn4 sn8 sn16 sn16
>   sn4 r4
> }
>   \layout { }
>   \midi { }
> }
> #+end_src
>
> In Frescobaldi this gets me both midi-output and pdf. In Emacs with
> org it does say "Midi output to test.midi", but then there's that "no
> midi file generated" message.
>

What happens if you save the contents of the source block into a file
and run lilypond on the file from the command line?

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: I can't find "org-latex-toc-command"

2021-08-25 Thread Nick Dokos
Ypo  writes:

> Hi. I was trying to add a break-line after the TOC. I've search for
> some help, and I found this: (setq org-latex-toc-command
> "\\tableofcontents \\clearpage"). But, it seems
> org-latex-toc-command doesn't exist anymore? I can't find it, but
> since I am quite newbie, I am not sure if it's there or not.
>

It's there AFAICT: it's a variable defined in `ox-latex.el'.
Maybe you looked for it as a function with `C-h f ...' rather
than `C-h v ...'? Or maybe `ox-latex' is not loaded for some
unfathomable reason?

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Repeating task not repeating

2021-08-18 Thread Nick Dokos
Do `M-x org-lint` on your agenda files. It may not solve this problem, but
it's always worth trying first, since it's so easy - and it may find other
problems that you are unaware of.
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Bug: refreshing agenda moves all lines up [9.4.6 (9.4.6-12-gdcc3a8-elpa @ /Users/pu/.emacs.d/elpa/org-20210802/)]

2021-08-10 Thread Nick Dokos
p...@disroot.org writes:

> Hello everybody,
>
> my first bug report so I hope this is useful.
>
> Since the last org-mode update, whenever I press "r" to refresh my customised 
> agenda view (org-agenda-redo),
> the whole buffer moves up by 1 line, which hasn't been the case until now.
>

This was probably a bad interaction with `visual-line-mode', although
what exactly that means is not clear to me: see


https://emacs.stackexchange.com/questions/67999/refresh-org-agenda-org-agenda-redo-scrolls-buffer-by-1-line

for some more details.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Bug: org-clock-report tag matching seems to be broken [9.1.9 (release_9.1.9-65-g5e4542 @ c:/Users/user/emacs-26.3-x86_64/share/emacs/26.3/lisp/org/)]

2021-08-10 Thread Nick Dokos
"Lewalder, Sebastian" via "General discussions about Org-mode." 
 writes:

> I recently updated my packages and after the update the clock tables are
>
> not working anymore. I reran an report from june and here too the
>
> matching didn't work anymore.
>
> #+BEGIN: clocktable :scope file :maxlevel 4 :match "traj"

IIUC, the problem is the presence of both `maxlevel' and `match' specifiers:
the code does not handle that case correctly.

You might want to try a patch that I submitted some time ago to fix that:

https://orgmode.org/list/87h7h0w5nz@alphaville.usersys.redhat.com/

I believe this is the second time that this problem has been reported
to the mailing list since then (plus there was a question about the
same problem on Emacs SE), so if you can review it and/or try it out,
that might help to get it reviewed and merged.

If anybody else is willing to review it as well, I'd appreciate it.

Thanks!
--
Nick

>
> #+CAPTION: Clock summary at [2021-08-06 Fr 08:48]
>
> | Headline  | Time   |  |  |  |
>
> |---++--+--+--|
>
> | *Total time*  | *2:33* |  |  |  |
>
> |---++--+--+--|
>
> | 2021  | 2:33   |  |  |  |
>
> | \_  2021-06 Juni  || 2:33 |  |  |
>
> | \_2021-06-01 Dienstag ||  | 2:33 |  |
>
> | \_  Trajectory calc   ||  |  | 0:41 |
>
> | \_  Concept work  ||  |  | 1:52 |
>
> #+END:
>
> * 2021
>
> ** 2021-06 Juni
>
> *** 2021-06-01 Dienstag
>
>  Trajectory calc   :traj:
>
>  :LOGBOOK:
>
>  CLOCK: [2021-06-01 Di 11:40]--[2021-06-01 Di 12:21] =>  0:41
>
>  :END:
>
>  Concept work  
> :concept:
>
>  :LOGBOOK:
>
>  CLOCK: [2021-06-01 Di 13:10]--[2021-06-01 Di 13:24] =>  0:14
>
>  CLOCK: [2021-06-01 Di 12:21]--[2021-06-01 Di 12:41] =>  0:20
>
>  CLOCK: [2021-06-01 Di 10:22]--[2021-06-01 Di 11:40] =>  1:18
>
>  :END:
>
> Emacs  : GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)
>
> of 2019-08-29
>
> Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ 
> c:/Users/user/emacs-26.3-x86_64/share/emacs/26.3/lisp/org/)
>
> current state:
>
> ==
>
> (setq
>
> org-src-mode-hook '(org-src-babel-configure-edit-buffer 
> org-src-mode-configure-edit-buffer)
>
> org-after-todo-state-change-hook '(org-clock-out-if-current)
>
> org-metadown-hook '(org-babel-pop-to-session-maybe)
>
> org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
>
> org-agenda-files '("~/org")
>
> org-modules '(org-habit)
>
> org-mode-hook '(er/add-org-mode-expansions
>
>  #[0 "\300\301\302\303\304$\207"
>
>[add-hook change-major-mode-hook org-show-block-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
>
>  #[nil "\300\301!\207" [run-hooks prelude-org-mode-hook] 2])
>
> 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-babel-pre-tangle-hook '(save-buffer)
>
> org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
> org-babel-header-arg-expand)
>
> org-log-done 'time
>
> org-habit-show-habits-only-for-today nil
>
> org-occur-hook '(org-first-headline-recenter)
>
> org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers 
> 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-confirm-shell-link-function 'yes-or-no-p
>
> org-link-parameters '(("id" :follow org-id-open) ("file+sys") ("file+emacs") 
> ("doi" :follow org--open-doi-link)
>
>("elisp" :follow org--open-elisp-link) ("file" 
> :complete org-file-complete-link)
>
>("ftp" :follow (lambda (path) (browse-url (concat 
> "ftp:" path
>
>("help" :follow org--open-help-link)
>
>("http" :follow (lambda (path) (browse-url (concat 
> "http:" path
>
>("https" :follow (lambda (path) (browse-url (concat 
> "https:" path
>
>("mailto" :follow (lambda (path) (browse-url (concat 
> "mailto:; path
>
>("news" :follow (lambda (path) (browse-url (concat 
> "news:; path
>
>("shell" :follow org--open-shell-link))
>
> )
>

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, 

Re: Bug: :match filter fails on columnview dblock when :maxlevel present [9.4.6 (9.4.6-gab9f2a @ /Users/pabfr/.emacs.d/elpa/org-9.4.6/)]

2021-07-27 Thread Nick Dokos
I have submitted a patch to allow both match and maxlevel to be specified:

https://orgmode.org/list/87h7h0w5nz@alphaville.usersys.redhat.com/

but it has not been reviewed, tested or merged yet. Maybe you can test it
and report? That should help move it forward.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: a repeater doesn't increment

2021-07-27 Thread Nick Dokos
Jude DaShiell  writes:

> What I'm trying to do is more complex than that.
> * Reorder pills
> ** TODO order hctz, lisinipril, metformin, provacol, claritin, Co-q10,
>Deadline: <8-2-2021 +4w>
> ** TODO order Colase
>Deadline: <10-13-2021 +14w>
> ** TODO order Turmerick
>Deadline: <8-30-2021 +8w>
>
> On Thu, 22 Jul 2021, Nick Dokos wrote:
>
>> Jude DaShiell  writes:
>>
>> > Does enough material exist on werg tutorials that document how to get a
>> > repeater operational?  That or maybe I don't understand repeaters.  Had
>> > the repeater I tried to use worked correctly it would have advanced the
>> > original date by 4 weeks when that date got copied down to another cell.
>> > I selected the whole line including both verticals and perhaps this works
>> > when only a time stamp is copied.
>> >
>> >> I am likely doing this wrong but will describe what has been done.
>> >> I put an agenda time stamp into a field in test.org and add +4w to the end
>> >> of the time stamp inside the >.
>> >> I get on the left of the field column on the vertical character and type
>> >> control-space to set mark.
>> >> I move to the end of the field on the > sign and type space and another
>> >> vertical to close the column entry for that field.
>> >> Next I do control-c+x+v and am told strings are copied to the kill ring.
>> >> Next I move down one line and type control-y to yank those strings out of
>> >> the kill buffer and paste them on that line.
>> >> When this is done, I expected the time stamp to increment by 4 weeks.
>> >> What happened was the same information got copied down and it didn't
>> >> increment.
>> >> What am I doing wrong?
>> >>

I still don't understand: in your most recent response (at the top of this 
thread)
you are talking about headlines with DEADLINE added (which seems the right 
approach
to me: is there a problem with it?) But in your original mail, as well as in 
the followup, you are
taling about "field columns" and "vertical characters" and "cop[ying] down to 
another cell",
which seems to imply that you have an Org mode table somewhere.

Maybe you can elaborate a bit?
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: a repeater doesn't increment

2021-07-22 Thread Nick Dokos
Jude DaShiell  writes:

> Does enough material exist on werg tutorials that document how to get a
> repeater operational?  That or maybe I don't understand repeaters.  Had
> the repeater I tried to use worked correctly it would have advanced the
> original date by 4 weeks when that date got copied down to another cell.
> I selected the whole line including both verticals and perhaps this works
> when only a time stamp is copied.
>

I may be misunderstanding, but are you trying to fill a column in a table
with dates that are four weeks apart? If so, repeaters have nothing to do
with it (AFAIK). You need `org-table-copy-increment' to be set to 28.

--8<---cut here---start->8---

| date | foo |
|--+-|
| <2021-07-22 Thu> | |
| <2021-08-19 Thu> | |
| <2021-09-16 Thu> | |
| <2021-10-14 Thu> | |
| <2021-11-11 Thu> | |
| <2021-12-09 Thu> | |


* Code

#+begin_src elisp
(setq-local org-table-copy-increment 28)

#+end_src

#+RESULTS:
: 28

--8<---cut here---end--->8---

Then keep pressing `S-RET' to get the next date.


>
> On Tue, 20 Jul 2021, Jude DaShiell wrote:
>
>> I am likely doing this wrong but will describe what has been done.
>> I put an agenda time stamp into a field in test.org and add +4w to the end
>> of the time stamp inside the >.
>> I get on the left of the field column on the vertical character and type
>> control-space to set mark.
>> I move to the end of the field on the > sign and type space and another
>> vertical to close the column entry for that field.
>> Next I do control-c+x+v and am told strings are copied to the kill ring.
>> Next I move down one line and type control-y to yank those strings out of
>> the kill buffer and paste them on that line.
>> When this is done, I expected the time stamp to increment by 4 weeks.
>> What happened was the same information got copied down and it didn't
>> increment.
>> What am I doing wrong?
>>
>>
>>
>
>

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: what would cause failure in template for org capture?

2021-07-21 Thread Nick Dokos
Eric S Fraga  writes:

> Hello all,
>
> I am getting this error message:
>
> org-capture: Capture abort: Unknown template placeholder: "%^G"
>
> when attempting to capture a task using this template:
>
> #+begin_src emacs-lisp
>   (add-to-list 'org-capture-templates
>'("t"
>  "todo"
>  entry (file+headline "~/s/notes/todo.org" "refile")
>  "* %^{Task}   %^G\n%i%?\n%U\n"))
> #+end_src
>
> The error happens after having entered the information for the Task in
> the template so next would be the tags.
>
> This was working until recently.  Both Emacs and org are up to date
> relative to their git repositories.  The only change done recently in my
> configuration is a move from ivy to selectrum for completion.

FWIW, it's working for me. There was a change on July 8 having to do
with tags completion (using completing-read-multiple), but I'm running
with that change and I don't see a problem. OTOH, I'm not using
selectrum (or ivy for that matter), so the change may be interacting
badly with it.

I would probably edebug `org-capture-fille-template` and check that the
code around l.1733 in `org-capture.el' behaves as expected.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: convert subtree or nested list to table

2021-07-20 Thread Nick Dokos
Matt Price  writes:

> Christian et al,
>
> I seem to have broken something while fiddling around and I can't quite make 
> out what.  Would someone be willing to check for me whether this does or does 
> not produce the desired full table? Right now I am again getting a truncated 
> result and I'm not
> fully sure what I might be oding wrong.  Here is what I have:
>
> #+NAME: rubric-one
> - Grade
>   a. A
>   b. B
>   c. C
>   d. D
>   e. F
> - Style
>   a. Excellent
>   b. Good
>   c. Adequate
>   d. Lousy
>   e. Failing
>
These seem to have zero-width spaces and maybe that breaks the structure. To 
make sure that the structure is recognized properly,
maybe try a very simple code block:


--8<---cut here---start->8---
#+begin_src elisp :var data=rubric-one :results drawer
data
#+end_src

#+RESULTS:
:results:
((Grade (ordered (A) (B) (C) (D) (F))) (Style (ordered (Excellent) (Good) 
(Adequate) (Lousy) (Failing
:end:
--8<---cut here---end--->8---

If that does not work, then something is fishy with `rubric-one', so start 
there.

--
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: [PATCH] ob-core: tangle check library of babel after current buffer

2021-07-17 Thread Nick Dokos
Tom Gillespie  writes:

> Pinging on this to see if anyone can test it so that it can be merged.
> Tom
>
> On Wed, Jun 16, 2021 at 4:29 PM Tom Gillespie  wrote:
>>
>> Hi,
>>This is a patch that fixes tangling behavior when a block has been
>> ingested into the library of babel and then modified. Best!
>> Tom
>
>

I have not tested it but I reviewed the code and it looks good to me.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




[PATCH] Fix match/maxlevel conflict in colview dynblock

2021-07-11 Thread Nick Dokos

Specifying both `maxlevel' and `match' in a columnview dynamic block
was broken: the `match' argument is ignored in that case. See the link
below for a (not so minimal) ECM.

Reported-by: Pablo A Perez-Fernandez
Link: 
https://emacs.stackexchange.com/questions/66658/filter-columnview-dblock-on-properties-or-tags

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler

>From 8bcff482e59c24758f87b9b5cdef3bc123dc12f8 Mon Sep 17 00:00:00 2001
From: Nick Dokos 
Date: Sun, 11 Jul 2021 22:30:22 -0400
Subject: [PATCH] Fix match/maxlevel conflict in colview dynblock

* lisp/org-coplview.el (org-columns--capture-view): Combine the match
and maxlevel arguments properly to construct the MATCH argument of
`org-map-entries'.

Specifying both `maxlevel' and `match' in a columnview dynamic block
does not work: the `match' argument is ignored in that case. See the
link below for a (not so minimal) ECM.

Reported-by: Pablo A Perez-Fernandez
Link: https://emacs.stackexchange.com/questions/66658/filter-columnview-dblock-on-properties-or-tags
---
 lisp/org-colview.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 2e1c29a99..7144308ff 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1398,8 +1398,9 @@ other rows.  Each row is a list of fields, as strings, or
   (org-get-tags
 	 (push (cons (org-reduced-level (org-current-level)) (nreverse row))
 		   table)
- (or (and maxlevel (format "LEVEL<=%d" maxlevel))
-	 (and match match))
+ (if match
+ (concat match (and maxlevel (format "+LEVEL<=%d" maxlevel)))
+   (and maxlevel (format "LEVEL<=%d" maxlevel)))
  (and local 'tree)
  'archive 'comment)
 (org-columns-quit)
-- 
2.31.1



Re: breakpoint in debugging org-table formulas

2021-07-08 Thread Nick Dokos
Uwe Brauer  writes:

> Hi 
>
> I just started to use the formula debugger
> (org-table-toggle-formula-debugger) which is quite nice.
>
> However for large tables with a lot of rows it would be more
> convenient to use breakpoints and not start just in the first row.
>
> I can't find any reference for that. 
>
> It is not implemented?
>
I've often wished for the same, but I don't think it's implemented.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: how to document/comment a complex org table formula

2021-07-08 Thread Nick Dokos
Uwe Brauer  writes:

 "GdaO" == General discussions about Org-mode  writes:
>
>> Limbic answer : 
>>   - create an emacs-lisp function doing what you want
>>   - comment /ad libitum/
>>   - call this function in your spreadsheet.
>
> I hoped such a function already existed and somebody would point it out
> to me (I searched the package-list-package list but nothing came up)
>

IIUC, the function would replace the formula, so it's really the
formula in a different guise, similar to what Eric F. was talking
about: implementing the formula as a source block. Both of them put
the code in some other place, where there is space to add comments.
IOW, it's not a general-purpose function. But I may be misconstruing
what Emmanuel was suggesting.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: table: problem with nan and if

2021-06-22 Thread Nick Dokos
Uwe Brauer  writes:

>> Uwe Brauer  writes:
>
>
>> I'm not very familiar with calc, but am wondering if the issue is the
>> 'nan'. In many languages, a nan is a 'polluting' variable i.e. once you
>> have a nan as a form anywhere in your calculation, the result will
>> always be a nan. Many languages actually have a special function to test
>> for a nan because it isn't actually a 'value'. Don't know if this is the
>> case with calc. 
>
> Yeah, when I googled, I found complains about nan using in calc but I
> did not really found an working alternative.
>
>> Perhaps an alternative strategy might help. Could you address what is
>> generating the nan and change that so that it generates something else,
>> possibly even a blank string and avoid the nan altogether? 
>
> I tried nil and other expressions but non really worked, so maybe a calc
> guru could clarify?
>

Could you write the formulas in lisp instead? You might be able to control
things more easily:

  (info "(org) Formula syntax for Lisp")

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: [BUG] org babel fails with matlab+python kernel on MacOS-10.15 [9.4.6 (release_9.4.6-541-g52b097 @ /Users/oub/emacs/site-lisp/packages/org/)]

2021-06-14 Thread Nick Dokos
Uwe Brauer  writes:

>
>>> |   ob-ipython--dump-error("Traceback (most recent call last):\n  File 
>>> \"/Users/...")
>
>
>
>> This line seems to be the critical one in the error output. If you can
>> expand out the full error message, it may elucidate what the problem is.
>
> This message drives my crazy since the most important information is
> just not shown.
>

IIUC, clicking on the three dots should expand the message to its full
glory. You'll probably need to cut-n-past it to another buffer and
replace "\n" with "real" newlines to make it readable.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: LaTeX fragment preview weirdness

2021-06-02 Thread Nick Dokos
Scott Randby  writes:

> First, I'm using Emacs 27.2 and Org 9.4.6.
>
> I have the following code in an Org file:
>
> #+latex_header: 
> \hypersetup{pdfauthor={Author},pdftitle={Title},pdfsubject={Subject},pdfkeywords={keyword},pdfproducer={Emacs
>  Org},pdfcreator={pdflatex}}
> #+latex_header: \hypersetup{colorlinks=true,urlcolor=blue,linkcolor=black}
>
> The above lines are in a section at the end of my document.
>
> When I do C-c C-x C-l in a section (or with a fragment at point), the 
> following appears above every  fragment that is previewed:
>
> pdfauthor=Author,pdftitle=Title,pdfsubject=Subject,pdfkeywords=keyword,pdfproducer=Emacs
>  Org,pdfcreator=pdflatex colorlinks=true,urlcolor=blue,linkcolor=black
>
> Here is a sample section from my Org file:
>
> --BEGIN--
>
> * Distance Formula
>
> Let $d$ be the distance between $(x_{1}, y_{1})$ and $(x_{2}, y_{2})$.
> \[
> d=\sqrt{\left(x_{1}-x_{2}\right)^{2}+\left(y_{1}-y_{2}\right)^{2}}
> \]
>
> --END--
>
>

You probably want #+LATEX_HEADER_EXTRA, not #+LATEX_HEADER. Do

   (info "(org) Latex header and sectioning")

where it says:

#+BEGIN_QUOTE
   The LaTeX export back-end appends values from ‘LATEX_HEADER’ and
‘LATEX_HEADER_EXTRA’ keywords to the LaTeX header.  The docstring for
‘org-latex-classes’ explains in more detail.  Also note that LaTeX
export back-end does not append ‘LATEX_HEADER_EXTRA’ to the header when
previewing LaTeX snippets (see *note Previewing LaTeX fragments::).
#+END_QUOTE

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: suggestion to change default org-latex-pdf-process to latexmk

2021-06-01 Thread Nick Dokos
"Bruce D'Arcus"  writes:

> While testing org-cite a few weeks ago, I noticed by default bibtex
> won't run with natbib export, or biblatex with biblatex export.
>
> Since org has not had native citations, this is not surprising.
>
> But with org-cite coming soon, this will change.
>
> At the time I suggested changing default to use latexmk, which will
> handle both bibtex and biblatex runs.
>
> https://lists.gnu.org/archive/html/emacs-orgmode/2021-05/msg00486.html
>
> So what do LaTeX users think about changing the default for
> "org-latex-pdf-process" to "latexmk"?
>
> Is there any reason not to do this?
>

The only reason I can think of is that it might not be available by
default, so it will be one more thing for a noob to install before Org mode
starts "working".

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Manual on web site is not the latest version

2021-05-17 Thread Nick Dokos
William Denton  writes:

> On 28 April 2021, Bastien wrote:
>
>> Do you still see differences between the doc/org-manual.org and the
>> one published on https://orgmode.org/manual/ ?
>>
>> If so, please point at one or two differences.  Thanks!
>
> Here's a late follow-up.  Thanks for checking.
>
> On the web at https://orgmode.org/manual/Languages.html#Languages
>
> "Code blocks in the following languages are supported."
>
> "Additional documentation for some languages is at 
> https://orgmode.org/worg/org-contrib/babel/languages.html.;
>
> In org-manual.org, both sentence are different:
>
> $ grep -A2 "Code blocks" doc/org-manual.org
> Code blocks in dozens of languages are supported.  See Worg for
> [[https://orgmode.org/worg/org-contrib/babel/languages/index.html][language
> specific documentation]].
>
>
> Bill
>
> --
> William Denton
> https://www.miskatonic.org/
> Librarian, artist and licensed private investigator.
>
>

The online manual is for 9.4 (the released version). What you see in 
org-manual.org
is for 9.5 (which AFAIK has not been released yet).

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: The fate of ditaa.jar (9.4.5.)

2021-05-10 Thread Nick Dokos
Jarmo Hurri  writes:

> Greetings.
>
> I pulled the latest master and noticed that contrib has been moved into
> a separate repository. I also cloned this contrib repository, but can
> not find the file
>
> scripts/ditaa.jar
>
> in the repo. In fact, there is no directory scripts in the repo.
>
> The documentation in the latest master states that
>
> Stathis Sideris wrote the ‘ditaa.jar’ ASCII to PNG converter that is now
> packaged into the org-contrib repository.
>
> How should I proceed? Should I build this separately
>
> https://github.com/stathissideris/ditaa

You don't need to build it: it's available in the release area

https://github.com/stathissideris/ditaa/releases

>
> or will it still be included into contrib?

In general, I think it's a better idea to point to the canonical sources
and document how to integrate it into Org mode, than bundle things like
that, but I have no idea how things are going to go. I'm sure there will
be some problems that will need fixing one way or another.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: publishing does not work anymore

2021-05-06 Thread Nick Dokos
Giuseppe Lipari  writes:


> (setq org-publish-project-alist
>    '(("fil-web"
>       :base-directory "./"
>       :base-extension "org"
>       :publishing-directory "./"
>       :preparation-function update-all-dblocks-before-exporting
>       :publishing-function org-html-publish-to-html
>       :html-extension "php"
>       :body-only t
>       :html-postamble: t
>       :html-postamble-format : ""

This last one seems wrong: the extra space before the colon should probably not 
be there.
And I'm not sure whethe the colon after the last two properties should be there 
at all.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Programmatically set TODO labels per file?

2021-04-29 Thread Nick Dokos
Arthur Miller  writes:

> I have a simple question, but I wasn't able to find answer on the web,
> so finally I'll try my luck here.
>

> I know I can setq org-todo-keywords with a list '((sequence "TODO"
> DONE")), as an example. But what variable is used for per-file keywords?
> Once that are set with #+TODO: ... line?
>
> I guess when org mode parses a file when starting up the mode, it has to
> parse that line into some var, where do I find it?
>

It is parsed into a buffer-local variable by the name of
`org-todo-keywords-1'. Do `C-h v org-todo-keywords' and `C-h v
org-todo-keywords-1' for all the details.

BTW, when the interwebs fail you (or even before that), use the source :-)

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: splot and #+PLOT keyword

2021-04-28 Thread Nick Dokos
Eric S Fraga  writes:

> Hello,
>
> a question/problem regarding the #+plot: keyword.
>
> I am trying to plot out some data where the table looks like this:
>
> #+begin_src org
>   ,#+plot: ind:(6 7) deps:(1) with:"linespoints pt 7" set:"logscale xy" 
> type:3d
>   | 1 |   81 |  5 |  0 |   2.27 | 0.9729848950975623 |   
> 0.019370016994566613 | 0.0 |
>   | 2 |  179 | 12 |  2 |   3.68 |0.42919355355596267 |  
> 0.098179980500945 | 0.0 |
>   | 3 |  192 |  6 |  4 |   3.73 |   0.022272788298562045 | 
> 107.57399021086516 | 0.0 |
>   | 4 |  207 |  7 |  8 |   3.78 |  5.793210638997738 |  
> 0.0012069891001225872 | 0.0 |
>   | 5 |  194 | 10 | 12 |   3.83 |0.06356594000544429 |
> 0.04724965431965522 | 0.0 |
>   | 6 |  216 |  8 | 14 |   3.89 |0.06342050747033937 |  
> 0.0030380306687021346 | 0.0 |
>   | 7 |  193 |  7 | 18 |   3.94 | 0.0021538841210584 |
> 0.05771587421360767 | 0.0 |
>   | 8 |  193 |  7 | 19 |   3.99 |  0.0010739216097561438 |
> 0.10625133051680691 | 0.0 |
>   | 9 |  182 |  6 | 19 |   4.04 |  0.0014893478573963876 |
> 0.03593357278451856 | 0.0 |
>   |10 |  192 |  6 | 21 |   4.10 |   0.013251328328567616 |  
> 0.0006605631984014402 | 0.0 |
> #+end_src
>
>
> I have tried a variety of directives for the #+PLOT: keyword but none
> give me what I want.  I would like to plot column 1 (dependent variable)
> versus columns 6 and 7 (independent variables) in 3d.  (don't ask ;-))
>
> I have also tried:
>
>#+plot: ind:6 deps:(7 1) ...
>
> but in all cases I seem to be getting somewhat random data plotted,
> possibly columns 2 versus 3 and 4, which makes no sense except that
> maybe the "|" table column separator is being retained in the data file
> created.  Is there any way to stop the data file from being deleted
> after plotting?  I can inspect the *gnuplot* buffer but cannot see the
> actual data.
>
> 2d plots work just fine, by the way.
>
> thank you,
> eric

Have you tried looking at the produced gnuplot script? It goes in a temp file
so it's a bit of a pain, but that's my fallback method when I'm really confused 
:-)

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Bug: org-columns--compute-spec tries to set CLOCKSUM property [9.4.4 (release_9.4.4-231-gf46925 @ /home/nick/elisp/org-mode/lisp/)]

2021-04-09 Thread Nick Dokos
Nicolas Goaziou  writes:

>>   | ITEM  | CLOCKSUM |
>>   |---+--|
>>   | Goal 3| 2:11 |
>>   |---+--|
>>   | Task 1| 2:11 |
>>   |---+--|
>>   | Subtask 1 | 1:00 |
>>   #+END
>> --8<---cut here---end--->8---
>
> Why do you say the entries are wrong?
>

Temporary (I hope...) brain damage.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Bug: Display Inline Images from Subdirectory [9.4.4 (9.4.4-33-g5450d6-elpaplus @ /home/ded/.emacs.d/elpa/org-plus-contrib-20210322/)]

2021-04-06 Thread Nick Dokos
"Daniel E. Doherty"  writes:

> I have a hook function (cribbed from Emacs Stack Exchange) to re-display 
> inline images in the current subtree after execution of a source block 
> if the header argument contains, ':results graphics'.  As its last 
> action, it calls:
>
> (org-display-inline-images nil nil beg end)
>
> where beg and end have been set to the bounds of the current subtree.
>
> This works perfectly if the image file is in the current directory.  For
> example, here is a block that displays as expected:
>
> #+begin_SRC dot :file lehman.svg :cmdline -Kdot -Tsvg :results graphics
>   digraph lehman {
> Thomas [shape=circle];
> TideWater [shape = box, label="Tide Water\nSecurities\n(Issuer)"];
> Lehman [shape = box];
> Thomas -> TideWater [label="Director"];
> Lehman -> TideWater [label="Shareholder"];
> Thomas -> Lehman [label="Partner"];
>   }
> #+end_SRC
>
>
> However, if I add a :dir header, it ceases to work:
>
> #+begin_SRC dot :dir dot :file lehman.svg :cmdline -Kdot -Tsvg :results 
>  graphics
>   digraph lehman {
> Thomas [shape=circle];
> TideWater [shape = box, label="Tide Water\nSecurities\n(Issuer)"];
> Lehman [shape = box];
> Thomas -> TideWater [label="Director"];
> Lehman -> TideWater [label="Shareholder"];
> Thomas -> Lehman [label="Partner"];
>   }
> #+end_SRC
>
>
> #+RESULTS:
> [[file:dot/lehman.svg]]
>
> I have run edebug on the function, and the only difference I can detect
> is the location of the image file in a subdirectory called 'dot'.
>
> Here is my hook function, just for the record:
>
> #+begin_SRC emacs-lisp
>   (setq org-startup-with-inline-images t)
>   (require 'subr-x)
>   (defun ded:org-babel-display-subtree ()
> "Redisplay inline images in subtree if cursor in source block with 
> :result graphics."
>
> (when (org-in-src-block-p)
>   (let (beg end)
> (save-excursion
>   (org-mark-subtree)
>   (setq beg (point))
>   (setq end (mark)))
> (when-let ((info (org-babel-get-src-block-info t))
>(params (org-babel-process-params (nth 2 info)))
>(result-params (cdr (assq :result-params params)))
>((member "graphics" result-params)))
>   (org-display-inline-images nil nil beg end)
>
>   (add-hook 'org-babel-after-execute-hook 
>   #'ded:org-babel-display-subtree)
> #+end_SRC
>

FWIW, this works fine for me: Org mode version 9.4.4 (release_9.4.4-231-gf46925 
@ /home/nick/elisp/org-mode/lisp/)

The only things I had to do was 1) to make the above into a tree by
adding a headline (otherwise, I guess org-mark-subtree would complain:
Not in a subtree) and 2) create the dot subdirectory.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: "#+STARTUP: hideblocks" has no effect?

2021-04-06 Thread Nick Dokos
autofrettage  writes:


> I recently read about the #+STARTUP parameter "hideblocks", but it
> doesn't seem to have any effect in my set-up. All the blocks kept
> laughing straight in my face. :-(
>
> Any ideas about what could have gone wrong?
>
> I use Org Mode 9.4.5 with Emacs 26.3, and I also tried closing the
> file and Emacs before I tried.
>
>
> p.s. Setting org-hide-block-startup with local variables is a
> solution, but not as nice as doing it with #+STARTUP, I'd say.


It interacts with org-startup-folded (whose default was changed
recently to 'showeverything'): you need to set the latter to something
other than 'showeverything' in order for hideblocks to be effective.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Bug: org-columns--compute-spec tries to set CLOCKSUM property [9.4.4 (release_9.4.4-231-gf46925 @ /home/nick/elisp/org-mode/lisp/)]

2021-04-05 Thread Nick Dokos
The following MWE illustrates:

--8<---cut here---start->8---
#+COLUMNS: %25ITEM %6CLOCKSUM{:}

* Goal 3
  :PROPERTIES:
  :ID: goal_3
  :END:

  #+BEGIN: columnview :hlines 4 :id goal_3 :maxlevel 3

  #+END

** TODO Task 1
   :LOGBOOK:
   CLOCK: [2020-01-26 18:05]--[2020-01-26 Mon 19:16] =>  1:11
   :END:

   Task body

*** TODO Subtask 1
 :LOGBOOK:
 CLOCK: [2020-01-28 Tue 15:45]--[2020-01-28 Tue 16:45] =>  1:00
 :END:
 
--8<---cut here---end--->8---

Starting with `emacs -Q foo.org', place the cursor on the `#+BEGIN:
columnview' line and type `C-c C-c`. That produces a table (although
the entries are wrong):

--8<---cut here---start->8---
  #+BEGIN: columnview :hlines 4 :id goal_3 :maxlevel 3
  | ITEM  | CLOCKSUM |
  |---+--|
  | Goal 3| 2:11 |
  |---+--|
  | Task 1| 2:11 |
  |---+--|
  | Subtask 1 | 1:00 |
  #+END
--8<---cut here---end--->8---

But then doing it again fails with the following (elided) backtrace:

--8<---cut here---start->8---
Debugger entered--Lisp error: (error "The CLOCKSUM property cannot be set with 
‘org-entr...")
  signal(error ("The CLOCKSUM property cannot be set with ‘org-entr..."))
  error("The %s property cannot be set with `org-entry-put'" "CLOCKSUM")
  ...
  org-entry-put(147 "CLOCKSUM" "1:00")
  (progn (org-entry-put (point) property new-value))
  (if (and update value (not (equal value new-value))) (progn (org-entry-put 
(point) property new-value)))
  (let ((new-value (org-trim summary))) (if (and update value (not (equal value 
new-value))) (progn (org-entry-put (point) property new-value
  ...
  org-columns--compute-spec(("CLOCKSUM" "CLOCKSUM" 6 ":" nil) t)
  ...
  org-columns-compute-all()
  ...
  org-columns(nil nil)
  org-columns--capture-view(3 nil nil nil nil 35)
  ...
  org-dblock-write:columnview((:name "columnview" :hlines 4 :id goal_3 
:maxlevel 3 :indentation-column 2 :content #("\n" 0 1 (org-category "foo500" 
wrap-prefix #("  " 0 2 (face org-indent)) line-prefix #("  " 0 2 (face 
org-indent)) fontified t
  ...
  org-update-dblock()
  (save-excursion (goto-char (org-element-property :post-affiliated context)) 
(org-update-dblock))
  ...
  org-ctrl-c-ctrl-c(nil)
--8<---cut here---end--->8---

Part of the problem seems to be that `org-get-entry' manufactures
CLOCKSUM properties out of the CLOCK entries above, but
`org-put-entry' knows that that's a special property and refuses to
put it. But I think the major fail is in `org-columns--compute-spec'
which takes the property at face value and just passes it along. I
believe it needs to do whatever accumulation it is supposed to do and
set a text property to store the value in the headline, but that's
guessing on my part.

I saw this on Emacs SE (the above example is a simplified version of
the example in the post):


https://emacs.stackexchange.com/questions/55164/org-columns-error-the-clocksum-property-cannot-be-set-with-org-entry-put

and it has apparently been reported once before:

https://lists.gnu.org/archive/html/emacs-orgmode/2012-02/msg00309.html


Emacs : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 2.24.33, cairo version 1.16.0) of 2021-02-17
 
Package: Org mode version 9.4.4 (release_9.4.4-231-gf46925)
-- 
Nick




Re: How to get shell source blocks to read my profile?

2021-03-16 Thread Nick Dokos
George Mauer  writes:

> I understand why you say that maxim but testing that this worked was the 
> first thing I did
> and it does work. I was surprised as well. I haven't debugged all the way 
> into the eval
> functions to see why this works but my guess is that the authors were pretty 
> smart about
> figuring out which executable to invoke.
>

Starting with `emacs -q' I evaluate

(setq shell-file-name "bash -i")

in the *scratch* buffer and then do `M-x shell'. I get

apply: Searching for program: No such file or directory, bash -i


If I do

(setq shell-file-name "/bin/bash -i")

I get

emacs: /bin/bash -i: No such file or directory

Process shell exited abnormally with code 127

The trouble is that `shell-file-name' may be used much more widely than you 
expect.

> As for the problem I'm trying to solve, there isn't one exactly. This is more 
> me hacking on
> something I don't fully understand because it regularly trips me up.
>
> I do still wonder what would be the disadvantage of just configuring it to do 
> --login by
> default and doing all configuration in profile scripts. It would be 
> unconventional yes, but
> it would also make dynamic scoping of environment variable effectively opt-in 
> via
> --noprofile rather than opt-out (which imo is how it should be). I would 
> assume that uses
> extra resources or risks improperly handling crashed processes, but I can't 
> find anything to
> that effect in the docs
>
> On Tue, Mar 16, 2021, 07:32 Maxim Nikulin  wrote:
>
> On 16/03/2021 00:49, George Mauer wrote:
> >    shell-file-name: "/bin/zsh -i"
>
> I am afraid, you should be prepared to face some problem accidentally.
> The value of this variable is used to execute the specified file
> ("zsh -i" in the "/bin" directory, I do not think, you have such file),
> not as a part of shell command. shell-file-name in namely file name to
> be executed with shell-command-switch as first argument (separate
> arguments, not merged into a string) to run shell commands (next 
> argument).
>
> Environment variables could be set on OS level, inside emacs
> https://www.gnu.org/software/emacs/manual/html_node/emacs/Environment.html
> , etc. It is hard to suggest something since you have not described the
> problem you are trying to solve. Tim in details explained why you
> attempt to solve it did not work, but the problem (or the goal) is still
> unknown.
>

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Problems while trying to load feature

2021-03-16 Thread Nick Dokos
"Charles R (Charlie) Martin"  writes:

> This is a problem I’ve noticed as well. Now, I am a programmer — my
> code or it’s descendants is still in the distribution — I do update
> org mode regularly, and I get messages when I start up Emacs about
> Org mode files that can’t be loaded. I wouldn’t be surprised if the
> cause is this renaming. But honestly I stopped having time to hack
> emacs 30 years ago. Wouldn’t it be desirable if changes that aren’t
> backward-compatible included some kind of assistance for users? 
>

You probably don't want to hear this, but you will have to figure out
what those messages are telling you and fix the problems. At best,
they might be innocuous: your init file might be trying to load things
that don't exist any more. At worst, you may be running a mixed
installation: you might be loading things from various versions of Org
mode that might coexist on your system(s) (depending on how exactly
you install Org mode: if you use the version that is bundled with
emacs *only* you should not have any problems; but if you install a
more recent one from ELPA or from git, you should be careful). If you
encounter problems after the initial load, you might have a mixed
installation. See https://orgmode.org/worg/org-faq.html#mixed-install for more
details on how to check. Mixed installations are an unending source of
problems and need to be taken care of.

I install new versions of emacs and Org mode fairly frequently (every
couple of months) at which point I restart emacs to see whether any
such problems crop up. If there are, I fix them right then and there,
until I can get a clean restart. If it's not obvious, I take a look
through the etc/ORG-NEWS file, which you should have locally, but in a
pinch you can look for it online:

https://code.orgmode.org/bzg/org-mode/src/master/etc/ORG-NEWS

In particular, this is the best place for assistance with backward
incompatibilities that you mentioned above. Assuming you know which
release you came from and which release you are going to, look through
the sections describing them and all intermediate releases, to see
what backward incompatibilites were introduced and what suggested
solutions there are. As a last resort, you can always ask here. In
general, I find that fixing these problems asap is better for my
sanity.

Cleaning up your init file to get rid of the (now) useless loads is
also a good idea (even though they are innocuous): init files tend to
accumulate junk (mine has been doing that for 30 years), so getting
rid of old cruft is, for me, another essential activity to maintain a
semblance of sanity.

My $0.02, YMMV, etc.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Problems while trying to load feature

2021-03-15 Thread Nick Dokos
The renaming was e.g org-bbdb to ol-bbdb, *NOT* to ol-org-bbdb.

Similarly for all the rest: you won't find any of them in any installation.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: org to beamer structure not working

2021-03-15 Thread Nick Dokos
Luca Ferrari  writes:

> On Mon, Mar 8, 2021 at 4:29 PM Eric S Fraga  wrote:
>>
>> How are you actually exporting?  Are you choosing a beamer export option
>> as it looks like article LaTeX output.  Your settings look fine
>> otherwise.
>
> Shame on me! I was exporting it as latex-pdf file (C-c C-e l p)
> instead of beamer (C-c C-e l P).
>

You are not the first (nor are you going to be the last) to do that - I speak 
from experience ;-)

> Sorry for the noise.
>
> Luca
>
>

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Bug: linking to <> requests tags table [9.4.4 ( @ /home/arne/.guix-profile/share/emacs/site-lisp/)]

2021-02-17 Thread Nick Dokos
"Dr. Arne Babenhauserheide"  writes:

>
> Following the manual at Hyperlinks Node: Internal Links
>
>  1. one item
>  2. <>another item
>  Here we refer to item [[target]].
>
> And then using C-c C-o on [[target]] I get the prompt in the minibuffer
> “Visit tags table (default TAGS)” instead of jumping to <>.
>

Does it happen with `emacs -q`? If not, your init file is at fault.
-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Where has the manual on one html page gone?

2021-02-15 Thread Nick Dokos
Christine Köhn  writes:

> Hi,
>
> I always used the manual online as one html page but it does not seem to
> be available since (?) the website revamp. I prefer the manual as one
> page for many reasons. Is it still available online?
>

I've always used the one-page per section version on the web (although
I tend to use Info much more often), primarily because I thought that
downloading the whole manual to just look at a section or two or five
would be inefficient - in fact, I've wondered why the single-page
versions of various manuals (particularly the larger ones: emacs and
elisp) are made available. So it is idle curiosity on my part, but
what are the the reasons for your preference?

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Get =#+RESULTS= without re-evaluating source code block?

2021-02-02 Thread Nick Dokos
John Kitchin  writes:

> I discovered that it matters a lot which block you cache. You have to
> cache the long running block. I had put cache on the block with noweb
> expansion, and then the long running block still runs every time. That
> was a surprise to me, since nothing was changing in that block, so I
> thought it would just use the cached result.
>

Just to elaborate a bit: Org mode checks whether to reevaluate a cached block
by checksumming it and seeing if the sum is different from before. That's why
you have to mark the actual block for caching, not its callers.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: [Bug] org-version returns empty string when called uninteractively [9.4]

2021-01-26 Thread Nick Dokos
Jean-Léon HENRY  writes:

> Hi,
>
> I just upgraded org to 9.4.4 and org-version is returning an empty string 
> when called
> unineractively. More precisely
>
> I started emacs with : emacs -Q -l minimal-org.el
> Contents of minimal-org.el :
>
> ;
> ;;; Minimal setup to load latest `org-mode'.
>
> ;; Activate debugging.
> (setq debug-on-error t
>   debug-on-signal nil
>   debug-on-quit nil)
>
> ;; Add latest Org mode to load path.
> (add-to-list 'load-path (expand-file-name 
> "/home/me/.emacs.d/elpa/org-9.4.4/"))
> 
>
> Then did :
> M-x org-version
>
> Result :
> "Org mode version  ( @ /home/me/.emacs.d/elpa/org-9.4.4/)"
>
> But when evaluated non-interactively :
> (org-version)
>
> Results :
> ""
>
> In my regular set-up, this breaks version checks used in other packages : 
> (version<
> (org-version) "9.0") for example is called. This gives you the following 
> backtrace :
> Debugger entered--Lisp error: (error "Invalid version syntax: ‘’ (must start 
> with a number)
> ")
>   signal(error ("Invalid version syntax: ‘’ (must start with a number)"))
>   error("Invalid version syntax: `%s' (must start with a number)" "")
>   version-to-list("")
>   version<("" "9.0")
> [...]
>
> Thanks for your help
>

It does not do that for me:

   (org-version)
   "9.4.4"

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Inserting LaTex expressions using a filter fails

2021-01-05 Thread Nick Dokos
Mart van de Wege  writes:

> I'm trying to replace U+00BD in an org buffer with \sfrac{1}{2} during
> export to LaTex, and obviously I'm doing something wrong, or I don't
> understand the documentation.
>
> I use the following code to set up the filter:
>
> #+BIND: org-export-filter-item-functions (latex-replace-half)
> #+BEGIN_SRC emacs-lisp :exports results :results none
>
>   (defun latex-replace-half (text backend info)
> (when (org-export-derived-backend-p backend 'latex)
>   (replace-regexp-in-string  "½" "\\sfrac{1}{2}" text)))
> #+END_SRC
>

Try

(replace-regexp-in-string  "½" "sfrac{1}{2}" text)))


> Down the line in the document there is this example line:
>
>- 1½ eetl. gehakte peterselie, ½ eetl. azijn, 4 eetl. olie
>
> Or this one:
>
>Laat de gewassen en gebroken vermicelli met de foelie ½ uur in de
>
> But neither of them get replaced. I tried plain-text, item, and
> final-output filters.
>

"item" will only deal with the first one: an item in a list. You'll need
to use "final-output" probably.

> What am I missing?
>
> Mart

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Bug: org-element does not recognize table.el tables [9.4 (release_9.4-53-g23f941 @ /home/nick/elisp/org-mode/lisp/)]

2021-01-04 Thread Nick Dokos
Nicolas Goaziou  writes:

> Hello,
>
> Nick Dokos  writes:
>
> [...]
>
>> Evaluating `(org-element-at-point)' returns `(paragraph ...)' all along
>> the top line and `(table ( :type org ))' when the cursor is at
>> the beginning of the `a b c' line.
>
> Fixed. Thank you.
>

Thank you!

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Bug: org-element does not recognize table.el tables [9.4 (release_9.4-53-g23f941 @ /home/nick/elisp/org-mode/lisp/)]

2020-12-22 Thread Nick Dokos
Bastien  writes:

> Hi Nick,
>
> Nick Dokos  writes:
>
>> Consider an Org mode file with a table.el table (which I made by
>> first constructing an Org mode table and then usind `C-c ~' to
>> convert it):
>
> Would it be so bad if org-mode decides to stop supporting table.el tables? 
>
> I don't see the benefit of supporting both Org tables and tables.el tables,
> and it calls for confusion.
>
> What do you and everyone else think?

I don't use table.el tables. The only reason I submitted the bug
report was because I was trying to investigate this Emacs SE question:

   
https://emacs.stackexchange.com/questions/62335/org-mode-export-table-to-latex-with-word-wrap

In the process, I discovered that the LaTeX file was broken and traced
it back to org-element. Note that the manual says:

"Org mode recognizes such tables and exports them properly."

See

   (info "(org) Cooperation") 

So there are three roads ahead as I see it:

- Fix the bug in org-element and make sure that table.el tables are
  exported properly.

- Do not fix the bug. Instead, tear out table.el support from Org mode
  code and fix the manual to say so.

- Do not fix the bug (and do nothing else).

I presume the third choice is distasteful to everybody, but that's
going to be the default choice unless somebody volunteers to do either
of the other two.

Either of the first two choices requires work. From my POV, it does
not matter which of the two is done: if somebody volunteers to do
either, I am not going to object (and I suspect, almost nobody else
will either: if the second course is chosen, there may be some table.el
users who would object to losing it, but if so, they should volunteer
to fix the bug).

My 0.02 kopek.

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Bug: org-element does not recognize table.el tables [9.4 (release_9.4-53-g23f941 @ /home/nick/elisp/org-mode/lisp/)]

2020-12-21 Thread Nick Dokos
Hi Bastien,

Bastien  writes:

> Would it be so bad if org-mode decides to stop supporting table.el tables? 
>

I don't use table.el tables so it's easy for me to say "Get rid of them" - but
there may be objections :-)

> I don't see the benefit of supporting both Org tables and tables.el tables,
> and it calls for confusion.
>
> What do you and everyone else think?

They do exist in a sort of twilight zone: not many people use them
AFAICT, but there is ostensible support and the manual says "Org mode
recognizes such tables and exports them properly", but the bug I sent
shows that that's not correct.

So: fix this bug now that it's been pointed out? Close it as "Will not
fix" with some guidance on what the user is supposed to do ("don't use
table.el tables" is probably the best advice)? Or decide to jettison
table.el support altogether? The first and the last involve real work,
the middle one not, but it's not particularly tasty.

Somebody else will have to make the decision: I'm fine with either of
the exreme ways, not so much with the middle option, but since I'm not
going to do the work, I am in no position to insist.

BTW, I ran into this while looking into this Emacs SE question:

https://emacs.stackexchange.com/questions/62335/org-mode-export-table-to-latex-with-word-wrap

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




Re: Selecting a date to show on the agenda with time grids

2020-12-21 Thread Nick Dokos
Christopher Dimech  writes:

> Dear Compeers,
>
> I able to run the command
>
> (org-agenda-list nil (org-read-date))
>
> to select the date and get the week for the agenda.
>
> But I would like the grid marks for the selected date to show up
> together with the list of appointments in the time slots.
>

No idea what you mean, but does `v d' on that day do what you want?
AFAIK, the grid is shown in the weekly/monthly agenda only for the
current date.  But as I said I don't really know what you mean, so I
may be misunderstanding you.  If so, please elaborate.

> Would be very grateful if somebody can help me further with this.
>
> Regards
> Christopher
>
>
>
>

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler




  1   2   3   4   5   6   7   8   9   10   >