Re: managing aggressive link activation within lines?

2019-12-18 Thread Nicolas Goaziou
Hello,

Matt Price  writes:

> MWE:
> test.org:
> --
> This is a paragraph with  [[https://google.com][a link]]
> ---
> steps to reproduce:
>
> put cursor at beginning of file and type ~[[~.  The paragraph text will
> collapse into the link definition, and (point) will move to the ~a~ in ~a
> link~, so manual typing of a new link will fail.  Is there anything I can
> do to stop this from happening?

IIUC, this is related to the link syntax change introduced in Org 9.3,
which allows, among other things, "[[" within a link. In this situation,
once you write

  [[This is a paragraph with  [[https://google.com][a link]]
^^

the underlined part becomes the link.

I agree this is not optimal. Yet, I'm not sure about how to deal with
this.

Regards,

-- 
Nicolas Goaziou



Re: Can Org warn me if I create a time conflict?

2019-12-18 Thread David R
On Wednesday, December 18, 2019, Mikhail Skorzhinskiy 
wrote:
> I think there is a package exactly for this:
>
> https://www.mail-archive.com/emacs-orgmode@gnu.org/msg123154.html
>
> I'm happily using this since summer with latest org. Although in case you
want to extend  scheduling function (ie check it automatically) you  need
to write write some code around.
>
> I can send you my customizations on  top of that package, but at the end
of  the week, im in vacation currently.
>
> --
>   Mikhail Skorzhinskiy
>   mskorzhins...@eml.cc



I haven't had a chance to try this yet, but the description sounds like
what I want. I'll try it for sure. Thanks!

-- 
-- 
David Rogers


Re: Bug: org-tempo expansion comments out the following src block when org-src-tabs-natively is 't [9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)]

2019-12-18 Thread Berry, Charles



> On Dec 18, 2019, at 5:07 AM, Ihor Radchenko  wrote:
> 
> Recipe:
> 
> 1. emacs -Q
> 2. Execute the following lisp code:
> 
> (setq org-src-tab-acts-natively t)
> (require 'org-tempo)

I did not need to add this line to confirm the behavior:

> (push (cons "el" "src emacs-lisp") org-structure-template-alist)
> 
> 3. Create the following org file:
> 
> 
> 
> #+begin_src emacs-lisp
> #+end_src
> 
> 4. Put the point before the code block
> 
> 5.1. Type  
> Observed behaviour:
> 
> #+begin_src 
> 
> 
> #+begin_src emacs-lisp
> #+end_src
> 


Right. The issue seems to be that `org-tempo-add-block' puts  `>' elements in 
its recipe for converting  `org-structure-template-alist' to 
`tempo-org-template-*' values.

Those are innocuous when `org-src-tab-acts-natively' is nil.

But when `org-src-tab-acts-natively' is `t', an attempt is made to indent 
within the src block, which I guess is where the trouble lies as an error 
occurs which prevents the remainder of the template from being inserted.

If you really need `

Re: Calling/using named babel code blocks

2019-12-18 Thread John Kitchin
I think you want:


#+name: my-random-gen
#+header: :var n=0 :var lim=0
#+BEGIN_SRC emacs-lisp
(loop repeat n collect (random* lim))
#+END_SRC

and this various versions of this

#+BEGIN_SRC emacs-lisp :var results=my-random-gen(n=5, lim=1.0)
results
#+END_SRC

#+RESULTS:
| 0.27765703201293945 | 0.7524830102920532 | 0.854852557182312 |
0.22202050685882568 | 0.604256272315979 |


John

---
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Wed, Dec 18, 2019 at 12:11 PM Lawrence Bottorff 
wrote:

> I thought I understood "metaprogramming," i.e., creating generic code
> blocks that can be called by any other code block regardless of programming
> language -- but apparently I don't. I have this
>
>  #+name: my-random-gen
> #+header: :var n=0 :var lim=0
> #+BEGIN_SRC emacs-lisp
> (loop repeat n collect (random* lim))
> #+END_SRC
>
> and I have the variables initialized to zero. But now I don't know how to
> call it with another code block. I've tried various versions of this
>
> #+BEGIN_SRC emacs-lisp
> my-random-gen(5 1.0)
> #+END_SRC
>
> and this various versions of this
>
> #+BEGIN_SRC emacs-lisp :var results=my-random-gen() :var n=5 :var lim=1.0
> results
> #+END_SRC
>
> to no avail. What am I missing? How can I actually use, call my-random-gen
> in other code blocks?
>
> LB
>
>
>


Re: Calling/using named babel code blocks

2019-12-18 Thread Berry, Charles



> On Dec 18, 2019, at 9:10 AM, Lawrence Bottorff  wrote:
> 
> I thought I understood "metaprogramming," i.e., creating generic code blocks 
> that can be called by any other code block regardless of programming language 
> -- but apparently I don't. I have this
> 
>  #+name: my-random-gen
> #+header: :var n=0 :var lim=0
> #+BEGIN_SRC emacs-lisp
> (loop repeat n collect (random* lim))
> #+END_SRC
> 
> and I have the variables initialized to zero. But now I don't know how to 
> call it with another code block. I've tried various versions of this
> 
> #+BEGIN_SRC emacs-lisp
> my-random-gen(5 1.0)
> #+END_SRC
> 
> and this various versions of this
> 
> #+BEGIN_SRC emacs-lisp :var results=my-random-gen() :var n=5 :var lim=1.0
> results
> #+END_SRC
> 
> to no avail. What am I missing? How can I actually use, call my-random-gen in 
> other code blocks?
> 

Do these help?

#+BEGIN_SRC emacs-lisp :noweb yes
'<>
#+END_SRC


#+BEGIN_SRC emacs-lisp :var mrg=my-random-gen(5, 1.0)
mrg
#+END_SRC

Chuck





ob-js and Indium

2019-12-18 Thread Ezequiel Birman
Hi all.

I wanted to know if a JavaScript source block configured to use a session
managed via https://github.com/NicolasPetton/Indium is currently supported.

I believe the error I am getting is related to
https://code.orgmode.org/bzg/org-mode/src/master/lisp/ob-js.el#L47

where “(declare-function indium-run-node "ext:indium-nodejs" (command))”
refers to a function named “indium-run-node” that does no longer exist

https://github.com/NicolasPetton/Indium/commit/3e7f181dca115bccb0cb150fc753ca353be359e4#diff-76bee0dfd13edc6083c22f66c5711149

There is an “indium-launch-nodejs” instead that works with the current
client-server model for Indium.

I'll try to replace “indium-run-node” for “indium-launch-nodejs” and
provide a proper config for an ob-js REPL in a “.indium.json” but any
pointers you could provide to me would be of great help.

Thank you

-- 
Ezequiel Birman


Calling/using named babel code blocks

2019-12-18 Thread Lawrence Bottorff
I thought I understood "metaprogramming," i.e., creating generic code
blocks that can be called by any other code block regardless of programming
language -- but apparently I don't. I have this

 #+name: my-random-gen
#+header: :var n=0 :var lim=0
#+BEGIN_SRC emacs-lisp
(loop repeat n collect (random* lim))
#+END_SRC

and I have the variables initialized to zero. But now I don't know how to
call it with another code block. I've tried various versions of this

#+BEGIN_SRC emacs-lisp
my-random-gen(5 1.0)
#+END_SRC

and this various versions of this

#+BEGIN_SRC emacs-lisp :var results=my-random-gen() :var n=5 :var lim=1.0
results
#+END_SRC

to no avail. What am I missing? How can I actually use, call my-random-gen
in other code blocks?

LB


Re: Can Org warn me if I create a time conflict?

2019-12-18 Thread Mikhail Skorzhinskiy
I think there is a package exactly for this:

https://www.mail-archive.com/emacs-orgmode@gnu.org/msg123154.html

I'm happily using this since summer with latest org. Although in case you want 
to extend  scheduling function (ie check it automatically) you  need to write 
write some code around.

I can send you my customizations on  top of that package, but at the end of  
the week, im in vacation currently.

-- 
  Mikhail Skorzhinskiy
  mskorzhins...@eml.cc

On Wed, Dec 18, 2019, at 09:02, Allen Li wrote:
> On Wed, Dec 18, 2019 at 7:06 AM David Rogers
>  wrote:
> >
> > It's currently possible for me to create two meeting times, one from 
> > 8:00-10:00 tomorrow and the other from 9:00-11:00 tomorrow.
> >
> > When both are mentioned in the same sentence, as above, it's easy to 
> > recognize that the two meetings are probably incompatible. But org-mode 
> > allows agenda items to be created at different times and in different 
> > files; it's possible to create Meeting #1 far in advance, have enough time 
> > to forget that Meeting #1 exists, and then create Meeting #2 covering the 
> > same period of time. (Compare this with the wall calendar made of paper, 
> > where if I try to add Meeting #2 I'll be forced to write it in the same 
> > physical space, and therefore automatically be alerted before making the 
> > error.)
> >
> > Is there any method to get org-mode to alert me (by an error message, or a 
> > red mark in the agenda, or whatever) that I've created a conflict - 
> > specifically, a method that doesn't involve me having to remember to 
> > perform any type of conflict-checking myself? If I could remember to do 
> > things like conflict checks, I wouldn't really need org-agenda anyway. :-)
> >
> > I realize that it's likely some situations *do* require timed events to 
> > happen concurrently - but I don't believe that they're the usual case for 
> > an individual. Having an "ignore conflict" or "accept anyway" type of 
> > option would make sense to me for such situations.
> 
> Does org-clock-consistency-checks support your needs?
> https://orgmode.org/manual/Agenda-commands.html
> 
> >
> > --
> > Thanks
> > David
> >
> 
>



managing aggressive link activation within lines?

2019-12-18 Thread Matt Price
Hi everyone,

Not sure if this has always been an issue but with a pretty recent org git
and emacs-git, I'm running into a usability issue with org-activiate-links.

MWE:
test.org:
--
This is a paragraph with  [[https://google.com][a link]]
---
steps to reproduce:

put cursor at beginning of file and type ~[[~.  The paragraph text will
collapse into the link definition, and (point) will move to the ~a~ in ~a
link~, so manual typing of a new link will fail.  Is there anything I can
do to stop this from happening?

>From what i can tell, ~org-activate-links~ was last modified in
1fd07c1eeb0f29de9ce058fac995031413201d4d in late August, but I'm not sure
if that's when this behaviour was introduced, or if it has been around for
a while and I'm only noticing it now. I know many people don't type links
manually, but I do so almost exclusively, so this can be frustrating when
I'm editing existing text.

Thanks as always!


Bug: org-tempo expansion comments out the following src block when org-src-tabs-natively is 't [9.3 (release_9.3 @ /home/yantar92/.emacs.d/straight/build/org/)]

2019-12-18 Thread Ihor Radchenko
Recipe:

1. emacs -Q
2. Execute the following lisp code:

(setq org-src-tab-acts-natively t)
(require 'org-tempo)
(push (cons "el" "src emacs-lisp") org-structure-template-alist)

3. Create the following org file:



#+begin_src emacs-lisp
#+end_src

4. Put the point before the code block

5.1. Type 

Re: backup of abbrev_defs

2019-12-18 Thread Neil Jerram
On Wed, 18 Dec 2019, 11:10 Fraga, Eric,  wrote:

> On Wednesday, 18 Dec 2019 at 11:02, Sharon Kimble wrote:
> > I've tried using a symlink to the file held in another directory, but
> > when I restarted emacs the symlink wasn't followed and it created a new
> > abbrev_def file from somewhere, I don't know where.
>
> This is strange.  I have my .abbrev_defs symlinked to elsewhere and it
> works just fine.  I've been doing this for years, probably from emacs
> v22 onwards (but that's just a guess).
>
> To answer your original question, I use version control (e.g. src or
> git) to manage that file along with other dotfiles.
>

Likewise; I symlink from ~/.emacs to the real .emacs in my git-managed
repo, and that has been working well for me.

Best wishes,
Neil


Re: [PATCH] ob-scheme: Handle :epilogue params

2019-12-18 Thread Neil Jerram
On Wed, 18 Dec 2019, 09:25 oldk1331,  wrote:

> Hi all,
>
> This is a simple change that adds support for :epilogue in ob-scheme.
>
> Best wishes,
> Qian
>
> ==
>
> * lisp/ob-scheme.el (org-babel-expand-body:scheme): Add :epilogue
>   param support.
>
> TINYCHANGE
> ---
>  lisp/ob-scheme.el | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
> index 21d9fad2b..ee0d93c13 100644
> --- a/lisp/ob-scheme.el
> +++ b/lisp/ob-scheme.el
> @@ -71,7 +71,8 @@
>  (defun org-babel-expand-body:scheme (body params)
>"Expand BODY according to PARAMS, return the expanded body."
>(let ((vars (org-babel--get-vars params))
> -   (prepends (cdr (assq :prologue params
> +   (prepends (cdr (assq :prologue params)))
> +   (postpends (cdr (assq :epilogue params
>  (concat (and prepends (concat prepends "\n"))
> (if (null vars) body
>   (format "(let (%s)\n%s\n)"
> @@ -80,7 +81,8 @@
>  (format "%S" (print `(,(car var) ',(cdr var)
>vars
>"\n  ")
> - body)
> + body))
> +   (and postpends (concat "\n" postpends)
>
>
>  (defvar org-babel-scheme-repl-map (make-hash-table :test #'equal)
> --
> 2.24.0
>

LGTM as another ob-scheme user. I don't think Scheme code should need the
"\n", but it's consistent with the existing handling for prologue.

Best wishes,
  Neil


Re: backup of abbrev_defs

2019-12-18 Thread Fraga, Eric
On Wednesday, 18 Dec 2019 at 11:02, Sharon Kimble wrote:
> I've tried using a symlink to the file held in another directory, but
> when I restarted emacs the symlink wasn't followed and it created a new
> abbrev_def file from somewhere, I don't know where. 

This is strange.  I have my .abbrev_defs symlinked to elsewhere and it
works just fine.  I've been doing this for years, probably from emacs
v22 onwards (but that's just a guess).

To answer your original question, I use version control (e.g. src or
git) to manage that file along with other dotfiles.

-- 
Eric S Fraga via Emacs 27.0.50, Org release_9.3-34-g2eee3c



backup of abbrev_defs

2019-12-18 Thread Sharon Kimble

This is slightly off topic but I really need some help.

How can I reliably backup my abbrev_defs file along with my usual
backups of my org files, every time that it is saved with a new addition
please?

I've tried using a symlink to the file held in another directory, but
when I restarted emacs the symlink wasn't followed and it created a new
abbrev_def file from somewhere, I don't know where. The new file was
only 5.7kbs, whereas the correct one is 10.4kbs! I had to copy over all
my savings to the new file so that it was able to be read and used.

Hopefully, thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
DrugFacts = https://www.drugfacts.org.uk
Debian 10.1, fluxbox 1.3.7, emacs 26.3, org 9.3


signature.asc
Description: PGP signature


[PATCH] ob-scheme: Handle :epilogue params

2019-12-18 Thread oldk1331
Hi all,

This is a simple change that adds support for :epilogue in ob-scheme.

Best wishes,
Qian

==

* lisp/ob-scheme.el (org-babel-expand-body:scheme): Add :epilogue
  param support.

TINYCHANGE
---
 lisp/ob-scheme.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index 21d9fad2b..ee0d93c13 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -71,7 +71,8 @@
 (defun org-babel-expand-body:scheme (body params)
   "Expand BODY according to PARAMS, return the expanded body."
   (let ((vars (org-babel--get-vars params))
-   (prepends (cdr (assq :prologue params
+   (prepends (cdr (assq :prologue params)))
+   (postpends (cdr (assq :epilogue params
 (concat (and prepends (concat prepends "\n"))
(if (null vars) body
  (format "(let (%s)\n%s\n)"
@@ -80,7 +81,8 @@
 (format "%S" (print `(,(car var) ',(cdr var)
   vars
   "\n  ")
- body)
+ body))
+   (and postpends (concat "\n" postpends)


 (defvar org-babel-scheme-repl-map (make-hash-table :test #'equal)
-- 
2.24.0


>From 168aaf5ea6c855dfab96d1df6ea85996ba643253 Mon Sep 17 00:00:00 2001
From: Qian Yun 
Date: Wed, 18 Dec 2019 16:53:01 +0800
Subject: [PATCH] ob-scheme: Handle :epilogue params

* lisp/ob-scheme.el (org-babel-expand-body:scheme): Add :epilogue
  param support.

TINYCHANGE
---
 lisp/ob-scheme.el | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index 21d9fad2b..ee0d93c13 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -71,7 +71,8 @@
 (defun org-babel-expand-body:scheme (body params)
   "Expand BODY according to PARAMS, return the expanded body."
   (let ((vars (org-babel--get-vars params))
-	(prepends (cdr (assq :prologue params
+	(prepends (cdr (assq :prologue params)))
+	(postpends (cdr (assq :epilogue params
 (concat (and prepends (concat prepends "\n"))
 	(if (null vars) body
 	  (format "(let (%s)\n%s\n)"
@@ -80,7 +81,8 @@
 			 (format "%S" (print `(,(car var) ',(cdr var)
 		   vars
 		   "\n  ")
-		  body)
+		  body))
+	(and postpends (concat "\n" postpends)
 
 
 (defvar org-babel-scheme-repl-map (make-hash-table :test #'equal)
-- 
2.24.0




Re: Can Org warn me if I create a time conflict?

2019-12-18 Thread Allen Li
On Wed, Dec 18, 2019 at 7:06 AM David Rogers
 wrote:
>
> It's currently possible for me to create two meeting times, one from 
> 8:00-10:00 tomorrow and the other from 9:00-11:00 tomorrow.
>
> When both are mentioned in the same sentence, as above, it's easy to 
> recognize that the two meetings are probably incompatible. But org-mode 
> allows agenda items to be created at different times and in different files; 
> it's possible to create Meeting #1 far in advance, have enough time to forget 
> that Meeting #1 exists, and then create Meeting #2 covering the same period 
> of time. (Compare this with the wall calendar made of paper, where if I try 
> to add Meeting #2 I'll be forced to write it in the same physical space, and 
> therefore automatically be alerted before making the error.)
>
> Is there any method to get org-mode to alert me (by an error message, or a 
> red mark in the agenda, or whatever) that I've created a conflict - 
> specifically, a method that doesn't involve me having to remember to perform 
> any type of conflict-checking myself? If I could remember to do things like 
> conflict checks, I wouldn't really need org-agenda anyway. :-)
>
> I realize that it's likely some situations *do* require timed events to 
> happen concurrently - but I don't believe that they're the usual case for an 
> individual. Having an "ignore conflict" or "accept anyway" type of option 
> would make sense to me for such situations.

Does org-clock-consistency-checks support your needs?
https://orgmode.org/manual/Agenda-commands.html

>
> --
> Thanks
> David
>