Re: Emacs as an Org LSP server

2020-12-14 Thread Neil Jerram
Yes, thanks, I'm seeing the picture now.  I guess that some of those things
would require extensions to the LSP standard/protocol, as well as just
implementation, wouldn't they?

On Mon, 14 Dec 2020 at 17:31, TEC  wrote:

> Hi Neil,
>
> Ah, I see what you’re getting at now. I’ll try to give you an idea of what
> I think could apply.
>
>- Provide nice text manipulation actions, e.g. structural editing
>- Completion, with company
>- Org Export
>- Run Babel blocks
>- Org syntax highlighting (potentially)
>- Folding (maybe)
>- All the nice stuff like table alignment, checkbox state propagation…
>
> Does that help?
>
> All the best,
> *Timothy*
>
> * From*: Neil Jerram <%22neil+jerram%22+%3cneiljer...@gmail.com%3E>
> * Subject*: Re: Emacs as an Org LSP server
> * To*: TEC <%22tec%22+%3ctecos...@gmail.com%3E>
> * Cc*: "org-mode-email" 
> * Date*: Tue, 15 Dec 2020 01:22:55 +0800
> I'm afraid things still aren't clear for me.  Is there a reason it's so
> hard to give a concrete example?
>
> If I try to analogise from how LSP works for golang, I believe the LSP
> server does things like
> - complete symbol beginning with "Xyz"
> - tell me where so-and-so function is defined (e.g. so that the client
> editor can jump to it).
> I'm not sure if operations like that make sense for Org.
>
> Another possibility might be interacting, from a 3rd party editor, with a
> body of Org content that has been primarily written and managed in Emacs.
> If so, what would those interactions be?  Marking a task as done?
> Something more complex than that?
>
> Or is it like: 3rd party editor opens an Org file and the user types some
> .  Editor asks the LSP server (Emacs) "what does
>  mean?", and the server replies "it means the Org
> entry should now look like this: ..."
>
>
> On Mon, 14 Dec 2020 at 15:58, TEC  wrote:
>
>> Hi Neil,
>>
>> Good to hear that you did take a look at the readme .
>>
>> You can think of the LSP as a specification for cross-editor/IDE
>> extensions. The intent of this is to make some of Org’s functionality
>> accessible to the ~95% of people who don’t use Emacs, by hooking into Emacs
>> itself.
>>
>> Does that clear things up for you? You can also see
>> https://langserver.org/.
>>
>> All the best,
>> *Timothy*
>>
>> * From*: Neil Jerram <%22neil+jerram%22+%3cneiljer...@gmail.com%3E>
>> * Subject*: Re: Emacs as an Org LSP server
>> * To*: TEC <%22tec%22+%3ctecos...@gmail.com%3E>
>> * Cc*: "org-mode-email" 
>> * Date*: Mon, 14 Dec 2020 23:46:12 +0800
>> Thanks Timothy.  I did read the README, but I'm afraid I still can't
>> quite picture a specific use.
>>
>>
>> On Mon, 14 Dec 2020 at 15:28, TEC  wrote:
>>
>>> Hi Neil,
>>>
>>> I’m going to quote you the readme from the linked github repo:
>>>
>>> Allow the unwashed masses to use Org, without using Emacs, using Emacs.
>>>
>>> Here’s the image from the readme [image: model.png]
>>>
>>> And here’s the first line from the first result of a google search for
>>> ”:
>>>
>>> The Language Server Protocol (LSP) defines the protocol used between an
>>> editor or IDE and a language server that provides language features
>>> like auto complete, go to definition, find all references etc.
>>>
>>> That should give you an idea of the intent here.
>>>
>>> All the best,
>>> *Timothy*
>>>
>>> * From*: Neil Jerram <%22neil+jerram%22+%3cneiljer...@gmail.com%3E>
>>> * Subject*: Re: Emacs as an Org LSP server
>>> * To*: TEC <%22tec%22+%3ctecos...@gmail.com%3E>
>>> * Cc*: "org-mode-email" 
>>> * Date*: Mon, 14 Dec 2020 19:41:05 +0800
>>> Could you describe a use case?  Apologies if I missed this in earlier
>>> threads.
>>>
>>>
>>> On Sun, 13 Dec 2020 at 10:44, TEC  wrote:
>>>
>>>>
>>>> A little progress update.
>>>>
>>>> https://github.com/tecosaur/org-lsp now exists.
>>>>
>>>> I have no idea what I'm doing, so if anyone has feedback on the current
>>>> idea, that would be much appreciated.
>>>>
>>>> TEC  writes:
>>>>
>>>> > Hi Everyone,
>>>> >
>>>> > From the Org standardisation effort the idea of using Emacs as the
>>>> basis
>>>> > of an LSP server for Org has been mentioned a few times.
>>&g

Re: Emacs as an Org LSP server

2020-12-14 Thread Neil Jerram
I'm afraid things still aren't clear for me.  Is there a reason it's so
hard to give a concrete example?

If I try to analogise from how LSP works for golang, I believe the LSP
server does things like
- complete symbol beginning with "Xyz"
- tell me where so-and-so function is defined (e.g. so that the client
editor can jump to it).
I'm not sure if operations like that make sense for Org.

Another possibility might be interacting, from a 3rd party editor, with a
body of Org content that has been primarily written and managed in Emacs.
If so, what would those interactions be?  Marking a task as done?
Something more complex than that?

Or is it like: 3rd party editor opens an Org file and the user types some
.  Editor asks the LSP server (Emacs) "what does
 mean?", and the server replies "it means the Org
entry should now look like this: ..."


On Mon, 14 Dec 2020 at 15:58, TEC  wrote:

> Hi Neil,
>
> Good to hear that you did take a look at the readme .
>
> You can think of the LSP as a specification for cross-editor/IDE
> extensions. The intent of this is to make some of Org’s functionality
> accessible to the ~95% of people who don’t use Emacs, by hooking into Emacs
> itself.
>
> Does that clear things up for you? You can also see
> https://langserver.org/.
>
> All the best,
> *Timothy*
>
> * From*: Neil Jerram <%22neil+jerram%22+%3cneiljer...@gmail.com%3E>
> * Subject*: Re: Emacs as an Org LSP server
> * To*: TEC <%22tec%22+%3ctecos...@gmail.com%3E>
> * Cc*: "org-mode-email" 
> * Date*: Mon, 14 Dec 2020 23:46:12 +0800
> Thanks Timothy.  I did read the README, but I'm afraid I still can't quite
> picture a specific use.
>
>
> On Mon, 14 Dec 2020 at 15:28, TEC  wrote:
>
>> Hi Neil,
>>
>> I’m going to quote you the readme from the linked github repo:
>>
>> Allow the unwashed masses to use Org, without using Emacs, using Emacs.
>>
>> Here’s the image from the readme [image: model.png]
>>
>> And here’s the first line from the first result of a google search for
>> ”:
>>
>> The Language Server Protocol (LSP) defines the protocol used between an
>> editor or IDE and a language server that provides language features like
>> auto complete, go to definition, find all references etc.
>>
>> That should give you an idea of the intent here.
>>
>> All the best,
>> *Timothy*
>>
>> * From*: Neil Jerram <%22neil+jerram%22+%3cneiljer...@gmail.com%3E>
>> * Subject*: Re: Emacs as an Org LSP server
>> * To*: TEC <%22tec%22+%3ctecos...@gmail.com%3E>
>> * Cc*: "org-mode-email" 
>> * Date*: Mon, 14 Dec 2020 19:41:05 +0800
>> Could you describe a use case?  Apologies if I missed this in earlier
>> threads.
>>
>>
>> On Sun, 13 Dec 2020 at 10:44, TEC  wrote:
>>
>>>
>>> A little progress update.
>>>
>>> https://github.com/tecosaur/org-lsp now exists.
>>>
>>> I have no idea what I'm doing, so if anyone has feedback on the current
>>> idea, that would be much appreciated.
>>>
>>> TEC  writes:
>>>
>>> > Hi Everyone,
>>> >
>>> > From the Org standardisation effort the idea of using Emacs as the
>>> basis
>>> > of an LSP server for Org has been mentioned a few times.
>>> >
>>> > I thought this deserved it's own thread so here it is :)
>>> >
>>> > I'm quite keen to investigate the viability of this idea.
>>> > Some key questions that I think need addressing are:
>>> > 1. How can we 'package' Emacs into an LSP client?
>>> > 2. Assuming we use some language as the basis for the host how do  we
>>> >want to pick it? LSP library? Lisp? Are there any outstanding
>>> >contenders.
>>> > 3. How much effort is involved? Is it worth it to try to make Org  more
>>> >approachable* (without Emacs)?
>>> >
>>> > Lastly, but perhaps even more crucially --- who would be interested in
>>> > working on this? I certainly am, but this feels like something that
>>> > would be more viable with a small working group.
>>> >
>>> > Who's interested?
>>> >
>>> > Timothy.
>>> >
>>> >
>>> > * I can't help but think that this hypothetical LSP server may   serve
>>> as
>>> >  a 'gateway drug' to Org in Emacs 
>>>
>>>
>>>


Re: Emacs as an Org LSP server

2020-12-14 Thread Neil Jerram
Thanks Timothy.  I did read the README, but I'm afraid I still can't quite
picture a specific use.


On Mon, 14 Dec 2020 at 15:28, TEC  wrote:

> Hi Neil,
>
> I’m going to quote you the readme from the linked github repo:
>
> Allow the unwashed masses to use Org, without using Emacs, using Emacs.
>
> Here’s the image from the readme [image: model.png]
>
> And here’s the first line from the first result of a google search for
> ”:
>
> The Language Server Protocol (LSP) defines the protocol used between an
> editor or IDE and a language server that provides language features like
> auto complete, go to definition, find all references etc.
>
> That should give you an idea of the intent here.
>
> All the best,
> *Timothy*
>
> * From*: Neil Jerram <%22neil+jerram%22+%3cneiljer...@gmail.com%3E>
> * Subject*: Re: Emacs as an Org LSP server
> * To*: TEC <%22tec%22+%3ctecos...@gmail.com%3E>
> * Cc*: "org-mode-email" 
> * Date*: Mon, 14 Dec 2020 19:41:05 +0800
> Could you describe a use case?  Apologies if I missed this in earlier
> threads.
>
>
> On Sun, 13 Dec 2020 at 10:44, TEC  wrote:
>
>>
>> A little progress update.
>>
>> https://github.com/tecosaur/org-lsp now exists.
>>
>> I have no idea what I'm doing, so if anyone has feedback on the current
>> idea, that would be much appreciated.
>>
>> TEC  writes:
>>
>> > Hi Everyone,
>> >
>> > From the Org standardisation effort the idea of using Emacs as the basis
>> > of an LSP server for Org has been mentioned a few times.
>> >
>> > I thought this deserved it's own thread so here it is :)
>> >
>> > I'm quite keen to investigate the viability of this idea.
>> > Some key questions that I think need addressing are:
>> > 1. How can we 'package' Emacs into an LSP client?
>> > 2. Assuming we use some language as the basis for the host how do  we
>> >want to pick it? LSP library? Lisp? Are there any outstanding
>> >contenders.
>> > 3. How much effort is involved? Is it worth it to try to make Org  more
>> >approachable* (without Emacs)?
>> >
>> > Lastly, but perhaps even more crucially --- who would be interested in
>> > working on this? I certainly am, but this feels like something that
>> > would be more viable with a small working group.
>> >
>> > Who's interested?
>> >
>> > Timothy.
>> >
>> >
>> > * I can't help but think that this hypothetical LSP server may   serve
>> as
>> >  a 'gateway drug' to Org in Emacs 
>>
>>
>>


Re: Emacs as an Org LSP server

2020-12-14 Thread Neil Jerram
Could you describe a use case?  Apologies if I missed this in earlier
threads.


On Sun, 13 Dec 2020 at 10:44, TEC  wrote:

>
> A little progress update.
>
> https://github.com/tecosaur/org-lsp now exists.
>
> I have no idea what I'm doing, so if anyone has feedback on the current
> idea, that would be much appreciated.
>
> TEC  writes:
>
> > Hi Everyone,
> >
> > From the Org standardisation effort the idea of using Emacs as the basis
> > of an LSP server for Org has been mentioned a few times.
> >
> > I thought this deserved it's own thread so here it is :)
> >
> > I'm quite keen to investigate the viability of this idea.
> > Some key questions that I think need addressing are:
> > 1. How can we 'package' Emacs into an LSP client?
> > 2. Assuming we use some language as the basis for the host how do  we
> >want to pick it? LSP library? Lisp? Are there any outstanding
> >contenders.
> > 3. How much effort is involved? Is it worth it to try to make Org  more
> >approachable* (without Emacs)?
> >
> > Lastly, but perhaps even more crucially --- who would be interested in
> > working on this? I certainly am, but this feels like something that
> > would be more viable with a small working group.
> >
> > Who's interested?
> >
> > Timothy.
> >
> >
> > * I can't help but think that this hypothetical LSP server may   serve as
> >  a 'gateway drug' to Org in Emacs 
>
>
>


Re: Org-GCal ?

2020-12-01 Thread Neil Jerram
On Mon, 30 Nov 2020 at 21:19, David Masterson 
wrote:

> Neil Jerram  writes:
>
> > On Mon, 30 Nov 2020 at 00:49, David Masterson <
> dsmasterson92...@outlook.com> wrote:
> >
> >  Anyone using org-gcal?  I just got it hooked up and am now trying to
> >  figure out how to fit it into my workflow.  My issue is (CMIAW) that
> >  org-gcal seems to have a 1 to 1 connection between a Google calendar and
> >  an Org file (org-gcal-file-alist).
> >
> > That was my observation too: it generates and maintains one .org file
> per Google calendar.
> >
> > How does that create a problem for you?
>
> My workflow has a number of Org files (one per ~project) with
> tasks/events related to the project in the associated Org file. Agenda
> can pull all the tasks together, so it seemed a natural workflow.  I
> wasn't thinking of creating a calendar per project as they are not
> worthy of that -- one calendar would do to share my events with the
> family.
>

Oh, I think I see, you're interested in syncing back from Org to Google,
and you'd like to do that from your multiple existing Org files to a single
Google calendar.

I'm sorry, I've only used org-gcal in the other direction, and didn't know
if it could sync back to Google.  But it sounds like org-caldav might be a
better fit for you.

Best wishes,
Neil


Re: Org-GCal ?

2020-11-30 Thread Neil Jerram
On Mon, 30 Nov 2020 at 00:49, David Masterson 
wrote:

> Anyone using org-gcal?  I just got it hooked up and am now trying to
> figure out how to fit it into my workflow.  My issue is (CMIAW) that
> org-gcal seems to have a 1 to 1 connection between a Google calendar and
> an Org file (org-gcal-file-alist).


That was my observation too: it generates and maintains one .org file per
Google calendar.

How does that create a problem for you?


Re: consistent behavior across babel languages

2020-11-26 Thread Neil Jerram
On Wed, 25 Nov 2020 at 05:20, ian martins  wrote:

> Something I've found challenging is the inconsistency between babel
> languages. It makes it difficult for a babel user to get a source
> block to do what they want, or for a babel developer to even know what
> correct behavior is.
>
> I'm not sure if anything can be done since changes will likely break
> existing behavior, but it's good to at least know what the rule is and
> where the exceptions to the rule are. To that end I started a page on
> worg [1] to document current behavior for actions taken across babel
> languages.
>
> [1] https://orgmode.org/worg/org-contrib/babel/languages/lang-compat.html


FWIW, I did not understand the "functional" and "scripting" terms that you
use on this page.

I've understood now, from
https://orgmode.org/worg/org-contrib/babel/intro.html, that you mean
"results: value" and "results: output".  For me it would be better if you
said that instead of "functional" and "scripting", as the former is what I
can actually type in my Org files.


Re: consistent behavior across babel languages

2020-11-26 Thread Neil Jerram
On Wed, 25 Nov 2020 at 05:20, ian martins  wrote:

> Something I've found challenging is the inconsistency between babel
> languages. It makes it difficult for a babel user to get a source
> block to do what they want, or for a babel developer to even know what
> correct behavior is.
>
> I'm not sure if anything can be done since changes will likely break
> existing behavior, but it's good to at least know what the rule is and
> where the exceptions to the rule are. To that end I started a page on
> worg [1] to document current behavior for actions taken across babel
> languages.
>
> [1] https://orgmode.org/worg/org-contrib/babel/languages/lang-compat.html


Wonderful, thank you.  I have been thinking it would be nice to have a test
suite along these lines, but detailed doc like this is more feasible and
maintainable.

When time permits I will work on adding Scheme to this page.

Best wishes,
Neil


Re: [PATCH] Remove redundant 'function's around lambda

2020-11-19 Thread Neil Jerram
On Thu, 19 Nov 2020 at 14:51, Stefan Kangas  wrote:

> Neil Jerram  writes:
>
> >> I've been working on removing redundant `function' around `lambda' in
> >> Emacs core,
> >
> > I'm slightly curious about the history and reasoning around this.  If I
> > understand correctly, (lambda ...) on its own has always worked, and it's
> > never been strictly necessary to add (quote ...) or (function ...) around
> > it.  Then sometime (Emacs 19 or later, I think) it started being
> > recommended to use (function ...).
> >
> > Do you know why that recommendation started, and should I understand that
> > the reasoning for it has now evaporated?
>
> Correct, there is no reason to do this.
>
> I don't know the history here, and there are people on emacs-devel that
> would know better.
>
> I _suspect_ that the byte-compiler first got the capability to optimize
> calls to anonymous functions, but that it required to explicitly marked
> as such with `function'.  Later, it grew the capability to recognize
> lambda as such automatically.  But I don't know if that is correct; it's
> just a guess.  In any case, they are no longer needed as lambda and
> lambda+function are equivalent.
>
> (Note that the worst thing here is to do `(quote (lambda ...))' as that
> defeats byte-compiler optimizations altogether.)
>

Many thanks Stefan!


Re: [PATCH] Remove redundant 'function's around lambda

2020-11-19 Thread Neil Jerram
On Tue, 17 Nov 2020 at 17:08, Stefan Kangas  wrote:

> I've been working on removing redundant `function' around `lambda' in
> Emacs core,


I'm slightly curious about the history and reasoning around this.  If I
understand correctly, (lambda ...) on its own has always worked, and it's
never been strictly necessary to add (quote ...) or (function ...) around
it.  Then sometime (Emacs 19 or later, I think) it started being
recommended to use (function ...).

Do you know why that recommendation started, and should I understand that
the reasoning for it has now evaporated?

Best wishes,
 Neil


Re: org-tables with monetary amounts

2020-09-26 Thread Neil Jerram
On Fri, 25 Sep 2020 at 12:36, Daniele Nicolodi  wrote:

> On 25/09/2020 11:25, Neil Jerram wrote:
> > Aside: Perhaps I'm misunderstanding them, but none of the open source
> > tools, including (h)ledger, seem to be of much help here.
> > - They focus on data entry and reconciliation, which I don't need as I'm
> > happy to download and use OFX files from my bank.
>
> I don't think the focus of ledger (or hledger, or beancount) is on data
> entry. Actually beancount even has an ingest framework to deal with
> importing data from bank statements and other sources.
>

Fair enough.  But I think what I really meant is that I would prefer tools
that can work directly on the data sources that I already have - i.e. OFX
files from my bank - without needing to convert those first into their own
file format.  To put it another way, if the file format per se is not an
important feature, what are the ways that the plain text accounting tools
add the most value?  The value I'm interested in is in (a) categorizing and
(b) reporting; but I haven't yet seen any of these tools having the kind of
intelligence, out of the box, that I'm looking for in those areas.


> > - They don't offer anything intelligent and automated for automatically
> > categorizing transactions.
>
> For beancount there is smart_importer
> https://github.com/beancount/smart_importer and it is not difficult to
> hack your own. I indeed use my own tool based on a simple machine
> learning algorithm implemented by scikit-learn (Python).
>

Thanks, but if I'm using a tool, I'd rather it had the intelligence
built-in (with appropriate configurability).  If I have to code...  well, I
have already done it myself.


>
> > - They don't have a sophisticated representation of a budget, and
> > reporting against that.
>
> I am not sure what you mean by "sophisticated representation of a
> budged". Once you categorize expenses in a (hierarchical) set of
> expenses accounts it is trivial to use something like beancount to check
> the balances against a budget.
>

I'm still thinking this through.  The simplest kind of budget would be a
number for each category, for the whole year.  But then you don't have a
very detailed evaluation if, say, you're looking at your actual expenditure
and it's only February.  Some bits of budget might only be expected on a
few specific dates; others are regular every month; others could be monthly
but varying in amount; others are allowances that could happen any time.
It seems to me that when you can predict particular expenses, it's better
if you can express those precisely and that an "expenditure against budget"
report can take those into account as well as the allowance pots.


>
> > Do you know of a good forum (other than this!) for discussing such
> points?
>
> The ledger-cli and the beancount mailing lists may be the right places
> to discuss the use of these tools.
>

Thank you.  I wish there was also a unified plaintextaccounting.org mailing
list, as I don't think my questions are for a specific tool.


>
> > I've attached mine, in case you read Scheme and there's more detail in
> > there that is of interest.
>
> My use case is very different, thus something external to org-mode is
> not really useful.
>
> Maybe an example would clarify what my use case is. I am working on a
> research proposal where I need to provide details about funding
> allocation in a few different categories over a certain amount of years.
> In my document this is an org-table. Right now I have two choices to
> edit the table:
>
> - have monetary amounts in the cells (example "123.00 EUR") and do the
> match externally,
>
> - do the math in the org-table, specify the right formatting for all
> computed cells, and still have to post-process it to add the currency
> symbols to the input cells.
>
> Either solution is sub-optimal. It would be nice if org-tables could
> support monetary fields as they support time fields.
>

Yes indeed.  The answer about Calc units sounded as though it could address
this - is there still a gap in applying it to your case?

Alternatively I believe an org-table formula can invoke arbitrary Lisp, so
in principle you could code a function to parse all the inputs (including
units), do the math needed, and then format the output with the desired
unit.

Best wishes,
Neil



>
> Cheers,
> Dan
>


Re: org-tables with monetary amounts

2020-09-25 Thread Neil Jerram
On Tue, 22 Sep 2020 at 17:05, Daniele Nicolodi  wrote:

> Hello,
>

Hi Daniele...


>
> I often use org-tables to work with monetary amounts.


Me too.  I use Org mode plus Scheme code to try to analyze my bank
statements and compare them against a budget.  Org is a convenient form for
specifying the inputs - e.g. the names of OFX files to read, and string
matches for how I want to categorize the transactions - and for displaying
the results.

Aside: Perhaps I'm misunderstanding them, but none of the open source
tools, including (h)ledger, seem to be of much help here.
- They focus on data entry and reconciliation, which I don't need as I'm
happy to download and use OFX files from my bank.
- They don't offer anything intelligent and automated for automatically
categorizing transactions.
- They don't have a sophisticated representation of a budget, and reporting
against that.
Do you know of a good forum (other than this!) for discussing such points?


> It would be very
> nice to have a couple of functionalities common in this domain:
>
> - fixed precision arithmetic, namely derive the precision of the results
> from the precision of the arguments (I think that calc can do this),
>

In my Scheme code, I convert between strings and pence:

;; In this file, an amount at rest is always represented as a string
;; with 2 decimal places.  Convert from that to an integer number of
;; pence:

(define (amount->pence amount)
  (inexact->exact (round (* 100 (string->number amount)

;; And the reverse:

(define (pence->amount pence)
  (format-2dp (/ (exact->inexact pence) 100)))


>
> - support for parsing numbers followed by currencies,
>
> - correct alignment for monetary values.
>
> I had a quick look around, but I haven't found anything that implements
> those things. Has anyone some secret code that they would like to share?
>

I've attached mine, in case you read Scheme and there's more detail in
there that is of interest.

Best wishes,
Neil

(add-to-load-path (in-vicinity (getenv "HOME") "ossaulib"))

(use-modules (ice-9 format)
	 (ice-9 regex)
	 (ossau ofx)
	 (srfi srfi-1)
	 (sxml simple)
	 (sxml match)
	 (srfi srfi-19))

;; (ossau ofx) provides 'get-transactions' to read transactions from a
;; single OFX file.  Let's build on that to read transactions from
;; multiple OFX files, assuming that the files given are already
;; ordered by date, so that the transactions in them follow on from
;; each other.

(define (read-transactions . files)
  (apply append (map get-transactions files)))

;; Return a date that is 00:00 UTC on the day of the given transaction.

(define (tx-date tx)
  (let ((d (string->date (tx:date tx) "~Y~m~d")))
(make-date 0 0 0 0			; nsec sec min hr
	   (date-day d)
	   (date-month d)
	   (date-year d)
	   0			; zone offset, i.e. UTC
	   )))

;; Given a date, return a date that is the start of the next month.

(define (start-of-following-month d)
  (if (= (date-month d) 12)
  (make-date 0 0 0 0		; nsec sec min hr
		 1			; day of month
		 1			; month of year
		 (+ (date-year d) 1)
		 0			; zone offset, i.e. UTC
		 )
  (make-date 0 0 0 0		; nsec sec min hr
		 1			; day of month
		 (+ (date-month d) 1)
		 (date-year d)
		 0			; zone offset, i.e. UTC
		 )))

;; Given a date, return a date that is exactly N days later.

(define (n-days-later d n)
  (julian-day->date (+ (date->julian-day d) n)))

;; Compare two dates.

(define (date-before? d1 d2)
  (< (date->julian-day d1) (date->julian-day d2)))

;; Given a series of transactions, partition them into an alist of
;; smaller series according to time periods calculated from START-DATE
;; and NEXT-START-DATE-PROC: the start of the first period is
;; START-DATE, the start of the second period is (NEXT-START-DATE-PROC
;; START-DATE), the start of the third period is (NEXT-START-DATE-PROC
;; (NEXT-START-DATE-PROC START-DATE)), and so on.  In the returned
;; alist, each entry is (DATE . TX-LIST), where DATE is the exclusive
;; period end date (== the start date of the following period) for the
;; transactions in TX-LIST.

(define (partition-by-period txs start-date next-start-date-proc)
  (let loop ((txs txs)
	 (partition-end-date-exclusive (next-start-date-proc start-date))
	 (previous-partitions '())
	 (current-partition '()))
(if (null? txs)
	(reverse (acons partition-end-date-exclusive current-partition previous-partitions))
	(let* ((tx (car txs)))
	  (if (date-before? (tx-date tx) partition-end-date-exclusive)
	  ;; This transaction is within the current partition.
	  (loop (cdr txs)
		partition-end-date-exclusive
		previous-partitions
		(cons tx current-partition))
	  ;; This transaction is after the current partition.  But
	  ;; bear in mind that it might not be in the immediate
	  ;; next partition either.  The safest thing to do is to
	  ;; close out the current partition, advance the limit
	  ;; 

Re: Shift select

2020-03-06 Thread Neil Jerram
On Fri, 6 Mar 2020 at 08:17, Josh  wrote:

> One more question,
>
> I turned on shift-select with the following line in my .emacs. It works,
> but of course, on headings, it doesn't work because it changes the TODO
> status of the heading (shift left-right) or the priority of the heading
> (shift up-down). How would I make shift select still work on headings, and
> assign those other functions to other bindings?
>
> (setq org-support-shift-select t)


The help text for this variable (C-h v org-support-shift-select) includes:

"If you set this variable to the symbol ‘always’, then the keys
will not be special in headlines, property lines, and item lines,
to make shift selection work there as well.  If this is what you
want, you can use the following alternative commands:
‘C-c C-t’ and ‘C-c ,’ to change TODO state and priority,
‘C-u C-u C-c C-t’ can be used to switch TODO sets,
‘C-c -’ to cycle item bullet types,
and properties can be edited by hand or in column view."

Does that answer your question?

Best wishes,
 Neil


Re: C-c C-c to close the buffer in *Org Src ...* buffers

2020-01-31 Thread Neil Jerram
On Fri, 31 Jan 2020 at 11:05, Bastien  wrote:

> Hi all,
>
> I'd like to make  an equivalent to  in Org Src buffers
> so that hitting  will close the buffer, which seems natural.
>
> WDYT?
>

SGTM.

Best wishes,
   Neil


Re: emacs build command for org-files

2020-01-27 Thread Neil Jerram
On Sun, 26 Jan 2020 at 18:11, John Kitchin  wrote:

> Hi everyone,
>
> This is only semi-on-topic. I am looking for something like M-x compile
> for my org-files, but I don't want it to necessarily use Makefiles. I am
> looking for suggestions of existing solutions to this, or thoughts on how
> to implement this.
>
> Actually, if it was possible to get M-x compile to run an elisp function
> instead of a make file, it might be all I need, but it looks like it runs
> shell commands.
>

So how about typing "M-: " instead of "M-x compile" ?  Why involve
other layers when Emacs can directly evaluate elisp?

Best wishes,
Neil


Re: ob-scheme haunted source code block?

2020-01-21 Thread Neil Jerram
On Fri, 17 Jan 2020 at 12:01, Joost Kremers 
wrote:

> Hi list,
>
> I've been learning some Scheme recently and decided to use Org
> mode and babel so I could document my progress, keep notes, etc.
> together with the code I write. I also installed the geiser
> package to work with Scheme source files directly.
>
> This all worked perfectly, until I made the (apparent) mistake of
> typing =C-c C-c= on an expression while editing a source code
> block. That is, I had pressed =C-c '= in an Org buffer on a source
> block and in the editing buffer that popped up, I hit =C-c C-c=
> (bound to =geiser-eval-definition=) on a particular function (well
> procedure...) definition.
>
> From that moment on, that particular procedure definition seems
> haunted. Whenever I evaluate a source block containing it from
> within an Org file, the associated REPL is doomed. It takes about
> 30 seconds for the evaluation to complete, during which time Emacs
> seems to hang (no CPU activity, just waiting). Any further
> interaction with the REPL from that point on, either from other
> source blocks in the same file (all source blocks in it use the
> same session) or in the REPL buffer directly, causes the same
> hang.
>
> I can `C-g` out of the hang, but this doesn't solve much because
> any further interaction causes the same hang.
>
> Putting the relevant procedure definition in a Scheme source file
> and evaluating that (within Emacs, through geiser) is
> unproblematic, so the code itself is not to blame.
>

OK, up to this point I am thinking: this is all quite curious, but
presumably not really a big problem, as you surely don't need to use this
rather strange workflow...


> The weirdest thing about this is that the problem is persistent. I
> restarted Emacs and in my desperation even rebooted the computer,
> but to no avail.
>

But this is indeed weird.  Are you saying that you can reboot your
computer, restart Emacs, open the relevant Org file, evaluate the source
block (without any C-c ') and you still see the problem?

If so, I wonder if it's a real but intermittent problem in your code that
was somehow made more likely by the original workflow, and now you're just
being unlucky?


>
> Does anyone have any idea what might be going on? I rgrepped
> through my =.emacs.d= directory to see if the relevant procedure
> name turns up anywhere but found nothing. I'm not really sure
> where to look beyond that.
>
> Versions:
>
> IELM> emacs-version
> "26.3"
> IELM> org-version
> "9.3.1"
>
> TIA
>
> Joost
>
> --
> Joost Kremers
> Life has its moments
>
>
Best wishes,
   Neil


Re: ob-scheme doesn't support :stdin?

2020-01-21 Thread Neil Jerram
I have been thinking for a while that it would be great to have some kind
of test system for Babel language implementations.  It seems there are lots
of possible Babel features, that some languages support and others don't,
and it would be good to have more clarity about that situation.

Is there already any testing or support matrix along these lines?

Best wishes,
Neil


On Tue, 21 Jan 2020 at 04:07, Vladimir Nikishkin 
wrote:

> I just thought that practically speaking, I no interpreter should
> really need stdin, right?
> Since everything that is prepended with a shebang: #! interpreter
> is at the same time a valid shell script, isn't it?
>
> сб, 18 янв. 2020 г. в 13:02, Kyle Meyer :
> >
> > Vladimir Nikishkin  writes:
> >
> > > Is it true that ob-scheme doesn't support :stdin ?
> > >
> > > I just tried, and doesn't seem to work, although it works with
> ob-shell.
> > >
> > > (This is not a complaint, I just would like to confirm that I
> > > understand things correctly.)
> >
> > Yes, that's true as far as I can tell:
> >
> >   $ git grep :stdin
> >   lisp/ob-awk.el:;; - :stdin takes an Org data or code block reference,
> the value of
> >   lisp/ob-awk.el:  (stdin (let ((stdin (cdr (assq :stdin params
> >   lisp/ob-sed.el:  (stdin (let ((stdin (cdr (assq :stdin params
> >   lisp/ob-shell.el:(stdin (let ((stdin (cdr (assq :stdin
> params
> >   testing/examples/ob-awk-test.org:#+begin_src awk  :stdin genseq
> :results silent
> >   testing/examples/ob-sed-test.org:  #+BEGIN_SRC sed :stdin ex1
> >
> > So it seems support for :stdin is limited to awk, sed, and shell.
>
>
>
> --
> Yours sincerely, Vladimir Nikishkin
>
>


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: mobile org

2019-11-19 Thread Neil Jerram
If org-web and organice are browser-based, why do they need syncing?  Could
the server be your regular non-mobile Org machine?

On Tue, 19 Nov 2019 at 08:57, Diego Zamboni  wrote:

> Hm... organice is suspiciously similar to https://org-web.org/, which I
> had seen before. Even the Sample files are almost identical.
>
> Looking at the github history, organice seems to be a fork of org-web, but
> with more recent development.
>
> --Diego
>
>
> On Mon, Nov 18, 2019 at 10:10 PM Richard Lawrence <
> richard.lawre...@berkeley.edu> wrote:
>
>> Jude DaShiell  writes:
>>
>> > Will mobile org work in Android PI?  If not, any good alternatives
>> beyond
>> > orgsly available?  I don't like to have to use dropbox and would like to
>> > plug a usb cord into my computer and synchtronize my orgmode files that
>> > way if possible.
>>
>> I saw this recently, and haven't seen it mentioned on the list:
>>
>> https://organice.200ok.ch/
>>
>> Here's an intro video: https://invidio.us/watch?v=aQKc0hcFXCk
>>
>> It's a browser-based interface rather than an app, so it should work
>> just about anywhere. It doesn't solve the syncing problem itself;
>> instead it allows you to sign in with Dropbox, Google Drive, or WebDAV.
>> Still not great if you're trying to avoid the proprietary services and
>> sync with a cable, but it looks like an interesting alternative to
>> Orgzly.
>>
>> --
>> Best,
>> Richard
>>
>>


Re: [O] Bug: Problems with ob-scheme in geiser-eval--retort-output [9.2.6 (9.2.6-4-ge30905-elpa @ /home/lockywolf/.emacs.d/elpa/org-20191021/)]

2019-10-21 Thread Neil Jerram
On Mon, 21 Oct 2019 at 15:16, Vladimir Nikishkin 
wrote:

> Yeah. The "output" is not the result of geiser's elisp functions, as far
> as I understand, it comes from comint, which reads it from a scheme
> interpreter, and is expected to be formatted specifically to be fed into
> geiser-eval--retort-output by the geiser scheme functions (running
> inside a scheme interpreter).
>
> So "output" is never 'nil, because comint, when scheme produces some
> rubbish, just makes it an empty string, which is not 'nil.
>
> Then, "output" is expected to be "retorted" back from a serialized
> scheme expression into an elisp expression by
> geiser-eval--retort-output. And this actually may and produce a 'nil,
> but there is no check for it.
>
> So, again, both of the geiser steps (namely, (a) serializing a sexp in
> scheme, and (b) de-serializing it in geiser-eval--retort-output) may fail.
>

I agree that it's fragile for geiser/scheme to output a sexp that it hopes
geiser/elisp will be able to read back.  (I'm guilty of doing that in the
past too!)

Do you have a specific example of that?  It feels like the right thing to
do would be to report that to the Geiser list, as this could and should be
fixed entirely within the Geiser code.


>
> Yes, I have seen this going on, actually quite a lot, because both
> geiser and different scheme interpreters are in constant development and
> get broken every other day.
>

I use Org with Guile 2.2.3 (via Geiser), and it seems a pretty stable setup
to me.

Best wishes,
 Neil


Re: [O] Bug: Problems with ob-scheme in geiser-eval--retort-output [9.2.6 (9.2.6-4-ge30905-elpa @ /home/lockywolf/.emacs.d/elpa/org-20191021/)]

2019-10-21 Thread Neil Jerram
Hi Vladimir,

On Mon, 21 Oct 2019 at 03:21, Vladimir Nikishkin 
wrote:

>
> Can we replace the (set) on line 177 of ob-scheme.el with the following
> form:
> (setq result (if output
>  (let ((g-r-o (geiser-eval--retort-output ret)))
>  (if g-r-o
>  g-r-o
>  "Geiser-eval--retort-output returned nil.\nThe
> interpreter produced no output\nor there is a bug in geiser (likely!)"))
> (geiser-eval--retort-result-str ret "")
>
> I am not super sure about what's going on there, but I think that output
> can never be an empty list, because in the worst case it is an empty
> string.
> (But I wouldn't vouch for this.)
>

Can you explain more?  Have you seen cases
where (geiser-eval--retort-output ret) returns nil, even though you say
just above that it can never do that?

Best wishes,
Neil


Re: [O] Tables: Exclude headings in Row Number?

2019-09-26 Thread Neil Jerram
Well, the code for this is in `org-table-overlay-coordinate-overlays' in
org-table.el.  There isn't an existing flag for your request, but of course
you can play with that code as you like.

For example, if the `(setq ih (1+ ih))' is changed to `(setq id 0 ih (1+
ih))', the row numbers will start again from 1 after each hline.

Best wishes,
Neil


On Mon, 23 Sep 2019 at 04:24, Nathan Neff  wrote:

> I also re-read my initial question and your response *does* address my
> mis phrased question.  To rephrase my question, I have a table
> with these values:
>
> | heading col 0  | heading col 1 |
> | -- | - |
> | A   | B
> | C  | D
>
> I found the org-table-toggle-coordinate-overlays
> which displays an overlay showing the row number:
>
> https://www.evernote.com/l/AOJvD5ty6RRIBYAcSWV-047CKCHT5NIAhl8
>
> I would like to know if there's a way to influence
> org-table-toggle-coordinate-overlays
> (e.g. some flag like "don't count rows before headings")
>
> Thanks,
> --Nate
>
>
>
>
>
>
> On Sun, Sep 22, 2019 at 10:22 PM Nathan Neff 
> wrote:
>
>> Hi Neil,
>>
>> Unfortunately, no - This code will print the number of rows in my table -
>> it does
>> not add a column to my table, with numbering starting at the first row
>> under the
>> headline.
>>
>> I really like the example, where I can mess with the table using lisp
>> though - thank
>> you!
>> --Nate
>>
>> On Thu, Sep 19, 2019 at 9:13 AM Neil Jerram  wrote:
>>
>>> Does this answer your question?
>>>
>>> #+NAME: tt
>>> | num | ID |
>>> |-+|
>>> |   1 | A  |
>>> |   2 | B  |
>>> |   3 | C  |
>>> |   4 ||
>>> |   5 | E  |
>>>
>>> #+BEGIN_SRC emacs-lisp :var tt=tt
>>> (length tt)
>>> #+END_SRC
>>>
>>> #+RESULTS:
>>> : 5
>>>
>>> Best wishes,
>>> Neil
>>>
>>>
>>> On Wed, 18 Sep 2019 at 18:39, Nathan Neff  wrote:
>>>
>>>> Hello all,
>>>>
>>>> I have a table like this:
>>>>
>>>>
>>>> | ID |
>>>> ||
>>>> |  2 |
>>>> |  3 |
>>>>
>>>> and I want to know how many rows there are w/o the ID heading
>>>> and w/o the horizontal separator.  I found the
>>>> org-table-toggle-coordinate-overlays
>>>> which displays an overlay showing the row number:
>>>>
>>>> https://www.evernote.com/l/AOJvD5ty6RRIBYAcSWV-047CKCHT5NIAhl8
>>>>
>>>> However, the heading is included in the row number (which makes sense).
>>>>
>>>> Is there a way to ignore lines above a heading (or mark a heading in
>>>> some way?
>>>>
>>>> I found a way to add a seq. number by using Calc [1] but I was
>>>> wondering if
>>>> there's a way to tell the org-table-toggle-coordinate-overlays not to
>>>> count the
>>>> heading.
>>>>
>>>> Thanks,
>>>> --Nate
>>>>
>>>> [1]
>>>>
>>>>
>>>> | num | ID |
>>>> |-+|
>>>> |   1 | A  |
>>>> |   2 | B  |
>>>> |   3 | C  |
>>>> |   4 ||
>>>> |   5 | E  |
>>>> #+TBLFM: $1=vlen(@I..0)
>>>>
>>>>
>>>> https://stackoverflow.com/questions/9267050/how-to-achieve-a-row-index-column-in-emacs-org-mode-using-a-calc-column-rule
>>>>
>>>>
>>>>


Re: [O] Tables: Exclude headings in Row Number?

2019-09-19 Thread Neil Jerram
Does this answer your question?

#+NAME: tt
| num | ID |
|-+|
|   1 | A  |
|   2 | B  |
|   3 | C  |
|   4 ||
|   5 | E  |

#+BEGIN_SRC emacs-lisp :var tt=tt
(length tt)
#+END_SRC

#+RESULTS:
: 5

Best wishes,
Neil


On Wed, 18 Sep 2019 at 18:39, Nathan Neff  wrote:

> Hello all,
>
> I have a table like this:
>
>
> | ID |
> ||
> |  2 |
> |  3 |
>
> and I want to know how many rows there are w/o the ID heading
> and w/o the horizontal separator.  I found the
> org-table-toggle-coordinate-overlays
> which displays an overlay showing the row number:
>
> https://www.evernote.com/l/AOJvD5ty6RRIBYAcSWV-047CKCHT5NIAhl8
>
> However, the heading is included in the row number (which makes sense).
>
> Is there a way to ignore lines above a heading (or mark a heading in some
> way?
>
> I found a way to add a seq. number by using Calc [1] but I was wondering if
> there's a way to tell the org-table-toggle-coordinate-overlays not to
> count the
> heading.
>
> Thanks,
> --Nate
>
> [1]
>
>
> | num | ID |
> |-+|
> |   1 | A  |
> |   2 | B  |
> |   3 | C  |
> |   4 ||
> |   5 | E  |
> #+TBLFM: $1=vlen(@I..0)
>
>
> https://stackoverflow.com/questions/9267050/how-to-achieve-a-row-index-column-in-emacs-org-mode-using-a-calc-column-rule
>
>
>


Re: [O] Best practice for providing an Org-based application?

2019-09-10 Thread Neil Jerram
Thanks Jean for your reply...

On Tue, 10 Sep 2019 at 14:53, Jean Louis  wrote:

> [...] It would be nice to write it all in the Org file, yet for me such
> data shall better be in the database. And links are then copied from
> central place to Org files or any other files finally, or to email, or
> shared by SMS, or published as web pages when necessary.
>

I think you touch on a couple of interesting points here.

Firstly, it could be difficult to separate out a particular application
from one's Org usage overall.  For me, for the particular case of this
choir role, that is not the case; but I can see that it might be for
others.  I guess that means that the application will be better if it
doesn't force you to move your fundamental data into a form specifically
for that application, but is able to work well with data across your Org
usage as a whole.

Secondly, when one thinks this kind of thing through, it all boils down to
just two things
- tables of fundamental data
- code for operating on that data and generating summaries and derived
tables.
One might then think: why still be in Org mode?  As opposed to a
traditional database.  I think the answer, for me, is that keeping in Org
and plain text means that there are so many levels of possibility that I
can fall back on, if my coding and workflows turn out to be deficient in
some way.  Working in Emacs and Org mode just feels nice.  Also, in my
case, there isn't the massive scale that might motivate using a more
scalable database.

Best wishes,
Neil


Re: [O] Best practice for providing an Org-based application?

2019-09-10 Thread Neil Jerram
 Kitchin  wrote:

> It would be helpful to get a better sense of what is the private data,
> e.g. is it something like org-contacts, or some structured data in a
> heading? and what are the workflows that might be generic.
>
> I have used org for lots of organizational things in the past, ranging
> from conference organization, teaching classes, running job searches,
> organizing special issues in scientific publications and lately to
> organize some things for a cub scout troop. They have all been pretty
> different, but I am sure I have reinvented pieces of it each time. I am
> interested in learning more about what you are doing.
>
>
>
> Neil Jerram  writes:
>
> > Is there a best practice or recommended approach for preparing and
> > providing an Org-based application so that others could make use of it?
> >
> > I've been using Org for a few years to keep track of the membership and
> > 'fixing' for my choir - where 'fixing' means finding out and recording
> who
> > can sing in each concert, who will be there for rehearsals, and so on.
> > This involves a mix of data that is private to my choir, and workflows
> and
> > code that are potentially generic.  I don't know how many people in the
> > world are both choir organisers and Emacs users, but it seems to me that
> it
> > could be useful to separate out and document the generic code and
> > workflows, so that others could use that as well as me, and that it would
> > also be an interesting technical challenge.
> >
> > Has anyone else done something like this?  I wonder if you have
> > recommendations for how to document, structure and publish this kind of
> > thing?
> >
> > Many thanks!
> >Neil
>
>
> --
> 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
>
>


[O] Best practice for providing an Org-based application?

2019-09-08 Thread Neil Jerram
Is there a best practice or recommended approach for preparing and
providing an Org-based application so that others could make use of it?

I've been using Org for a few years to keep track of the membership and
'fixing' for my choir - where 'fixing' means finding out and recording who
can sing in each concert, who will be there for rehearsals, and so on.
This involves a mix of data that is private to my choir, and workflows and
code that are potentially generic.  I don't know how many people in the
world are both choir organisers and Emacs users, but it seems to me that it
could be useful to separate out and document the generic code and
workflows, so that others could use that as well as me, and that it would
also be an interesting technical challenge.

Has anyone else done something like this?  I wonder if you have
recommendations for how to document, structure and publish this kind of
thing?

Many thanks!
   Neil


Re: [O] Potential bug with tables

2019-08-03 Thread Neil Jerram
I just tried this with

Org mode version 9.1.5 (release_9.1.5-1784-g772949 @
/home/neil/src/org-mode/lisp/)

and I don't see the problem with that version.  What version do you have?


On Sat, 3 Aug 2019 at 19:48, Charles R (Charlie) Martin <
chasrmar...@gmail.com> wrote:

> This seems like an unlikely bug because it's very basic to org-mode
> tables, but if I'm doing something wrong I sure can't figure out what.
>
> I have this table:
>
> | Date   | Count | Pages |
> |+---+---|
> | 2019-Aug-03 (Sat, 215) | 2069  | 7 |
> ||   |   |
>
> but when I hit TAB or C-c C-c to reformat the table it is displayed as in
> the screenshot
>
> [image: Screenshot 2019-08-03 12.44.51.png]
>
> Copying the text with M-w is still the same.
>
> | Date   | Count | Pages |
> |+---+---|
> | 2019-Aug-03 (Sat, 215) |  2069 | 7 |
> ||   |   |
>
> I'm immensely puzzled.
>
> Signed
> Immensely puzzled
>


Re: [O] exported contacts problem

2019-08-03 Thread Neil Jerram
I've tried to work on contact conversion and synchronization in the past,
aiming to merge and unify contacts that I've built up in BBDB, Google
Contacts, email systems, pre-Android phones, etc.  The problematic aspect
was different systems using different field names and structures, e.g. one
with separate First Name and Last Name, and another with a combined Name
field; different approaches to breaking up addresses; additional arbitrary
notes fields; etc.

With that in mind, I'm curious if the writers on this thread could comment
on:
1. is this situation any better now?
2. if you favour using org-contacts or org-vcard, what do you see as the
benefit of Org as your master contact format, as opposed to say BBDB or
.vcf?


Re: [O] Capture with date prompt defaults to yesterday

2019-06-11 Thread Neil Jerram
On Mon, 10 Jun 2019, 10:22 Nicolas Goaziou,  wrote:

> Hello,
>
> Neil Jerram  writes:
>
> > Yes, it does make the default time noon.  But AFAICS the time of day
> > doesn't actually matter in any of the Org source code where the result of
> > org-get-cursor-date is used.  Have I missed a case where it does
> > matter?
>
> Probably not. I didn't check. But this could become a future gotcha.
>
> > However, in the attached patch I've revised that so that the default time
> > of day is :00am, i.e. it's the earliest time that
> > Org treats as being that date.  WDYT?
>
> I think this is better. I applied your patch. Thank you.
>
> > Alternatively, we could refactor the code around where
> org-get-cursor-date
> > is used to make it more explicit when the time of day doesn't matter, and
> > look further if there are any cases where it does.
>
> I think the current state is sufficient.
>
> Regards,
>
> --
> Nicolas Goaziou
>

Thanks Nicolas!
   Neil


Re: [O] Capture with date prompt defaults to yesterday

2019-06-09 Thread Neil Jerram
On Fri, 7 Jun 2019 at 22:31, Nicolas Goaziou  wrote:

> Hello,
>
> Neil Jerram  writes:
>
> > Nicolas, I hope you don't mind me sending a 'ping' for this, as it looks
> > like it might have got lost.  Please do let me know what you think.
>
> I'm not sure this is a right fix. Doesn't it force default times to noon
> instead of midnight? I think default times should be midnight.
>

Yes, it does make the default time noon.  But AFAICS the time of day
doesn't actually matter in any of the Org source code where the result of
org-get-cursor-date is used.  Have I missed a case where it does matter?

However, in the attached patch I've revised that so that the default time
of day is :00am, i.e. it's the earliest time that
Org treats as being that date.  WDYT?

Alternatively, we could refactor the code around where org-get-cursor-date
is used to make it more explicit when the time of day doesn't matter, and
look further if there are any cases where it does.

Best wishes,
Neil
From 48b342bbd8c97bf24214b57e04d6d59108320ba0 Mon Sep 17 00:00:00 2001
From: Neil Jerram 
Date: Tue, 28 May 2019 21:01:17 +0100
Subject: [PATCH] Make capture's idea of the current day more intuitive

---
 lisp/org.el | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index c6861dc9a..6af97b348 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18936,7 +18936,9 @@ Returns the number of empty lines passed."
 This works in the calendar and in the agenda, anywhere else it just
 returns the current time.
 If WITH-TIME is non-nil, returns the time of the event at point (in
-the agenda) or the current time of the day."
+the agenda) or the current time of the day; otherwise returns the
+earliest time on the cursor date that Org treats as that date
+(bearing in mind `org-extend-today-until')."
   (let (date day defd tp hod mod)
 (when with-time
   (setq tp (get-text-property (point) 'time))
@@ -18949,13 +18951,13 @@ the agenda) or the current time of the day."
 (cond
  ((eq major-mode 'calendar-mode)
   (setq date (calendar-cursor-to-date)
-	defd (encode-time 0 (or mod 0) (or hod 0)
+	defd (encode-time 0 (or mod 0) (or hod org-extend-today-until)
 			  (nth 1 date) (nth 0 date) (nth 2 date
  ((eq major-mode 'org-agenda-mode)
   (setq day (get-text-property (point) 'day))
   (when day
 	(setq date (calendar-gregorian-from-absolute day)
-	  defd (encode-time 0 (or mod 0) (or hod 0)
+	  defd (encode-time 0 (or mod 0) (or hod org-extend-today-until)
 (nth 1 date) (nth 0 date) (nth 2 date))
 (or defd (current-time
 
-- 
2.17.1



Re: [O] Capture with date prompt defaults to yesterday

2019-06-07 Thread Neil Jerram
Nicolas, I hope you don't mind me sending a 'ping' for this, as it looks
like it might have got lost.  Please do let me know what you think.

Best wishes,
   Neil


On Tue, 28 May 2019 at 21:20, Neil Jerram  wrote:

> On Sun, 19 May 2019 at 14:36, Neil Jerram  wrote:
>
>> I have a capture template like this:
>>
>>  '(org-capture-templates
>>(quote
>> (("a" "" entry
>>   (file "~/org/capture.org")
>>   "** TODO %?
>> SCHEDULED: %^t"
>>
>> When I use that, the date prompt defaults to yesterday, whereas I'd
>> expect it to default to today.
>>
>> I believe this is because I also have (setq org-extend-today-until 2).
>> What happens is that (org-get-cursor-date) gets the right _date_, then
>> converts that to a time at midnight, i.e.  00:00.  And then, I
>> presume, some following code thinks that means -1, because of my
>> org-extend-today-until setting.
>>
>> Thoughts?
>>
>> Many thanks,
>>Neil
>>
>
> Well I think it's a bug and propose the attached fix.  Please let me know
> what you think.
>
>  Neil
>
>


Re: [O] Show APPTs every day in Agneda

2019-05-28 Thread Neil Jerram
On Mon, 27 May 2019 at 23:25, Michael Heerdegen 
wrote:

> Neil Jerram  writes:
>
> > Hi Michael,
>
> Hi Neil!
>
> > I'm not in front of my computer, to check this, but I think that an
> > active date range will have this effect, i.e.
> >
> > ** Vacation
> > --
>
> Hmm, no, AFAICT that's what I used to do, and it only shows the
> appointment at start and end date, not between the two dates.  That's
> with C-c a a btw.  I wonder why it seems to work for you...
>

I've just checked that it really does work for me - and yes, it does.  This
is a bit of one of my org files:

#+BEGIN_EXAMPLE
** Bank holiday weekend

<2018-05-05 Sat>--<2018-05-07 Mon>
#+END_EXAMPLE

and here's (part of) my agenda buffer for that month:

#+BEGIN_EXAMPLE
Saturday5 May 2018
  divorce:(1/3):  Bank holiday weekend
Sunday  6 May 2018
  divorce:(2/3):  Bank holiday weekend
Monday  7 May 2018 W19
  divorce:(3/3):  Bank holiday weekend
#+END_EXAMPLE

Sorry, that's no solution for you, but maybe there's a clue in the detail
there?

Best wishes,
   Neil


Re: [O] Capture with date prompt defaults to yesterday

2019-05-28 Thread Neil Jerram
On Sun, 19 May 2019 at 14:36, Neil Jerram  wrote:

> I have a capture template like this:
>
>  '(org-capture-templates
>(quote
> (("a" "" entry
>   (file "~/org/capture.org")
>   "** TODO %?
> SCHEDULED: %^t"
>
> When I use that, the date prompt defaults to yesterday, whereas I'd expect
> it to default to today.
>
> I believe this is because I also have (setq org-extend-today-until 2).
> What happens is that (org-get-cursor-date) gets the right _date_, then
> converts that to a time at midnight, i.e.  00:00.  And then, I
> presume, some following code thinks that means -1, because of my
> org-extend-today-until setting.
>
> Thoughts?
>
> Many thanks,
>Neil
>

Well I think it's a bug and propose the attached fix.  Please let me know
what you think.

 Neil
From d52c66f4e4f1fead135427d2c638890b5c7ab224 Mon Sep 17 00:00:00 2001
From: Neil Jerram 
Date: Tue, 28 May 2019 21:01:17 +0100
Subject: [PATCH] Make capture's idea of the current day more intuitive

---
 lisp/org.el | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index c6861dc9a..763eb1e45 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -18936,7 +18936,9 @@ Returns the number of empty lines passed."
 This works in the calendar and in the agenda, anywhere else it just
 returns the current time.
 If WITH-TIME is non-nil, returns the time of the event at point (in
-the agenda) or the current time of the day."
+the agenda) or the current time of the day; otherwise returns 12pm
+on the cursor date.  (Returning 12pm instead of 12am here avoids
+problems of interpretation with respect to `org-extend-today-until'.)"
   (let (date day defd tp hod mod)
 (when with-time
   (setq tp (get-text-property (point) 'time))
@@ -18949,13 +18951,13 @@ the agenda) or the current time of the day."
 (cond
  ((eq major-mode 'calendar-mode)
   (setq date (calendar-cursor-to-date)
-	defd (encode-time 0 (or mod 0) (or hod 0)
+	defd (encode-time 0 (or mod 0) (or hod 12)
 			  (nth 1 date) (nth 0 date) (nth 2 date
  ((eq major-mode 'org-agenda-mode)
   (setq day (get-text-property (point) 'day))
   (when day
 	(setq date (calendar-gregorian-from-absolute day)
-	  defd (encode-time 0 (or mod 0) (or hod 0)
+	  defd (encode-time 0 (or mod 0) (or hod 12)
 (nth 1 date) (nth 0 date) (nth 2 date))
 (or defd (current-time
 
-- 
2.17.1



Re: [O] Show APPTs every day in Agneda

2019-05-27 Thread Neil Jerram
On Sun, 26 May 2019, 18:38 Michael Heerdegen, 
wrote:

> Hi,
>
> I've APPTs like "Vacation" that last 14 days or so.  Is there an
> option/way to show such an APPT for every concerned day, and not only
> for the border days, so that when I for example want to make a doctor's
> appointment I see for the respective day that I'm on vacation on that
> day?
>
> TIA,
>
> Michael.
>

Hi Michael,

I'm not in front of my computer, to check this, but I think that an active
date range will have this effect, i.e.

** Vacation
--

You can use C-c . to enter and edit the dates.

Best wishes,
 Neil


Re: [O] Advance notice of birthdays in org-mode via org-contacts

2019-05-27 Thread Neil Jerram
On Sun, 26 May 2019, 16:12 Daryl Manning,  wrote:

> I'm trying to come up with a better way to give myself advanced notice on
> some peoples' birthdays coming up.
>
> Right now, I use the following in a `cal.org` file to give me notice in
> agenda that birthdays are coming up:
>
> ```
> * BDays
>   :bday:
> %%(org-contacts-anniversaries "BIRTHDAY")
> ```
>
> The generally feeds off a `contacts.org` entry of the nature:
>
> ```
> *** John Wick
> :PROPERTIES:
> :EMAIL: therealj...@notthepuppy.com
> :BIRTHDAY: 1975-06-06
> :END:
> ```
>
> What I'd like is to get, on virtually all birthdays , a week's notice
> through due soon (which I'll sort out in org-super-agenda in the view).
> Alternatively, is there a nicer way to tag or otherwise note some birthdays
> in the `contacts.org` so that I could note special people (close friends,
> family, etc) where I could set a specific advanced notice period so that I
> have time to do something special for them etc?
>
> Would love to hear peoples' approaches to this. In general, if I'm not
> looking out 2 weeks ahead (I spend most time in the day view), I can get
> surprised.
>
> thanks!
> Daryl.
>

Hi Daryl,

I have a TODO item for each of my family's birthdays, with a deadline for
the birthday day and a repeater of +1y. Then Org Agenda automatically gives
me about two weeks' notice of that approaching.

There's no integration here with another contacts system, but I find that
this works well for me.

Best wishes,
Neil


[O] Capture with date prompt defaults to yesterday

2019-05-19 Thread Neil Jerram
I have a capture template like this:

 '(org-capture-templates
   (quote
(("a" "" entry
  (file "~/org/capture.org")
  "** TODO %?
SCHEDULED: %^t"

When I use that, the date prompt defaults to yesterday, whereas I'd expect
it to default to today.

I believe this is because I also have (setq org-extend-today-until 2).
What happens is that (org-get-cursor-date) gets the right _date_, then
converts that to a time at midnight, i.e.  00:00.  And then, I
presume, some following code thinks that means -1, because of my
org-extend-today-until setting.

Thoughts?

Many thanks,
   Neil


Re: [O] Column width cookies stopped working in 9.2.3?

2019-05-13 Thread Neil Jerram
On Sun, 12 May 2019 at 22:39, Nick Dokos  wrote:
>
> Just to clarify: my intention was to advertise etc/ORG-NEWS more
> widely and point out that it's probably the best place to learn about
> things that are likely to break one's workflows (and if you read it
> before you update, you just might avoid unpleasant surprises - and
> this is not a specific "you", but a general "you" that includes
> everybody, including me: I often forget to do this and suffer the
> consequences).

Understood, and I appreciate your reply and interest in this topic.

> > Am I right about my use case being different, and therefore perhaps
> > having been caught up unintentionally in this change?
> >
>
> That may well be true: personally, I always thought of these cookies as 
> minimum width specifiers, not
> maximum width.
>
> But I think you could do what you want by having a row that contains fixed 
> width strings, instead of
> width cookies. To make it as unobtrusive as possible, I'd use non-breaking 
> spaces as the character:
>
> |  || 
>  |
> |  || 
>  |
>
> There may be better solutions, but this is what sprang to my mind after 
> reading your use case.

Yes indeed, and that is the solution that I'm now using.  I'm not
totally sure yet if it's a durable solution or just a workaround - but
it's working for now.

Best wishes,
Neil



Re: [O] Column width cookies stopped working in 9.2.3?

2019-05-12 Thread Neil Jerram
On Sun, 12 May 2019 at 00:29, Nick Dokos  wrote:
>
> Neil Jerram  writes:
>
> > Hi,
> >
> > I have tables with width cookies like this:
> >
> > | <16> | <6>   | <64>  |
> >
> > I just added new information to one of those tables, and the table
> > shrank down to match the size of the content, i.e. as though Org is
> > now ignoring the width cookies.
> >
> > I believe I've also upgraded in the last few days, and now have:
> > Org mode version 9.2.3 (9.2.3-13-g727c3f-elpa @
> > /home/neil/.emacs.d/elpa/org-20190506/)
> >
> > Is this a known thing?  Do I need something else now to make those
> > width cookies work?
> >
>
> As Eric says, things have changed in this area. It's always a good
> idea to check the /etc/ORG-NEWS file for such things.  In this
> particular case, read the section entitled "Dynamically narrow table
> columns" in the Version 9.2 "New features" section of etc/ORG-NEWS.

Thanks Nick.  I did check the manual before writing, and noticed that it
still says:

 To set the width of a column, one field anywhere in the column may
  contain just the string ‘’ where N specifies the width as a number of
  characters.

I think the crux of the matter is that my use case is apparently different
from everyone else's.  Now that I've reread the whole section, it seems
that the main target use case is _shrinking_ a column to be narrower than
what is needed for its content.  My use case is the opposite: I want a
column to be a fixed width that is always _larger_ than its content.
 (FWIW, this is in order to avoid spurious Git diffs for column width
changes, as I change the content in those tables.)

For example, after deploying 'C-u C-c TAB', one of my tables now looks like
this:

| Programme...| Sang? ...| Notes ...|
|--...+---...+---...|
| Audition ...|   ...| January 2019  ...|
|--...+---...+---...|
| <16> ...| <6>   ...| <64>  ...|
| 2019 ...|   ...|   ...|
| B minor mass ...| Yes   ...| 1 planned absence (6 Mar) ...|
|  ...|   ...| 6 Mar Present when not expected   ...|
| Songs Summer Eve ...| No...|   ...|
| French Choral...| Yes   ...| "I'm intending to sing in [this]" ...|

which is IMO uglier than what it used to be, and what I'd like, like this:

| Programme| Sang?  | Notes
   |
|--++--|
| Audition || January 2019
   |
|--++--|
| <16> | <6>| <64>
   |
| 2019 ||
   |
| B minor mass | Yes| 1 planned absence (6 Mar)
   |
|  || 6 Mar Present when not expected
   |
| Songs Summer Eve | No |
   |
| French Choral| Yes| "I'm intending to sing in [this]"
   |

Am I right about my use case being different, and therefore perhaps having
been caught up unintentionally in this change?

Best wishes,
Neil


[O] Column width cookies stopped working in 9.2.3?

2019-05-11 Thread Neil Jerram
Hi,

I have tables with width cookies like this:

| <16> | <6>   | <64>  |

I just added new information to one of those tables, and the table
shrank down to match the size of the content, i.e. as though Org is
now ignoring the width cookies.

I believe I've also upgraded in the last few days, and now have:
Org mode version 9.2.3 (9.2.3-13-g727c3f-elpa @
/home/neil/.emacs.d/elpa/org-20190506/)

Is this a known thing?  Do I need something else now to make those
width cookies work?

Thanks,
   Neil



Re: [O] [RFC] Fixing link encoding once and for all

2019-03-05 Thread Neil Jerram
Hi Nicolas,

On Tue, 5 Mar 2019 at 00:23, Nicolas Goaziou  wrote:
[...]
> So, the new challenger is:
>
> 
> "\\[\\[\\(\\(?:.\\|\n\\)*?[^\\]\\(\\)*\\)\\]\\(?:\\[\\(\\(?:.\\|\n\\)+?\\)\\]\\)?\\]"
>
> Beautiful.
>
> The commented rx equivalent would be:
>
> (seq "["
>  ;; URI part: match group 1.
>  "["
>  (group
>   (*? anything)
>   ;; Allow an even number of backslashes before the closing bracket.
>   (not (any "\\"))
>   (zero-or-more (group "")))
>  "]"
>  ;; Description (optional): match group 2.
>  (opt "[" (group (+? anything)) "]")
>  "]")
>
> > \(# begin group 3
> > ? # don't understand
> > :\[   # literal :[
>
> [...]
>
> > but there's at least a ? that I don't understand, and I'm afraid I'm
> > not seeing how it's useful.
>
> \(?: ... \) is a shy group.

Thanks for explaining that.  It's not mentioned in the manual though
(https://www.gnu.org/software/emacs/manual/html_node/emacs/Regexps.html);
are you sure that it's supported in Emacs regexps?

> > If you think it works, I'm happy to defer to your judgement on that!
> > Although I suggested the idea, I don't know Org nearly well enough to
> > be sure that I haven't missed problems;
>
> We are solving the problem with a regexp. What bad things could happen? ;)

Well hopefully the fallout is limited to destroying all of the text in
one Org buffer. :-)

More seriously, though, I don't understand when and how the regexp is
used.  Presumably you loop through the buffer looking for matches, but
what do you do after each match?

Regards,
Neil



Re: [O] [RFC] Fixing link encoding once and for all

2019-03-04 Thread Neil Jerram
On Fri, 1 Mar 2019 at 08:14, Nicolas Goaziou  wrote:
>
> Hello,
>
> Neil Jerram  writes:
>
> > Do you mean Windows file names in existing Org files?  I.e. the
> > back-compatibility concern?
> >
> > If so, yes, I confess I didn't think at all about back-compatibility,
> > with my suggestion above.  So perhaps that rules my idea out.
> >
> > If we were starting from scratch, however,
> > - I believe it would technically be fine; i.e. it's a complete and
> > unambiguous encoding
> > - it might be considered awkward for Windows users to have to write
> > c:\\system32\\mydoc.txt instead of c:\system32\mydoc.txt, but I don't
> > know how big a concern that would be.
>
> Thinking a bit more about it, we don't need to escape /all/ square
> brackets, only "]]" and "][" constructs. Therefore, we don't need to
> escape every backslash either.

Agreed.

> The regexp for bracket links could be, in its simple (!) form:
>
>   \[\[\(.*?[^\\]\(?:\\\)*\)\]\(?:\[\([^\000]+?\)\]\)?\]

[then a bit later]
> Small update, in its string form now:
>
>   
> "\\[\\[\\([^\000]*?[^\\]\\(\\)*\\)\\]\\(?:\\[\\([^\000]+?\\)\\]\\)?\\]"

Is [^\000] the only (or best) way of saying "any character, including
newlines"?  Could there be actual NUL characters in the document?

More generally I'm not sure I'm fully understanding the regex.  I
_think_ it breaks down like this:

\[\[  # literal [[
\(# begin group 1
[^\000]*? # non-greedy any characters (0 or more)
[^\]  # something not a backslash
\(# begin group 2
  # literal \\
\)*   # end group 2, and allow 0 or more of it
\)# end group 1
\]# literal ]
\(# begin group 3
? # don't understand
:\[   # literal :[
\(# begin group 4
[^\000]+? # non-greedy any characters (1 or more)
\)# end group 4
\]# literal ]
\)?   # end group 3, and allow 0 or 1 or it
\]# literal ]

but there's at least a ? that I don't understand, and I'm afraid I'm
not seeing how it's useful.

> Most links would need no change.  I see one notable exception:
> directories in Windows:
>
>   [[c:\system32\\]] for "c:\system32\"

But I guess it would be unusual to write a trailing backslash like that.

> Some further notes:
>
> 1. Macros already use backslashes to escape commas in arguments, so it
>is at least consistent with this part of Org.
>
> 2. The description part of the link, like most parts of Org, does not
>use backslash escaping. If needed, we can implement an entity for
>a square bracket.
>
> 3. There will be some backward compatibility issues. We can add
>a checker in Org Lint to catch most of those. For example, we could
>look at URI where every percent is followed only by 25, 5B, and 5D.
>
> WDYT?

If you think it works, I'm happy to defer to your judgement on that!
Although I suggested the idea, I don't know Org nearly well enough to
be sure that I haven't missed problems; but I guess that you would
know that.

Best wishes,
  Neil



Re: [O] [RFC] Fixing link encoding once and for all

2019-02-28 Thread Neil Jerram
On Wed, 27 Feb 2019 at 10:49, Nicolas Goaziou  wrote:
>
> Hello,
>
> Neil Jerram  writes:
>
> > I'm not sure how much freedom you have here, but I think it would be
> > both clearer - by avoiding confusion with URL-escaping - and easier to
> > type, to use an entirely different form of escaping in the Org syntax;
> > probably just this:
> >
> > \[ and \] to include a square bracket in a link
> > \\ to include a backslash
>
> Wouldn't that become problematic with file names in Windows?

Do you mean Windows file names in existing Org files?  I.e. the
back-compatibility concern?

If so, yes, I confess I didn't think at all about back-compatibility,
with my suggestion above.  So perhaps that rules my idea out.

If we were starting from scratch, however,
- I believe it would technically be fine; i.e. it's a complete and
unambiguous encoding
- it might be considered awkward for Windows users to have to write
c:\\system32\\mydoc.txt instead of c:\system32\mydoc.txt, but I don't
know how big a concern that would be.

Best wishes,
 Neil


> Regards,
>
> --
> Nicolas Goaziou



Re: [O] [RFC] Fixing link encoding once and for all

2019-02-24 Thread Neil Jerram
I'm not sure how much freedom you have here, but I think it would be
both clearer - by avoiding confusion with URL-escaping - and easier to
type, to use an entirely different form of escaping in the Org syntax;
probably just this:

\[ and \] to include a square bracket in a link
\\ to include a backslash

Regards,
Neil

On Sun, 24 Feb 2019 at 01:18, Nicolas Goaziou  wrote:
>
> Hello,
>
> Recently[1], issues about link escaping have resurfaced. I'd like to
> solve this once and for all.
>
> As a reminder, the initial issue is that bracket links, i.e., "[[path]]"
> or "[[path][description]]", cannot contain square brackets, for obvious
> reasons. Therefore, they need to be escaped somehow. For some historical
> reason, the "somehow" settled, for the path part[2], on URL encoding.
> Therefore [ and ] in a link must appear as, respectively, "%5B" and
> "%5D". Of course, the initial link could already contain any of these
> strings, so percent signs also need to be escaped, as "%25". Eventually,
> consecutive spaces are not very handled very gracefully by
> `fill-paragraph' function, so it is also useful, but not mandatory, to
> be able to escape white spaces, with "%20". It can sadly be confusing
> when Org encoding is applied on top an already encoded URI.
>
> To sum it up, `org-link-escape', by default, URL encodes only square
> brackets, percent signs and white spaces. Note that, however,
> `org-link-unescape' is not its reciprocal function, despite its
> docstring. It URL decodes every percent encoded combination.
>
> Anyway, square brackets in a bracket link almost looks like a solved
> problem. Alas, if some links are inserted by helper functions, such as
> `org-insert-link', others could have been typed right into the buffer.
> Therefore, there is usually no way to know if a link is already
> Org-encoded or not. Consequently, there is usually no way to know when
> a link needs to be Org-decoded. This is the root of all evil, or at
> least, all bugs encountered so far. Some links end up being encoded or
> decoded once too many.
>
> To solve this, we must assume that every bracket link is properly
> Org-encoded in a buffer. In other words, when typing, or yanking,
> a bracket link right into a buffer, users are required to use %5B, %5D,
> and %25 in the path part of the link, if necessary. I understand it will
> bite some users, but using `org-insert-link' would mitigate the pain. It
> is also limited to square brackets, which, I assume, is not the type of
> link you usually yank.
>
> With that assumption, the parser can safely Org-decode links
> appropriately, and store paths in their decoded form. Consumers, like
> export back-ends, need not call `org-link-unescape' anymore. In fact,
> the only situation where `org-link-unescape' is still needed is when
> extracting the path part of a bracket link from the buffer, e.g.,
> through regexp matching.
>
> Of course, the manual should mention this assumption, if we agree on it.
>
> Thoughts?
>
> Regards,
>
> Footnotes:
>
> [1] E.g., 
> or .
>
> [2] There is no clear mechanism for the description part.
> `org-insert-link' will replace square brackets with curly ones. We could
> also use entities, but none of them appears as a square bracket. Anyway,
> I'll ignore this issue for the time being.
>
> --
> Nicolas Goaziou
>



Re: [O] Org without Emacs?

2019-01-28 Thread Neil Jerram
Scott Randby  writes:

> Greetings,

Hi Scott,

> Here is an article that might interest some: 
> https://opensource.com/article/19/1/productivity-tool-org-mode
>
> I'm not sure if the article is entirely successful. Maybe the tools mentioned 
> in it can do some of the things Org does, but are there any that have full 
> Org functionality? I'm not convinced that Org can be divorced from Emacs. 
> Maybe parts of it can be separated.
>
> Scott Randby

My only worry would be if any of this support in other tools is cover
for attacking the copyleft and hence unity of how Org works; aimed
ultimately at fragmenting the Org ecosystem.

As long as that is not the case, I'm happy to fully support these
alternative implementations.  (And personally, I'm a heavy Orgzly user.)

Best wishes,
   Neil



Re: [O] Standard Format for Org Outlines?

2018-11-24 Thread Neil Jerram



On 23 November 2018 23:23:27 GMT, David Masterson  
wrote:
>Probably a dumb question, but is there a standard format for Org
>outlines. I'm particularly wondering about the use of blank lines. I
>prefer to have blank lines before my headings for readability, but I
>think a lot of other people work without the blank lines.  I recently
>ran into a case with BeOrg where it, in fact, removed the blank lines
>when it synced my change back to my original file.  That led me to
>think
>what is the standard format for an Org outline.  Should I expect the
>tools to adjust to me or should I adjust to them?
>--
>David

Great question; I've seen and wondered the same thing. In my case it's Orgzly 
that seems to like removing some blank lines - although happily it doesn't seem 
to mind when I add some of them back again.

Best wishes,
 Neil



Re: [O] [RFC] Org Num library

2018-11-20 Thread Neil Jerram
Nicolas Goaziou  writes:

> Since it is very much Org-specific, and a basic feature you could expect
> from Org, I'd like to add it in core. So, if there is no strong
> objection to it, it can go in Org 9.3.
>
> I attach the library for further testing, suggestions, remarks… Let me
> know what you think.

Well, with my Org 9.1.14, I can report that the code evaluates cleanly
and the feature works.  I can't see any objection to adding it into
core.

(I'd add that I'm not yet seeing a clear use case for it; but perhaps
that will change in future.)

 Neil



Re: [O] bug#33403: [Geiser-users] Data length limit in Guile/Geiser/Scheme evaluation

2018-11-16 Thread Neil Jerram
Neil Jerram  writes:

> Mark H Weaver  writes:
>
>> This is a documented limitation in Linux's terminal handling when in
>> canonical mode.  See the termios(3) man page, which includes this text:
>>
>>Canonical and noncanonical mode
>>
>>The setting of the ICANON canon flag in c_lflag determines
>>whether the terminal is operating in canonical mode (ICANON set)
>>or noncanonical mode (ICANON unset).  By default, ICANON is set.
> [...]
>>* The maximum line length is 4096 chars (including the
>>  terminating newline character); lines longer than 4096 chars
>>  are truncated.  After 4095 characters, input processing (e.g.,
>>  ISIG and ECHO* processing) continues, but any input data after
>>  4095 characters up to (but not including) any terminating
>>  newline is discarded.  This ensures that the terminal can
>>  always receive more input until at least one line can be read.
>>
>> Note that last item above.
>
> Awesome; thank you Mark.
>
> So possibly this limit can be removed, in my Org/Geiser context, by
> evaluating (system* "stty" "-icanon") when initializing the Geiser-Guile
> connection.  I'll try that.  Will the terminal that that 'stty' sees be
> the same as Guile's stdin?
>
> Jao, if that works, I wonder if it should be the default for Geiser?  It
> appears to me that Geiser shouldn't ever need the features of canonical
> mode.  Is that right?
>
> Anyway, I'll see first if the stty call is effective.

Yes, with this in my ~/.guile-geiser -

(system* "stty" "-icanon")

- I can do evaluations past the 4K line length limit, and the Org-driven
problem that I first reported [1] has disappeared.

Thanks to Nicolas, Jao and Mark for your help in understanding this.

Neil

[1] https://lists.gnu.org/archive/html/emacs-orgmode/2018-11/msg00177.html



Re: [O] [Geiser-users] Data length limit in Guile/Geiser/Scheme evaluation

2018-11-15 Thread Neil Jerram
"Jose A. Ortega Ruiz"  writes:

> I cannot see what it is, but there's something in that expression that
> makes scheme readers hang.  I just pasted it in a vanilla guile repl
> (started with run-scheme, no geiser involved), and it never gets
> evaluated.  The same thing happens with a MIT scheme vanilla repl.  And
> the same thing happens if i try to evaluate it in a guile repl in a
> terminal, so it's not even emacs fault.  Maybe there's some non-ascii
> char in there?  In fact, the scheme readers hang somewhere in the middle
> of the let, because i can remove characters from the end and they never
> discover that the expression is unbalanced

Thanks Jao; the plot thickens...

The line length is quite close to 4K; I wonder if that could be
relevant?

Anyway, I will also check for odd characters...

Neil



Re: [O] Data length limit in Guile/Geiser/Scheme evaluation

2018-11-15 Thread Neil Jerram
Nicolas Goaziou  writes:

> Hello,
>
> Neil Jerram  writes:
>
>> If I add one more (duplicate) row to the table, and hit C-c C-c again,
>> the evaluation hangs somewhere and Emacs is blocked until I interrupt
>> with C-g.
>
> Interesting.
>
>> Has anyone else seen this?
>
> I can reproduce this bug on master branch. 

Many thanks for trying and confirming this, Nicolas.

> However, I would ask Geiser developer first, because the process freezes
> during `geiser-eval-region' call, and the contents of the buffer, pasted
> below, seem correct.
>
> --8<---cut here---start->8---
> ;; -*- geiser-scheme-implementation: guile -*-
> (let ((classification (quote (("A" "Aood") ("AA" "Aood") ("AA 
>  A" "Aood") (" AAA AA" "Aood") ("A " "Aood") 
> ("AAA AAA" "Aood") ("AAA " "Aood") ("AAA Aithdrawal" "Aash") 
> ("AAA.AAA.AA" "Aravel") (" A" "AAAard") ("AAAard" "Aobot") 
> (" " "Ainging") ("A" "Aood") ("AA" "Aood") (" 
> AA" "Aetrol") ("Aetrol" "Aravel") ("A AAA" "Aaircut") 
> ("Aaircut" "Aersonal care") ("Aank credit A AAA AA AAA" "Ancome") 
> ("Anterest added" "Ancome") ("AA " "Aobot") ("Ao Aouth Aoast Aoole 
> AA" "Aravel") ("   AA" "Aravel") ("'A AAA 
> AAA" "Aoncert") ("AA & " "Aersonal care") ("" "Aood") 
> ("AAA AA" "Aood") ("A credit A+A AAA AA AA AAA" "Ancome") 
> ("A A" "Aetrol") ("A AAA" "Aetrol") ("A A" "Ausic 
> lessons") ("AAA" "Ainging") ("AA AAA AAA" "AA licence") ("AA licence" 
> "Atilities") ("" "Arance funding") ("AAA AA" "Aravel") 
> ("AAA  " "Aub") ("A A AA AAA AA" "Aennis with 
> cousin") ("A AAA" "Aood") ("AA AAA" "Aetrol") ("AA 
> AA" "Atilities") ("AAA A" "Aub") (" A AA" "Aood") ("" 
> "Atilities") ("AA AA " "Anvestment for cousin") ("AA" 
> "Aravel") ("Ahe Aike Aarista" "Aood") ("A AA A" "Atilities") 
> ("A.AA" "Atilities") ("A  AAA" "Aouncil tax") ("AA-  
> AAA" "Aetrol") ("A AAA A" "Aetrol") ("AAA AAA AA" 
> "Aub") ("AA AA" "Aharity") ("AAA" "Aharity") ("-AA51AAA" "Aar 
> tax") ("071660 50225530" "Aransfer from savings a/c") ("AAA" "Aegal 
> fees") ("AAA.AAA" "Anline content") ("Aon-Aterling transaction fee" "Anline 
> content") (" AA" "Aatteries") ("AA" "Aighgate 
> cleaning") (81 "Aegal fees") ("A AA40340807A A AAA" "Aetrol") 
> ("AA AAA A" "Aood") ("AAA..AAA" "Ainema") (" 
> A AAA" "Aegal fees") ("A " "Ausic lessons") ("A 
> AA " "Aetrol") (" A" "Aood") ("AAA AA AAA" "Aub") 
> ("Aank credit A AAA AA-AAA" "Ancome") ("AAA " "Aurling 
> (reimbursable)") ("Aank credit A Aerram" "Aransfer to/from other a/c") 
> ("A AA" "Aood") ("Aheque deposit" "Ancome") ("AAA" "Aood") ("AAA 
> AAA AA AAA" "Aegal fees") ("A AA & A A AAA" "Aransfer to/from other 
> a/c") ("AAA A A" &

Re: [O] Data length limit in Guile/Geiser/Scheme evaluation

2018-11-15 Thread Neil Jerram
Some versions in case they are relevant:

Org mode version 9.1.13 (9.1.13-elpa @ /home/neil/.emacs.d/elpa/org-20180625/)

Geiser from /home/neil/.emacs.d/elpa/geiser-20180610.1754

guile (GNU Guile) 2.2.3
Packaged by Debian (2.2.3-deb+1-3ubuntu0.1)

GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, 
modified by Debian


Neil Jerram  writes:

> I seem to have hit a limit in how much data can be successfully passed
> from Org to Geiser and Guile.  The attached file demonstrates this.
>
> With the file as attached, and hitting C-c C-c on '(length
> classification)', I get 139 (which is correct).
>
> If I add one more (duplicate) row to the table, and hit C-c C-c again,
> the evaluation hangs somewhere and Emacs is blocked until I interrupt
> with C-g.
>
> Has anyone else seen this?  Is there a fix?  If not, any ideas for how I
> can investigate further?  I love doing stuff with Org and Scheme code,
> so really hope that I don't have to have my wings clipped by this
> apparent limit.
>
> Best wishes,
>   Neil
>
>
> #+NAME: classification
> | A  | Aood   |
> | AA | Aood   |
> | AA  A  | Aood   |
> |  AAA AA| Aood   |
> | A  | Aood   |
> | AAA AAA| Aood   |
> | AAA    | Aood   |
> | AAA Aithdrawal | Aash   |
> | AAA.AAA.AA | Aravel |
> |  A | AAAard |
> | AAAard | Aobot  |
> |    | Ainging|
> | A  | Aood   |
> | AA | Aood   |
> |  AA| Aetrol |
> | Aetrol | Aravel |
> | A AAA  | Aaircut|
> | Aaircut| Aersonal care  |
> | Aank credit A AAA AA AAA | Ancome |
> | Anterest added | Ancome |
> | AA | Aobot  |
> | Ao Aouth Aoast Aoole AA| Aravel |
> |    AA  | Aravel |
> | 'A AAA AAA | Aoncert|
> | AA &   | Aersonal care  |
> |    | Aood   |
> | AAA AA | Aood   |
> | A credit A+A AAA AA AA AAA | Ancome |
> | A A| Aetrol |
> | A AAA  | Aetrol |
> | A A| Ausic lessons  |
> | AAA| Ainging|
> | AA AAA AAA | AA licence |
> | AA licence | Atilities  |
> |    | Arance funding |
> | AAA AA | Aravel |
> | AAA    | Aub|
> | A A AA AAA AA  | Aennis with cousin |
> | A AAA  | Aood   |
> | AA AAA | Aetrol |
> | AA AA  | Atilities  |
> | AAA A  | Aub|
> |  A AA  | Aood   |
> |    | Atilities  |
> | AA AA  | Anvestment for cousin  |
> | AA | Aravel |
> | Ahe Aike Aarista   | Aood   |
> | A AA A | A

[O] Data length limit in Guile/Geiser/Scheme evaluation

2018-11-15 Thread Neil Jerram
I seem to have hit a limit in how much data can be successfully passed
from Org to Geiser and Guile.  The attached file demonstrates this.

With the file as attached, and hitting C-c C-c on '(length
classification)', I get 139 (which is correct).

If I add one more (duplicate) row to the table, and hit C-c C-c again,
the evaluation hangs somewhere and Emacs is blocked until I interrupt
with C-g.

Has anyone else seen this?  Is there a fix?  If not, any ideas for how I
can investigate further?  I love doing stuff with Org and Scheme code,
so really hope that I don't have to have my wings clipped by this
apparent limit.

Best wishes,
  Neil


#+NAME: classification
| A  | Aood   |
| AA | Aood   |
| AA  A  | Aood   |
|  AAA AA| Aood   |
| A  | Aood   |
| AAA AAA| Aood   |
| AAA    | Aood   |
| AAA Aithdrawal | Aash   |
| AAA.AAA.AA | Aravel |
|  A | AAAard |
| AAAard | Aobot  |
|    | Ainging|
| A  | Aood   |
| AA | Aood   |
|  AA| Aetrol |
| Aetrol | Aravel |
| A AAA  | Aaircut|
| Aaircut| Aersonal care  |
| Aank credit A AAA AA AAA | Ancome |
| Anterest added | Ancome |
| AA | Aobot  |
| Ao Aouth Aoast Aoole AA| Aravel |
|    AA  | Aravel |
| 'A AAA AAA | Aoncert|
| AA &   | Aersonal care  |
|    | Aood   |
| AAA AA | Aood   |
| A credit A+A AAA AA AA AAA | Ancome |
| A A| Aetrol |
| A AAA  | Aetrol |
| A A| Ausic lessons  |
| AAA| Ainging|
| AA AAA AAA | AA licence |
| AA licence | Atilities  |
|    | Arance funding |
| AAA AA | Aravel |
| AAA    | Aub|
| A A AA AAA AA  | Aennis with cousin |
| A AAA  | Aood   |
| AA AAA | Aetrol |
| AA AA  | Atilities  |
| AAA A  | Aub|
|  A AA  | Aood   |
|    | Atilities  |
| AA AA  | Anvestment for cousin  |
| AA | Aravel |
| Ahe Aike Aarista   | Aood   |
| A AA A | Atilities  |
| A.AA   | Atilities  |
| A  AAA | Aouncil tax|
| AA-  AAA   | Aetrol |
| A AAA A| Aetrol |
| AAA AAA AA | Aub|
| AA AA  | Aharity|
| AAA| Aharity|
| -AA51AAA   | Aar tax|
| 071660 50225530| Aransfer from savings a/c  |
| 

Re: [O] *markup*, /markup/ and _markup_ true semantics [Was: Re: Ox-html: Replace with and with ]

2018-10-28 Thread Neil Jerram
Tim Cross  writes:

> On reading your response, we are probably not as far apart as I first
> thought. However, we have now wondered into discussion which probably
> isn't appropriate for this list. It is now in the realms of something
> that would probably be better discussed with a good bottle of red or a
> nice cold beer!
>
> There is lots that is 'broken' with the web and I suspect much of it we
> will just have to live with and hope whatever the next evolution brings
> us learns from our mistakes.
>
> Tim
>
> Garreau, Alexandre  writes:
>
>> On 2018/10/27 at 07:15, Tim Cross wrote:
>>> I have either misunderstood most of your position or I simply disagree
>>> with it - I'm not sure which.
>>
>> maybe a mix of both? I hope it’s a misunderstandnment but if it’s not I
>> want to understand too so to get to a constructive agreement.
[...]

Well for what it's worth I have enjoyed reading all this; especially
Alexandre's exposition of the difference between italic and bold when
being read 'from near' and 'from far'.  Thanks both.

Neil



Re: [O] org-babel-execute:go crashes on Mac

2018-10-25 Thread Neil Jerram
Mario Martelli  writes:

> Thank you for your answer. 
>
>> If you haven't already, I suggest checking that there isn't a difference in 
>> your Go setup, by working out the "go run ..." command that is being run 
>> below, and running that manually yourself.
>
> My first assumption was - to be honest, still is - that the "go run …” is not 
> executed at all because the call to “go run …”  is within an illegal elisp 
> function. Am I wrong with my assumption?
>
> Kind regards
> Mario
>
> P.S. Would have no idea how to work out what the outcome of the function is ;)

Perhaps I misunderstood the error message, but I thought perhaps it was
about code trying to represent the _result_ of the execution as an elisp
function.  But it is very difficult to tell!

I guess if I had this on my system (which I can't because I don't run on
a Mac), I'd use 'edebug-defun' on some of the functions involved in the
error message, in order to start understanding whether they are actually
being executed.

Best wishes,
   Neil



Re: [O] org-babel-execute:go crashes on Mac

2018-10-25 Thread Neil Jerram
If you haven't already, I suggest checking that there isn't a difference in 
your Go setup, by working out the "go run ..." command that is being run below, 
and running that manually yourself.


On 25 October 2018 05:28:53 BST, Mario Martelli  
wrote:
>Morning,
>
>recently I tried to use ob-go and ran immediately into:
>
>org-babel-execute:go: Invalid function: (results (org-babel-eval
>(format "%s run %s \"%s\" %s" org-babel-go-command (mapconcat (quote
>identity) (org-babel-go-as-list flags) " ")
>(org-babel-process-file-name tmp-src-file) (mapconcat (function (lambda
>(a) (format "%S" (if (symbolp a) (let* (... ...) (if ... ... out))
>a (org-babel-go-as-list args) " ")) ""))
>
>The strange thing is, that this only happens on my Mac. On my CentOS
>machine it works like a charm. Both machines run on Emacs 26.1b1 and
>org mode 9.1.9-65-g5e454. All packages are from Melpa and the machines
>share the same .emacs.
>
>I have no idea how to get to the bottom of this phenomenon. Any hint or
>help would be appreciated very much.
>
>Thank you
>Mario
>
>— 


Re: [O] slack syntax exporter/copier

2018-10-22 Thread Neil Jerram
Matt Price  writes:

> A while ago I asked about a slack syntax exporter.  I cpy text from org to
> slack often enough that I spent an hour or two today writing a simple one,
> which I put up in a  gist:
> https://gist.github.com/titaniumbones/c0c171e4df8a6ff5f0f564b8a655c079

Nice, thank you!

> If people are interested, I will be happy to package it up & put on melpa
> or whatever (would be the first time for me).

Yes, I think it's quite likely that I would use this sometimes, so I'd
love if it was conveniently available.

Best wishes,
   Neil


> I mostly am interested in copy-paste, not in producing permanent files, so
> I use it with this simple utility function:
>
> (defun ora-org-export-to-clipboard-as-slack ()
>   "Export region to FMT, and copy to the kill ring for pasting into
> other programs."
>   (interactive)
>   (let* ((org-export-with-toc nil)
>  (org-export-with-smart-quotes nil))
> (kill-new (org-export-as 'slack) ))
>   )
> (global-set-key (kbd "C-c W s") 'ora-org-export-to-clipboard-as-slack)
>
> The "ora" prefix reflects its origins in an old oremacs function that I use
> for (much more involved) HTML copy-paste:
> - [[
> https://github.com/abo-abo/oremacs/commit/6c86696c0a1f66bf690e1a934683f85f04c6f34d#diff-ecff87135600df0cafffb47c303ae9c6][abo-abo's
> code from oremacs]]
> - [[
> http://kitchingroup.cheme.cmu.edu/blog/2016/06/16/Copy-formatted-org-mode-text-from-Emacs-to-other-applications/#comment-2735698988][john's
> original post]]
>
>
> SO far it seems OK. There are doubtless still bugs so probably it would be
> better to make a repo after all!



Re: [O] Emacs mobile org

2018-09-10 Thread Neil Jerram



On 10 September 2018 08:46:41 BST, Alan Schmitt 
 wrote:
>On 2018-09-09 21:43, Kaushal Modi  writes:
>
>> On Sun, Sep 9, 2018 at 7:53 PM M. P. 
>wrote:
>>
>>> Hello I am running emacs on a mac I have a galaxy s8 android phone.
>I am
>>> wanting to sync my phone with emacs on my computer.
>>> I would prefer not to use a cloud service but instead use
>>> something like a usb or ther to sync with.
>>>
>>
>> So, what is the question? :)
>>
>> Looking at just "Org" and "Android phone", I can suggest the Orgzly
>app.
>>
>> It can sync notes to a directory on your phone, and you can sync that
>dir
>> to your computer via USB if you like (I like the Dropbox sync
>option).
>
>I use orgzly, and it works great with syncthing https://syncthing.net/
>
>Best,
>
>Alan

I also use orgzly, with my own scripting for syncing against a git repo on 
bitbucket.

Regards - Neil



Re: [O] Multi-step ledger org-capture template

2018-08-28 Thread Neil Jerram



On 27 August 2018 09:05:32 BST, ST  wrote:
>Thank you for sharing!
>
>It would be nice to be able to generate a .pdf invoice based on a
>predefined template (in .org/.tex/etc formats; maybe utilizing org-mode
>exporter) for certain ledger transaction (by default the current one,
>highlighted by cursor in ledger-mode).
>
>Did anybody wrote something similar in the past?

In this general area, I have been developing a combination of org mode and 
Scheme code whose aim is to help me define budgets, and then track whether my 
actual spending is in accordance with those budgets.

I'm not using ledger here. I hope I'm not missing something, but I looked at 
ledger and it didn't seem to help with the main thing I thought I needed, which 
was to read in transaction dump files from my bank and present those in a 
summarised form according to my budget categories. I use org tables to define 
what the categories are, and how particular transaction entries are mapped into 
those categories (or else show up as "Unknown").

It's a work in progress... In case anyone else is interested in this particular 
itch, I'd be interested to hear your thoughts.

Best wishes,
  Neil



Re: [O] Documentation: Babel scheme support and geiser

2018-07-26 Thread Neil Jerram
Jarmo Hurri  writes:

> Greetings.
>
> I started doing some Schemeing in org,

Welcome to the club!

> and bumped into a couple of
> documentation issues I wanted to check / report.
>
> In short, I wonder whether
> 1. geiser should be listed as a scheme requirement in worg
> 2. ob-scheme.el should point to MELPA instead of ELPA for geiser.
>
> The long version
> 
>
> First, worg lists no requirements for use of scheme
>
> https://orgmode.org/worg/org-contrib/babel/languages.html
>
> but typing C-c C-c in a scheme block gives error
>
> org-babel-execute-src-block: Symbol’s value as variable is void:
> geiser-default-implementation

Please note
https://www.mail-archive.com/emacs-orgmode@gnu.org/msg116779.html.  I
believe that can be a runtime problem, i.e. to do with
require/autoloading, and maybe not an installation problem.

> Second, file ob-scheme.el tells me that
>
> ;; - for session based evaluation geiser is required, which is available from
> ;;   ELPA.
>
> However, neither the ELPA page
>
> https://elpa.gnu.org/packages/
>
> nor "M-x list-packages" list geiser as an available package.
>
> It does seem, however, that geiser _is_ available from MELPA

That sounds right to me; I've checked that my geiser is from MELPA.

> http://stable.melpa.org/#/geiser
>
> (or git directly).
>
> All the best,
>
> Jarmo

Best wishes,
   Neil



Re: [O] How to move up/down a headline but not the subtree?

2018-07-05 Thread Neil Jerram
alain.coch...@unistra.fr writes:

> Neil Jerram writes on Thu  5 Jul 2018 11:46:
>
>  > > What I would like to do is to be able to move a headline with
>  > > everything up to (but not including) its first subheading.
>  > >
>  > > Does anyone know how to do that?  
>  > >
>  > > I am also interested in knowing if there are specific (deep?)
>  > > reasons why this seemingly basic operation, which I see as the
>  > > analogous of org-do-promote/demote and perform very often with
>  > > standard (but tedious) emacs editing commands, is not already
>  > > implemented.
>
>  > My view/guess: because the subheadings are an integral part of the
>  > content of the containing item.
>  > 
>  > Wouldn't you agree?  It seems to me like a fairly fundamental
>  > aspect of the Org model.
>
> Yes, but couldn't you raise the same argument about
> org-promote/demote?

Fair point.

>  > That said, perhaps your use case is one where you've realized that
>  > subheadings don't actually belong to the containing item?  In that
>  > case, what could make more sense is to promote (or kill and yank
>  > elsewhere) all of the wrongly placed subheadings.  You could
>  > promote an individual subheading with M-S-left, or kill and yank it
>  > with C-c C-x C-w and C-c C-x C-y, but I don't know if there's an
>  > easy way to repeat that over all subheadings.
>  > 
>  > Another possible approach: what about demoting just the containing
>  > heading with M-left and then killing/yanking that elsewhere?
>
> My use case is after I have not too carefully written down many ideas.
> Then I start thinking and try to order them in a better way.  All what
> you suggest is very sensible but much longer than the command I am
> looking for.

FWIW, I just experimented.  This seems to work:

  M-right M-right M-right M-right M-right C-c C-x C-w

  move to new destination

  C-c C-x C-y

and is pretty fast.

> Thanks much for you time.
> a.

No problem, it's an interesting question.

Neil



Re: [O] How to move up/down a headline but not the subtree?

2018-07-05 Thread Neil Jerram
alain.coch...@unistra.fr writes:

> Hello.  
>
> I am aware of org-move-subtree-up/down, which moves the entire
> subtree. 
>
> I am also aware of org-shiftmetaup/down which moves the line[fn:1] (also
> works for a headline).
>
> What I would like to do is to be able to move a headline with
> everything up to (but not including) its first subheading.
>
> Does anyone know how to do that?  
>
> I am also interested in knowing if there are specific (deep?) reasons
> why this seemingly basic operation, which I see as the analogous of
> org-do-promote/demote and perform very often with standard (but
> tedious) emacs editing commands, is not already implemented.

My view/guess: because the subheadings are an integral part of the
content of the containing item.

Wouldn't you agree?  It seems to me like a fairly fundamental aspect of
the Org model.

That said, perhaps your use case is one where you've realized that
subheadings don't actually belong to the containing item?  In that case,
what could make more sense is to promote (or kill and yank elsewhere)
all of the wrongly placed subheadings.  You could promote an individual
subheading with M-S-left, or kill and yank it with C-c C-x C-w and C-c
C-x C-y, but I don't know if there's an easy way to repeat that over all
subheadings.

Another possible approach: what about demoting just the containing
heading with M-left and then killing/yanking that elsewhere?

Regards,
   Neil



Re: [O] TODO do not display in org-agenda mode

2018-06-25 Thread Neil Jerram
Michaël Chlon  writes:

> Hi,
>
> I have spacemacs and write some org files.

By the way, does anyone else find "spacemacs" bothering?  Unlike
previous things like MicroEmacs, which have somehow always been clear to
me to be very different things from Emacs, I get the impression that
"spacemacs" users think that Emacs communities should be able to help
them in detail, which suggests that they think it's basically the same
thing.

But if it's the same as Emacs, why use a different name that makes me
hesitate / worry over whether it might be different from Emacs?

On the other hand, if it's different from Emacs, does it still make
sense to ask for support here?

I'm genuinely in the dark here, although inclined to think that forking
the name (of Emacs) is a subtly damaging thing to do; so interested
either to be put right or to hear other opinions.

Regards,
Neil



Re: [O] TODO do not display in org-agenda mode

2018-06-25 Thread Neil Jerram
Michaël Chlon  writes:

> Hi,
>
> I have spacemacs and write some org files.
> But when I generate an agenda view for week,
> for example, TODO task are not displayed !!

What kind of agenda view do you mean?

With 'C-c a a' (which is what I mostly use), TODO items are only shown
by default if they have a date (scheduled or deadline or active
timestamp).

With 'C-c a t', all TODO items are shown.

Hope this helps...

 Neil



Re: [O] [PATCH] ob-scheme.el: Fix scheme blocks ignoring :results in formatting

2018-06-21 Thread Neil Jerram
Henry Blevins  writes:

> Currently, scheme babel blocks ignore :results header arguments like
> 'verbatim' and attempt to format all output as tables. This patch corrects
> that and performs the user supplied formatting.
>
> This is my first time contributing a patch, so I apologize if I have made
> any mistakes in submitting this.

Thanks for working on this Henry; as a fellow ob-scheme user, I
appreciate it.

> Currently, `org-babel-execute:scheme' ignores the user specified :result 
> header
> argument found in the :result-param parameter and process all output as a 
> table.
> The fix is to pass the `result' and :result-param to the 
> `org-babel-result-cond'
> function to invoke the corresponding formatting.
>
> For example, the following block incorrectly formats its output as a table:
>
> (list 1 2 3)
>
> | 1 | 2 | 3 |
>
> This patch results in the correct behavior:
>
> (list 1 2 3)
>
> : (1 2 3)
>
> Bringing it inline with the result using Emacs lisp:
>
> (list 1 2 3)
>
> : (1 2 3)

But if I want the table output

| 1 | 2 | 3 |

will there still be a way to get it?  (I'm sure I have org files that
need this!)

Regards,
   Neil



Re: [O] Bug: Args out of range error in HTML export [9.1.13 (9.1.13-elpa @ /home/neil/.emacs.d/elpa/org-20180514/)]

2018-06-01 Thread Neil Jerram
FYI I can avoid this error by adding a space before the open and close
braces; i.e. this is OK:

#+BEGIN_SRC sh
 {
cat < writes:

> With this Org source:
>
> #+BEGIN_SRC sh
> {
> cat <   failsafeInboundHostPorts:
> EOF
> }
> #+END_SRC
>
> With `C-c C-e h h', to export that as HTML, I get:
>
> Debugger entered--Lisp error: (args-out-of-range # 0 1)
>   parse-partial-sexp(1 0)
>   syntax-ppss(0)
>   sh--inside-noncommand-expression(0)
>   sh--inside-noncommand-expression(10)
>   sh-font-lock-open-heredoc(10 "EOF" 16)
>   sh-syntax-propertize-function(1 50)
>   syntax-propertize(50)
>   font-lock-fontify-syntactically-region(1 50 nil)
>   font-lock-default-fontify-region(1 50 nil)
>   font-lock-fontify-region(1 50 nil)
>   font-lock-default-fontify-buffer()
>   #[(_beg _end) "?\205\302 \210  ?\205\303\211\207" [font-lock-fontified 
> font-lock-mode font-lock-default-fontify-buffer nil] 2](1 50)
>   org-font-lock-ensure()
>   org-html-fontify-code("{\ncat < failsafeInboundHostPorts:\nEOF\n}" "sh")
>   org-html-do-format-code("{\ncat < failsafeInboundHostPorts:\nEOF\n}" "sh" nil t nil)
>   org-html-format-code((src-block (:language "sh" :switches nil :parameters 
> nil :begin 2 :end 77 :number-lines nil :preserve-indent nil :retain-labels t 
> :use-labels t :label-fmt nil :value "{\ncat < failsafeInboundHostPorts:\nEOF\n}\n" :post-blank 0 :post-affiliated 2 :parent 
> (section (:begin 2 :end 77 :contents-begin 2 :contents-end 77 :post-blank 0 
> :post-affiliated 2 :parent (org-data nil #2)) #0))) (:export-options nil 
> :back-end [cl-struct-org-export-backend html nil ((bold . org-html-bold) 
> (center-block . org-html-center-block) (clock . org-html-clock) (code . 
> org-html-code) (drawer . org-html-drawer) (dynamic-block . 
> org-html-dynamic-block) (entity . org-html-entity) (example-block . 
> org-html-example-block) (export-block . org-html-export-block) 
> (export-snippet . org-html-export-snippet) (fixed-width . 
> org-html-fixed-width) (footnote-definition . org-html-footnote-definition) 
> (footnote-reference . org-html-footnote-reference) (headline . 
> org-html-headline) (horizontal-rule . org-html-horizontal-rule) 
> (inline-src-block . org-html-inline-src-block) (inlinetask . 
> org-html-inlinetask) (inner-template . org-html-inner-template) (italic . 
> org-html-italic) (item . org-html-item) (keyword . org-html-keyword) 
> (latex-environment . org-html-latex-environment) (latex-fragment . 
> org-html-latex-fragment) (line-break . org-html-line-break) (link . 
> org-html-link) (node-property . org-html-node-property) (paragraph . 
> org-html-paragraph) (plain-list . org-html-plain-list) (plain-text . 
> org-html-plain-text) (planning . org-html-planning) (property-drawer . 
> org-html-property-drawer) (quote-block . org-html-quote-block) (radio-target 
> . org-html-radio-target) (section . org-html-section) (special-block . 
> org-html-special-block) (src-block . org-html-src-block) (statistics-cookie . 
> org-html-statistics-cookie) (strike-through . org-html-strike-through) 
> (subscript . org-html-subscript) (superscript . org-html-superscript) (table 
> . org-html-table) (table-cell . org-html-table-cell) (table-row . 
> org-html-table-row) (target . org-html-target) (template . org-html-template) 
> (timestamp . org-html-timestamp) (underline . org-html-underline) (verbatim . 
> org-html-verbatim) (verse-block . org-html-verse-block)) ((:html-doctype 
> "HTML_DOCTYPE" nil org-html-doctype) (:html-container "HTML_CONTAINER" nil 
> org-html-container-element) (:description "DESCRIPTION" nil nil newline) 
> (:keywords "KEYWORDS" nil nil space) (:html-html5-fancy nil "html5-fancy" 
> org-html-html5-fancy) (:html-link-use-abs-url nil "html-link-use-abs-url" 
> org-html-link-use-abs-url) (:html-link-home "HTML_LINK_HOME" nil 
> org-html-link-home) (:html-link-up "HTML_LINK_UP" nil org-html-link-up) 
> (:html-mathjax "HTML_MATHJAX" nil "" space) (:html-postamble nil 
> "html-postamble" org-html-postamble) (:html-preamble nil "html-preamble" 
> org-html-preamble) (:html-head "HTML_HEAD" nil org-html-head newline) 
> (:html-head-extra "HTML_HEAD_EXTRA" nil org-html-head-extra newline) 
> (:subtitle "SUBTITLE" nil nil parse) (:html-head-include-default-style nil 
> "html-style" org-html-head-include-default-style) (:html-head-include-scripts 
> nil "html-scripts" org-html-head-include-scripts) 
> (:html-allow-name-attribute-in-anchors nil nil 
> org-html-allow-name-attribute-in-anchors) (:html-divs nil nil org-html-divs) 
> (:html-checkbox-type nil nil org-html-checkbox-type) (:html-extension nil nil 
> org-html-extension) (:html-footnote-format nil nil org-html-footnote-format) 
> (:html-footnote-separator nil nil org-html-footnote-separator) 
> (:html-footnotes-section nil nil org-html-footnotes-section) 
> (:html-format-drawer-function nil nil org-html-format-drawer-function) 
> (:html-format-headline-function nil nil org-html-format-headline-function) 
> 

[O] Bug: Args out of range error in HTML export [9.1.13 (9.1.13-elpa @ /home/neil/.emacs.d/elpa/org-20180514/)]

2018-06-01 Thread Neil Jerram
With this Org source:

#+BEGIN_SRC sh
{
cat < 0 1)
  parse-partial-sexp(1 0)
  syntax-ppss(0)
  sh--inside-noncommand-expression(0)
  sh--inside-noncommand-expression(10)
  sh-font-lock-open-heredoc(10 "EOF" 16)
  sh-syntax-propertize-function(1 50)
  syntax-propertize(50)
  font-lock-fontify-syntactically-region(1 50 nil)
  font-lock-default-fontify-region(1 50 nil)
  font-lock-fontify-region(1 50 nil)
  font-lock-default-fontify-buffer()
  #[(_beg _end) "?\205\302 \210   ?\205\303\211\207" 
[font-lock-fontified font-lock-mode font-lock-default-fontify-buffer nil] 2](1 
50)
  org-font-lock-ensure()
  org-html-fontify-code("{\ncat 

Re: [O] [RFC] Dog food, anyone?

2018-05-10 Thread Neil Jerram
In my $dayjob we're now calling that "drinking our own champagne", which IMO is 
rather nicer than eating our own dog food :-)

Best wishes - Neil


On 9 May 2018 19:11:21 BST, Jon Snader  wrote:
>This is excellent. I love that, as Nicolas says, we're eating our 
>own
>dog food. Perhaps this will put to rest the doubts expressed on
>Emacs-Devel a year or two ago in the thread about replacing 
>TeXinfo as
>to whether Org mode was up to the task.


Re: [O] [POLL] Should Org tempo be enabled by default? (expand templates thru e.g. "<s[TAB]")

2018-05-04 Thread Neil Jerram
William Denton  writes:

> On 3 May 2018, Carsten Dominik wrote:
>
>> after initial doubt about this issue, I am now siding with Nicolas on this
>> one.  I have started to use C-c C-,   , and it works very well.  In
>> particular, as Bernt says, the wrapping makes a very big difference, I have
>> always missed this.
>
> I feel the same.  I'd set up ya-snippets to get the old behaviour, but I've 
> been 
> trying this and am going to switch over permanently.  (That said, it might 
> make 
> sense to do this in version 10.)

How can I see and try this famous C-c C-, ?  I'm running:

  Org mode version 9.1.12 (9.1.12-1-g388254-elpa @ 
/home/neil/.emacs.d/elpa/org-20180430/)

but apparently that is still not new enough:

  C-c C-, is undefined

> M-x three-cheers-for-org-mode,

Hip hip!

Many thanks - Neil



Re: [O] Bug: Modifying org-latex-pdf-process doesn't modify the async export behaviour

2018-04-07 Thread Neil Jerram
Leo Vivier  writes:

> Hello,
>
> Thank you for pointing me in the right direction. I've created another 
> init file just for async-export, and not only have I got it to work, but 
> it's also quite a lot faster than it used to be.
>
> All that remains now is to find a way to re-write my function. My 
> knowledge of elisp if fairly limited, and I don't see how to communicate 
> with the background process other than by writing the value of my 
> toggle-variable to a file.

Hi Leo,

In general, one would communicate with a subprocess through its input
and output, and to do that in elisp please see (elisp) Input to
Processes.

Neil



Re: [O] Adding an item to the agenda from the agenda view

2018-03-05 Thread Neil Jerram
Eric,

IIUC, that would add an entry to the 'diary' file.  I thought perhaps that 
Shérab meant something different, namely to capture a new TODO item that was 
scheduled for that date.

In any case, I think that latter thing is also an interesting thing to do. Is 
there an easy way to do that?

Best wishes - Neil


On 5 March 2018 06:52:40 GMT+00:00, Eric S Fraga  wrote:
>On Sunday,  4 Mar 2018 at 23:22, Shérab wrote:
>> I would like to add an item with the
>> corresponding date to my agenda file. What would be the most direct /
>> straightforward / idiomatic way to achieve this, please?
>
>try "i d".  "i" should be bound to org-agenda-diary-entry.  This is the
>route I use for adding entries to my agenda all the time.
>
>-- 
>Eric S Fraga via Emacs 27.0.50, Org release_9.1.6-191-g90607d


Re: [O] Orgmode in Madrid

2018-03-02 Thread Neil Jerram
I won't be in Madrid, but would still be interested to hear (especially) 
Bastien's remarks about the French government's use of free software. Could you 
let us know if slides and/or a recording are posted?

Thanks - Neil


On 1 March 2018 11:49:47 GMT+00:00, David Arroyo Menendez  
wrote:
>
>Hi emacsers,
>
>Bastien Guerry will be in Medialab this weekend if you are in Madrid,
>you can enjoy about orgmode and emacs speech.
>
>All info in
>https://www.medialab-prado.es/actividades/dia-de-los-datos-abiertos
>
>I'm creating an event in meetup to this event
>https://www.meetup.com/es-ES/EmacsMadrid/
>
>Regards.


Re: [O] Scheme code evaluation in fresh Emacs

2017-12-19 Thread Neil Jerram

On 19/12/17 19:30, Nicolas Goaziou wrote:

Hello,

Neil Jerram <n...@ossau.homelinux.net> writes:


When I try to evaluate Scheme code in an Emacs where I haven't yet
done any Geiser/Scheme work, I get an error about
geiser-default-implementation being undefined.  The attached patch
fixes that, but I am not sure if it is the most minimal fix possible.
WDYT?

Thank you. I applied the patch.

I think it would be worth notifying upstream about it, if you have some
spare time.


Sure, but which upstream do you mean?

    Neil




[O] Scheme code evaluation in fresh Emacs

2017-12-19 Thread Neil Jerram
When I try to evaluate Scheme code in an Emacs where I haven't yet done 
any Geiser/Scheme work, I get an error about 
geiser-default-implementation being undefined.  The attached patch fixes 
that, but I am not sure if it is the most minimal fix possible.  WDYT?


Best wishes - Neil


>From adceb034b886d1c3624b31f83f8826869cd1b92c Mon Sep 17 00:00:00 2001
From: Neil Jerram <n...@tigera.io>
Date: Tue, 19 Dec 2017 18:15:00 +
Subject: [PATCH] Fix Scheme evaluation in fresh Emacs

* lisp/ob-scheme.el: Require geiser-impl so that
  geiser-default-implementation is defined.  Otherwise, unless Geiser
  has previously been run (e.g. with `run-geiser'), you'll see an
  error that geiser-default-implementation is undefined.
---
 lisp/ob-scheme.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index f67080adf..7dbd78097 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -40,6 +40,7 @@
 ;;; Code:
 (require 'ob)
 (require 'geiser nil t)
+(require 'geiser-impl nil t)
 (defvar geiser-repl--repl) ; Defined in geiser-repl.el
 (defvar geiser-impl--implementation)   ; Defined in geiser-impl.el
 (defvar geiser-default-implementation) ; Defined in geiser-impl.el
-- 
2.15.1



Re: [O] use a src block's result as input of another src block report error: the input device is not a TTY

2017-12-19 Thread Neil Jerram
Remove the -it options, which I believe you don't need for executing a simple 
command like pwd.

(-it is what you use to execute a shell or other interactive command in a 
container, and requires there to be a tty.)

Best wishes - Neil


On 19 December 2017 12:59:19 GMT+00:00, "numbch...@gmail.com" 
 wrote:
>Here is my example:
>
>#+NAME: get-container-name
>#+begin_src shell :results output
>echo $(docker ps --format="{{.Names}}")
>#+end_src
>
>#+RESULTS: get-container-name
>: elastic_thompson
>
>#+begin_src shell :var container_name=get-container-name :noweb yes
>docker exec -it $container_name pwd
># docker exec -it <> pwd
>#+end_src
>
>#+RESULTS:
>
>But I got error:
>
>#+begin_example
>the input device is not a TTY
>#+end_example
>
>
>[stardiviner] GPG key ID: 47C32433
>IRC(freeenode): stardiviner Twitter:  @numbchild
>Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
>Blog: http://stardiviner.github.io/


Re: [O] Emacs sagmentation fault error on a big org-mode file movement

2017-12-16 Thread Neil Jerram

I would suggest (but without detailed knowledge of current emacs practice):

1. Report your exact emacs version.

2. Install a corresponding debug symbols package, if your distro 
provides that.  That should add a lot more interesting detail to the 
backtrace.


3. To go further, repro under GDB, ideally with corresponding source 
code.  Then you could explore the immediate cause of the segfault.


    Neil


On 16/12/17 04:27, numbch...@gmail.com wrote:
I have a big org-mode file which is overview at startup. When I 
navigate around with [C-v] and [M-v]. The Emacs crashed.


Here is the output from command-line:
```
Fatal error 11: Segmentation fault
Backtrace:
emacs[0x51195e]
emacs[0x4f739a]
emacs[0x50fe3e]
emacs[0x510058]
emacs[0x5100dc]
/usr/lib/libpthread.so.0(+0x11da0)[0x7fcb1cdcada0]
emacs[0x4caa74]
emacs[0x45b2b5]
emacs[0x4613e9]
emacs[0x41eb42]
emacs[0x42087c]
emacs[0x42157a]
emacs[0x421567]
emacs[0x421567]
emacs[0x42351d]
emacs[0x458015]
emacs[0x501893]
emacs[0x50465a]
emacs[0x5061dc]
emacs[0x56c85e]
emacs[0x4f7754]
emacs[0x56c7cd]
emacs[0x4f76eb]
emacs[0x4fc313]
emacs[0x4fc636]
emacs[0x41b302]
/usr/lib/libc.so.6(__libc_start_main+0xea)[0x7fcb1bf30f4a]
emacs[0x41c01a]
[1]    17259 segmentation fault (core dumped)  emacs --debug-init
```
Is there a way to debug this?
I know it is not possible to invoke edebug on anything internal Emacs.
So is there any system (Linux)  solution?
Like system process dump or traceback.

I'm using latest version `master` branch source code Org-mode.
Emacs is from compiled `master` branch  source code too.

[stardiviner]     GPG key ID: 47C32433
IRC(freeenode): stardiviner Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/




Re: [O] Status of org-babel lua / ob-lua.el

2017-11-24 Thread Neil Jerram
I'm completely guessing - but does it help to add :results output ?

On 24 November 2017 10:06:12 GMT+00:00, Jakob Simeth  
wrote:
>Hi,
>
>I seem to have problems with lua source blocks (others are working
>fine): When evaluating a simple block like
>
>#+BEGIN_SRC lua
>print("Hello world!")
>#+END_SRC
>
>I get an empty RESULT block, and the message "evaluation complete".
>I am running org-9.1.3 (within the spacemacs org layer).
>
>Is lua still officially supported? ob-lua.el seems to be part of
>org-plus-contrib and lua is listed on
>http://orgmode.org/org.html#Languages
>
>However, not on
>http://orgmode.org/worg/org-contrib/babel/languages.html
>
>Is there a way to "debug" this?
>
>Thank you,
>Jakob
>
>
>-- 
>Jakob Simeth
>===
>GPG:   AD0B55F959F83D14C6CA28153BE2F106425CBE4E


Re: [O] Ediff org files starts folded

2017-10-25 Thread Neil Jerram

org-startup-folded nil


On 25/10/17 15:55, Tory S. Anderson wrote:
I've wondered the same thing. Normally I just manually  and 
open all bullets before ediffing, but this assumes, of course, that 
the file is already open.

Alex Branham  writes:


Hello -

Whenever I ediff an org file, the three windows start with the 
content folded and out of site. I have to navigate to windows A, B, 
and C and hit S- until everything is visible. Does anyone know a 
way to start org mode files unfolded when ediffing them?


Thanks!
Alex







Re: [O] *Good* client for Android?

2017-10-13 Thread Neil Jerram
Hi John,There is a great discussion about adding git synchronization to Orgzly, in progress here: https://github.com/orgzly/orgzly-android/issues/24I am enjoying the Orgzly UI on my phone, and I have similar org-mode usage to you, in that l also already use a git repo to synchronize changes that l make on two separate laptops. So when that Orgzly enhancement lands, I think it will be Ideal for me.Best wishes,      Neil

Re: [O] orgmode for many continuous tasks?

2017-09-25 Thread Neil Jerram

Hi Peter...

On 25/09/17 12:58, Peter Neilson wrote:
Hmmm. I have similar problems, but on a somewhat more difficult level. 
A lot of my tasks are farm-related and are thus self-driven rather 
than org-mode-driven. For instance, two barn roofs need repair, and 
seeing them listed as TODO in an agenda does nothing to get started on 
them, or on the sub-tasks necessary to starting the work on the roofs. 
But when I look at the roofs, and thus am reminded of "* TODO Repair 
barn roofs", it's always when I'm already at work on something 
immediately more pressing.


But it gets worse! If I think of a task that needs to be done, and 
write it into one of my TODO lists, then I tend to ignore it. Adding 
it to the schedule dismisses it from any immediate concern, and (as I 
alluded before) much of my work is outside, on the farm, nowhere near 
my computer. It's almost like Ko-Ko's solution in G's operetta 'The 
Mikado':


  Ko-Ko: When Your Majesty says "Let a thing be done", it’s as good as 
done, practically it is done, because Your Majesty’s will is law. Your 
Majesty says "Kill a gentleman", and the gentleman is to be killed, 
consequently that gentleman is as good as dead, practically he is 
dead, and if he is dead, why not say so?
  The Mikado: I see. [Dramatic Pause] Nothing could possibly be 
more...satisfactory!


My problem with org mode itself thus becomes yet another action item 
(to be ignored):


* TODO Devise a way to project my agenda (in unavoidable brilliance) 
onto the side of the barn, or perhaps embroider it into the fleece of 
my sheep (who * TODO need to be shorn).


Plausible (or implausible) solutions to my problem or to Mycroft's are 
hereby solicited.




If I'm understanding correctly, part of your problem is that you don't 
have org-mode with you when you're in the places that you can get things 
done.  In that case, part of the answer might be having your org-mode on 
a mobile device.


I've just started using a new Android phone, with Orgzly on the phone, 
and a manual sync process between the files that Orgzly works on and my 
main org-mode files (which I keep in a git server, and update from 
multiple laptops). So far I've only been doing this for 1 day, but it 
looks promising.


Regards - Neil




Re: [O] Scheme output results

2017-09-07 Thread Neil Jerram

Hi Nicolas,

On 05/09/17 22:49, Nicolas Goaziou wrote:

Hello,

Neil Jerram <n...@ossau.homelinux.net> writes:


Hi Bastien & Nicolas,

I've been told by "Theodore Teah via RT <copyright-cl...@fsf.org>"
that my copyright assignment is in place now.

Great!

I tried to build Org with your patch, but it generates compilation
warnings. Could you look into it?

Thank you.

Regards,



I believe the attached patch fixes those problems.

Regards - Neil

>From 35d3742774335decfcf8e4e5ab8e4101332a39a5 Mon Sep 17 00:00:00 2001
From: Neil Jerram <n...@tigera.io>
Date: Sun, 20 Aug 2017 17:25:58 +0100
Subject: [PATCH] Improve Scheme code evaluation

* lisp/ob-scheme.el (org-babel-scheme-execute-with-geiser): Use
  Geiser's explicit 'retort' object, instead of catching and parsing
  an expected Emacs message (which for me is in any case overwritten
  by a following "Mark set" message); this also means we don't need
  the with-output-to-string approach for getting 'output' results.
  Also 'let' Geiser variables so as to avoid popping up the REPL
  and *Geiser dbg* buffers.
---
 lisp/ob-scheme.el | 62 ++-
 1 file changed, 34 insertions(+), 28 deletions(-)

diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index b8867d5..f822e15 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -44,12 +44,18 @@
 (defvar geiser-impl--implementation)   ; Defined in geiser-impl.el
 (defvar geiser-default-implementation) ; Defined in geiser-impl.el
 (defvar geiser-active-implementations) ; Defined in geiser-impl.el
+(defvar geiser-debug-show-debug-p) ; Defined in geiser-debug.el
+(defvar geiser-debug-jump-to-debug-p)  ; Defined in geiser-debug.el
+(defvar geiser-repl-use-other-window)  ; Defined in geiser-repl.el
+(defvar geiser-repl-window-allow-split)	; Defined in geiser-repl.el
 
 (declare-function run-geiser "ext:geiser-repl" (impl))
 (declare-function geiser-mode "ext:geiser-mode" ())
 (declare-function geiser-eval-region "ext:geiser-mode"
   (start end  and-go raw nomsg))
 (declare-function geiser-repl-exit "ext:geiser-repl" ( arg))
+(declare-function geiser-eval--retort-output "ext:geiser-eval" (ret))
+(declare-function geiser-eval--retort-result-str "ext:geiser-eval" (ret prefix))
 
 (defcustom org-babel-scheme-null-to 'hline
   "Replace `null' and empty lists in scheme tables with this before returning."
@@ -150,35 +156,35 @@ is true; otherwise returns the last value."
 (with-temp-buffer
   (insert (format ";; -*- geiser-scheme-implementation: %s -*-" impl))
   (newline)
-  (insert (if output
-		  (format "(with-output-to-string (lambda () %s))" code)
-		code))
+  (insert code)
   (geiser-mode)
-  (let ((repl-buffer (save-current-buffer
-			   (org-babel-scheme-get-repl impl repl
-	(when (not (eq impl (org-babel-scheme-get-buffer-impl
-			 (current-buffer
-	  (message "Implementation mismatch: %s (%s) %s (%s)" impl (symbolp impl)
-		   (org-babel-scheme-get-buffer-impl (current-buffer))
-		   (symbolp (org-babel-scheme-get-buffer-impl
-			 (current-buffer)
-	(setq geiser-repl--repl repl-buffer)
-	(setq geiser-impl--implementation nil)
-	(setq result (org-babel-scheme-capture-current-message
-		  (geiser-eval-region (point-min) (point-max
-	(setq result
-	  (if (and (stringp result) (equal (substring result 0 3) "=> "))
-		  (replace-regexp-in-string "^=> " "" result)
-		"\"An error occurred.\""))
-	(when (not repl)
-	  (save-current-buffer (set-buffer repl-buffer)
-			   (geiser-repl-exit))
-	  (set-process-query-on-exit-flag (get-buffer-process repl-buffer) nil)
-	  (kill-buffer repl-buffer))
-	(setq result (if (or (string= result "#")
-			 (string= result "#"))
-			 nil
-		   result
+  (let ((geiser-repl-window-allow-split nil)
+	(geiser-repl-use-other-window nil))
+	(let ((repl-buffer (save-current-buffer
+			 (org-babel-scheme-get-repl impl repl
+	  (when (not (eq impl (org-babel-scheme-get-buffer-impl
+			   (current-buffer
+	(message "Implementation mismatch: %s (%s) %s (%s)" impl (symbolp impl)
+		 (org-babel-scheme-get-buffer-impl (current-buffer))
+		 (symbolp (org-babel-scheme-get-buffer-impl
+			   (current-buffer)
+	  (setq geiser-repl--repl repl-buffer)
+	  (setq geiser-impl--implementation nil)
+	  (let ((geiser-debug-jump-to-debug-p nil)
+		(geiser-debug-show-debug-p nil))
+	(let ((ret (geiser-eval-region (point-min) (point-max
+	  (setq result (if output
+			   (geiser-eval--retort-output ret)
+			 (geiser-eval--retort-result-str ret "")
+	  (when (not repl)
+	(save-current-buffer (set-buffer repl-buffer)
+ (geiser-repl-exit))
+	(set-proces

Re: [O] Scheme output results

2017-09-05 Thread Neil Jerram

Hi Bastien & Nicolas,

I've been told by "Theodore Teah via RT <copyright-cl...@fsf.org>" that 
my copyright assignment is in place now.


Regards - Neil



On 31/08/17 13:21, Neil Jerram wrote:

Hi Bastien,

Thanks for checking this. I've written to ass...@gnu.org to kick off sorting 
out the additional assignment.

Regards - Neil


   Original Message
From: Bastien Guerry
Sent: Sunday, 27 August 2017 13:07
To: Nicolas Goaziou
Cc: Neil Jerram; emacs-orgmode@gnu.org
Subject: Re: [O] Scheme output results

Hi Neil,

Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:


I cannot, I'm not the maintainer. I'm Cc'ing Bastien. I'll apply your
patch as soon as it is sorted out.

Thanks for contributing.

I’ve found your copyright assignment for GUILE but it does not cover
changes for GNU Emacs, you would need another copyright assignment for
this.

Thanks in advance,






Re: [O] Scheme output results

2017-08-31 Thread Neil Jerram
Hi Bastien,

Thanks for checking this. I've written to ass...@gnu.org to kick off sorting 
out the additional assignment.

Regards - Neil


  Original Message  
From: Bastien Guerry
Sent: Sunday, 27 August 2017 13:07
To: Nicolas Goaziou
Cc: Neil Jerram; emacs-orgmode@gnu.org
Subject: Re: [O] Scheme output results

Hi Neil,

Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

> I cannot, I'm not the maintainer. I'm Cc'ing Bastien. I'll apply your
> patch as soon as it is sorted out.

Thanks for contributing.

I’ve found your copyright assignment for GUILE but it does not cover
changes for GNU Emacs, you would need another copyright assignment for
this.

Thanks in advance,

-- 
Bastien




Re: [O] Scheme output results

2017-08-20 Thread Neil Jerram

On 23/07/17 09:52, Nicolas Goaziou wrote:

Hello,

Neil Jerram <n...@ossau.homelinux.net> writes:


I don't think that Scheme output results are correctly handled. Please
consider:

#+BEGIN_SRC scheme :results output
(display "a") (newline)
(display "b") (newline)
(display "c") (newline)
'(a b c)
#+END_SRC


#+RESULTS: : "a\nb\nc\n"

As compared with the Elisp equivalent:

#+BEGIN_SRC elisp :results output
(princ "a") (terpri)
(princ "b") (terpri)
(princ "c") (terpri)
'(a b c)
#+END_SRC

#+RESULTS:
: a
: b
: c

I have a possible fix for this - on another computer, so not to hand
right now - but thought it would be check first whether you agree with
me that the Scheme results should be more like the Elisp ones.

That sounds like a good idea. Could you send your fix as a proper patch
with a commit message?

Thank you!

Regards,


With apologies for the slow follow up, attached is a patch that works 
well for me.


I think a concern with it would be whether the Geiser retort object and 
functions have always existed, and whether we can rely on them 
continuing to exist.  But - at least for me - every Scheme evaluation 
was previously giving "An error occurred", because of an unexpected 
extra "Mark set" message, so I am pretty sure that my patch is an 
improvement.


I guess (following any revisions) you will also need assignment papers.  
I believe I have these on file for Guile already (since about 1990), and 
it's possible that those are worded so as to cover Emacs as well.  Would 
you mind checking, as I've forgotten how to do that myself?


Regards - Neil

>From a02b60b88bcfd1896c05cd858ae80bb1ef183730 Mon Sep 17 00:00:00 2001
From: Neil Jerram <n...@tigera.io>
Date: Sun, 20 Aug 2017 17:25:58 +0100
Subject: [PATCH] Improve Scheme code evaluation

* lisp/ob-scheme.el (org-babel-scheme-execute-with-geiser): Use
  Geiser's explicit 'retort' object, instead of catching and parsing
  an expected Emacs message (which for me is in any case overwritten
  by a following "Mark set" message); this also means we don't need
  the with-output-to-string approach for getting 'output' results.
  Also 'let' Geiser variables so as to avoid popping up the REPL
  and *Geiser dbg* buffers.
---
 lisp/ob-scheme.el | 56 +++
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/lisp/ob-scheme.el b/lisp/ob-scheme.el
index b8867d5f6..bf1da01b0 100644
--- a/lisp/ob-scheme.el
+++ b/lisp/ob-scheme.el
@@ -150,35 +150,35 @@ is true; otherwise returns the last value."
 (with-temp-buffer
   (insert (format ";; -*- geiser-scheme-implementation: %s -*-" impl))
   (newline)
-  (insert (if output
-		  (format "(with-output-to-string (lambda () %s))" code)
-		code))
+  (insert code)
   (geiser-mode)
-  (let ((repl-buffer (save-current-buffer
-			   (org-babel-scheme-get-repl impl repl
-	(when (not (eq impl (org-babel-scheme-get-buffer-impl
-			 (current-buffer
-	  (message "Implementation mismatch: %s (%s) %s (%s)" impl (symbolp impl)
-		   (org-babel-scheme-get-buffer-impl (current-buffer))
-		   (symbolp (org-babel-scheme-get-buffer-impl
-			 (current-buffer)
-	(setq geiser-repl--repl repl-buffer)
-	(setq geiser-impl--implementation nil)
-	(setq result (org-babel-scheme-capture-current-message
-		  (geiser-eval-region (point-min) (point-max
-	(setq result
-	  (if (and (stringp result) (equal (substring result 0 3) "=> "))
-		  (replace-regexp-in-string "^=> " "" result)
-		"\"An error occurred.\""))
-	(when (not repl)
-	  (save-current-buffer (set-buffer repl-buffer)
-			   (geiser-repl-exit))
-	  (set-process-query-on-exit-flag (get-buffer-process repl-buffer) nil)
-	  (kill-buffer repl-buffer))
-	(setq result (if (or (string= result "#")
-			 (string= result "#"))
-			 nil
-		   result
+  (let ((geiser-repl-window-allow-split nil)
+	(geiser-repl-use-other-window nil))
+	(let ((repl-buffer (save-current-buffer
+			 (org-babel-scheme-get-repl impl repl
+	  (when (not (eq impl (org-babel-scheme-get-buffer-impl
+			   (current-buffer
+	(message "Implementation mismatch: %s (%s) %s (%s)" impl (symbolp impl)
+		 (org-babel-scheme-get-buffer-impl (current-buffer))
+		 (symbolp (org-babel-scheme-get-buffer-impl
+			   (current-buffer)
+	  (setq geiser-repl--repl repl-buffer)
+	  (setq geiser-impl--implementation nil)
+	  (let ((geiser-debug-jump-to-debug-p nil)
+		(geiser-debug-show-debug-p nil))
+	(let ((ret (geiser-eval-region (point-min) (point-max
+	  (setq result (if output
+			   (geiser-eval--retort-output ret)
+			 (geiser-eval--retort-result-str ret "")
+	  (when (not repl)
+	(save-c

Re: [O] [RFC] Remove Org Struct mode

2017-08-20 Thread Neil Jerram
I have been using org-mode for a few years now, but have never yet 
noticed org-struct mode.  So removing org-struct would be no loss for me 
(and possibly a gain, if it eased ongoing org-mode maintenance and 
development).


OTOH I certainly do use and appreciate orgtbl minor mode, and it would 
be a big disadvantage for me if that function disappeared. I've no 
objection in principle, though, to reorganizing _how_ that function is 
provided.


Regards - Neil


On 20/08/17 14:57, Nicolas Goaziou wrote:

Hello,

I would like to remove Org Struct minor mode from Org code base. Here is
the rationale:

1. It is broken. It might look like using Org in another buffer, but it
is not. In particular, it just cannot cope with lists, indentation,
filling in, e.g., Message mode, as soon as we try something
non-trivial. Really, that's a poor-man's Org mode.

2. Its implementation is very hackish. In particular, it is not modular
at all. It rewrites some core functions according to the major mode
in use. For example `org-fill-function' tries to handle specially
text in a Message mode buffer, basically short-circuiting regular
behaviour. There no support for other major modes. If we want some,
we need to hard-code it.

3. Due to previous point, some basic Org functions are sub-optimal
because they preserve compatibility with Org Struct mode. For example
`org-forward-heading-same-level' must process every headline past the
current one and check their level until an appropriate one is found.
It would be faster to go looking for the next headline according to
the number of stars we want.

4. It is somewhat outside Org mode's scope to provide such a feature. It
is tempting to provide everything we can think of, but we should
focus on the main task: handle Org files, i.e., files written in Org
compatible syntax.

5. There are alternatives. E.g., outshine.el, outline-minor-mode, ...

I _do_ use `orgstruct++-mode'. But it is broken beyond repair.
Alternatives, which do not need to pay a technical debt, are certainly
better, or, at least, a saner ground for improvement.

I'm not opposed to an Org struct mode living in ELPA. But, as pointed
out, it is difficult to extract from code base without rewriting it
completely. If alternatives are serious enough, that would be
re-inventing the wheel, too.

The only thing that would be missing, AFAIK, is plain list handling.
However, I'm quite certain it is possible to re-use most code from
"org-list.el", using a dumbed down `org-list-struct' function. Indeed,
currently, `org-list-struct' requires to know about inlinetasks,
drawers, blocks... i.e., most of the Org syntax. This is not an option
in foreign buffers. Once `org-list-struct' (and maybe `org-in-item-p')
are simplified, other functions in "org-list.el" can be used as is.

I'm not talking about OrgTbl mode (yet). OrgTbl mode is different: it
doesn't suffer from points 1, 3 end 5. It is easier to extract it as an
external library, which someone should ultimately do.

To sum it up, I offer to remove `orgstruct-mode' (and
`orgstruct++-mode') from the code base. I can also offer my help to
anyone willing to extract some `list-minor-mode' and `table-minor-mode'
from Org.

WDYT?


Regards,






[O] [PATCH] typo fix

2017-08-20 Thread Neil Jerram

A simple typo fix in README_contribute...

Regards - Neil



>From 16380217d8d7d19329a0e5cfbc0956a9c1789342 Mon Sep 17 00:00:00 2001
From: Neil Jerram <n...@tigera.io>
Date: Sun, 20 Aug 2017 13:26:19 +0100
Subject: [PATCH] Fix typo in README_contribute

* README_contribute: Fix typo

TINYCHANGE
---
 README_contribute | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README_contribute b/README_contribute
index 2dc62e62b..7433becf6 100644
--- a/README_contribute
+++ b/README_contribute
@@ -24,7 +24,7 @@ development.
  git clone git://repo.or.cz/org-mode.git
 
 3. People who are interested to participate in the Org-mode
-   development can to so by sending patches to this address:
+   development can do so by sending patches to this address:
 
  [[mailto:emacs-orgmode@gnu.org][emacs-orgmode@gnu.org]]
 
-- 
2.13.2




Re: [O] babel, matlab export plot to png fails

2017-08-15 Thread Neil Jerram

On 13/08/17 10:33, Uwe Brauer wrote:

Hi

I would like to execute some matlab code in org file (using GNU emacs 26
and the git version of org mode) and save the result of the plot command
in a png file, so I tried

#+begin_src matlab :session :exports both :file testplot.png
t=[0:0.1:1];
y=sin(t);
plot(t,y)
print -dpng  testplot.png
#+end_src

And also
#+begin_src matlab :results output latex :exports results  :file testplot.png
t=[0:0.1:1];
y=sin(t);
plot(t,y)
print -dpng  testplot.png
#+end_src

But the resulting png files are corrupt. I presume also the matlab
commands are included in the png file which is not correct. But I don't
know who to achieve that just the last command is saved in a png file.


I guess the problem is that the Matlab line "print -dpng testplot.png" 
is correctly writing the plot to testplot.png, as you want, but then 
org-mode is overwriting that file because of the ":file testplot.png".  
I would try deleting ":file testplot.png".


The meaning of ":results output" may be a bit language-dependent - I 
don't know org-mode well enough to be sure about that yet - but in 
general I would expect it to consist of the standard output of those 
commands.  So, for example, if you type "print -dpng testplot.png" and 
Matlab responds with "Generated 'testplot.png'", I would expect 
":results output" to contain "Generated 'testplot.png'", not the PNG data.


Regards - Neil




Re: [O] Escaping links

2017-08-14 Thread Neil Jerram

Except if your original string was "%org-9.0"...

For this kind of approach to work, you generally need to prefix 
everything; specifically included the cases that are _not_ encoded.


Regards - Neil


On 12/08/17 16:01, John Kitchin wrote:

I was thinking of something like how all PDF files start with something
like %PDF-1.3. So any string that started with %org-9.0, for example
would be certain to be encoded, whereas any other beginning would not be
certain.

Nicolas Goaziou writes:


Hello,

John Kitchin  writes:


Could you put some magic at the beginning of the string that indicates it
is encoded?

I don't know. Could you elaborate a bit?

Regards,







[O] Scheme output results

2017-07-18 Thread Neil Jerram
I don't think that Scheme output results are correctly handled. Please 
consider:


#+BEGIN_SRC scheme :results output
(display "a") (newline)
(display "b") (newline)
(display "c") (newline)
'(a b c)
#+END_SRC

#+RESULTS:
: "a\nb\nc\n"

As compared with the Elisp equivalent:

#+BEGIN_SRC elisp :results output
(princ "a") (terpri)
(princ "b") (terpri)
(princ "c") (terpri)
'(a b c)
#+END_SRC

#+RESULTS:
: a
: b
: c

I have a possible fix for this - on another computer, so not to hand 
right now - but thought it would be check first whether you agree with 
me that the Scheme results should be more like the Elisp ones.


Regards - Neil





Re: [O] Upstream synchronization documentation

2017-07-03 Thread Neil Jerram
No problem to stick with 'backport' if that is the conventional term here. 
Thanks for considering and explaining the point. 

     Neil 


  Original Message  
From: Rasmus Pank Roulund
Sent: Monday, 3 July 2017 18:22
To: k...@kyleam.com
Cc: n...@ossau.homelinux.net; emacs-orgmode@gnu.org
Subject: Re: [O] Upstream synchronization documentation

Kyle Meyer  writes:

>> Whereas in your text I think it is the other way round, isn't it?
>> (I.e. the Emacs branch is more stable, and you are talking about
>> porting a fix that someone has made in that branch to the Org master.)
>> So perhaps 'forward port' would be clearer?
>
> I suspect that Org's maint (where the Emacs changes land) is generally
> more stable than the Org in Emacs's master, but, yes, Emacs's version is
> the older version. (Well, with v9.0.9 just synced the versions match,
> but maint still has quite a few more commits.)
>
> Since before I took over "backporting" changes from the Emacs repo, it's
> been referred to as this. Although I agree it isn't great word choice,
> I'd prefer that we remain consistent so that, for example, "git log -i
> --grep=backport" remains informative.
>
> But if people think using "backport" is too confusing, I'm OK switching
> to another term. Of "forward port" and "propagate" (suggested in this
> thread by Eric), I prefer "propagate"---or maybe just "port", though
> grepping for that might lead to too many false positives. And if we
> stick with "backport", it still might be a good idea to clarify in
> README_maintainer that we're abusing the term.

So at least I’m not crazy for "coming up with" it backporting!

So I will keep calling it "backporting" but explain that it is more like
propagating changes from the Emacs repository (back) to the Org
repository.

Thanks,
Rasmus

-- 
Dung makes an excellent fertilizer



Re: [O] Upstream synchronization documentation

2017-07-03 Thread Neil Jerram

Hi Rasmus,

On 03/07/17 11:35, Rasmus wrote:

Hi,

The documentation in README_maintainer is a bit outdated
wrt. synchronizing with upstream Emacs.

I have updated the to best of my knowledge in the attached patch.  I would
be happy to push it, if there are no objections.

It would also be great if someone would let me know about the mistakes
that are undoubtedly in the draft.

Rasmus



I just noticed that your text talks about 'backporting', and wondered if 
that is the clearest term to use.  To me, a 'backport' usually means 
porting a change or fix from the master or development branch to some 
older or more stable branch.  Whereas in your text I think it is the 
other way round, isn't it?  (I.e. the Emacs branch is more stable, and 
you are talking about porting a fix that someone has made in that branch 
to the Org master.)  So perhaps 'forward port' would be clearer?


Regards - Neil




Re: [O] import excel files into org

2017-06-28 Thread Neil Jerram

On 27/06/17 17:54, Uwe Brauer wrote:

Hi

Maybe the following is helpful:


(defun org-table-import-xlsx-to-csv-org ()
   (interactive)
   (let* ((source-file  (file-name-sans-extension (buffer-file-name 
(current-buffer
  (xlsx-file (concat source-file ".xlsx"))
  (csv-file (concat source-file ".csv")))
 (org-odt-convert xlsx-file "csv")
 (org-table-import csv-file  nil)))


(defun org-table-import-xlsx-file-to-csv-org (file)
   (interactive "f")
   (let* ((source-file  (file-name-sans-extension (buffer-file-name 
(current-buffer
  (xlsx-file (concat source-file ".xlsx"))
  (csv-file (concat source-file ".csv")))
 (org-odt-convert file "csv")
 (org-table-import csv-file  nil)))


What is the intended difference between those?

The second one looks odd, because
- xlsx-file is never used
- there doesn't appear to be any link from the CSV output from 'file' 
(presumably in a file whose name is derived from 'file') and the 
'csv-file' content that org then imports (in a file whose name is 
derived from the current buffer).


Regards - Neil




Re: [O] Problem with bash arrays from list-valued org-babel :var assignments?

2017-06-09 Thread Neil Jerram

On 09/06/17 05:56, Keith Amidon wrote:

With current org-mode, when I try to execute the following org-babel
block:

#+begin_src bash :var lst='(1 2 3 4 5 6 7)
printf "%s\n" "${lst[*]}"
#+end_src

I get result and the following error in the minibuffer:

Wrong type argument: listp, 1

This, on the other hand works fine:

#+begin_src emacs-lisp :var lst='(1 2 3 4 5 6 7)
lst
#+end_src

In investigating this, I looked into the code for how bash variables
are set from the org variables and found this code in ob-shell that I
don't really understand:

(defun org-babel--variable-assignments:bash (varname values  sep hline)
   "Represents the parameters as useful Bash shell variables."
   (if (listp values)
   (if (and (listp (car values)) (= 1 (length (car values
  (org-babel--variable-assignments:bash_array varname values sep hline)
(org-babel--variable-assignments:bash_assoc varname values sep hline))
 (org-babel--variable-assignments:sh-generic varname values sep hline)))


Based on that code, I'd expect this to work, and it does:

#+begin_src bash :var lst='((1) (2) (3) (4) (5) (6) (7))
printf "%s\n" "${lst[*]}"
#+end_src

#+RESULTS:
: 1 2 3 4 5 6 7

But I agree that it would still be nice if the more intuitive form that 
you mentioned also worked.


Regards,
 Neil