emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-babel for prolog
@ 2014-12-10 17:20 Bjarte Johansen
  2014-12-19 15:25 ` Bjarte Johansen
  0 siblings, 1 reply; 9+ messages in thread
From: Bjarte Johansen @ 2014-12-10 17:20 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 841 bytes --]

Hi,

I have started to implement org-babel support for (swi-)prolog. I have gotten to the point where I can execute a goal in an external process and have the result show up in the org file. I am now working on getting the session to work correctly. It runs and prints, but it doesn’t do the correct thing in the inferior-mode-buffer and the output is garbled. I still have some work ahead of me.

I just thought I would let you know in case someone was interested in following the progress or maybe also in helping me. I have the mode hosted in its current state here https://gist.github.com/ljos/2e346333e1b7bfd56d05 <https://gist.github.com/ljos/2e346333e1b7bfd56d05> . 

And before you ask, yes, if I get this into a working order, I would eventually be interested in getting this into either contrib or core.

Regards,
Bjarte

[-- Attachment #2: Type: text/html, Size: 1301 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-babel for prolog
  2014-12-10 17:20 org-babel for prolog Bjarte Johansen
@ 2014-12-19 15:25 ` Bjarte Johansen
  2015-01-02 13:29   ` Bjarte Johansen
  0 siblings, 1 reply; 9+ messages in thread
From: Bjarte Johansen @ 2014-12-19 15:25 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1826 bytes --]

I just wanted to report that it is now possible to evaluate prolog code and it should return the correct result. Both as a call to the executable and in a session. When calling a goal in a session, I add a cut at the end of the goal so that prolog doesn’t ask if you want to get the next possible answer. I am not sure if this is the best approach.

I haven’t implemented variable assignment yet because I haven’t decided how it should do that considering how prolog uses variables. If someone has any ideas for this I would be glad to hear them. I have considered entering the variables into the prolog database with the record predicates or replacing all prolog variables with the same name as in the var declaration with the value. The last one I don’t think is a particularly good idea, except if we only replace the free variables.

Regards,
Bjarte


> 10. des. 2014 kl. 18.20 skrev Bjarte Johansen <Bjarte.Johansen@infomedia.uib.no>:
> 
> Hi,
> 
> I have started to implement org-babel support for (swi-)prolog. I have gotten to the point where I can execute a goal in an external process and have the result show up in the org file. I am now working on getting the session to work correctly. It runs and prints, but it doesn’t do the correct thing in the inferior-mode-buffer and the output is garbled. I still have some work ahead of me.
> 
> I just thought I would let you know in case someone was interested in following the progress or maybe also in helping me. I have the mode hosted in its current state here https://gist.github.com/ljos/2e346333e1b7bfd56d05 <https://gist.github.com/ljos/2e346333e1b7bfd56d05> . 
> 
> And before you ask, yes, if I get this into a working order, I would eventually be interested in getting this into either contrib or core.
> 
> Regards,
> Bjarte


[-- Attachment #2: Type: text/html, Size: 2838 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-babel for prolog
  2014-12-19 15:25 ` Bjarte Johansen
@ 2015-01-02 13:29   ` Bjarte Johansen
  2015-05-14 18:11     ` Lawrence Bottorff
  0 siblings, 1 reply; 9+ messages in thread
From: Bjarte Johansen @ 2015-01-02 13:29 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2392 bytes --]

I thought you should know that I moved the project here: https://github.com/ljos/ob-prolog <https://github.com/ljos/ob-prolog> This makes it a bit easier for me to track issues and do proper commit-messages etc.

I have now implemented the session stuff properly (I think). I still have to implement the variable stuff and expansion of the body (or I can perhaps just use the generic function). 


