Re: Introducing Org-transclusion

2021-11-01 Thread Noboru Ota
Ihor Radchenko  writes:
>
> Welcome ;)
>

Thank you.

> You have my +100500 to have this package as part of Org :D

Thank you again :) Is there anything I can/should do to make this
happen?  I would be happy to email the whole package as a "patch" for
code review, if this were the way but I feel that might clutter this
mailing list too much with a large amount of text (?)


> The package may allow several interesting things in Org:
>
> 1.  An alternative way to structure headings
> Currently, we have a rigid headline structures in Org and
> alternative tag-based approaches like Org Roam. Headline
> transclusion will allow same subtree under several headings (aka
> file system symlinks).

Org-transclusion will be probably of help here. I didn't think it in
this frame (like symlinks) but it has the :level property to control the
heading level of the transclusion, which can be different to the original.


> 2. A much faster tangle system. If we can directly transclude and sync
>contents of source blocks with actual programming language buffer,
>C-c ' can trivially support flycheck-mode and provide a more
>IDE-like experience while still benefiting from literate programming
>style.

It has ":src lang" property and can transclude a specific range of
source code into Org's source block. It is essentially read-only copy of
the original, and you can use "C-c C-c" as a normal Org source block to
execute/evaluate it.

For flycheck-mode, I am not sure; I don't use it (I use built-in
flymake).  It may be an interesting experiment for me, too.  One thing
is that transcluded source blocks are read-only.  I think it will
require a bit of work to get the correction to work on both the
transclusion and source buffers.


> 3. Visible #+INCLUDE directives. I recall multiple requests to be able
>to see the INCLUDEd files right inside source Org buffer.

There is a parallel between #+INCLUDE and #+TRANSCLUDE.  Transclusions
are read-only copy so they can be exported.  I think in many cases they
can work as "visible #+INCLUDE".

But #+TRANSCLUDE does not support all the features #+INCLUDE
support. For example, noweb to include yet another block of text has
been reported to output an error.


> 4. Dynamic Org files like agenda views, but made of transcluded
>headlines. Such files can be kept in Org mode with all its features.

Maybe... I don't use Org-agenda, so it didn't occur to me to test this
use case.  


> Transculation has been requested many times by different users. Some
> relevant links:
> - 
> https://emacs.stackexchange.com/questions/51814/embed-org-task-list-from-other-subtree
> - 
> https://www.reddit.com/r/emacs/comments/dz5xeb/is_there_a_way_to_include_an_org_file_in_another/
> - 
> https://www.reddit.com/r/emacs/comments/flxqei/cloningmirroring_a_region_to_some_other_location/fl22ele/
> - https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg00141.html
> - 
> https://emacs.stackexchange.com/questions/57608/split-code-across-multiple-src-blocks
> - https://lists.gnu.org/archive/html/help-gnu-emacs/2020-06/msg00151.html
> - 
> https://reddit.com/r/emacs/comments/debean/possible_to_embed_another_org_file_or_entry_in_an/]]

Org-transclusion might provide some steps forward for some of the
desired functionality discussed in these threads.  Especially for the
"cloning" a body of text across multiple buffers, I have factored out
this part and created a stand-alone library called "Text-clone".  It is
available in the same repository at
https://github.com/nobiot/org-transclusion/blob/main/docs/text-clone.md.

This separation was born out of a suggestion by alphapapa on Reddit.

I feel that Text-clone can be taken further than the use in
Org-transclusion (I feel that Org-transclusion is only one use case for
Text-clone).


> Other attempted implementations:
> - https://github.com/legalnonsense/org-clones
> - https://github.com/magnars/multifiles.el
> - https://github.com/vspinu/lentic
> - https://github.com/whacked/transclusion-minor-mode

