Archive done tasks and preserve tree structure

2024-05-19 Thread Naresh Gurbuxani

In my task list, items are grouped under various headings.  For example:

* Reading

** TODO Book 1

** TODO Book 2

* Programming

** TODO assignment 1

** TODO assignment 2


When an item is DONE, I want to archive it such that archive file 
preserves tree structure.  So when Book 1 above is DONE, I want C-c C-x 
C-a to send this subtree to archive file under the heading Reading.  I 
followed the suggestion here:


https://stackoverflow.com/questions/10143959/keeping-the-context-when-archiving-in-emacs-org-mode

My updated tasks file looks like this.

* Reading

:PROPERTIES:
:ARCHIVE: %s_archive::Reading
:END:

** TODO Book 1

** TODO Book 2


Adding this property does not change archive action.  After marking Book 
1 as DONE, then typing C-c C-x C-a sends this subtree to archive file as 
a top level heading.  As a result, my archive file has a long list of 
top level headings.


How can I get the archiving done to preserve tree structure of tasks?  
Any hope for already archived items to be reorganized?


Thanks,

Naresh




Org agenda view does not display correctly

2024-02-26 Thread Naresh Gurbuxani
Until recently, my org agenda view displayed correctly.  Now M-x 
org-agenda a display begins with question marks.  Is there a simple way 
to diagnose and fix this problem?  I am using org mode version 9.6.6 
(default) in emacs version 29.1 on mac.


Thanks,

Naresh

My org agenda display:

Week-agenda (W09):

Monday 26 February 2024 W09
  ???:    Schededuled: TODO xxx    
:ABC:

Tuesday    27 February 2024
  ???:    Scheduled:  TODO yyy     :ABC:
Wednesday  28 February 2024
Thursday   29 February 2024
Friday  1 March 2024
Saturday    2 March 2024
  ???:    Scheduled:  TODO zzz     :FGH::
  ???:    Scheduled:  TODO www     :PQR::
Sunday  3 March 2024




Re: Emacs and org mode in aws

2023-04-16 Thread Naresh Gurbuxani
I understand that, in terminal, images are not displayed in emacs.  Are people 
using other ways to connect to aws where they can see images in emacs?

Sent from my iPhone

> On Apr 16, 2023, at 7:01 AM, Ihor Radchenko  wrote:
> 
> Naresh Gurbuxani  writes:
> 
>> In my Amazon Web Service account, I can launch emacs from the terminal.  
>> Nearly all emacs features work well.  But I miss the ability to view graphs 
>> created by code blocks in org mode.  Have other members found a solution?
> 
> If your terminal Emacs does not support graphics, images will not be 
> displayed.
> 
> -- 
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>


Emacs and org mode in aws

2023-04-15 Thread Naresh Gurbuxani
In my Amazon Web Service account, I can launch emacs from the terminal.  Nearly 
all emacs features work well.  But I miss the ability to view graphs created by 
code blocks in org mode.  Have other members found a solution?

Thanks,
Naresh


Re: R code blocks in org version 9.5

2022-10-19 Thread Naresh Gurbuxani
It seems that org 9.5 has simplified header arguments for R code blocks that 
use grid graphics.

Org 9.4 requires
:results output graphics file

Org 9.5 requires
:results output file

Do other users find the same change?

Sent from my iPhone