> 19. des. 2014 kl. 16.25 skrev Bjarte Johansen <Bjarte.Johansen@infomedia.uib.no>:
> 
> I just wanted to report that it is now possible to evaluate prolog code and it should return the correct result. Both as a call to the executable and in a session. When calling a goal in a session, I add a cut at the end of the goal so that prolog doesn’t ask if you want to get the next possible answer. I am not sure if this is the best approach.
> 
> I haven’t implemented variable assignment yet because I haven’t decided how it should do that considering how prolog uses variables. If someone has any ideas for this I would be glad to hear them. I have considered entering the variables into the prolog database with the record predicates or replacing all prolog variables with the same name as in the var declaration with the value. The last one I don’t think is a particularly good idea, except if we only replace the free variables.
> 
> Regards,
> Bjarte
> 
> 
>> 10. des. 2014 kl. 18.20 skrev Bjarte Johansen <Bjarte.Johansen@infomedia.uib.no <mailto:Bjarte.Johansen@infomedia.uib.no>>:
>> 
>> Hi,
>> 
>> I have started to implement org-babel support for (swi-)prolog. I have gotten to the point where I can execute a goal in an external process and have the result show up in the org file. I am now working on getting the session to work correctly. It runs and prints, but it doesn’t do the correct thing in the inferior-mode-buffer and the output is garbled. I still have some work ahead of me.
>> 
>> I just thought I would let you know in case someone was interested in following the progress or maybe also in helping me. I have the mode hosted in its current state here https://gist.github.com/ljos/2e346333e1b7bfd56d05 <https://gist.github.com/ljos/2e346333e1b7bfd56d05> . 
>> 
>> And before you ask, yes, if I get this into a working order, I would eventually be interested in getting this into either contrib or core.
>> 
>> Regards,
>> Bjarte
> 


[-- Attachment #2: Type: text/html, Size: 3884 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-babel for prolog
  2015-01-02 13:29   ` Bjarte Johansen
@ 2015-05-14 18:11     ` Lawrence Bottorff
  2015-05-14 18:22       ` Puneeth Chaganti
  0 siblings, 1 reply; 9+ messages in thread
From: Lawrence Bottorff @ 2015-05-14 18:11 UTC (permalink / raw)
  To: Bjarte Johansen; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2748 bytes --]

Thanks for your great effort, BTW.

Confused by the requirement:

;; To activate ob-prolog add the following to your init.el file:
;;
;;  (eval-after-load 'org
;;    '(require 'org-prolog))

My Emacs ( 24.5.1) gives an error with this line. I know I'm probably
missing something obvious, but what is org-prolog?

On Fri, Jan 2, 2015 at 8:29 AM, Bjarte Johansen <
bjarte.johansen@infomedia.uib.no> wrote:

> I thought you should know that I moved the project here:
> https://github.com/ljos/ob-prolog This makes it a bit easier for me to
> track issues and do proper commit-messages etc.
>
> I have now implemented the session stuff properly (I think). I still have
> to implement the variable stuff and expansion of the body (or I can perhaps
> just use the generic function).
>
>
> 19. des. 2014 kl. 16.25 skrev Bjarte Johansen <
> Bjarte.Johansen@infomedia.uib.no>:
>
> I just wanted to report that it is now possible to evaluate prolog code
> and it should return the correct result. Both as a call to the executable
> and in a session. When calling a goal in a session, I add a cut at the end
> of the goal so that prolog doesn’t ask if you want to get the next possible
> answer. I am not sure if this is the best approach.
>
> I haven’t implemented variable assignment yet because I haven’t decided
> how it should do that considering how prolog uses variables. If someone has
> any ideas for this I would be glad to hear them. I have considered entering
> the variables into the prolog database with the record predicates or
> replacing all prolog variables with the same name as in the var declaration
> with the value. The last one I don’t think is a particularly good idea,
> except if we only replace the free variables.
>
> Regards,
> Bjarte
>
>
> 10. des. 2014 kl. 18.20 skrev Bjarte Johansen <
> Bjarte.Johansen@infomedia.uib.no>:
>
> Hi,
>
> I have started to implement org-babel support for (swi-)prolog. I have
> gotten to the point where I can execute a goal in an external process and
> have the result show up in the org file. I am now working on getting the
> session to work correctly. It runs and prints, but it doesn’t do the
> correct thing in the inferior-mode-buffer and the output is garbled. I
> still have some work ahead of me.
>
> I just thought I would let you know in case someone was interested in
> following the progress or maybe also in helping me. I have the mode hosted
> in its current state here
> https://gist.github.com/ljos/2e346333e1b7bfd56d05 .
>
> And before you ask, yes, if I get this into a working order, I would
> eventually be interested in getting this into either contrib or core.
>
> Regards,
> Bjarte
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 3865 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-babel for prolog
  2015-05-14 18:11     ` Lawrence Bottorff
@ 2015-05-14 18:22       ` Puneeth Chaganti
  2015-05-14 21:03         ` Bjarte Johansen
  0 siblings, 1 reply; 9+ messages in thread
From: Puneeth Chaganti @ 2015-05-14 18:22 UTC (permalink / raw)
  To: Lawrence Bottorff; +Cc: emacs-orgmode, Bjarte Johansen

On Thu, May 14, 2015 at 11:41 PM, Lawrence Bottorff <borgauf@gmail.com> wrote:
>
> Confused by the requirement:
>
> ;; To activate ob-prolog add the following to your init.el file:
> ;;
> ;;  (eval-after-load 'org
> ;;    '(require 'org-prolog))


