Documentation missing for several org-habit variables?

2023-01-06 Thread Christian Heinrich
Hi everyone,

I noticed that https://orgmode.org/manual/Tracking-your-habits.html explains 
only a few variables
that exist in org-agenda.el and that are declared via defvar.

However, in org-habit.el, more variables exist but are declared via defcustom. 
I cannot find any
documentation (online) on, e.g., org-habit-today-glyph.

Is this correct / are you aware of this or should the documentation for these 
variables be added as
well?

Best regards
Christian



Re: org-capture and fast selection of tags

2022-09-28 Thread Christian Heinrich
Hi Ihor,

unfortunately, I didn't have any time to incorporate your comments but this is 
still on my todo
list. I hope I will have more time soon, but it will most likely take me a few 
weeks.

Thanks for checking in with me, I really appreciate your support!

Best regards
Christian

On Tue, 2022-08-23 at 10:17 +0800, Ihor Radchenko wrote:
> 
> Christian, did you get a chance to take a look at my further comments on
> the patch?
> 


signature.asc
Description: This is a digitally signed message part


Re: org-capture and fast selection of tags

2022-07-16 Thread Christian Heinrich
Hi Ihor,

thanks for your feedback. I attached a patch, but I'm not sure why you said 
"all but the last line".
That last line for me was (org-set-tags tags), which proved important as 
otherwise the tags were not
set in the buffer.

Anyways, please find the patch attached. Feedback is welcome, particularly on 
naming the auxiliary
function (org-input-tags does not seem like a great name).

I didn't sign any papers yet, but as this is just a minor refactoring without 
new logic, I'm not
sure whether it would be required.

Best
Christian

On Sat, 2022-07-16 at 17:12 +0800, Ihor Radchenko wrote:
> Christian Heinrich  writes:
> 
> > I looked at the code and came up with a patch that works for me (see 
> > below). However, this may
> > change behavior for others:
> 
> Thanks!
> 
> > 1. The original %^g will work on non-headlines, but if 
> > (org-set-tags-command) is called as I do,
> > this is no longer possible and would need to be checked (what would be a 
> > good way here?)
> > 
> > 2. Can I really deduce from (org-use-fast-tag-selection) being non-nil that 
> > fast selection
> > should be
> > used in capture templates as well? Does it actually make sense to 
> > incorporate this into %^g/G?
> > 
> > I am neither a lisp programmer nor acquainted with the org codebase; this 
> > is a draft I came up
> > with. If you can provide me with further feedback, I'm willing to make this 
> > more stable.
> 
> The idea is reasonable, but using org-set-tags-command is not ideal
> indeed. Instead, you can take the relevant part of org-set-tags-command
> (it is all but last line of the "t" cond clause) and put it into a
> separate auxiliary function. Then, you can simply call that function
> inside the org-set-tags-command and inside the capture template code.
> 
> Best,
> Ihor
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 9ef160d16..4f7652ca3 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -72,6 +72,7 @@
 (defvar crm-separator)
 (defvar org-end-time-was-given)
 (defvar org-keyword-properties)
+(defvar org-use-fast-tag-selection)
 (defvar org-remember-default-headline)
 (defvar org-remember-templates)
 (defvar org-store-link-plist)