> On Oct 19, 2022, at 8:59 AM, Naresh Gurbuxani  
> wrote:
> 
> Thanks to your suggestion, I was able to narrow down the problem.
> 
> My R code blocks work fine in org 9.5. When I plot graph using base graphics 
> in session, it works fine.  The problem is with lattice graphs. With below 
> header variables, code block works fine.
> 
> #+begin_src R :session *R* :results graphics file :file test.png
> library(lattice)
> print(histogram(rnorm(1)))
> #+end_src
> 
> But this does not work.  Emacs hangs.
> 
> #+begin_src R :session *R* :results output graphics file :file test.png
> library(lattice)
> histogram(rnorm(1))
> #+end_src
> 
> I can simply add print command to my code blocks.  Is there an easier 
> solution?
> 
> Naresh
> 
> Sent from my iPhone
> 
>>> On Oct 18, 2022, at 11:14 PM, William Denton  wrote:
>>> 
>>> On 18 October 2022, Naresh Gurbuxani wrote:
>>> 
>>> Recently I started using org version 9.5 with my init.el that worked well 
>>> for org 9.4
>>> 
>>> In org 9.5, I can run stand-alone R code blocks.  But when I try to run 
>>> them in a session, emacs hangs.
>> 
>> I haven't had any problems like that, and I use R session code blocks pretty 
>> much every day.  Can you narrow it down any?  Does even the most basic 
>> block, just adding 1 + 1, not work?  What about with emacs -Q?
>> 
>> 
>> Bill
>> 
>> --
>> William Denton
>> https://www.miskatonic.org/
>> Librarian, artist and licensed private investigator.
>> Toronto, Canada


Re: R code blocks in org version 9.5

2022-10-19 Thread Naresh Gurbuxani
Thanks to your suggestion, I was able to narrow down the problem.

My R code blocks work fine in org 9.5. When I plot graph using base graphics in 
session, it works fine.  The problem is with lattice graphs. With below header 
variables, code block works fine.

#+begin_src R :session *R* :results graphics file :file test.png
library(lattice)
print(histogram(rnorm(1)))
#+end_src

But this does not work.  Emacs hangs.

#+begin_src R :session *R* :results output graphics file :file test.png
library(lattice)
histogram(rnorm(1))
#+end_src

I can simply add print command to my code blocks.  Is there an easier solution?

Naresh

Sent from my iPhone

> On Oct 18, 2022, at 11:14 PM, William Denton  wrote:
> 
> On 18 October 2022, Naresh Gurbuxani wrote:
> 
>> Recently I started using org version 9.5 with my init.el that worked well 
>> for org 9.4
>> 
>> In org 9.5, I can run stand-alone R code blocks.  But when I try to run them 
>> in a session, emacs hangs.
> 
> I haven't had any problems like that, and I use R session code blocks pretty 
> much every day.  Can you narrow it down any?  Does even the most basic block, 
> just adding 1 + 1, not work?  What about with emacs -Q?
> 
> 
> Bill
> 
> --
> William Denton
> https://www.miskatonic.org/
> Librarian, artist and licensed private investigator.
> Toronto, Canada


R code blocks in org version 9.5

2022-10-18 Thread Naresh Gurbuxani
Recently I started using org version 9.5 with my init.el that worked well for 
org 9.4

In org 9.5, I can run stand-alone R code blocks.  But when I try to run them in 
a session, emacs hangs.

Have you seen this problem? Is there a solution?

Thanks,
Naresh

Sent from my iPhone


Re: Efficiently reuse code in org babel with R

2022-07-07 Thread Naresh Gurbuxani
Thanks for providing a detailed solution.  

I also learned from other responses.

Sent from my iPhone