Yes, I have looked at some of them and also this question from John
Kitchen, recorded by alphapapa: 
(https://github.com/alphapapa/transclusion-in-emacs#org-mode).

I also looked at https://github.com/gregdetre/emacs-freex. 

Org-clones have given me some inspirations.  Multifiles looked to be too
complicated for me to understand and abandoned for a long time. I was
not aware of Lentic.  I dismissed Transclusion-minor-mode because it
requires a server.

Org-transclusion is rather simple. It only requires Emacs 27.1 and Org 9.4.

> Best,
> Ihor



Re: Introducing Org-transclusion

2021-11-01 Thread Noboru Ota
Juan Manuel Macías  writes:

> I installed your package a few months ago and I have to say that it
> works quite well, although I have not had, at the moment, the
> opportunity to make intensive use of it. What I can say is that the
> concept seems very interesting to me. Very nice package.

Thank you for your kind words. 



Re: send agenda-weekly-view via email html formated

2021-11-01 Thread Uwe Brauer
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer  writes:
>> Thanks, works very nicely, I only will send it inline, because then it is 
>> nicely displayed in HTML enabled MTA.

> ---(mml-attach-file (file-name-concat 
> (temporary-file-directory)"agenda.html")
> +++(mml-attach-file (file-name-concat 
> (temporary-file-directory)"agenda.html") nil nil "inline"

Right, maybe such a function should be included in org?

Uwe 


smime.p7s
Description: S/MIME cryptographic signature


Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist [9.5 (9.5-gd4e192 @ c:/Users/scott/.emacs.d/straight/build/org/)]

2021-11-01 Thread Ihor Radchenko
Scott Otterson  writes:

> Apparently, org version 9.5 expects the directory "~/.cache" to exist, and
> if it doesn't, it terminates with an error.  I'd suggest that org mode
> makes this directory if it needs it.

Thanks for reporting! Fixed in 6621ee32e.

Best,
Ihor



Re: [BUG] after update to 9.5, starting org mode results in cache error messages [9.5 (9.5-gd4e192 @ c:/Users/scott/.emacs.d/straight/build/org/)]

2021-11-01 Thread Ihor Radchenko
Greg Coladonato  writes:

> I get a similar error to Scott's every time I save an org-mode file. I
> turned on backtrace and got this output:

Thanks for reporting and providing the detailed backtrace!
Backtrace is really strange because cache is clearly updated upon
changing the file, but somehow somewhere a stale element is still
returned.

Given that you are using org-roam, the only suspect that may create
stale copies of cached elements is org-element-parse-buffer. The
attached patch is making sure that org-element-parse-buffer never tries
to reuse cache. Can you try the patch and see if it helps?

Best,
Ihor

>From cc2b4081796ed3caeb193b45588bfb9fd3d77625 Mon Sep 17 00:00:00 2001
Message-Id: 
From: Ihor Radchenko 
Date: Mon, 1 Nov 2021 20:38:11 +0800
Subject: [PATCH] org-element--current-element: Do not use cache

---
 lisp/org-element.el | 342 
 1 file changed, 157 insertions(+), 185 deletions(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index 9fa6fd5e2..caa714f34 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -4106,7 +4106,7 @@ ;;; Parsing Element Starting At Point
 ;; point.
 
 (defvar org-element--cache-sync-requests); Declared later
-(defun org-element--current-element (limit &optional granularity mode structure add-to-cache)
+(defun org-element--current-element (limit &optional granularity mode structure)
   "Parse the element starting at point.
 
 Return value is a list like (TYPE PROPS) where TYPE is the type
@@ -4138,190 +4138,162 @@ (defun org-element--current-element (limit &optional granularity mode structure
 
 This function assumes point is always at the beginning of the
 element it has to parse."
-  (let* ((element (and (not (buffer-narrowed-p))
-   (org-element--cache-active-p)
-   (not org-element--cache-sync-requests)
-   (org-element--cache-find (point) t)))
- (element (progn (while (and element
- (not (and (eq (point) (org-element-property :begin element))
- (eq mode (org-element-property :mode element)
-   (setq element (org-element-property :parent element)))
- element))
- (old-element element)
- (element (when
-  (pcase (org-element-property :granularity element)
-(`nil t)
-(`object t)
-(`element (not (memq granularity '(nil object
-(`greater-element (not (memq granularity '(nil object element
-(`headline (eq granularity 'headline)))
-element)))
-(if element
-element
-  (save-excursion
-(let ((case-fold-search t)
-	  ;; Determine if parsing depth allows for secondary strings
-	  ;; parsing.  It only applies to elements referenced in
-	  ;; `org-element-secondary-value-alist'.
-	  (raw-secondary-p (and granularity (not (eq granularity 'object
-  result)
-  (setq
-   result
-   (cond
-;; Item.
-((eq mode 'item)
-	 (org-element-item-parser limit structure raw-secondary-p))
-;; Table Row.
-((eq mode 'table-row) (org-element-table-row-parser limit))
-;; Node Property.
-((eq mode 'node-property) (org-element-node-property-parser limit))
-;; Headline.
-((org-with-limited-levels (org-at-heading-p))
- (org-element-headline-parser limit raw-secondary-p))
-;; Sections (must be checked after headline).
-((eq mode 'section) (org-element-section-parser limit))
-((eq mode 'first-section)
-	 (org-element-section-parser
-	  (or (save-excursion (org-with-limited-levels (outline-next-heading)))
-	  limit)))
-;; Comments.
-((looking-at "^[ \t]*#\\(?: \\|$\\)")
-	 (org-element-comment-parser limit))
-;; Planning.
-((and (eq mode 'planning)
-	  (eq ?* (char-after (line-beginning-position 0)))
-	  (looking-at org-planning-line-re))
-	 (org-element-planning-parser limit))
-;; Property drawer.
-((and (pcase mode
-	(`planning (eq ?* (char-after (line-beginning-position 0
-	((or `property-drawer `top-comment)
-		 (save-excursion
-		   (beginning-of-line 0)
-		   (not (looking-at "[[:blank:]]*$"
-	(_ nil))
-	  (looking-at org-property-drawer-re))
-	 (org-element-property-drawer-parser limit))
-;; When not at bol, point is at the beginning of an item or
-;; a footnote definition: next item is always a paragraph.
-((not (bolp)) (org-element-paragraph-parser limit (list (point
-;; Clock.
-((looking

Re: [BUG] Unregistered buffer modifications detected [9.5 (9.5-g49e2f6 @ /Users/myuser/.emacs.d/straight/29/straight/build/org/)]

2021-11-01 Thread Ihor Radchenko
Aaron Jensen  writes:

> On Sat, Oct 30, 2021 at 11:16 PM Aaron Jensen  wrote:
>>
>> Done, I'll report back.
>
> Another one, no trace:
>
> Warning (emacs): Emacs reader failed to read data for # config.org>:org-element--cache. The error was: "Invalid read syntax:
> \"#\", 1, 4670" Disable showing Disable logging

Thanks! I have seen this one. Now can confirm that it is not just on my
system. This warning indicates a likely bug in Emacs read/write. I
disabled this warning on latest main to not irritate users.

Best,
Ihor



Re: send agenda-weekly-view via email html formated

2021-11-01 Thread Ihor Radchenko
Uwe Brauer  writes:

> Right, maybe such a function should be included in org?

If there is sufficient interest and someone prepares a patch, why not?
But, no other people are participating in this thread for now.



Re: Introducing Org-transclusion

2021-11-01 Thread Ihor Radchenko
Noboru Ota  writes:

>> You have my +100500 to have this package as part of Org :D
>
> Thank you again :) Is there anything I can/should do to make this
> happen?  I would be happy to email the whole package as a "patch" for
> code review, if this were the way but I feel that might clutter this
> mailing list too much with a large amount of text (?)

Attached patches is the workflow in this mailing list. Do not worry
about cluttering. Clutter is meaningless text, not a patch. We have
recommendations about submitting new patches at
https://orgmode.org/worg/org-contribute.html

Once you submit _something_, core maintainers will be more inclined to
jump in and provide their opinion on including the new feature.

>> 2. A much faster tangle system. If we can directly transclude and sync
>>contents of source blocks with actual programming language buffer,
>>C-c ' can trivially support flycheck-mode and provide a more
>>IDE-like experience while still benefiting from literate programming
>>style.
>
> It has ":src lang" property and can transclude a specific range of
> source code into Org's source block. It is essentially read-only copy of
> the original, and you can use "C-c C-c" as a normal Org source block to
> execute/evaluate it.

I actually had something slightly different in mind. If we have a way to
copy and sync text between different places, we can as well compile all
the related source blocks into a temporary buffer in the correct
prog-mode. Then, C-c ' can simply jump to that buffer with all the code
from different source blocks bundled together. Changes in the temporary
buffer can then be synced on exit.

> For flycheck-mode, I am not sure; I don't use it (I use built-in
> flymake).  It may be an interesting experiment for me, too.  One thing
> is that transcluded source blocks are read-only.  I think it will
> require a bit of work to get the correction to work on both the
> transclusion and source buffers.

Can be flymake as well. The problem with current implementation of
source blocks is that only the code from individual source block is
visible for flymake. Imagine the following

#+begin_src emacs-lisp
(progn
 (message "A")
#+end_src

#+begin_src emacs-lisp
 (message "B"))
#+end_src

If you open the top source block with C-c ', flymake will report errors
because of unmatched parenthesis. The errors will be correct from
flymake's perspective because all flymake will see is text in the first
source block. However, the code is correct when you tangle the file.

If we can have a single buffer with all the source blocks, C-c ' can
simply jump to that buffer and narrow to region representing the current
source block. flymake will behave correctly because all the code will be
present in the buffer. Moreover, the user may widen the buffer
conveniently see all the code together. Tangling will be mostly a
question of simply saving the temporary buffer.

Trnasclusion is required to correctly keep the temporary code buffer and
actual Org file in sync.

Of course, things like noweb will be tricky. You may need something
similar to bi-directional text transformation like implemented in
lentic, when changes in text are not simply mirrored, but the text is
also transformed when syncing transcluded regions. You implemented
something similar in the :level parameter.

> Org-transclusion might provide some steps forward for some of the
> desired functionality discussed in these threads.  Especially for the
> "cloning" a body of text across multiple buffers, I have factored out
> this part and created a stand-alone library called "Text-clone".  It is
> available in the same repository at
> https://github.com/nobiot/org-transclusion/blob/main/docs/text-clone.md.

I noticed that you are using overlays in text-clone. It may potentially
cause slowdown in large Org buffers. Of course, it does not mean that
org-transclusion should not be accepted. Just something that may be
optimised.

Best,
Ihor



Re: Installation on offline machines

2021-11-01 Thread Edmund Christian Herenz
On Sun, Oct 31, 2021 at 07:39:37PM +, autofrettage wrote:
> you could try using the Emacs package elpa-mirror.

Thanks - this seems exactly what I need - if the idea of distributing
emacs extensions as tar files is completely abandoned.  I also see
reasons why going this route to deploy extensions is a good idea - and
the elpa-mirror package helps out for the "niche" of users who need to
deploy the extensions on machines that do not have access to the
internet.

Auctex also started recommending the install via elpa, but they still
offer the "traditional method" (at least on *nix).  

Best,
Chrsitian

-- 

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




Re: Installation on offline machines

2021-11-01 Thread autofrettage
> /.../ the elpa-mirror package helps out for the "niche" of
> users who need to deploy the extensions on machines that do
> not have access to the internet.

I found out about and used elpa-mirror when I worked in
Windows Subsystem for Linux (WSL). Its connection with the net
was somewhat mysterious to me, and elpa-mirror was the answer.
WSL may have improved since then.

Yours
Rasmus



Re: send agenda-weekly-view via email html formated

2021-11-01 Thread Uwe Brauer
>>> "IR" == Ihor Radchenko  writes:

> Uwe Brauer  writes:
>> Right, maybe such a function should be included in org?

> If there is sufficient interest and someone prepares a patch, why not?
I think even I am able to provide a patch

> But, no other people are participating in this thread for now.

That is very true, so better wait.


smime.p7s
Description: S/MIME cryptographic signature


Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-01 Thread Max Nikulin

On 01/11/2021 18:29, Ihor Radchenko wrote:

Scott Otterson writes:


Apparently, org version 9.5 expects the directory "~/.cache" to exist, and
if it doesn't, it terminates with an error.  I'd suggest that org mode
makes this directory if it needs it.


Thanks for reporting! Fixed in 6621ee32e.


Ihor, your fix affects linux as well. .cache directory may be missed in 
fresh accounts. E.g. I just have created a new test container (my old 
one has emacs-25):


emacs --batch -L org-mode/lisp/ -l org-persist  --eval '(message 
"%s\n%s" org-persist-directory (org-version nil t))'


Loading /etc/emacs/site-start.d/00debian.el (source)...
/home/ubuntu/.emacs.d/org-persist/
Org mode version 9.5 (release_9.5-194-g7a6f48 @ /home/ubuntu/org-mode/lisp/)

P.S. ~/.cache directory should not be world-readable, so likely it is 
required to change umask or to explicitly specify permissions while 
creating it.





Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-01 Thread Ihor Radchenko
Max Nikulin  writes:

> Ihor, your fix affects linux as well. .cache directory may be missed in 
> fresh accounts. E.g. I just have created a new test container (my old 
> one has emacs-25):

You are right. Though creating .cache dir is probably a job for xdg.el,
not Org. XDG spec prescribes specific permissions for the XDG
directories. I would prefer to send a bug report/feature request to
Emacs core rather than fixing this scenario on Emacs side.

Best,
Ihor



Re: [BUG] Org V 9.5 error when ~/.cache doesn't exist

2021-11-01 Thread Ihor Radchenko


> Emacs core rather than fixing this scenario on Emacs side.
*Org side



[BUG] org-cite-insert ignores JSON entries with editors only [9.5 (9.5-g0a86ad @ /home/rasmus/.emacs.d/elpa/org-9.5/)]

2021-11-01 Thread autofrettage
Hi,

I recently used oc-basic and oc-csl but ran into a slight problem when I tried 
to cite

"97 Things Every Programmer Should Know — Collective Wisdom from the Experts", 
1st ed.; Henney, K., Ed.; O’Reilly Media, Inc., 2010.

...with the command org-cite-insert. Typing "Henney" produced no suggestions.

After editing the JSON file from Zotero manually, making Henney an author 
instead of an editor, everything worked as expected.

As you may guess, the book is a collection of expert tips from many different 
programmers, and Kevlin Henney is "just" the editor.

The same happened for some other sources having editors, but no authors.

Yours
Rasmus
Emacs  : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, 
cairo version 1.16.0)
 of 2021-01-18, modified by Debian
Package: Org mode version 9.5 (9.5-g0a86ad @ 
/home/schoon/.emacs.d/elpa/org-9.5/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer 
org-src-mode-configure-edit-buffer)
 org-link-shell-confirm-function 'yes-or-no-p
 org-num-format-function 'org-num-default-format
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-download-annotate-function 'org-download-annotate-default
 org-modules '(ol-bibtex ol-docview ol-eww ol-info org-tempo)
 org-plantuml-jar-path "/usr/share/plantuml/plantuml.jar"
 org-calc-default-modes '(calc-internal-prec 16 calc-float-format (float 16) 
calc-angle-mode
  deg calc-prefer-frac nil calc-symbolic-mode nil 
calc-date-format
  ( "-" MM "-" DD " " Www (" " hh ":" mm))
  calc-display-working-message t)
 org-mode-hook '(org-tempo-setup
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-show-all append local] 
5]
 #[0 "\300\301\302\303\304$\207"
   [add-hook change-major-mode-hook org-babel-show-result-all 
append local] 5]
 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-download-file-format-function 'org-download-file-format-default
 org-footnote-section nil
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
 org-adapt-indentation t
 org-babel-pre-tangle-hook '(save-buffer)
 org-file-apps '((auto-mode . emacs) ("\\.mm\\'" . default) ("\\.x?html?\\'" . 
system)
 ("\\.pdf\\'" . "/usr/bin/evince %s"))
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe 
org-babel-header-arg-expand)
 org-babel-load-languages '((emacs-lisp . t) (python . t) (gnuplot . t) 
(asymptote . t)
(plantuml . t) (shell . t) (dot . t) (ditaa . t))
 org-export-backends '(ascii beamer html latex md odt)
 org-babel-python-command "python3"
 org-agenda-loop-over-headlines-in-active-region nil
 org-src-lang-modes '(("ocaml" . tuareg) ("elisp" . emacs-lisp) ("ditaa" . 
artist)
  ("asymptote" . asy) ("dot" . fundamental) ("sqlite" . sql)
  ("calc" . fundamental) ("C" . c) ("cpp" . c++) ("C++" . 
c++)
  ("screen" . shell-script) ("shell" . sh) ("bash" . sh)
  ("plantuml" . plantuml))
 org-cite-export-processors '((latex biblatex nil nil) (t basic nil nil))
 org-occur-hook '(org-first-headline-recenter)
 org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar"
 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-footnote-define-inline t
 org-babel-tangle-lang-exts '(("asymptote" . "asy") ("python" . "py") 
("emacs-lisp" . "el")
  ("elisp" . "el"))
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("info" :follow org-info-open :export org-info-export 
:store
org-info-store-link)
   ("eww" :follow org-eww-open :store org-eww-store-link)
   ("docview" :follow org-docview-open :export 
org-docview-export :store
org-docview-store-link)
   ("bibtex" :follow org-bibtex-open :store 
org-bibtex-store-link)
   ("attachment" :follow org-attach-follow :complete
org-attach-complete-link)
   ("id" :follow org-id-open) ("file+sys") ("file+emacs")
   ("shell" :follow org-link--open-shell)
   ("news" :follow
#[514 "\301\300\302Q\"\207" ["news" browse-url ":"] 6
  "\n\n(fn URL ARG)"]
)

add automatically a counter to a header/TODO???

2021-11-01 Thread Uwe Brauer


Hi

I am using a poor man's issue system
the org file in question has header of the form.




** WAIT \eqref{eq:section5-blowup:1} is referred as an item not an equation!
   :PROPERTIES:
   :ID:   Issues
   :Date: <2021-11-01 lun>
   :STATUS:   [ ]
   :Is:   11
   :END:

I was wondering whether 

- I could automatically insert in the HEADER a counter like 
** WAIT 1: \eqref{eq:section5-blowup:1} is referred as an item not 
an equation
   - or in the drawer like this 

** WAIT \eqref{eq:section5-blowup:1} is referred as an item not an equation!
   :PROPERTIES:
   :ID:   Issues
   :Date: <2021-11-01 lun>
   :STATUS:   [ ]
   :Is:   automatically inserted
   :END:

Regards

Uwe Brauer 




Re: Re: Introducing Org-transclusion

2021-11-01 Thread Thomas Paulsen
Hi,

it isn't part of gnu emacs currently.






Re: add automatically a counter to a header/TODO???

2021-11-01 Thread Uwe Brauer
>>> "UB" == Uwe Brauer  writes:

> Hi

> I am using a poor man's issue system
> the org file in question has header of the form.




> ** WAIT \eqref{eq:section5-blowup:1} is referred as an item not an equation!
>:PROPERTIES:
>:ID:   Issues
>:Date: <2021-11-01 lun>
>:STATUS:   [ ]
>:Is:   11
>:END:

> I was wondering whether 

> - I could automatically insert in the HEADER a counter like 
> ** WAIT 1: \eqref{eq:section5-blowup:1} is referred as an item not 
> an equation
>- or in the drawer like this 

> ** WAIT \eqref{eq:section5-blowup:1} is referred as an item not an equation!
>:PROPERTIES:
>:ID:   Issues
>:Date: <2021-11-01 lun>
>:STATUS:   [ ]
>:Is:   automatically inserted
>:END:

I found an answer in
https://stackoverflow.com/questions/27937446/how-to-vote-for-a-heading-in-org-mode

Which works nicely although 

(add-to-list 'org-speed-commands-user '("+" . (plusone)))

Is no longer valid, so I bound that function just to another key.

One question remains: is there any way to take the counter down?

(defun plusone ()
  "Increase the VOTES property in an org-heading by one. Create
the property if needed."
  (interactive)
  (org-entry-put
   (point)
   "VOTES"
   (format "%s" (+ 1 (string-to-number
  (or
   (org-entry-get (point) "VOTES")
   "0"))


The genius in me, though 

   (format "%s" (- 1 (string-to-number

Would do that but it does not, strange, 


smime.p7s
Description: S/MIME cryptographic signature


Re: Re: Introducing Org-transclusion

2021-11-01 Thread Noboru Ota
"Thomas Paulsen"  writes:

> Hi,
>
> it isn't part of gnu emacs currently.

Yes, this is correct.  Org-transclusion is only available on GitHub at
the moment.  With the advice from Ihor and others, I am in the process
of sending the whole package as a patch to Org.



Re: Storing database credentials outside an org file

2021-11-01 Thread Mike Gauland

On 1/11/21 4:33 pm, Tim Cross wrote:

Mike Gauland  writes:


I often use an org file to record database queries, using sql source blocks.
I've been putting the database credentials in the file using header-args:sql
properties, but I'd prefer to have the credentials saved in a separate file for
security reasons.

Any ideas on how I could make this work?

It probably wouldn't be too hard to use the authinfo.gpg facility via
the auth-source library which is included in Emacs. In fact, I think
sql-mode might already have support for this built in.

Thanks for the suggestion. I didn't see it on worg, but in ob-sql.el I 
found support for ":dbconnection". I can set up an entry in 
sql-connection-alist, and give the name of the entry to the sql block 
via :dbconnection. Now, my password is safely out of the .org file. As a 
bonus, it is easier to maintain across different org files.







Re: [BUG] after update to 9.5, starting org mode results in cache error messages [9.5 (9.5-gd4e192 @ c:/Users/scott/.emacs.d/straight/build/org/)]

2021-11-01 Thread Greg Coladonato
On Mon, Nov 1, 2021 at 5:40 AM Ihor Radchenko  wrote:

> Thanks for reporting and providing the detailed backtrace!
> Backtrace is really strange because cache is clearly updated upon
> changing the file, but somehow somewhere a stale element is still
> returned.
>
> Given that you are using org-roam, the only suspect that may create
> stale copies of cached elements is org-element-parse-buffer. The
> attached patch is making sure that org-element-parse-buffer never tries
> to reuse cache. Can you try the patch and see if it helps?
>

Applying the patch doesn't seem to have completely fixed the issue.
Here's an error message I got after re-starting running the patch, below.

Before I go though, I thought it might be worth asking: how does one turn
off the cache? I'd like to see if that resolves not only this issue, but
also the
fact that saving this 700 line file takes 15 seconds now.

Thanks for your help,
Greg

--- error message below ---
Warning (emacs): org-element--cache: Cached element has wrong parent in
211002_monthly.org. Resetting.
If this warning appears regularly, please report it to Org mode mailing
list (M-x org-submit-bug-report).
The element is: "(headline (:raw-value \"Make sure Maia and I are on the
same page regarding -- getting everything out of the attic and garage
before Thursday!\" :begin 188 :end 315 :pre-blank 0 :contents-begin nil
:contents-end nil :robust-begin nil :robust-end nil :level 2 :priority nil
:tags nil :todo-keyword #(\"TODO\" 0 4 (face (org-todo org-todo
org-level-2) wrap-prefix #(\"*** \" 0 1 ... 1 4 ...) line-prefix #(\"*\" 0
1 ...) fontified t)) :todo-type todo :post-blank 0 :footnote-section-p nil
:archivedp nil :commentedp nil :post-affiliated 188 :title \"Make sure Maia
and I are on the same page regarding -- getting everything out of the attic
and garage before Thursday!\" :mode nil :granularity element :cached t
:parent (org-data (:begin 1 :contents-begin 1 :contents-end 93756 :end
93756 :robust-begin 44 :robust-end 93754 :post-blank 0 :post-affiliated 1
:path \"/Users/greg/org/roam-personal/211002_monthly.org\" :mode org-data
:ID \"211002_080654\" :CATEGORY \"211002_monthly\" :cached t
:org-element--cache-sync-key nil)) :org-element--cache-sync-key (29 .
188)))"
 The parent is: "(org-data (:begin 1 :contents-begin 1 :contents-end 93756
:end 93756 :robust-begin 44 :robust-end 93754 :post-blank 0
:post-affiliated 1 :path \"/Users/greg/org/roam-personal/211002_monthly.org\"
:mode org-data :ID \"211002_080654\" :CATEGORY \"211002_monthly\" :cached t
:org-element--cache-sync-key nil))"
 The real parent is: "(headline (:raw-value \"Monday\" :begin 112 :end 424
:pre-blank 0 :contents-begin 121 :contents-end 424 :robust-begin 123
:robust-end 422 :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 112 :title (#(\"Monday\" 0 6 (:parent
#0))) :mode nil :granularity nil))"


Re: [BUG] after update to 9.5, starting org mode results in cache error messages [9.5 (9.5-gd4e192 @ c:/Users/scott/.emacs.d/straight/build/org/)]

2021-11-01 Thread Ihor Radchenko
Greg Coladonato  writes:

> Applying the patch doesn't seem to have completely fixed the issue.
> Here's an error message I got after re-starting running the patch, below.

Thanks! Is org-element--cache-self-verify still set to 'backtrace? I am
not seeing any extra backtrace in the new warning.

> Before I go though, I thought it might be worth asking: how does one turn
> off the cache? I'd like to see if that resolves not only this issue, but
> also the
> fact that saving this 700 line file takes 15 seconds now.

You can disable cache by setting org-element-use-cache to nil.
However, it would be helpful if you run M-x profiler-start, save the
buffer, run M-x profiler-report, save the report buffer, and post the
report here.

Best,
Ihor



Re: [BUG] after update to 9.5, starting org mode results in cache error messages [9.5 (9.5-gd4e192 @ c:/Users/scott/.emacs.d/straight/build/org/)]

2021-11-01 Thread Greg Coladonato
On Mon, Nov 1, 2021 at 9:03 PM Ihor Radchenko  wrote:

> Greg Coladonato  writes:
>
> > Applying the patch doesn't seem to have completely fixed the issue.
> > Here's an error message I got after re-starting running the patch, below.
>
> Thanks! Is org-element--cache-self-verify still set to 'backtrace? I am
> not seeing any extra backtrace in the new warning.
>

Ahh, that setting was lost after one of my restarts. I've reset it in my
config
file and will report back next time the warning happens.


> > Before I go though, I thought it might be worth asking: how does one turn
> > off the cache? I'd like to see if that resolves not only this issue, but
> > also the
> > fact that saving this 700 line file takes 15 seconds now.
>
> You can disable cache by setting org-element-use-cache to nil.
> However, it would be helpful if you run M-x profiler-start, save the
> buffer, run M-x profiler-report, save the report buffer, and post the
> report here.
>

Here's the report:

[profiler-profile "24.3" cpu #s(hash-table size 325 test equal rehash-size
1.5 rehash-threshold 0.8125 data ([nil nil nil nil nil nil nil nil nil nil
nil nil nil nil nil nil] 277 [file-truename file-truename file-truename
file-truename "#" cl-some projectile-project-root
let doom-project-root or cond let +doom-dashboard--get-pwd let if
+doom-dashboard-update-pwd-h] 1 [doom-modeline-segment--buffer-encoding
eval redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil
nil nil nil nil nil] 1 [doom-modeline-segment--vcs eval format-mode-line
doom-modeline-format--main eval redisplay_internal\ \(C\ function\) nil nil
nil nil nil nil nil nil nil nil] 2 [org-insert-heading
org-insert-todo-heading funcall-interactively call-interactively
command-execute nil nil nil nil nil nil nil nil nil nil nil] 1
[replace-regexp-in-string org-trim let* save-excursion
org-element-headline-parser cond setq let save-excursion
org-element--current-element progn unwind-protect let* save-restriction
save-excursion save-excursion] 1 [setcar if org-element-put-property progn
if let* or org-element--cache-key org-element--cache-key-less-p not and
cond let* while let save-current-buffer] 1 [progn if progn if let and or if
if while let if let* org-element--cache-for-removal let if] 1 [let* progn
if progn if while let if let* org-element--cache-for-removal let if let
save-current-buffer org-element--cache-submit-request progn] 1
[run-with-idle-timer setq org-element--cache-set-timer progn if
save-current-buffer progn if org-element--cache-after-change
org-insert-todo-heading funcall-interactively call-interactively
command-execute nil nil nil] 1 [font-lock-fontify-region "#" run-hook-wrapped jit-lock--run-functions
jit-lock-fontify-now jit-lock-function redisplay_internal\ \(C\ function\)
nil nil nil nil nil nil nil nil nil] 2 [doom-modeline-format--main eval
redisplay_internal\ \(C\ function\) nil nil nil nil nil nil nil nil nil nil
nil nil nil] 2 [let* progn if org-element--cache-process-request while
catch let let if save-current-buffer progn if org-element--cache-sync apply
timer-event-handler nil] 1 [progn if let save-excursion
org-element--current-element setq if if while let let* save-restriction
save-excursion progn unwind-protect let] 1 [or and
org-element--cache-interrupt-p or if if if let* while let catch
org-element--cache-process-request while catch let let] 2 [and let let
while let let org-element--cache-shift-positions if if if let* while let
catch org-element--cache-process-request while] 2 [regexp-opt-group
regexp-opt-group regexp-opt-group regexp-opt sp--regexp-for-group apply
"#" mapconcat sp--strict-regexp-opt
sp--get-closing-regexp sp-insert-pair sp--post-self-insert-hook-handler
self-insert-command org-self-insert-command funcall-interactively
call-interactively] 1 [eval redisplay_internal\ \(C\ function\) nil nil nil
nil nil nil nil nil nil nil nil nil nil nil] 1 [and while save-excursion
let* cond org-element--object-lex setq and while let save-restriction
save-excursion org-element--parse-objects if org-element-put-property let]
20 [sp--do-action-p sp--all-pairs-to-insert sp--pair-to-insert
sp-escape-open-delimiter sp--post-self-insert-hook-handler
self-insert-command org-self-insert-command funcall-interactively
call-interactively command-execute nil nil nil nil nil nil] 1
[doom-modeline-segment--buffer-encoding eval format-mode-line
doom-modeline-format--main eval redisplay_internal\ \(C\ function\) nil nil
nil nil nil nil nil nil nil nil] 1 [timer--time-less-p timer--activate
timer-activate-when-idle run-with-idle-timer setq
org-element--cache-set-timer if let if save-current-buffer progn if
org-element--cache-sync progn if if] 1 [sp--looking-back sp--looking-back-p
sp-point-after-word-p sp--do-action-p sp--all-pairs-to-insert
sp--pair-to-insert sp-insert-pair sp--post-self-insert-hook-handler
self-insert-command org-self-insert-command funcall-interactively
call-interactively command-execute nil nil nil] 1 [basic-save-buffer
save-buffe

Re: Introducing Org-transclusion

2021-11-01 Thread Timothy
Hi Noboru,

> Org-transclusion is rather simple. It only requires Emacs 27.1 and Org 9.4.

It’s worth noting that currently Org’s minimum supported Emacs version is 25. Do
you use much from Emacs 26/27? There was mention of compat.el earlier though,
and if that goes somewhere this may not be an issue.

All the best,
Timothy


Re: [BUG] after update to 9.5, starting org mode results in cache error messages [9.5 (9.5-gd4e192 @ c:/Users/scott/.emacs.d/straight/build/org/)]

2021-11-01 Thread Ihor Radchenko
Greg Coladonato  writes:

> Here's the report:
>
> [profiler-profile "24.3" cpu #s(hash-table size 325 test equal rehash-size
> ...

The profile shows that bottleneck is undo-fu-session. Even if
org-element-cache is the cause, it should be some strange interaction
with other external packages. org-element-cache itself does not change
buffer text. If anything, the new code should change buffer text
properties less than before because some of the older cache logic is
moved from using text properties to using org-element-cache.

Best,
Ihor