@@ -1751,21 +1752,8 @@ Expansion occurs in a temporary Org mode buffer."
 			 (org-global-tags-completion-table
 			  (cond ((equal key "G") (org-agenda-files))
 (file (list file))
-(t nil
-			(org-add-colon-after-tag-completion t)
-			(ins (mapconcat
-  #'identity
-  (let ((crm-separator "[ \t]*:[ \t]*"))
-(completing-read-multiple
- (if prompt (concat prompt ": ") "Tags: ")
- org-last-tags-completion-table nil nil nil
- 'org-tags-history))
-  ":")))
-		   (when (org-string-nw-p ins)
-			 (unless (eq (char-before) ?:) (insert ":"))
-			 (insert ins)
-			 (unless (eq (char-after) ?:) (insert ":"))
-			 (when (org-at-heading-p) (org-align-tags)
+(t nil)
+   (org-input-tags)))
 		((or "C" "L")
 		 (let ((insert-fun (if (equal key "C") #'insert
 	 (lambda (s) (org-insert-link 0 s)
diff --git a/lisp/org.el b/lisp/org.el
index dd33028c6..6631d2a0a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11445,49 +11445,53 @@ in Lisp code use `org-set-tags' instead."
 	   'region)
 	 (lambda () (when (org-invisible-p) (org-end-of-subtree nil t))
  (t
-  (save-excursion
-	(org-back-to-heading)
-	(let* ((all-tags (org-get-tags))
-	   (table (setq org-last-tags-completion-table
-			(org--tag-add-to-alist
-			 (and org-complete-tags-always-offer-all-agenda-tags
-  (org-global-tags-completion-table
-   (org-agenda-files)))
-			 (or org-current-tag-alist (org-get-buffer-tags)
-	   (current-tags
-		(cl-remove-if (lambda (tag) (get-text-property 0 'inherited tag))
-			  all-tags))
-	   (inherited-tags
-		(cl-remove-if-not (lambda (tag) (get-text-property 0 'inherited tag))
-  all-tags))
-	   (tags
-		(replace-regexp-in-string
-		 ;; Ignore all forbidden characters in tags.
-		 "[^[:alnum:]_@#%]+" ":"
-		 (if (or (eq t org-use-fast-tag-selection)
-			 (and org-use-fast-tag-selection
-			  (delq nil (mapcar #'cdr table
-		 (org-fast-tag-selection
-		  current-tags
-		  inherited-tags
-		  table
-		  (and org-fast-tag-selection-include-todo org-todo-key-alist))
-		   (let ((org-add-colon-after-tag-completion (< 1 (length table)))
- (crm-separator "[ \t]*:[ \t]*"))
-		 (mapconcat #'identity
-(completing-read-multiple
-			 "Tags: "
-			 org-last-tags-comp

Re: org-capture and fast selection of tags

2022-07-14 Thread Christian Heinrich
Hi Ihor,

thanks for your reply.

I looked at the code and came up with a patch that works for me (see below). 
However, this may
change behavior for others:

1. The original %^g will work on non-headlines, but if (org-set-tags-command) 
is called as I do,
this is no longer possible and would need to be checked (what would be a good 
way here?)

2. Can I really deduce from (org-use-fast-tag-selection) being non-nil that 
fast selection should be
used in capture templates as well? Does it actually make sense to incorporate 
this into %^g/G?

I am neither a lisp programmer nor acquainted with the org codebase; this is a 
draft I came up
with. If you can provide me with further feedback, I'm willing to make this 
more stable.


Best regards 
Christian



diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 9ef160d16..a2a05c69d 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -72,6 +72,7 @@
 (defvar crm-separator)
 (defvar org-end-time-was-given)
 (defvar org-keyword-properties)
+(defvar org-use-fast-tag-selection)
 (defvar org-remember-default-headline)
 (defvar org-remember-templates)
 (defvar org-store-link-plist)
@@ -1751,7 +1752,10 @@ Expansion occurs in a temporary Org mode buffer."
 (org-global-tags-completion-table
  (cond ((equal key "G") (org-agenda-files))
(file (list file))
-   (t nil
+   (t nil)
+(if (and (boundp 'org-use-fast-tag-selection) (not (null 
org-use-fast-tag-
selection)))
+  (org-set-tags-command)
+  (let* (
(org-add-colon-after-tag-completion t)
(ins (mapconcat
  #'identity
@@ -1765,7 +1769,7 @@ Expansion occurs in a temporary Org mode buffer."
 (unless (eq (char-before) ?:) (insert ":"))
 (insert ins)
 (unless (eq (char-after) ?:) (insert ":"))
-(when (org-at-heading-p) (org-align-tags)
+(when (org-at-heading-p) (org-align-tags)))
((or "C" "L")
 (let ((insert-fun (if (equal key "C") #'insert
 (lambda (s) (org-insert-link 0 s)


On Mon, 2022-07-11 at 10:02 +0800, Ihor Radchenko wrote:
> Christian Heinrich  writes:
> 
> > Today, I went through your init.org on github (it's ... huge) and couldn't 
> > find anything there
> > either.
> 
> That's because I rarely need to set standard tags when capturing staff.
> So, I am content with entering tags manually.
> 
> > ... Do you have an idea
> > on how to use fast selection of tags (using shortcuts) when capturing an 
> > entry?
> > ...
> > I first thought that using %(org-set-tags-command) should work; but the 
> > capture-buffer is
> > narrowed
> > (i.e., no tags are available),...
> 
> %(org-with-wide-buffer (org-set-tags-command)) may work.
> 
> Of course, we may also implement a proper capture selection for %^g
> template. As usual, patches are welcome.
> 
> Best,
> Ihor
> 


signature.asc
Description: This is a digitally signed message part


Re: [BUG] Inline src blocks do not work for LaTeX [9.5.4 (release_9.5.4-3-g6dc785 @ /Users/salutis/src/emacs/nextstep/Emacs.app/Contents/Resources/lisp/org/)]

2022-07-03 Thread Christian Heinrich
Hi Rudolf,

as to your question when to use an inline src block:

I use it particularly in documents that present results from data sets. For 
instance, when you
calculate something (e.g., an average value), you can store it in a variable 
=foo= (e.g., in R,
python etc., just make sure you use the :session parameter) and access =foo= in 
an inline source
block (that uses the same :session parameter). This allows you to avoid having 
hardcoded numbers in
your documents - when the data changes, so do all the numbers in your text.

As to the naming: begin_src also uses underscores, so I guess the naming scheme 
is fine...

Hope this helps!

Best regards
Christian

On Sun, 2022-07-03 at 21:11 +0200, Rudolf Adamkovič wrote:
> Ihor Radchenko  writes:
> 
> > […]  By default, unlike ordinary src blocks, inline src blocks are
> > only exported as results - code is not exported, only the result is
> > exported.  […]  Further, because Org is not always able to evaluate
> > src blocks (when the relevant ob-*.el is not loaded), inline src
> > blocks can sometimes be exported as code.
> 
> Dear Ihor,
> 
> Thank you for taking the time with your reply.
> 
> Oh, my!  I expected the exact opposite default for *inline* source,
> namely show code and hide results.  But then, I noticed that these
> "inline" elements do not work in tables, so I cannot use them to
> syntax-highlight a table of LaTeX commands anyway.  Bummer!
> 
> So then, when should we use these "inline blocks" in Org?  I expected
> them to provide inline (nicely rendered) code anywhere, including in the
> tables, like LaTeX provides in-line (nicely rendered) math everywhere.
> 
> (I also keep wondering why the feature uses a "special" syntax with
> underscores when everything else in Org uses dashes.)
> 
> P.S. I also experimented with the src_shell some more:
> 
> With #+PROPERTY: header-args+ :exports both, src_shell{ls} exports as
> "ls".  I did not expect that.  Note that I executed a normal BEGIN_SRC
> "shell" block seconds before, so Emacs must have loaded the relevant
> Lisp code.  I then started 'emacs -Q' and tried again.  This time,Org
> exported 'src' followed by a subscript 'shell'.
> 
> Completely and utterly confused,
> 
> Rudy


signature.asc
Description: This is a digitally signed message part


org-capture and fast selection of tags

2022-06-26 Thread Christian Heinrich
Hi everyone,

I am trying to set up an org-capture template that presents me with the fast 
selection window for
tags instead of just the prompt one gets when using org-capture's %^g / %^G 
placeholders. I often
have project related tags that I need to apply to many but not all tasks, so 
this would help me a
lot.

I have my tags defined through #+TAGS in my org file. 

I first thought that using %(org-set-tags-command) should work; but the 
capture-buffer is narrowed
(i.e., no tags are available), so I used (setq 
org-complete-tags-always-offer-all-agenda-tags t) to
make my tags available there as well. They are available now, but the fast 
selection is not used, as
org-use-fast-tag-selection is set to 'auto'. When I set it explicitly to t, the 
fast selection is
shown but because of org-complete-tags-always-offer-all-agenda-tags, I have way 
too many options to
choose from. I only want the tags defined through #+TAGS to be offered through 
fast selection.

How can I achieve that? Is there a way to also make only the tags defined in 
the target file
available?

Thanks for any help!

Best regards
Christian


signature.asc
Description: This is a digitally signed message part


Re: Tips on using Org-mode to manage a reading list

2022-05-29 Thread Christian Heinrich
Hi,

personally, I find tracking information through TODO keywords rather 
unappealing. There are two
reasons: the first one is that you may loose information. For instance, if you 
use "TO-READ", "To-
BUY", "READ" to track your books, does that mean that every item that is marked 
"READ" is related to
a book in your possession? What about books you read that you borrowed from the 
library or a good
friend? Once you change to the final keyword, you loose track of the former 
ones. I do believe that
is is better to use properties and/or tags for this.

Secondly, since I store everything in my journal, I would end up (and at some 
point, I did) with
TOREAD / READ; UNVISITED / VISITED (locations); UNTESTED / TESTED (e.g., food 
recipes, code, ...)
and so on. I found that rather unappealing as it is based on the content of the 
item. Today, my
keyword is simply "TODO" and I tag the headline "ARTICLE" or "BOOK". If I want 
to query books that I
still need to read, I will filter on tags and TODO item. (This also allows me 
to search for articles
I still need to read but exclude books.)


Since you are also talking about articles: the CLI tool org_attach can fetch 
data and pdfs (when
accessible) based on DOIs, bibtex files, URLs, ...: 
https://github.com/Ezibenroc/org_attach

org_attach bib 10.1137/0206024

would look up the DOI and create an entry in the org-mode file automatically, 
including a bibtex
section; in some cases (when it can find it), it even downloads the PDF and 
attaches it.

Further tips: there are tools like org-noter and org-pdftools (combined through 
org-noter-pdftools)
that can help you with taking notes.

When you set up an org-capture template, consider putting it into its own file 
and reading it via
(file "path/to/your/template" ); makes your init.el a bit tidier.

Third advice: you may want to add a property called "GENRE"; and in some cases, 
you may want to
limit the entries via the _ALL option. So for example, you list all genres 
through 

#+PROPERTY: GENRE_ALL genre1 genre2 genre3

Other values will then not be permitted for that property.

Best regards
Christian



On Mon, 2022-05-16 at 23:22 +0200, Sébastien Gendre wrote:
> Hello.
> 
> I want to use Org-mode to manage a reading list and I'm looking for
> tips.
> 
> My goals are to:
>   * List books and articles I want to read
>   * Track books I have to buy and which I already own
>   * Track books and articles I have read
>   * Take notes on books I have read
> 
> The following is what I plan to do.
> 
> The idea is to use an Org-mode heading for each book and the
> properties of the books become the ones of the Org-mode heading. The
> synopsis of the book can be in the body of the heading.
> 
> Example:
> #+begin_example
> 
> * TO-READ Four Futures - Life After Capitalism
> :PROPERTIES:
> :Title: Four Futures - Life After Capitalism
> :Author:    Peter Frase
> :Score: 
> :Publisher: Verso Books
> :Release_date:  Unknown
> :Link:  https://www.versobooks.com/books/1847-four-futures
> :Pages: 
> :END:
> 
> An exhilarating exploration into the utopias and dystopias that
> could develop from present society
> 
> #+end_example
> 
> I can then structure my Org-mode file like I want. Here, the first
> level headings are:
>   * Articles
>   * Books
> 
> In the "Books" heading I have the headings "Non-fiction" and
> "Fiction".
> 
> To track the status of the books, I set the following for the Org-mode
> file:
>   * TO-GET
>   * TO-READ
>   * READING
>   * READ (DONE state)
> 
> For adding new books, I can use Org-capture with a custom template.
> The captured book can be saved inside an "Inbox" Org-mode file, then
> moved to its destination heading with Org-refile.
> 
> For searching a book inside the file, I can use "Sparse Trees" or
> Org-ql.
> 
> If I get the digital version of the book, I can attach it to its
> corresponding heading with Org-attach.
> 
> And for taking notes, I can create headings inside the book heading.
> Using Emacs narrow to focus on it. If I get the digital version of the
> book, I can use Org-noter.
> 
> End of description.
> 
> 
> Do you have any suggestions or idea ?
> 
> I don't know how to manage books with several volumes.
> Do I create a heading for each volumes ?
> Do I create one heading for the whole collection ?
> 
> The first is easy with 2 or 3 volumes, but not when I got 23 or more in a 
> collection.
> 
> Do you have idea to manage borrowing and loaning books ?
> 
> Thank you in advance. :)
> 
> 
> Best regards
> 


signature.asc
Description: This is a digitally signed message part


Re: Bug: ob-R.el breaks when :session is specified

2022-05-15 Thread Christian Heinrich
Hi Charles,

ob-R.el requires ess and the (require 'package) makes sure the ~/.emacs.d/elpa/ 
directory was added
to the load path. But you were somewhat right already: the loaded ESS was years 
old and caused the
issue.

Thanks for your help!

Christian

On Sun, 2022-05-15 at 19:58 +, Berry, Charles wrote:
> 
> Um...
> 
> > On May 15, 2022, at 2:46 AM, Christian Heinrich 
> >  wrote:
> > 
> > I run 
> > 
> > emacs -q --load /tmp/init.el --file=/tmp/test.org 
> > 
> > with my /tmp/init.el being only
> > 
> > > (require 'package)
> > > (package-initialize)
> > > (add-to-list 'load-path "~/.emacs.d/straight/repos/org/lisp/")
> > > (require 'org)
> > > 
> > > ;(require 'ess-site)
> 
> The line above is commented out. So how do you load ess-site?
> 
> 
> > > (org-babel-do-load-languages
> > >   'org-babel-load-languages
> > >    '((R . t)))
> > 
> > I hope this constitutes a minimal example for a config - please correct me 
> > if I'm wrong.
> 
> 
> Just spitballing here:
> 
> Have you tried instrumenting `org-babel-R-evaluate-session'? 
> 
> Maybe watching changes made to the session buffer on first evaluation and 
> comparing to subsequent
> evals helps.
> 
> HTH,
> Chuck
> 


signature.asc
Description: This is a digitally signed message part


Re: Bug: ob-R.el breaks when :session is specified

2022-05-15 Thread Christian Heinrich
Hi Jeremie,

thank you for providing this example!

The ess that was found in the load path was years old and once updated, all 
issues were resolved. In
fact, my so-called minimum init still used (require 'package) and I didn't even 
think about ESS
causing this trouble.

It's now a bit clearer how to build a real minimum init - thank you!

This is hence resolved.

Best regards
Christian


On Mon, 2022-05-16 at 00:21 +0200, Jeremie Juste wrote:
> 
> Hello Christian
> 
> On Sunday, 15 May 2022 at 20:06, Christian Heinrich wrote:
> > I just tested with
> > 
> >  Org mode version 9.5.3 (release_9.5.3-504-gcdbb1c @
> > /home/heinrich/.emacs.d/straight/repos/org/lisp/)
> > 
> > using
> > 
> > GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo 
> > version 1.16.0) of
> > 2021-
> > 11-27, modified by Debian
> 
> 
> Many thanks for reporting back.  I updated to gcdbb1c and it is still working 
> fine.
> 
> My minimum working example is the following. From the org-mode root directory,
> 
> $ emacs -Q -L ./lisp -l org  -l ~/ess-barebone.el
> 
> where ~/ess-barebone.el is the following:
> 
> #+begin_src  elisp
> (add-to-list 'load-path "/home/djj/.emacs.d/elpa/ess-20220125.2207/")
> (require 'ess-r-mode)
> 
>  (org-babel-do-load-languages
>    'org-babel-load-languages
>    '((R . t)))
> 
> (setq org-confirm-babel-evaluate nil)
> #+end_src
> 
> Note that I'm still using a rather old ess version. Could you please try
> with the above configuration? Note that I am using a rather old ess
> version but the I haven't experienced issues with the newer one.
> 
> Best regards
> Jeremie
> 
> 
> > Hi Jeremie,
> > 
> > I just tested with
> > 
> >  Org mode version 9.5.3 (release_9.5.3-504-gcdbb1c @
> > /home/heinrich/.emacs.d/straight/repos/org/lisp/)
> > 
> > using
> > 
> > GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo 
> > version 1.16.0) of
> > 2021-
> > 11-27, modified by Debian
> > 
> > I am on Debian Testing and that is the default emacs version.
> > 
> > Using the unmodified org (git hash from above) I get the following messages 
> > when executing a src
> > block with R:
> > 
> >    executing R code block...
> >    Loading ‘ess-bugs-l’: unescaped character literals `?(', `?)' detected, 
> > `?\(', `?\)'
> > expected!
> >    Type C-h m for help on ESS version 15.09
> >    ess-tracebug mode enabled
> >    Quit
> >    Package cl is deprecated
> > 
> > Note that the "Quit" is me pressing Ctrl-g after a few seconds.
> > 
> > Removing the commit in question makes the block return instantaneously:
> > 
> >    executing R code block...
> >    Loading ‘ess-bugs-l’: unescaped character literals `?(', `?)' detected, 
> > `?\(', `?\)'
> > expected!
> >    Type C-h m for help on ESS version 15.09
> >    ess-tracebug mode enabled
> >    Code block evaluation complete.
> >    Package cl is deprecated
> > 
> > I anticipated that this would not be obvious, since this feature is used 
> > too much to go
> > unnoticed for
> > two years - but I am clueless as to how I should continue with debugging...
> > 
> > Thanks for your help!
> > Christian
> > 
> > On Sun, 2022-05-15 at 16:16 +0200, Jeremie Juste wrote:
> > > 
> > > Hello Christian,
> > > 
> > > Thanks for reporting but I cannot reproduce the bug with the org and
> > > emacs version below.
> > > 
> > > Org mode version 9.5.3 (release_9.5.3-467-g2bd34e @
> > > /home/djj/src/org-mode/lisp/)
> > > GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24) of
> > > 2022-01-16
> > > 
> > > Can you please let me know which version of org-mode you are actually
> > > using?
> > > 
> > > Ihor, many thanks for checking.
> > > 
> > > Best regards,
> > > Jeremie
> > > 
> > > On Sunday, 15 May 2022 at 16:08, Ihor Radchenko wrote:
> > > > Christian Heinrich  writes:
> > > > 
> > > > > I got back to an org file after upgrading to the latest release of 
> > > > > org-mode and tried
> > > > > executing the
> > > > > contained R source blocks. Unfortunately, emacs got stuck in the 
> > > > > execution and was
> > > > > blocked; I
> > > > > had to
> > > > > exit using C-g.
> > > > > 
> > > > > Here's a minimal example src block that causes emacs to get stuck:
> > > > > 
> > > > > #+begin_src R :results output :session *R* :exports both
> > > > >   a <- 10
> > > > >   a
> > > > > #+end_src
> > > > > 
> > > > > R itself does start and the code is also executed correctly. However, 
> > > > > the output from that
> > > > > session
> > > > > is apparently not returned to emacs or the buffer.
> > > > 
> > > > I tried you example using Emacs >=26 and it works just fine.
> > > > 
> > > > Best,
> > > > Ihor
> 


signature.asc
Description: This is a digitally signed message part


Re: Bug: ob-R.el breaks when :session is specified

2022-05-15 Thread Christian Heinrich
Hi Jeremie,

thank you for providing this example!

The ess that was found in the load path was years old and once updated, all 
issues were resolved. In
fact, my so-called minimum init still used (require 'package) and I didn't even 
think about ESS
causing this trouble.

It's now a bit clearer how to build a real minimum init - thank you!

This is hence resolved.

Best regards
Christian

On Mon, 2022-05-16 at 00:21 +0200, Jeremie Juste wrote:
> 
> Hello Christian
> 
> On Sunday, 15 May 2022 at 20:06, Christian Heinrich wrote:
> > I just tested with
> > 
> >  Org mode version 9.5.3 (release_9.5.3-504-gcdbb1c @
> > /home/heinrich/.emacs.d/straight/repos/org/lisp/)
> > 
> > using
> > 
> > GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo 
> > version 1.16.0) of
> > 2021-
> > 11-27, modified by Debian
> 
> 
> Many thanks for reporting back.  I updated to gcdbb1c and it is still working 
> fine.
> 
> My minimum working example is the following. From the org-mode root directory,
> 
> $ emacs -Q -L ./lisp -l org  -l ~/ess-barebone.el
> 
> where ~/ess-barebone.el is the following:
> 
> #+begin_src  elisp
> (add-to-list 'load-path "/home/djj/.emacs.d/elpa/ess-20220125.2207/")
> (require 'ess-r-mode)
> 
>  (org-babel-do-load-languages
>    'org-babel-load-languages
>    '((R . t)))
> 
> (setq org-confirm-babel-evaluate nil)
> #+end_src
> 
> Note that I'm still using a rather old ess version. Could you please try
> with the above configuration? Note that I am using a rather old ess
> version but the I haven't experienced issues with the newer one.
> 
> Best regards
> Jeremie
> 
> 
> > Hi Jeremie,
> > 
> > I just tested with
> > 
> >  Org mode version 9.5.3 (release_9.5.3-504-gcdbb1c @
> > /home/heinrich/.emacs.d/straight/repos/org/lisp/)
> > 
> > using
> > 
> > GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo 
> > version 1.16.0) of
> > 2021-
> > 11-27, modified by Debian
> > 
> > I am on Debian Testing and that is the default emacs version.
> > 
> > Using the unmodified org (git hash from above) I get the following messages 
> > when executing a src
> > block with R:
> > 
> >    executing R code block...
> >    Loading ‘ess-bugs-l’: unescaped character literals `?(', `?)' detected, 
> > `?\(', `?\)'
> > expected!
> >    Type C-h m for help on ESS version 15.09
> >    ess-tracebug mode enabled
> >    Quit
> >    Package cl is deprecated
> > 
> > Note that the "Quit" is me pressing Ctrl-g after a few seconds.
> > 
> > Removing the commit in question makes the block return instantaneously:
> > 
> >    executing R code block...
> >    Loading ‘ess-bugs-l’: unescaped character literals `?(', `?)' detected, 
> > `?\(', `?\)'
> > expected!
> >    Type C-h m for help on ESS version 15.09
> >    ess-tracebug mode enabled
> >    Code block evaluation complete.
> >    Package cl is deprecated
> > 
> > I anticipated that this would not be obvious, since this feature is used 
> > too much to go
> > unnoticed for
> > two years - but I am clueless as to how I should continue with debugging...
> > 
> > Thanks for your help!
> > Christian
> > 
> > On Sun, 2022-05-15 at 16:16 +0200, Jeremie Juste wrote:
> > > 
> > > Hello Christian,
> > > 
> > > Thanks for reporting but I cannot reproduce the bug with the org and
> > > emacs version below.
> > > 
> > > Org mode version 9.5.3 (release_9.5.3-467-g2bd34e @
> > > /home/djj/src/org-mode/lisp/)
> > > GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24) of
> > > 2022-01-16
> > > 
> > > Can you please let me know which version of org-mode you are actually
> > > using?
> > > 
> > > Ihor, many thanks for checking.
> > > 
> > > Best regards,
> > > Jeremie
> > > 
> > > On Sunday, 15 May 2022 at 16:08, Ihor Radchenko wrote:
> > > > Christian Heinrich  writes:
> > > > 
> > > > > I got back to an org file after upgrading to the latest release of 
> > > > > org-mode and tried
> > > > > executing the
> > > > > contained R source blocks. Unfortunately, emacs got stuck in the 
> > > > > execution and was
> > > > > blocked; I
> > > > > had to
> > > > > exit using C-g.
> > > > > 
> > > > > Here's a minimal example src block that causes emacs to get stuck:
> > > > > 
> > > > > #+begin_src R :results output :session *R* :exports both
> > > > >   a <- 10
> > > > >   a
> > > > > #+end_src
> > > > > 
> > > > > R itself does start and the code is also executed correctly. However, 
> > > > > the output from that
> > > > > session
> > > > > is apparently not returned to emacs or the buffer.
> > > > 
> > > > I tried you example using Emacs >=26 and it works just fine.
> > > > 
> > > > Best,
> > > > Ihor
> 


signature.asc
Description: This is a digitally signed message part


Re: Bug: ob-R.el breaks when :session is specified

2022-05-15 Thread Christian Heinrich
Hi Jeremie,

I just tested with

 Org mode version 9.5.3 (release_9.5.3-504-gcdbb1c @
/home/heinrich/.emacs.d/straight/repos/org/lisp/)

using

GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo 
version 1.16.0) of 2021-
11-27, modified by Debian

I am on Debian Testing and that is the default emacs version.

Using the unmodified org (git hash from above) I get the following messages 
when executing a src
block with R:

   executing R code block...
   Loading ‘ess-bugs-l’: unescaped character literals `?(', `?)' detected, 
`?\(', `?\)' expected!
   Type C-h m for help on ESS version 15.09
   ess-tracebug mode enabled
   Quit
   Package cl is deprecated
   
Note that the "Quit" is me pressing Ctrl-g after a few seconds.

Removing the commit in question makes the block return instantaneously:

   executing R code block...
   Loading ‘ess-bugs-l’: unescaped character literals `?(', `?)' detected, 