> On Jul 7, 2022, at 4:42 AM, Jeremie Juste  wrote:
> 
> Hello Naresh,
> 
> Many thanks for sharing.
> If I'm looking for efficiency, I tend not to use noweb and use an R
> session instead.
> 
> One reason is that caching does not work with noweb
> 
> #+name: test
> #+begin_src R  :cache yes :session *R*
> Sys.sleep(10)
>  a <- 1
> #+end_src
> 
> #+RESULTS[36c41617bf9aa447ecc28fca8207eab38340d418]: test
> : 1
> 
> 
> #+name: add1
> #+begin_src R :noweb yes :cache no :session *R*
> <>
> a + 1
> #+end_src
> 
> #+RESULTS: add1
> : 2
> 
> 
> I would proceed in the following way
> 
>#+name: connection
>#+begin_src R :exports results :results output :session *R* 
> ## my code here
>#+end_src
> 
>#+begin_src R :exports results :results output graphics file
>:session *R* :file figures/fig1.png
>## my code here
>#+end_src
> 
>#+begin_src R :exports results output graphics file :file figures/fig2.png 
> :session *R*
>## my code here
>#+end_src
> 
> this will require running the first code chunk once only to run the rest
> 
>> On Thursday,  7 Jul 2022 at 09:22, Greg Minshall wrote:
>> you'd have to be careful to not get bitten by the code
>> *not* being evaluated, and by it being evaluated too often.  (probably
>> too clever by half.)
> 
> The comment of Greg is very relevant here as you'll have to manage
> updates yourself, and it can get complex very quickly. A potential
> pitfall is when the tables in database you are referring to, change.
> So in this case I would avoid using :cache yes in the first code chunk
> 
> 
> I'm also tempted to adopt the following organization
> 
>* setup table
>#+name: connection
>#+begin_src R :exports results :results output :session *R* 
> ## my code here
>#+end_src
> 
>* output graphs
> :PROPERTIES:
> :header-args:R: :exports results output graphics file  :session *R*
> :END:
> 
>#+begin_src R  :file figures/fig2.png
>## my code here
>#+end_src
> 
>#+begin_src R  :file figures/fig1.png 
>## my code here
>#+end_src
> 
> then I would use (org-babel-execute-subtree) which is bound to C-c C-v
> s on the subheading output graphs to regenerate the graphs.
> 
> 
> HTH,
> Jeremie


Efficiently reuse code in org babel with R

2022-07-06 Thread Naresh Gurbuxani
I want to source some data from databases, then use this data in various 
blocks.  I am looking for the most efficient way to achieve this.  In below 
blocks, is the code in block ``connection'' executed thrice (economy of code 
but no saving of time) or is it only executed once then used twice?  If the 
code is run thrice, is there another way to create code blocks so that the code 
is executed only once?

Thanks,
Naresh

#+name: connection
#+begin_src R :exports results :results output
  ## my code here
#+end_src

#+begin_src R :exports results :results output graphics file :file 
figures/fig1.png
<>
## my code here
#+end_src

#+begin_src R :exports results output graphics file :file figures/fig2.png
<>
## my code here
#+end_src


Re: org-babal-R-command

2022-06-28 Thread Naresh Gurbuxani
It works!  You made my day.

Thanks,
Naresh

Sent from my iPhone

> On Jun 28, 2022, at 2:40 PM, Bruno Barbier  wrote:
> 
> Naresh Gurbuxani  writes:
> 
>> In my windows computer, R is installed at c:/Program Files/Microsoft/R 
>> Open/R-3.5.1/bin
>> 
>> Notice two spaces: “Program Files” and “R Open”
>> 
>> How can I set the variable org-babel-R-command?
>> 
>> I tried
>> (setq org-babel-R-command “c:/Progra~1/Microsoft/R Open/R-3.5.1/bin/R.exe 
>> —slave —no-save”)
>> 
>> But the space between R and Open is a problem.  What is the solution?
> 
> Maybe this will work (quoting the path between "):
> 
>  (setq org-babel-R-command “\"c:/Progra~1/Microsoft/R 
> Open/R-3.5.1/bin/R.exe\" —slave —no-save”)
> 
> 
> 
>> 
>> Thanks,
>> Naresh
>> 
>> Sent from my iPhone


org-babal-R-command

2022-06-28 Thread Naresh Gurbuxani
In my windows computer, R is installed at c:/Program Files/Microsoft/R 
Open/R-3.5.1/bin

Notice two spaces: “Program Files” and “R Open”

How can I set the variable org-babel-R-command?

I tried
(setq org-babel-R-command “c:/Progra~1/Microsoft/R Open/R-3.5.1/bin/R.exe 
—slave —no-save”)

But the space between R and Open is a problem.  What is the solution?

Thanks,
Naresh

Sent from my iPhone