I'm guessing its a typo and should be ob-prolog. The file provides ob-prolog.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-babel for prolog
  2015-05-14 18:22       ` Puneeth Chaganti
@ 2015-05-14 21:03         ` Bjarte Johansen
  2015-05-16 13:00           ` Lawrence Bottorff
  0 siblings, 1 reply; 9+ messages in thread
From: Bjarte Johansen @ 2015-05-14 21:03 UTC (permalink / raw)
  To: Puneeth Chaganti; +Cc: emacs-orgmode, Lawrence Bottorff


> On 14 May 2015, at 20:22, Puneeth Chaganti <punchagan@gmail.com> wrote:
> 
> On Thu, May 14, 2015 at 11:41 PM, Lawrence Bottorff <borgauf@gmail.com> wrote:
>> 
>> Confused by the requirement:
>> 
>> ;; To activate ob-prolog add the following to your init.el file:
>> ;;
>> ;;  (eval-after-load 'org
>> ;;    '(require 'org-prolog))
> 
> 
> I'm guessing its a typo and should be ob-prolog. The file provides ob-prolog.

Yes, I typed it wrong. Thank you for bringing it to my attention. I also discovered that it is better to use `org-babel-do-load-languages’ instead as well. I will change the recommendation tomorrow.

Regards,
Bjarte

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-babel for prolog
  2015-05-14 21:03         ` Bjarte Johansen
@ 2015-05-16 13:00           ` Lawrence Bottorff
       [not found]             ` <B34606FC-7BF5-48A8-A3D1-82B6A1913C16@infomedia.uib.no>
  0 siblings, 1 reply; 9+ messages in thread
From: Lawrence Bottorff @ 2015-05-16 13:00 UTC (permalink / raw)
  To: Bjarte Johansen, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1346 bytes --]

I'm just a Prolog beginner, but this:

#+begin_src prolog
edge(a,b).
edge(a,e).
edge(b,d).
edge(b,c).
edge(c,a).
edge(e,b).
tedge(Node1,Node2) :-
        edge(Node1,SomeNode),
        edge(SomeNode,Node2).
#+end_src

keeps giving me this:

executing Prolog code block...
executing Prolog source code block
org-babel-execute:prolog: Wrong type argument: char-or-string-p, ni

BTW, should it be

(eval-after-load 'org
  '(require 'ob-prolog))

or

(eval-after-load "org"
  '(require 'ob-prolog))

. . . org in quotes?

On Thu, May 14, 2015 at 5:03 PM, Bjarte Johansen <
bjarte.johansen@infomedia.uib.no> wrote:

>
> > On 14 May 2015, at 20:22, Puneeth Chaganti <punchagan@gmail.com> wrote:
> >
> > On Thu, May 14, 2015 at 11:41 PM, Lawrence Bottorff <borgauf@gmail.com>
> wrote:
> >>
> >> Confused by the requirement:
> >>
> >> ;; To activate ob-prolog add the following to your init.el file:
> >> ;;
> >> ;;  (eval-after-load 'org
> >> ;;    '(require 'org-prolog))
> >
> >
> > I'm guessing its a typo and should be ob-prolog. The file provides
> ob-prolog.
>
> Yes, I typed it wrong. Thank you for bringing it to my attention. I also
> discovered that it is better to use `org-babel-do-load-languages’ instead
> as well. I will change the recommendation tomorrow.
>
> Regards,
> Bjarte