`?\(', `?\)' expected!
   Type C-h m for help on ESS version 15.09
   ess-tracebug mode enabled
   Code block evaluation complete.
   Package cl is deprecated
   
I anticipated that this would not be obvious, since this feature is used too 
much to go unnoticed for
two years - but I am clueless as to how I should continue with debugging...

Thanks for your help!
Christian

On Sun, 2022-05-15 at 16:16 +0200, Jeremie Juste wrote:
> 
> Hello Christian,
> 
> Thanks for reporting but I cannot reproduce the bug with the org and
> emacs version below.
> 
> Org mode version 9.5.3 (release_9.5.3-467-g2bd34e @
> /home/djj/src/org-mode/lisp/)
> GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24) of
> 2022-01-16
> 
> Can you please let me know which version of org-mode you are actually
> using?
> 
> Ihor, many thanks for checking.
> 
> Best regards,
> Jeremie
> 
> On Sunday, 15 May 2022 at 16:08, Ihor Radchenko wrote:
> > Christian Heinrich  writes:
> > 
> > > I got back to an org file after upgrading to the latest release of 
> > > org-mode and tried
> > > executing the
> > > contained R source blocks. Unfortunately, emacs got stuck in the 
> > > execution and was blocked; I
> > > had to
> > > exit using C-g.
> > > 
> > > Here's a minimal example src block that causes emacs to get stuck:
> > > 
> > > #+begin_src R :results output :session *R* :exports both
> > >   a <- 10
> > >   a
> > > #+end_src
> > > 
> > > R itself does start and the code is also executed correctly. However, the 
> > > output from that
> > > session
> > > is apparently not returned to emacs or the buffer.
> > 
> > I tried you example using Emacs >=26 and it works just fine.
> > 
> > Best,
> > Ihor


