org-in-org

2021-02-23 Thread Greg Minshall
i have a question about org-in-org source blocks.  i volunteered to help
in an effort to provide a tutorial of using the ESS (Emacs Speaks
Statistics) package for R, in particular, from org mode.

i'd like to write my contribution as a .org file.  i'd like to include
fragments of org code, including source blocks (in R).  and, i'd like to
show various result types.  so, i'd like to be able to have the
#+RESULTS show up in the org-in-org source block as exported inside the
containing .org file.

and, i'd like to trigger all this from a makefile, using some emacs
batch script to export the containing .org file into a .html or .pdf
file.

(i *think*) what i would like to end up with is what it would like if i
had manually opened the org-in-org source blocks (C-c‌'), then went to
each (or, possibly, selected, i guess) source blocks inside *that*
(org-in-org) source block, and executed each, producing a #+RESULTS
block for each, then closed the org-in-org source block (C-c‌', again),
and then exported the containing .org file.

is this possible?  any ideas?

cheers, Greg



false-list-item-mode?

2021-02-23 Thread Juan Manuel Macías
Hi,

This is not a solution to what was commented in this recent thread
(https://lists.gnu.org/archive/html/emacs-orgmode/2021-02/msg00239.html)
on the false list item issue. But, in case anyone finds it useful, I
happened to sketch this minor mode to highlight, while typing, *only*
(+/-) those lines in a paragraph that start with a 'false' list item.

The code is in this GitLab snippet:
https://gitlab.com/-/snippets/2081294

And here a short screenshot:
https://gnutas.juanmanuelmacias.com/images/false-list-item-mode-test.mp4

Feedback Welcome!

Regards,

Juan Manuel 




Org-ref-helm-insert-cite-link

2021-02-23 Thread Marvin M. Doyley
Hi there,

For some reason org-ref-helm-insert-cite-link is not working anymore for me. 
When I try to execute it,  I get the following error 
helm-bibtex-candidates-formatter: Symbol’s function definition is void: 
bibtex-completion-candidates-formatter

Does anybody know how to fix this?

Enclosed is the backtrace,

thanks
M 


Debugger entered--Lisp error: (error "Command attempted to use minibuffer while 
in minib...")
  read-from-minibuffer(#("pattern: " 0 9 (face helm-minibuffer-prompt)) nil 
(keymap (tab . helm-execute-persistent-action) (normal-state keymap "Auxiliary 
keymap for Normal state" (32 . helm-toggle-visible-mark) (121 keymap (121 . 
helm-kill-selection-and-quit) (80 . helm-copy-to-buffer) (112 . 
helm-yank-selection)) (47 . helm-quit-and-find-file) (71 . helm-end-of-buffer) 
(107 . helm-previous-line) (106 . helm-next-line) (41 . helm-next-visible-mark) 
(40 . helm-prev-visible-mark) (103 keymap (114 . helm-refresh) (103 . 
helm-beginning-of-buffer) (106 . helm-next-source) (107 . 
helm-previous-source)) (93 keymap (93 . helm-next-source)) (91 keymap (91 . 
helm-previous-source)) (tab . helm-select-action) (4 . helm-next-page) (15 . 
helm-next-source) (14 . helm-next-line) (16 . helm-previous-line) (22 . 
helm-next-page) (13 . helm-maybe-exit-minibuffer) (2 . helm-previous-page) (6 . 
helm-next-page) (27 keymap (118 . helm-previous-page) (107 . 
helm-previous-line) (106 . helm-next-line) (108 . 
helm-execute-persistent-action) (93 . helm-next-source) (91 . 
helm-previous-source))) (insert-state keymap "Auxiliary keymap for Insert 
state" (15 . helm-next-source) (14 . helm-next-line) (16 . helm-previous-line) 
(22 . helm-next-page) (13 . helm-maybe-exit-minibuffer) (2 . 
helm-previous-page) (6 . helm-next-page) (27 keymap (118 . helm-previous-page) 
(107 . helm-previous-line) (106 . helm-next-line) (108 . 
helm-execute-persistent-action) (93 . helm-next-source) (91 . 
helm-previous-source))) (\(insert\ normal\)-state keymap "Auxiliary keymap for 
(insert normal) state") (26 . helm-select-action) (f13 lambda nil (interactive) 
(helm-select-nth-action 12)) (f12 lambda nil (interactive) 
(helm-select-nth-action 11)) (f11 lambda nil (interactive) 
(helm-select-nth-action 10)) (f10 lambda nil (interactive) 
(helm-select-nth-action 9)) (f9 lambda nil (interactive) 
(helm-select-nth-action 8)) (f8 lambda nil (interactive) 
(helm-select-nth-action 7)) (f7 lambda nil (interactive) 
(helm-select-nth-action 6)) (f6 lambda nil (interactive) 
(helm-select-nth-action 5)) (f5 lambda nil (interactive) 
(helm-select-nth-action 4)) (f4 lambda nil (interactive) 
(helm-select-nth-action 3)) (f3 lambda nil (interactive) 
(helm-select-nth-action 2)) (f2 lambda nil (interactive) 
(helm-select-nth-action 1)) (menu-bar keymap (help-menu keymap (describe keymap 
(describe-mode . helm-help (help keymap (109 . helm-help)) (23 . 
#f(compiled-function () (interactive nil) #)) (f1 
lambda nil (interactive) (helm-select-nth-action 0)) (8 keymap (109 . 
helm-help) (104 . undefined) (8 . undefined) (99 . helm-customize-group) (4 . 
helm-enable-or-switch-to-debug)) (20 . helm-toggle-resplit-and-swap-windows) 
(C-tab . undefined) (67108897 . helm-toggle-suspend-update) (3 keymap (57 . 
helm-execute-selection-action-at-nth-+9) (56 . 
helm-execute-selection-action-at-nth-+8) (55 . 
helm-execute-selection-action-at-nth-+7) (54 . 
helm-execute-selection-action-at-nth-+6) (53 . 
helm-execute-selection-action-at-nth-+5) (52 . 
helm-execute-selection-action-at-nth-+4) (51 . 
helm-execute-selection-action-at-nth-+3) (50 . 
helm-execute-selection-action-at-nth-+2) (49 . 
helm-execute-selection-action-at-nth-+1) (63 . helm-help) (110 . 
#f(compiled-function () (interactive nil) #)) (108 . 
helm-display-line-numbers-mode) (62 . helm-toggle-truncate-line) (21 . 
helm-refresh) (6 . helm-follow-mode) (9 . helm-copy-to-buffer) (11 . 
helm-kill-selection-and-quit) (25 . helm-yank-selection) (37 . 
helm-exchange-minibuffer-and-header-line) (95 . helm-toggle-full-frame) (45 . 
helm-swap-windows)) (67108987 . helm-enlarge-window) (67108989 . 
helm-narrow-window) (19 . undefined) (24 keymap (57 . 
helm-execute-selection-action-at-nth-+9) (56 . 
helm-execute-selection-action-at-nth-+8) (55 . 
helm-execute-selection-action-at-nth-+7) (54 . 
helm-execute-selection-action-at-nth-+6) (53 . 
helm-execute-selection-action-at-nth-+5) (52 . helm-select-4rd-action) (51 . 
helm-select-3rd-action) (50 . helm-select-2nd-action) (49 . 
helm-execute-selection-action-at-nth-+1) (2 . 
helm-resume-list-buffers-after-quit) (98 . 
helm-resume-previous-session-after-quit) (6 . helm-quit-and-find-file)) (11 . 
helm-delete-minibuffer-contents) (67108896 . helm-toggle-visible-mark-forward) 
(0 . helm-toggle-visible-mark) (C-M-up . helm-scroll-other-window-down) 
(C-M-down . helm-scroll-other-window) (M-prior . helm-scroll-other-window-down) 
(M-next . helm-scroll-other-window) (12 . 
helm-recenter-top-bottom-other-window) (left . helm-previous-source) (right . 

Re: org-in-org

2021-02-23 Thread Berry, Charles
Greg, 

See inline

> On Feb 23, 2021, at 6:24 AM, Greg Minshall  wrote:
> 
> i have a question about org-in-org source blocks.  i volunteered to help
> in an effort to provide a tutorial of using the ESS (Emacs Speaks
> Statistics) package for R, in particular, from org mode.
> 
> i'd like to write my contribution as a .org file.  i'd like to include
> fragments of org code, including source blocks (in R).  and, i'd like to
> show various result types.  so, i'd like to be able to have the
> #+RESULTS show up in the org-in-org source block as exported inside the
> containing .org file.

I think I get your intention. You want the visual to look like it would if the 
src-edit buffer was opened in emacs as org.

> 
> and, i'd like to trigger all this from a makefile, using some emacs
> batch script to export the containing .org file into a .html or .pdf
> file.
> 
> (i *think*) what i would like to end up with is what it would like if i
> had manually opened the org-in-org source blocks (C-c‌'), then went to
> each (or, possibly, selected, i guess) source blocks inside *that*
> (org-in-org) source block, and executed each, producing a #+RESULTS
> block for each, then closed the org-in-org source block (C-c‌', again),
> and then exported the containing .org file.
> 
> is this possible?  any ideas?


I have two alternative approaches:

1) Add an export engine for "org" to ox-ravel[1]. This is a trivial 
customization of `org-ravel-engines' to add a '("org" . "engine='org'") 
element.  Then add a custom language engine[2] for rmarkdown or knitr.

The actions for the makefile would be a ravel export to generate *.Rmd, *.Rnw, 
or *.Rhtml files followed by rmarkdown::render or knitr::knit on the generated 
files.

2) Define this function:

#+begin_src emacs-lisp
  (defun org-exe-org ()
(let ((org-confirm-babel-evaluate nil))
  (org-edit-src-code)
  (org-babel-execute-buffer)
  (org-edit-src-exit)))
#+end_src

In an org buffer with one or more org src blocks containing R src blocks:

eval this

 (org-babel-map-executables nil (org-exe-org))

Then export the buffer to pdf or html.

I haven't tested this much, but for the snippet below evaluating that line and 
exporting to html produces two framed blocks with R src blocks and the results 
displayed in each:

--8<---cut here---start->8---
#+begin_src org
  ,#+begin_src R
print("abc")
  ,#+end_src
#+end_src


#+begin_src org
  ,#+begin_src R
print("def")
  ,#+end_src
#+end_src
--8<---cut here---end--->8---

I expect doing this in batch mode will not be a challenge.

For pdf output the result is rather plain. Maybe there is some minted idiom 
that would help?

HTH,
Chuck

p.s. I am an `ess-intro' member, in case it helps to move the conversation to 
there.


[1] https://github.com/chasberry/orgmode-accessories

[2] https://bookdown.org/yihui/rmarkdown-cookbook/custom-engine.html 

Re: org-in-org

2021-02-23 Thread Erik Iverson
Hi Greg!

I am not sure if this would be useful to your efforts, but I have an "R in
org-mode" tutorial on github:

https://github.com/erikriverson/org-mode-R-tutorial

Apparently it is now 10 years old somehow, time flies.

Best,
--Erik



On Tue, Feb 23, 2021 at 6:25 AM Greg Minshall  wrote:

> i have a question about org-in-org source blocks.  i volunteered to help
> in an effort to provide a tutorial of using the ESS (Emacs Speaks
> Statistics) package for R, in particular, from org mode.
>
> i'd like to write my contribution as a .org file.  i'd like to include
> fragments of org code, including source blocks (in R).  and, i'd like to
> show various result types.  so, i'd like to be able to have the
> #+RESULTS show up in the org-in-org source block as exported inside the
> containing .org file.
>
> and, i'd like to trigger all this from a makefile, using some emacs
> batch script to export the containing .org file into a .html or .pdf
> file.
>
> (i *think*) what i would like to end up with is what it would like if i
> had manually opened the org-in-org source blocks (C-c‌'), then went to
> each (or, possibly, selected, i guess) source blocks inside *that*
> (org-in-org) source block, and executed each, producing a #+RESULTS
> block for each, then closed the org-in-org source block (C-c‌', again),
> and then exported the containing .org file.
>
> is this possible?  any ideas?
>
> cheers, Greg
>
>


Using lexical-binding

2021-02-23 Thread Stefan Monnier
As part of the on-going work to use lexical-binding in all the files
bundled with Emacs, I took a stab at converting org-agenda.el to
lexical-binding.

Since I'm not using it, I can't really test the result in any meaningful
way.  Furthermore, just like `calendar.el`, it relies on dynamic scoping
and `eval` in all kinds of ways, so it's very difficult to be sure the
result is "sufficiently similar" to the old behavior not to break some
funky use somewhere out there.

Anyway, here's my first cut (the patch is made against the head of
Org's `master` rather than Emacs's `master`, since I suspect that could
make things easier for you).  The commit message is basically empty
because it's not intended to be installed yet.  I'm instead hoping for
some feedback, such as "tried it, works" or "burps all over the place",
or "pretends everything is fine but doesn't do the right thing any
more", or (even better) actual feedback about the code itself and the
approach(es) I chose to use.


Stefan


- Removed the global (defvar date) and (defvar entry) so as not to
  conflict with function arguments of that name.  Instead I added such
  `defvar`s in the body of each of the functions where it seemed needed.
- I believe I have quashed all the compiler warnings (some had nothing
  to do with lexical scoping), except for a reference to the function
  `add-to-diary-list` which I can't find anywhere (is it some old
  function that has disappeared, maybe?).
- Added an `org-dlet` macro, just like I had done for `calendar-dlet`,
  but I also use `defvar` "manually" at some places, when splitting an
  existing `let` into a mix of `let`s and `dlet`s seemed too much trouble.
- Removed uses of `org-let and `prg-let2` not only because I consider
  them offensive to my sense of aesthetics but also because they're
  basically incompatible with lexical scoping.
  I replaced them with uses of `cl-progv` which are a bit more verbose.
  Maybe we should define some `org-progv` macro on top of `cl-progv` to
  make the code less verbose, but I didn't do that because I like the
  fact that the current code makes uses of `eval` a bit more obvious
  (since these behave differently with lexical scoping than with
  lexical binding, it seemed worthwhile).
- Removed the use of `eval` in `org-store-agenda-views` which was only
  placed there in order to use a macro before it's defined (it would
  have been simpler/cleaner to just move that functions *after* the
  macro, but with the new code the problem doesn't occur any more
  anyway).
- Replaced a few `(lambda...) with actual closures.

>From d34f993044ee817f7ee18342bcc686285329bea5 Mon Sep 17 00:00:00 2001
From: Stefan Monnier 
Date: Tue, 23 Feb 2021 15:47:29 -0500
Subject: [PATCH] * org-agenda.el: First attempt at using `lexical-binding`

---
 .gitignore |   6 +
 doc/Makefile   |  14 +-
 lisp/org-agenda.el | 827 +
 lisp/org-macs.el   |  41 ++-
 4 files changed, 502 insertions(+), 386 deletions(-)

diff --git a/.gitignore b/.gitignore
index 1a72cc20b0..4bb81c359b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -49,6 +49,12 @@ local*.mk
 mk/x11idle
 ChangeLog
 
+# Files generated during `make packages/org` in a clone of `elpa.git`.
+
+/org-pkg.el
+/org-autoloads.el
+/lisp/org-autoloads.el
+
 # texi2pdf --tidy
 
 doc/*.t2d
diff --git a/doc/Makefile b/doc/Makefile
index 96fda14454..dc6882927e 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -28,9 +28,9 @@ guide::		orgguide.texi org-version.inc
 endif
 
 org.texi orgguide.texi:	org-manual.org org-guide.org
-	$(BATCH) \
-	  --eval '(add-to-list '"'"'load-path "../lisp")' \
-	  --eval '(load "../mk/org-fixup.el")' \
+	$(BATCH)   \
+	  --eval '(add-to-list `load-path "../lisp")' \
+	  --eval '(load "../mk/org-fixup.el")' 	  \
 	  --eval '(org-make-manuals)'
 
 org-version.inc:	org.texi
@@ -88,8 +88,8 @@ ifneq ($(SERVERMK),)
 endif
 
 %_letter.tex:	%.tex
-	$(BATCH) \
-	  --eval '(add-to-list '"'"'load-path "../lisp")' \
-	  --eval '(load "org-compat.el")' \
-	  --eval '(load "../mk/org-fixup.el")' \
+	$(BATCH)   \
+	  --eval '(add-to-list `load-path "../lisp")' \
+	  --eval '(load "org-compat.el")' 	  \
+	  --eval '(load "../mk/org-fixup.el")' 	  \
 	  --eval '(org-make-letterformat "$(= iso-week 52))
-			  (1- year))
-			 ((and (= month 12) (<= iso-week 1))
-			  (1+ year))
-			 (t year)))
+	 ;; (weekyear (cond ((and (= month 1) (>= iso-week 52))
+	 ;;	  (1- year))
+	 ;;	 ((and (= month 12) (<= iso-week 1))
+	 ;;	  (1+ year))
+	 ;;	 (t year)))
 	 (weekstring (if (= day-of-week 1)
 			 (format " W%02d" iso-week)
 		   "")))
@@ -2269,7 +2271,7 @@ The following commands are available:
 	 (setq-local org-agenda-this-buffer-is-sticky t))
 	(org-agenda-sticky
 	 ;; Creating a sticky Agenda buffer for the first time
-	 (mapc 'make-local-variable org-agenda-local-vars)
+	 (mapc #'make-local-variable org-agenda-local-vars)
 

Re: org-in-org

2021-02-23 Thread Jeremie Juste
Hello Greg,

Many thanks for the effort. 
A possible solution might be this one 

#+NAME: readdata-code
#+BEGIN_SRC org
  ,#+NAME: readdata-code
  ,#+BEGIN_SRC R :results value silent

  read.data("datafile1.csv",sep=",",header=T)->mydata1


  ,#+END_SRC
#+END_SRC

credit goes to 
https://raw.githubusercontent.com/vikasrawal/orgpaper/master/orgpapers.org

Best regards,
Jeremie


On Tuesday, 23 Feb 2021 at 17:24, Greg Minshall wrote:
> i have a question about org-in-org source blocks.  i volunteered to help
> in an effort to provide a tutorial of using the ESS (Emacs Speaks
> Statistics) package for R, in particular, from org mode.
>
> i'd like to write my contribution as a .org file.  i'd like to include
> fragments of org code, including source blocks (in R).  and, i'd like to
> show various result types.  so, i'd like to be able to have the
> #+RESULTS show up in the org-in-org source block as exported inside the
> containing .org file.
>
> and, i'd like to trigger all this from a makefile, using some emacs
> batch script to export the containing .org file into a .html or .pdf
> file.
>
> (i *think*) what i would like to end up with is what it would like if i
> had manually opened the org-in-org source blocks (C-c‌'), then went to
> each (or, possibly, selected, i guess) source blocks inside *that*
> (org-in-org) source block, and executed each, producing a #+RESULTS
> block for each, then closed the org-in-org source block (C-c‌', again),
> and then exported the containing .org file.
>
> is this possible?  any ideas?
>
> cheers, Greg
>

-- 
Jeremie Juste



Re: Org-ref-helm-insert-cite-link

2021-02-23 Thread Kyle Meyer
Marvin M. Doyley writes:

> Hi there,
>
> For some reason org-ref-helm-insert-cite-link is not working anymore
> for me. When I try to execute it, I get the following error
> helm-bibtex-candidates-formatter: Symbol’s function definition is
> void: bibtex-completion-candidates-formatter

I don't use org-ref or helm-bibtex, but, based on poking around in their
repos, helm-bibtex removed bibtex-completion-candidates-formatter way
back in 390e9c3 (move helm-specific code to helm-bibtex.el, 2016-09-27),
which in turn led to 400c4f4 (use helm-bibtex-candidates-formatter,
2016-10-01) on org-ref's side.  So...

> Does anybody know how to fix this?

... while it's not really a satisfying answer, I suspect your issue will
be fixed by uninstalling both packages, including the *.elc files, and
reinstalling.



Re: [EXT] Org-ref-helm-insert-cite-link

2021-02-23 Thread Marvin M. Doyley
Thanks Kyle,

I deleted both packages, but the problem still persists.

I am using the latest version of org and help-bibtex-2.0.0 that I just pulled 
from Melpa. I also pulled the latest version org-ref

Strange but I will keep digging 

Cheers,
M






> On Feb 23, 2021, at 5:53 PM, Kyle Meyer  wrote:
> 
> Marvin M. Doyley writes:
> 
>> Hi there,
>> 
>> For some reason org-ref-helm-insert-cite-link is not working anymore
>> for me. When I try to execute it, I get the following error
>> helm-bibtex-candidates-formatter: Symbol’s function definition is
>> void: bibtex-completion-candidates-formatter
> 
> I don't use org-ref or helm-bibtex, but, based on poking around in their
> repos, helm-bibtex removed bibtex-completion-candidates-formatter way
> back in 390e9c3 (move helm-specific code to helm-bibtex.el, 2016-09-27),
> which in turn led to 400c4f4 (use helm-bibtex-candidates-formatter,
> 2016-10-01) on org-ref's side.  So...
> 
>> Does anybody know how to fix this?
> 
> ... while it's not really a satisfying answer, I suspect your issue will
> be fixed by uninstalling both packages, including the *.elc files, and
> reinstalling.



Re: Using lexical-binding

2021-02-23 Thread Kyle Meyer
Stefan Monnier writes:

> As part of the on-going work to use lexical-binding in all the files
> bundled with Emacs, I took a stab at converting org-agenda.el to
> lexical-binding.

Thank you.

> [...]
> Anyway, here's my first cut (the patch is made against the head of
> Org's `master` rather than Emacs's `master`, since I suspect that could
> make things easier for you).  The commit message is basically empty
> because it's not intended to be installed yet.  I'm instead hoping for
> some feedback, such as "tried it, works" or "burps all over the place",

With a quick test of a few main commands, burps in one of four.
Contents /tmp/scratch.org:

--8<---cut here---start->8---
* TODO a  :t:
SCHEDULED: <2021-02-23 Tue>
foo
* DONE b
* TODO c
DEADLINE: <2021-02-23 Tue>
--8<---cut here---end--->8---

Running with emacs 27.1 and -Q:

  (require 'org-agenda)
  (setq org-agenda-files '("/tmp/scratch.org"))
  (global-set-key (kbd "C-c a") #'org-agenda)

  ;; Commands:

  ;; (org-todo-list)  ; works
  ;; (org-search-view nil "foo")  ; works
  ;; (org-tags-view nil "+t") ; works
  ;; (org-agenda-list); fails: void-variable date

There are also some `make test' failures:

  7 unexpected results:
 FAILED  test-org-agenda/diary-inclusion
 FAILED  test-org-agenda/empty
 FAILED  test-org-agenda/one-line
 FAILED  test-org-agenda/scheduled-non-todo
 FAILED  test-org-agenda/set-priority
 FAILED  test-org-agenda/sticky-agenda-name
 FAILED  test-org-agenda/sticky-agenda-name-after-reload

> or "pretends everything is fine but doesn't do the right thing any
> more", or (even better) actual feedback about the code itself and the
> approach(es) I chose to use.

While I'm not sure I can provide any useful feedback about approaches,
I'll see if I can tweak your patch to resolve the org-agenda-list
failure or any of the above test failures.

> - I believe I have quashed all the compiler warnings (some had nothing
>   to do with lexical scoping),

Hmm, I wonder why I'm not seeing the ones unrelated to the lexical
scoping change.  `make compile' and `make single' are quiet for me on
Org's current master (d21d200bc) with Emacs 27.  If I use an Emacs built
from a recent Emacs commit (6172454ff3), I see a couple of "docstring
wider than 80 characters" warnings (will fix), but nothing in
org-agenda.el.

>   except for a reference to the function `add-to-diary-list` which I
>   can't find anywhere (is it some old function that has disappeared,
>   maybe?).

It looks like add-to-diary-list became an obsolete alias for
diary-add-to-list in Emacs 23.1 and was removed in Emacs 25.1,
specifically 3f65970414 (Remove calendar code obsolete since at least
version 23.1, 2014-10-05).



Re: [EXT] Org-ref-helm-insert-cite-link

2021-02-23 Thread Marvin M. Doyley
Installing bibtex-completion fixed the problem








> On Feb 23, 2021, at 5:53 PM, Kyle Meyer  wrote:
> 
> Marvin M. Doyley writes:
> 
>> Hi there,
>> 
>> For some reason org-ref-helm-insert-cite-link is not working anymore
>> for me. When I try to execute it, I get the following error
>> helm-bibtex-candidates-formatter: Symbol’s function definition is
>> void: bibtex-completion-candidates-formatter
> 
> I don't use org-ref or helm-bibtex, but, based on poking around in their
> repos, helm-bibtex removed bibtex-completion-candidates-formatter way
> back in 390e9c3 (move helm-specific code to helm-bibtex.el, 2016-09-27),
> which in turn led to 400c4f4 (use helm-bibtex-candidates-formatter,
> 2016-10-01) on org-ref's side.  So...
> 
>> Does anybody know how to fix this?
> 
> ... while it's not really a satisfying answer, I suspect your issue will
> be fixed by uninstalling both packages, including the *.elc files, and
> reinstalling.



Re: Using lexical-binding

2021-02-23 Thread Kyle Meyer
Kyle Meyer writes:

> Stefan Monnier writes:
[...]
>   ;; (org-agenda-list); fails: void-variable date
>
> There are also some `make test' failures:
>
>   7 unexpected results:
>  FAILED  test-org-agenda/diary-inclusion
>  FAILED  test-org-agenda/empty
>  FAILED  test-org-agenda/one-line
>  FAILED  test-org-agenda/scheduled-non-todo
>  FAILED  test-org-agenda/set-priority
>  FAILED  test-org-agenda/sticky-agenda-name
>  FAILED  test-org-agenda/sticky-agenda-name-after-reload
>
>> or "pretends everything is fine but doesn't do the right thing any
>> more", or (even better) actual feedback about the code itself and the
>> approach(es) I chose to use.
>
> While I'm not sure I can provide any useful feedback about approaches,
> I'll see if I can tweak your patch to resolve the org-agenda-list
> failure or any of the above test failures.

With the changes below on top of your patch, the simple org-agenda-list
call from above works and the test failures are gone.

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 16ec70c77..81409d6ac 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -5448,27 +5448,29 @@ (defun org-agenda-get-day-entries (file date &rest args)
  (setf args (cons :deadline* (delq :deadline* args)
;; Collect list of headlines.  Return them flattened.
(let ((case-fold-search nil) results deadlines)
- (dolist (arg args (apply #'nconc (nreverse results)))
-   (pcase arg
- ((and :todo (guard (org-agenda-today-p date)))
-  (push (org-agenda-get-todos) results))
- (:timestamp
-  (push (org-agenda-get-blocks) results)
-  (push (org-agenda-get-timestamps deadlines) results))
- (:sexp
-  (push (org-agenda-get-sexps) results))
- (:scheduled
-  (push (org-agenda-get-scheduled deadlines) results))
- (:scheduled*
-  (push (org-agenda-get-scheduled deadlines t) results))
- (:closed
-  (push (org-agenda-get-progress) results))
- (:deadline
-  (setf deadlines (org-agenda-get-deadlines))
-  (push deadlines results))
- (:deadline*
-  (setf deadlines (org-agenda-get-deadlines t))
-  (push deadlines results)))
+  (org-dlet
+  ((date date))
+   (dolist (arg args (apply #'nconc (nreverse results)))
+ (pcase arg
+   ((and :todo (guard (org-agenda-today-p date)))
+(push (org-agenda-get-todos) results))
+   (:timestamp
+(push (org-agenda-get-blocks) results)
+(push (org-agenda-get-timestamps deadlines) results))
+   (:sexp
+(push (org-agenda-get-sexps) results))
+   (:scheduled
+(push (org-agenda-get-scheduled deadlines) results))
+   (:scheduled*
+(push (org-agenda-get-scheduled deadlines t) results))
+   (:closed
+(push (org-agenda-get-progress) results))
+   (:deadline
+(setf deadlines (org-agenda-get-deadlines))
+(push deadlines results))
+   (:deadline*
+(setf deadlines (org-agenda-get-deadlines t))
+(push deadlines results
 
 (defsubst org-em (x y list)
   "Is X or Y a member of LIST?"
@@ -6710,6 +6712,7 @@ (defun org-agenda-format-item (extra txt &optional level 
category tags dotime
  (get-text-property 1 'effort txt)))
 (tag (if tags (nth (1- (length tags)) tags) ""))
 (time-grid-trailing-characters (nth 2 org-agenda-time-grid))
+(extra (or (and (not habitp) extra) ""))
 time
 (ts (when dotime (concat
   (if (stringp dotime) dotime "")
@@ -6793,7 +6796,6 @@ (defun org-agenda-format-item (extra txt &optional level 
category tags dotime
   (concat time-grid-trailing-characters " ")
 time-grid-trailing-characters)))
 (t ""))
- extra (or (and (not habitp) extra) "")
  category (if (symbolp category) (symbol-name category) category)
  level (or level ""))
(if (string-match org-link-bracket-re category)



Re: Using lexical-binding

2021-02-23 Thread Samuel Wales
just a thanks to maintainers of emacs and org including those of you
fixing this and those who wrote the tests.  i had no idea org wasn't
fully lexical yet.  i look forward to whatever good that brings.


On 2/23/21, Kyle Meyer  wrote:
> Kyle Meyer writes:
>
>> Stefan Monnier writes:
> [...]
>>   ;; (org-agenda-list); fails: void-variable date
>>
>> There are also some `make test' failures:
>>
>>   7 unexpected results:
>>  FAILED  test-org-agenda/diary-inclusion
>>  FAILED  test-org-agenda/empty
>>  FAILED  test-org-agenda/one-line
>>  FAILED  test-org-agenda/scheduled-non-todo
>>  FAILED  test-org-agenda/set-priority
>>  FAILED  test-org-agenda/sticky-agenda-name
>>  FAILED  test-org-agenda/sticky-agenda-name-after-reload
>>
>>> or "pretends everything is fine but doesn't do the right thing any
>>> more", or (even better) actual feedback about the code itself and the
>>> approach(es) I chose to use.
>>
>> While I'm not sure I can provide any useful feedback about approaches,
>> I'll see if I can tweak your patch to resolve the org-agenda-list
>> failure or any of the above test failures.
>
> With the changes below on top of your patch, the simple org-agenda-list
> call from above works and the test failures are gone.
>
> diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
> index 16ec70c77..81409d6ac 100644
> --- a/lisp/org-agenda.el
> +++ b/lisp/org-agenda.el
> @@ -5448,27 +5448,29 @@ (defun org-agenda-get-day-entries (file date &rest
> args)
> (setf args (cons :deadline* (delq :deadline* args)
>   ;; Collect list of headlines.  Return them flattened.
>   (let ((case-fold-search nil) results deadlines)
> -   (dolist (arg args (apply #'nconc (nreverse results)))
> - (pcase arg
> -   ((and :todo (guard (org-agenda-today-p date)))
> -(push (org-agenda-get-todos) results))
> -   (:timestamp
> -(push (org-agenda-get-blocks) results)
> -(push (org-agenda-get-timestamps deadlines) results))
> -   (:sexp
> -(push (org-agenda-get-sexps) results))
> -   (:scheduled
> -(push (org-agenda-get-scheduled deadlines) results))
> -   (:scheduled*
> -(push (org-agenda-get-scheduled deadlines t) results))
> -   (:closed
> -(push (org-agenda-get-progress) results))
> -   (:deadline
> -(setf deadlines (org-agenda-get-deadlines))
> -(push deadlines results))
> -   (:deadline*
> -(setf deadlines (org-agenda-get-deadlines t))
> -(push deadlines results)))
> +  (org-dlet
> +  ((date date))
> + (dolist (arg args (apply #'nconc (nreverse results)))
> +   (pcase arg
> + ((and :todo (guard (org-agenda-today-p date)))
> +  (push (org-agenda-get-todos) results))
> + (:timestamp
> +  (push (org-agenda-get-blocks) results)
> +  (push (org-agenda-get-timestamps deadlines) results))
> + (:sexp
> +  (push (org-agenda-get-sexps) results))
> + (:scheduled
> +  (push (org-agenda-get-scheduled deadlines) results))
> + (:scheduled*
> +  (push (org-agenda-get-scheduled deadlines t) results))
> + (:closed
> +  (push (org-agenda-get-progress) results))
> + (:deadline
> +  (setf deadlines (org-agenda-get-deadlines))
> +  (push deadlines results))
> + (:deadline*
> +  (setf deadlines (org-agenda-get-deadlines t))
> +  (push deadlines results
>
>  (defsubst org-em (x y list)
>"Is X or Y a member of LIST?"
> @@ -6710,6 +6712,7 @@ (defun org-agenda-format-item (extra txt &optional
> level category tags dotime
> (get-text-property 1 'effort txt)))
>(tag (if tags (nth (1- (length tags)) tags) ""))
>(time-grid-trailing-characters (nth 2 org-agenda-time-grid))
> +  (extra (or (and (not habitp) extra) ""))
>time
>(ts (when dotime (concat
>  (if (stringp dotime) dotime "")
> @@ -6793,7 +6796,6 @@ (defun org-agenda-format-item (extra txt &optional
> level category tags dotime
>(concat time-grid-trailing-characters "
> ")
>  time-grid-trailing-characters)))
>(t ""))
> -   extra (or (and (not habitp) extra) "")
> category (if (symbolp category) (symbol-name category) category)
> level (or level ""))
>   (if (string-match org-link-bracket-re category)
>
>


-- 
The Kafka Pandemic

Please learn what m

Bug: org-clone-subtree-with-time-shift invalid interval when using hours [9.3 (release_9.3 @ /usr/local/share/emacs/27.1/lisp/org/)]

2021-02-23 Thread Felipe Barros
Running org-clone-subtree-with-time-shift and entering an hourly
interval returns an error that the shift specification is invalid.

For example, entering +8h returns:

user-error: Invalid shift specification +8h

I have also tested with just 8 and with .+8h.

The documentation for org-clone-subtree-with-time-shift states that:

> If the entry has a timestamp, the user will also be prompted for a
> time shift, which may be a repeater as used in time stamps, for
> example ‘+3d’.

And the Info page for Repeated Tasks states that:

> You can use yearly, monthly, weekly, daily and hourly repeat cookies
> by using the ‘y’, ‘w’, ‘m’, ‘d’ and ‘h’ letters.

So, as I couldn’t find a reference to this limitation anywhere, I
believe this is a valid bug.

Emacs : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.23)
of 2020-10-28
Package: Org mode version 9.3 (release_9.3 @ 
/usr/local/share/emacs/27.1/lisp/org/)

--
Felipe Barros

Re: Using lexical-binding

2021-02-23 Thread Stefan Monnier
> With a quick test of a few main commands, burps in one of four.

Excellent, and thanks for the subsequent patch (I don't think I'd have
come up with the move of `extra` on my own).

>> - I believe I have quashed all the compiler warnings (some had nothing
>>   to do with lexical scoping),
>
> Hmm, I wonder why I'm not seeing the ones unrelated to the lexical
> scoping change.

I don't think there were many of them.  As for why there were some:

1- the change away from `org-let` and friends causes some code to become
   visible to the compiler (it was hidden behind the "eval wall" until
   then).

2- I have some extra warnings in my local Emacs.

>>   except for a reference to the function `add-to-diary-list` which I
>>   can't find anywhere (is it some old function that has disappeared,
>>   maybe?).
>
> It looks like add-to-diary-list became an obsolete alias for
> diary-add-to-list in Emacs 23.1 and was removed in Emacs 25.1,
> specifically 3f65970414 (Remove calendar code obsolete since at least
> version 23.1, 2014-10-05).

Ah, thanks for tracking it down, so I guess we can drop this altogether.
And we can also drop the `condition-case` in `org-diary-default-entry`
because that change in calling convention is even older than the change
of name from `add-to-diary-list` to `diary-add-to-list`.


Stefan




Re: Bug: org-clone-subtree-with-time-shift invalid interval when using hours [9.3 (release_9.3 @ /usr/local/share/emacs/27.1/lisp/org/)]

2021-02-23 Thread Kyle Meyer
Felipe Barros writes:

> Running org-clone-subtree-with-time-shift and entering an hourly
> interval returns an error that the shift specification is invalid.
>
> For example, entering +8h returns:
>
> user-error: Invalid shift specification +8h
[...]
> And the Info page for Repeated Tasks states that:
>
>> You can use yearly, monthly, weekly, daily and hourly repeat cookies
>> by using the ‘y’, ‘w’, ‘m’, ‘d’ and ‘h’ letters.
>
> So, as I couldn’t find a reference to this limitation anywhere, I
> believe this is a valid bug.

I'm guessing h was left off for this command because it didn't seem too
useful.  But something like below should work (untested), and I don't
see any particular reason to not support h.

diff --git a/lisp/org.el b/lisp/org.el
index 7d8733448..00596564f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7906,7 +7906,7 @@ (defun org-clone-subtree-with-time-shift (n &optional 
shift)
"")))   ;No time shift
 (doshift
  (and (org-string-nw-p shift)
-  (or (string-match "\\`[ \t]*\\([+-]?[0-9]+\\)\\([dwmy]\\)[ 
\t]*\\'"
+  (or (string-match "\\`[ \t]*\\([+-]?[0-9]+\\)\\([hdwmy]\\)[ 
\t]*\\'"
 shift)
   (user-error "Invalid shift specification %s" shift)
 (goto-char end-of-tree)
@@ -7916,6 +7916,7 @@ (defun org-clone-subtree-with-time-shift (n &optional 
shift)
   (shift-n (and doshift (string-to-number (match-string 1 shift
   (shift-what (pcase (and doshift (match-string 2 shift))
 (`nil nil)
+("h" 'hour)
 ("d" 'day)
 ("w" (setq shift-n (* 7 shift-n)) 'day)
 ("m" 'month)