Re: Two low-priority questions re: design of org-babel-do-load-languages

2023-03-22 Thread Mandar Mitra
Ihor Radchenko wrote (Wed, Mar 22, 2023 at 12:55:31PM +):
> The function `org-babel-do-load-languages' is originally not a generic
> function. It is specifically designed to be used as a :set function for
> `org-babel-load-languages' variable:
> 
> (defcustom org-babel-load-languages '((emacs-lisp . t))
> ...
>   :set 'org-babel-do-load-languages
> ...)
> 
> If you alter `org-babel-load-languages' via customize interface or via
> `setopt', the :set function is automatically called.
> 
> Later, AFAIK, it was also used in the manual as Elisp function.
> Against its original design.

Ok, I understand now. I had missed the 

:set 'org-babel-do-load-languages

That itself answered almost all my questions. Thank you very much for the 
detailed explanation! 

Warm regards,
Mandar.



Two low-priority questions re: design of org-babel-do-load-languages

2023-03-21 Thread Mandar Mitra
Here's the code from my version of org.el (9.5.5, inbuilt in Emacs 28.2).

(defun org-babel-do-load-languages (sym value)
  "Load the languages defined in `org-babel-load-languages'."
  (set-default sym value)
  (dolist (pair org-babel-load-languages)
(let ((active (cdr pair)) (lang (symbol-name (car pair
  (if active
  (require (intern (concat "ob-" lang)))
(fmakunbound
 (intern (concat "org-babel-execute:" lang)))
(fmakunbound
 (intern (concat "org-babel-expand-body:" lang)))

1. Question from purely a programming student's perspective: this seems to be 
doing two things: (i) a set-default on line 3, and (ii) actually loading the 
language support libraries. If one were re-designing from scratch, without 
worrying about backward compatibility, would it be cleaner to separate the 
above into

(defun org-babel-do-load-languages () ; no arguments
  "Load the languages defined in `org-babel-load-languages'."
  (interactive) ; why not?   
  (dolist (pair org-babel-load-languages) ... ))

and

(defun org-babel-update-loaded-languages (value) ; value seems enough, don't 
need sym
  "Update the value of `org-babel-load-languages' and call 
org-babel-do-load-languages"
  (set-default ...))


2. This question 
https://emacs.stackexchange.com/questions/20577/org-babel-load-all-languages-on-demand
 asks: is there any way for org-babel to load support for languages when I 
actually try to use a code block with that language? [as opposed to customising 
org-babel-load-languages or similar]

and the accepted answer suggests the following:

(defadvice org-babel-execute-src-block (around load-language nil activate)
  "Load language if needed" ...

What would be the downside of making load-on-demand the default for all 
languages? Then people wouldn't have to customise org-babel-load-languages.


Apologies if this is not the right list for such "idle curiosity" type 
questions, and thanks for any insights!

-mandar



Re: tab at beginning of line does not indent any more

2021-12-27 Thread Mandar Mitra
On Mon, Dec 27 2021, Jose A. Ortega Ruiz wrote:
> On Mon, Dec 27 2021, Mandar Mitra wrote:
> i was surprised by this (new?) behaviour too.  in my case, i "fixed" it
> with
> 
>   (setq org-adapt-indentation t)
> 
> if memory serves, i found about this variable in the info manual.
> 
> hope this helps,

Yes, this fixed the problem for me too, thanks very much!

In hindsight, seems to me that this may have been intended for people who write 
LaTeX (or other documents) using org-mode.



tab at beginning of line does not indent any more

2021-12-26 Thread Mandar Mitra
I have org 20210929 installed. 

With emacs -Q and (package-initialize) evaluted in the *scratch* buffer, I see 
the following change in behaviour:

* ABCD




I'm fairly sure that, before the last upgrade, I used to get 

* ABCD
  


Have other users observed this? Are you bothered by it? Is this a bug or a 
feature? Note I'm running with emacs -Q for the above, but I get the same 
behaviour with org-cycle-emulate-tab set to t or white. The information I found 
on the net seems to pertain to much older versions. 

Thanks,
Mandar.



Some broken links in pages under https://orgmode.org/worg/org-contrib/babel

2021-10-04 Thread Mandar Mitra
Not sure if this is the right place to report this, but I was trying to learn 
about Org-Babel, and encountered some broken links. Below are a few (not a 
comprehensive list, of course, just some that I happened to encounter).


* https://orgmode.org/worg/org-contrib/babel/intro.html
*** ... relevant section in the 
[[https://orgmode.org/manual/Literal-examples.html][Org manual]] ...
*** please have a look at the 
[[https://orgmode.org/manual/Literal-examples.html][Org-mode manual]] before 
proceeding
*** blocks located in the 
[[https://orgmode.org/worg/org-contrib/babel/library-of-babel.html][Library of 
Babel]] file – raw file at

* https://orgmode.org/worg/org-contrib/babel/uses.html
*** 
[[https://orgmode.org/worg/org-contrib/babel/examples/org-check.html][Checking 
Your Org Mode Configuration]]
*** 
[[https://orgmode.org/worg/org-contrib/babel/examples/data-collection-analysis.html][Data
 Collection and Analysis]]



[O] Skipping multiple timestamps

2013-12-27 Thread Mandar Mitra
I'm using 8.4.2. I have the following in my TODO:

*** [#1] Grading
DEADLINE: 2013-12-30 Mon
2013-12-27 Fri--2013-12-29 Sun

In the custom-set-variables section, I have

 '(org-agenda-skip-additional-timestamps-same-entry t)
 '(org-agenda-skip-deadline-if-done t)
 '(org-agenda-skip-deadline-prewarning-if-scheduled t)
 '(org-agenda-skip-scheduled-if-deadline-is-shown t)
 '(org-agenda-skip-scheduled-if-done t)
 '(org-agenda-skip-timestamp-if-deadline-is-shown t)

Yet, the agenda view shows

  (2/3):nil  [#1] Compiler grading
  In   2 d.:nil  [#1] Compiler grading

I can't figure out why both the lines appear. Can someone please help?

Thanks,
Mandar.


M-x org-version gives: Org-mode version 8.2.4 (8.2.4-dist @
/home/mandar/.emacs.d/org/lisp/)



[O] how to schedule over a range of dates?

2012-04-22 Thread Mandar Mitra
I understand that SCHEDULED is intended to only specify a start date,
but I'd like to be able to use a range of dates with SCHEDULED, and get
consistent behaviour in the Agenda view. This helps when I'm looking at
the Agenda view and trying to find free days to schedule other stuff.

Currently (version 7.8.09), if I have something like

SCHEDULED: 2012-04-21 Sat--2012-04-24 Tue

then the agenda view gives me 2 lines of the form:

  TODO:   Sched. 2x:  [#0] some work
  TODO:   (2/4):  [#0] same work as above

I have org-agenda-skip-additional-timestamps-same-entry set to t, but
perhaps I've misunderstood the intention of this variable?

If I leave just the timestamp (no SCHEDULED), then the behaviour is
almost like what I want, with two exceptions:

1. Once the end date is past, the item disappears from the agenda
   irrespective of whether I've marked it DONE.
   (I have org-agenda-skip-timestamp-if-done set to nil.)
   This does not happen for a SCHEDULED item (which I have to explicitly
   mark DONE).

2. (minor) The corresponding line in the agenda view does not have any
   face associated with it, so I can't customise its appearance.

Is there an easy way of achieving something like the following in the
agenda view?

Sunday 22 April 2012
  TODO:   Sched. 2x (or 2/4): [#0] some work
Monday 23 April 2012 W17
  TODO:   Sched. 3x (or 3/4):  [#0] same work as above

And later, if I've left the work not done, 

On some future date
  TODO:Sched. Nx (or N/4, or similar):  [#0] same work as above


Haven't found an answer in TFM. Grateful for any pointers.

Thanks,
Mandar.



Re: [O] how to schedule over a range of dates?

2012-04-22 Thread Mandar Mitra
Detlef Steuer wrote (Sun, Apr 22, 2012 at 07:05:12PM +0200):
 On Sun, 22 Apr 2012 20:28:08 +0530
 Mandar Mitra mandar.mi...@gmail.com wrote:
 
  Currently (version 7.8.09), if I have something like
  
  SCHEDULED: 2012-04-21 Sat--2012-04-24 Tue
 
 I use it without the SCHEDULED keyword and it does exactly what I need.

This *almost* does what I need, but I don't want the item to disappear
from the agenda simply because the scheduled period has passed. It
should go away only when I explicitly mark the item done.

Is this the behaviour you get?

Thanks,
Mandar.



Re: [O] how to schedule over a range of dates?

2012-04-22 Thread Mandar Mitra
Detlef Steuer wrote (Sun, Apr 22, 2012 at 10:58:15PM +0200):
 
 Sorry, no. It disappears and I agree that this is a problem sometimes with
 cleaning up my org file.
 
 You can try something like
 
 ** TODO testschedule
2012-04-17 Di--2012-04-22 So
DEADLINE: 2012-04-22 So -0d   
 
 It will remind of the item after the deadline, but not before.
 Not sure, just playing around.

Yes, thanks, this kind of works.

I tweaked the variables org-agenda-skip-additional-timestamps-same-entry
and org-agenda-skip-deadline-prewarning-if-scheduled to get the exact
behaviour I want, but they don't seem to work the way I expected.

Will get the daily build and dig around more in the code as and when I
get the time.

Thanks again,
mandar.