signature.asc
Description: This is a digitally signed message part


Re: Bug: ob-R.el breaks when :session is specified

2022-05-15 Thread Christian Heinrich
Hi,

thanks, that's what I had expected since that patch has been around for a long 
time.

I run 

 emacs -q --load /tmp/init.el --file=/tmp/test.org 

with my /tmp/init.el being only

> (require 'package)
> (package-initialize)
> (add-to-list 'load-path "~/.emacs.d/straight/repos/org/lisp/")
> (require 'org)
> 
> ;(require 'ess-site)
> (org-babel-do-load-languages
>'org-babel-load-languages
> '((R . t)))

I hope this constitutes a minimal example for a config - please correct me if 
I'm wrong.

My test.org contains the source block I had already posted:

#+begin_src R :results output :session *R* :exports both
  a <- 10
  a
#+end_src

Any ideas how I could continue to debug this? If I just remove that patch, 
everything works
flawlessly for me but I would like to figure out what causes the issues.

Thanks!

Christian


On Sun, 2022-05-15 at 16:08 +0800, Ihor Radchenko wrote:
> Christian Heinrich  writes:
> 
> > I got back to an org file after upgrading to the latest release of org-mode 
> > and tried executing
> > the
> > contained R source blocks. Unfortunately, emacs got stuck in the execution 
> > and was blocked; I
> > had to
> > exit using C-g.
> > 
> > Here's a minimal example src block that causes emacs to get stuck:
> > 
> > #+begin_src R :results output :session *R* :exports both
> >   a <- 10
> >   a
> > #+end_src
> > 
> > R itself does start and the code is also executed correctly. However, the 
> > output from that
> > session
> > is apparently not returned to emacs or the buffer.
> 
> I tried you example using Emacs >=26 and it works just fine.
> 
> Best,
> Ihor


signature.asc
Description: This is a digitally signed message part


Bug: ob-R.el breaks when :session is specified

2022-05-15 Thread Christian Heinrich
Hi there,

I got back to an org file after upgrading to the latest release of org-mode and 
tried executing the
contained R source blocks. Unfortunately, emacs got stuck in the execution and 
was blocked; I had to
exit using C-g.

Here's a minimal example src block that causes emacs to get stuck:

#+begin_src R :results output :session *R* :exports both
  a <- 10
  a
#+end_src

R itself does start and the code is also executed correctly. However, the 
output from that session
is apparently not returned to emacs or the buffer.

When removing the :session argument it executes and returns as expected.

When bisecting this issue, I found that this commit causes it:
ac8c009e006197d2dad226dbe822d450aec23d23

lisp/ob-R.el: Fix session output with substrings matching prompts

Reverting it fixes the issue for earlier release (9.5.3) as well as for the 
current main branch.

The (with-current-buffer session ... ) somehow seems to break it for me, but I 
am unsure why no one
else here seems to experience this as the commit is from 2020?

Any suggestions?

Thanks!
Christian


signature.asc
Description: This is a digitally signed message part


Re: LaTeX letters in Org

2022-02-20 Thread Christian Heinrich
FYI, there's also an article on using the scrlttr2 class from KOMA-script 
(mostly for
European/German usage I guess) for letters:

https://orgmode.org/worg/exporters/koma-letter-export.html

On Sat, 2022-01-29 at 12:39 -0500, William Denton wrote:
> I wrote up how to use Org to write letters with the LaTeX letter class. 
> Here's the link in case anyone's interested:
> 
> https://www.miskatonic.org/2022/01/28/latex-letters-in-org/
> 
> Cheers,
> 
> Bill
> 
> --
> William Denton
> https://www.miskatonic.org/
> Librarian, artist and licensed private investigator.
> Toronto, Canada
> 


signature.asc
Description: This is a digitally signed message part


Re: Smart processing of http(s) links

2020-06-29 Thread Christian Heinrich
I'm not sure if this is of interest to you, but I like org-cliplink to insert 
links with their
titles. Maybe you can look at their source to build your own if it doesn't work 
for you?

On Sun, 2020-06-28 at 13:43 -0700, Ag Ibragimov wrote:
> I want to make something like this:
> 
> Whenever I I use org-insert-link and it turns out to be a URI that starts 
> with "https://github.com
> " I would like it to be processed differently than any other link, one 
> example - if it is a PR or
> a Github Issue, I'd like it to fetch summary(title) of it and create a link 
> that looks like this:
> 
> [[https://github.com/user/repo/issues/3899][This issue needs to be fixed 
> #3899]]
> 
> Do we have any "built-in" mechanism for doing something like this? Can 
> someone suggest how I can
> make it. Thank you!
> 


signature.asc
Description: This is a digitally signed message part


Re: [patch suggestion] Mitigating the poor Emacs performance on huge org files: Do not use overlays for PROPERTY and LOGBOOK drawers

2020-05-07 Thread Christian Heinrich
Hi,

thanks for your (initial) patch! I traced another error down today and found 
your code by chance. I
tested it on an org-drill file that I had (with over 3500 items and hence 3500 
drawers) and this
patch helps *a lot* already. (Performance broke in 
4403d4685e19fb99ba9bfec2bd4ff6781c66981f when
outline-flag-region was replaced with org-flag-region, as drawers are no longer 
opened using
outline-show-all which I had to use anyways to deal with my huge file.)

I am not sure I understand how your follow-up code (below) needs to be 
incorporated. Would you mind
sending a patch file? I hope that this ends up in the master branch at some 
point.

Thanks again!
Christian

On Mon, 2020-04-27 at 00:04 +0800, Ihor Radchenko wrote:
> > You cannot. You may however mimic it with `cursor-sensor-functions' text
> > property. These assume Cursor Sensor minor mode is active, tho.
> > I haven't tested it, but I assume it would slow down text properties
> > a bit, too, but hopefully not as much as overlays.
> 
> Unfortunately, isearch sets inhibit-point-motion-hooks to non-nil
> internally. Anyway, I came up with some workaround, which seems to work
> (see below). Though it would be better if isearch supported hidden text
> in addition to overlays.
> 
> > Missing `isearch-open-invisible' is a deal breaker, IMO. It may be worth
> > experimenting with `cursor-sensor-functions'.
> 
> So far, I came up with the following partial solution searching and
> showing hidden text.
> 
> ;; Unfortunately isearch, sets inhibit-point-motion-hooks and we
> ;; cannot even use cursor-sensor-functions as a workaround
> ;; I used a less ideas approach with advice to isearch-search-string as
> ;; a workaround 
> 
> (defun org-find-text-property-region (pos prop)
>   "Find a region containing PROP text property around point POS."
>   (require 'org-macs) ;; org-with-point-at
>   (org-with-point-at pos
> (let* ((beg (and (get-text-property pos prop) pos))
>  (end beg))
>   (when beg
>   (setq beg (or (previous-single-property-change pos prop)
> beg))
>   (setq end (or (next-single-property-change pos prop)
> end))
> (unless (equal beg end)
>   (cons beg end))
> 
> ;; :FIXME: re-hide properties when point moves away
> (define-advice isearch-search-string (:after ( _) put-overlay)
>   "Reveal hidden text at point."
>   (when-let ((region (org-find-text-property-region (point) 'invisible)))
> (with-silent-modifications
>   (put-text-property (car region) (cdr region) 'org-invisible 
> (get-text-property (point)
> 'invisible)))
>   (remove-text-properties (car region) (cdr region) '(invisible nil
> 
> ;; this seems to be unstable, but I cannot figure out why
> (defun org-restore-invisibility-specs ( _)
>   ""
>(let ((pos (point-min)))
>  (while (< (setq pos (next-single-property-change pos 'org-invisible nil 
> (point-max))) (point-
> max))
>(when-let ((region (org-find-text-property-region pos 'org-invisible)))
>  (with-silent-modifications
>(put-text-property (car region) (cdr region) 'invisible 
> (get-text-property pos 'org-
> invisible))
>(remove-text-properties (car region) (cdr region) '(org-invisible 
> nil)))
> 
> (add-hook 'post-command-hook #'org-restore-invisibility-specs)
> 
> (defun org-flag-region (from to flag spec)
>   "Hide or show lines from FROM to TO, according to FLAG.
> SPEC is the invisibility spec, as a symbol."
>   (pcase spec
> ('outline
>  (remove-overlays from to 'invisible spec)
>  ;; Use `front-advance' since text right before to the beginning of
>  ;; the overlay belongs to the visible line than to the contents.
>  (when flag
>(let ((o (make-overlay from to nil 'front-advance)))
>(overlay-put o 'evaporate t)
>(overlay-put o 'invisible spec)
>(overlay-put o 'isearch-open-invisible #'delete-overlay
> (_
>  (with-silent-modifications
>(remove-text-properties from to '(invisible nil))
>(when flag
>(put-text-property from to 'invisible spec)
>)
> 
> ;; This normally deletes invisible text property. We do not want this now.
> (defun org-unfontify-region (beg end  _maybe_loudly)
>   "Remove fontification and activation overlays from links."
>   (font-lock-default-unfontify-region beg end)
>   (let* ((buffer-undo-list t)
>(inhibit-read-only t) (inhibit-point-motion-hooks t)
>(inhibit-modification-hooks t)
>deactivate-mark buffer-file-name buffer-file-truename)
> (decompose-region beg end)
> (remove-text-properties beg end
>   '(mouse-face t keymap t org-linked-text t
>;; Do not remove invisible during 
> fontification
>
>;; invisible t
>  intangible t
>   

Possible bug in subtree matching with empty title + tags

2020-05-02 Thread Christian Heinrich
Hi,

I'm often using empty header titles that only contain tags, such as

> **:foo:

In my case, this is sufficient (for instance for flashcards, where I never have 
to actually have to
use the agenda etc.). However, since Nicolas's refactoring in
be31a0c4595a6d68b03b5cfbcbcdbf2cd76d2b7f empty titles seem to be prohibited. In 
the above example,
using subtrees (C-/ m) on the "foo" tag will return nothing, even though the 
tag is in the file. Is
this a deliberate change? I didn't see a note in the manual saying that 
headings must not be empty
(this might be useful then).

Thanks for your help guys!

Cheers
Christian


signature.asc
Description: This is a digitally signed message part


Re: [O] org-drill extremely slow with Org 9.2.5

2019-09-15 Thread Christian Heinrich
Hi,

are all your headlines folded? I found that running "M-x outline-show-all" 
before the first org-
drill call resolves this issue for me with org 9.2 (but not with 9.3).

See also my analysis 
https://bitbucket.org/eeeickythump/org-drill/issues/48/slow-startup

Are you aware of the new org-drill releases by Philipp Lord? 
https://gitlab.com/phillord/org-drill

Cheers
Christian

On Sun, 2019-08-25 at 20:10 +0200, Milan Zamazal wrote:
> Hi, after upgrading from Org 9.1 to 9.2, org-drill has become extremely
> slow.  org-drill has never been fast, but now it stops being usable.
> Everything takes much more time than before -- running `M-x org-drill',
> both for the first time and again, responding to drill queries, moving
> over my Org file.
> 
> My org-drill Org file has over 4,000 entries and almost 50,000 lines.
> With Org 9.1, it used to be usable after running `M-x org-drill' for the
> first time in the given Emacs session; after the initial Org processing,
> I could move over the entries relatively smoothly.  But this no longer
> helps and org-drill itself is much slower too.
> 
> Is Org 9.2 no longer capable to handle (relatively) large files with a
> lot of Org properties?  Are there any tricks to speed it up?
> 
> Thanks for any advice,
> Milan
> 
> 


signature.asc
Description: This is a digitally signed message part


[O] Problems with inline source blocks

2019-05-27 Thread Christian Heinrich
Hi everyone,

several issues with inline source blocks:

1) https://orgmode.org/manual/Exporting-code-blocks.html states:

> The :exports header arguments control exporting code blocks only and
> not inline code:

but 
https://orgmode.org/manual/Using-Header-Arguments.html#Using-Header-Arguments 
gives as example:

> src_haskell[:exports both]{fac 5}

Which one is true?

2) I cannot get the results of inline blocks to be exported.

When I have a file that contains:

> Test: src_R[:exports results]{4*4} {{{results(=16=)}}}

then the code is always exported but the results are only exported up to
623cc4625950f84442d4cde0faa9cc3ea0233283

but starting from 65ebb128bc380fe4795dedd655d6f7b685249842
the results macro is ignored and the result never appears.

Looking at online documentation (other projects) like 
https://org-babel.readthedocs.io/en/latest/eval/#inline-code-blocks I realize 
that this may be a
problem in general (look at the Example sections, such as "The answer to 2 + 3 
is .")


3) The source block never gets evaluated. I tried 
src_sh{touch /tmp/test21.txt}

but this file doesn't get created, only when I execute it directly.

Can anyone point out what I'm doing wrong, or is this actually a bug? I can't 
even get a basic
source block like

#+begin_src R :results output :session *R* :exports none
5*5
#+end_src

to ignore the code when exporting (but it's not evaluated).


Thanks!
Christian


signature.asc
Description: This is a digitally signed message part


[O] Remove documentation for deleted function org-mark-entry-for-agenda-action

2019-05-07 Thread Christian Heinrich
Hi,

FYI: the documentation still talks about org-mark-entry-for-agenda-action even 
though this function
was removed in f95e5ff. 

Best regards
Christian




[O] ox-latex: Export ignores org-latex-classes from 4th level on

2016-11-06 Thread Christian Heinrich
Hello,

the ox-latex file uses org-latex-classes to help, among other things,
with exporting headlines to the right commands, such as \section,
\subsection etc.

Unfortunately, not all headlines get exported correctly; the default
"article" class, as defined in ox-latex.el (see org-latex-classes
there), does for instance not use  "\paragraph" or "\subparagraph".

Here is an example file:


#+LATEX_CLASS: article

* First
** Second
*** Third
 Fourth
* Fifth
** Sixth
*** Seventh
This is the final text.


When I export, I get something like this:

[...]
\subsubsection{Third}
\label{sec:orgafa785d}
\begin{enumerate}
\item Fourth
[...]

However, it should use "\paragraph{Fourth}" instead, and not a list
with \item.

It seems there is something going on with the deep subtrees, starting
at line 1929 in ox-latex.el; (for the first 3 levels, line 1893 gets
called, too).

Can anyone see whats going on here? I'm currently on master. I tried
older versions, but this bug must have been there since 7.8 (I couldn't
compile many older versions any more or I couldn't export).

Thanks
Christian

PS: I couldn't find any news about the renaming (?) of org-export-
latex-classes to org-latex-classes. There is still quite a bit of
documentation out there, such as http://orgmode.org/tmp/worg/org-tutori
als/org-latex-export.html that refers to the former but doesn't work.
Is this intended?

signature.asc
Description: This is a digitally signed message part


[O] :exports ignored when org-export-babel-evaluate is nil

2016-07-03 Thread Christian Heinrich
Hello,

I built org-mode from the master branch. I set org-export-babel-
evaluate to nil in my init.el as my org-files contain lots of src-
blocks that take ages to execute.

I realized that since commit ec615b192d703a0201ceefd46897e4636ff00a38,
the export behavior has changed. Since then, the ":exports" seems to
get ignored if said variable is set to nil and always exports the code
as well, even when ":exports" is set to "results". If org-export-babel-
evaluate is set to true, everything works fine.

Is this a bug or is there a new way to prevent org-mode from executing
my blocks before the export?

On a side note: This is also true for inline source blocks. I couldn't
really find anything in etc/ORG-NEWS about this, but I might just not
look in the right place.

I think that I read somewhere that inline source blocks can now export
the code as well. This doesn't work for me, too.

Thanks
Christian





signature.asc
Description: This is a digitally signed message part