[-- Attachment #2: Type: text/html, Size: 2285 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-babel for prolog
       [not found]             ` <B34606FC-7BF5-48A8-A3D1-82B6A1913C16@infomedia.uib.no>
@ 2015-05-16 13:31               ` Lawrence Bottorff
  2015-05-17 12:59                 ` Bjarte Johansen
  0 siblings, 1 reply; 9+ messages in thread
From: Lawrence Bottorff @ 2015-05-16 13:31 UTC (permalink / raw)
  To: Bjarte Johansen, emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 2128 bytes --]

No worries. I can wait. Thanks again for your efforts.

On Sat, May 16, 2015 at 9:28 AM, Bjarte Johansen <
bjarte.johansen@infomedia.uib.no> wrote:

>
> On 16 May 2015, at 15:00, Lawrence Bottorff <borgauf@gmail.com> wrote:
>
> I'm just a Prolog beginner, but this:
>
> #+begin_src prolog
> edge(a,b).
> edge(a,e).
> edge(b,d).
> edge(b,c).
> edge(c,a).
> edge(e,b).
> tedge(Node1,Node2) :-
>         edge(Node1,SomeNode),
>         edge(SomeNode,Node2).
> #+end_src
>
> keeps giving me this:
>
> executing Prolog code block...
> executing Prolog source code block
> org-babel-execute:prolog: Wrong type argument: char-or-string-p, ni
>
>
> Thank you for reporting a bug. I think I see what the problem is. You
> haven't defined a goal for the source block and ob-prolog doesn't guard for
> that. It should be easy to fix, but I am not sure if I will be able to do
> that before next week. If you want you can try to fix it yourself and send
> a PR on GitHub or a patch here.
>
> BTW, should it be
>
> (eval-after-load 'org
>   '(require 'ob-prolog))
>
> or
>
> (eval-after-load "org"
>   '(require 'ob-prolog))
>
> . . . org in quotes?
>
>
> I think both should work. I can't check right now as I only have my phone
> with me right now.
>
>
> On Thu, May 14, 2015 at 5:03 PM, Bjarte Johansen <
> bjarte.johansen@infomedia.uib.no> wrote:
>
>>
>> > On 14 May 2015, at 20:22, Puneeth Chaganti <punchagan@gmail.com> wrote:
>> >
>> > On Thu, May 14, 2015 at 11:41 PM, Lawrence Bottorff <borgauf@gmail.com>
>> wrote:
>> >>
>> >> Confused by the requirement:
>> >>
>> >> ;; To activate ob-prolog add the following to your init.el file:
>> >> ;;
>> >> ;;  (eval-after-load 'org
>> >> ;;    '(require 'org-prolog))
>> >
>> >
>> > I'm guessing its a typo and should be ob-prolog. The file provides
>> ob-prolog.
>>
>> Yes, I typed it wrong. Thank you for bringing it to my attention. I also
>> discovered that it is better to use `org-babel-do-load-languages’ instead
>> as well. I will change the recommendation tomorrow.
>>
>> Regards,
>> Bjarte
>
>
>

[-- Attachment #2: Type: text/html, Size: 3651 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: org-babel for prolog
  2015-05-16 13:31               ` Lawrence Bottorff
@ 2015-05-17 12:59                 ` Bjarte Johansen
  0 siblings, 0 replies; 9+ messages in thread
From: Bjarte Johansen @ 2015-05-17 12:59 UTC (permalink / raw)
  To: Lawrence Bottorff; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 252 bytes --]


> On 16 May 2015, at 15:31, Lawrence Bottorff <borgauf@gmail.com> wrote:
> 
> No worries. I can wait. Thanks again for your efforts.

I had some spare time today that I didn’t expect. I believe I have fixed the bug.

Kind regards,
Bjarte


[-- Attachment #2: Type: text/html, Size: 1068 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-05-17 12:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-10 17:20 org-babel for prolog Bjarte Johansen
2014-12-19 15:25 ` Bjarte Johansen
2015-01-02 13:29   ` Bjarte Johansen
2015-05-14 18:11     ` Lawrence Bottorff
2015-05-14 18:22       ` Puneeth Chaganti
2015-05-14 21:03         ` Bjarte Johansen
2015-05-16 13:00           ` Lawrence Bottorff
     [not found]             ` <B34606FC-7BF5-48A8-A3D1-82B6A1913C16@infomedia.uib.no>
2015-05-16 13:31               ` Lawrence Bottorff
2015-05-17 12:59                 ` Bjarte Johansen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).