Re: use-package mistake?

2021-02-05 Thread Lawrence Bottorff
Sorry, this was meant for emacs.stackexchange.

On Thu, Feb 4, 2021 at 2:49 PM Lawrence Bottorff  wrote:

> Each time I call up list-package and update, I get this message after the
> updates
>
> Operation finished.  Packages that are no longer needed: 43.  Type ‘M-x
> package-autoremove’ to remove them
>
> Below is my init.el concerning use-package
>
> (require 'package)
> (setq package-enable-at-startup nil)
>
> (setq package-archives '(("ELPA"  . "http://tromey.com/elpa/;)
> ("gnu"   . "http://elpa.gnu.org/packages/;)
> ("melpa" . "https://melpa.org/packages/;)
> ("org"   . "https://orgmode.org/elpa/;)))
>
> (package-initialize)
>
> ;;; Bootstrapping use-package, i.e., if use-package isn't installed
> ;;; then install it
> (unless (package-installed-p 'use-package)
>   (package-refresh-contents)
>   (package-install 'use-package))
>
> ;;;This will ensure all packages are installed if not already
> (require 'use-package-ensure)
> (setq use-package-always-ensure t)
>
> ;;;This will make sure packages are updated
> (use-package auto-package-update
>   :config
>   (setq auto-package-update-delete-old-versions t)
>   (setq auto-package-update-interval 1)
>   (setq auto-package-update-hide-results t)
>   (auto-package-update-maybe))
>
>
> I obviously don't want to uninstall all the packages on my system. What
> have I done wrong? Can you critique my setup here?
>
> LB
>


use-package mistake?

2021-02-04 Thread Lawrence Bottorff
Each time I call up list-package and update, I get this message after the
updates

Operation finished.  Packages that are no longer needed: 43.  Type ‘M-x
package-autoremove’ to remove them

Below is my init.el concerning use-package

(require 'package)
(setq package-enable-at-startup nil)

(setq package-archives '(("ELPA"  . "http://tromey.com/elpa/;)
("gnu"   . "http://elpa.gnu.org/packages/;)
("melpa" . "https://melpa.org/packages/;)
("org"   . "https://orgmode.org/elpa/;)))

(package-initialize)

;;; Bootstrapping use-package, i.e., if use-package isn't installed
;;; then install it
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

;;;This will ensure all packages are installed if not already
(require 'use-package-ensure)
(setq use-package-always-ensure t)

;;;This will make sure packages are updated
(use-package auto-package-update
  :config
  (setq auto-package-update-delete-old-versions t)
  (setq auto-package-update-interval 1)
  (setq auto-package-update-hide-results t)
  (auto-package-update-maybe))


I obviously don't want to uninstall all the packages on my system. What
have I done wrong? Can you critique my setup here?

LB


Region-based meta-notes

2021-01-19 Thread Lawrence Bottorff
I've got this

* foldl
:PROPERTIES:_

Problematic with ~foldr~ is that it recurses out to its full length
before performing the given function's task. For example, with

#+begin_example
foldr (+) list
#+end_example

~(+)~ behaves strictly, meaning that both arguments to it must be
fully evaluated before ~(+)~ can return a result. Hence, for
...

Problem is I've borrowed (some, most, all of) this from an online source
and I want to credit the source. What would be nice is to be able to select
a region -- however big or small -- and create a log/note/footnote etc.
about the selected region -- in my case, give reference.

Of course I could just tack a footnote at the end of the borrowed stuff,
but then in the case of multiple preceding paragraphs, formulae, etc. it
would be hard to indicate where the particular borrowed parts began --
without resorting to ugly marker kludges.

So yes, simply being able to select regions and make side notes about them
could give you a very fine level of control over metadata in a file. Is
there such a thing in the Emacs/org-mode world?

LB


ob-haskell

2021-01-02 Thread Lawrence Bottorff
I recently wimped out of trying to update ob-haskell as an official
maintainer, but I'd eventually like to get back to it -- *after *I get some
base understanding of what Haskell is (Zeno's paradox-land?) and how the
ghci works. Basically, the ghci is what it is -- tautological, but true.
And that means when ob-haskell does nothing but dump the contents of a
babel code block into ghci, it's no better than if the user had typed in
into the REPL line-by-line. A quick run-down:

:set +m supposedly alerts ghci that a multi-line expression is coming, will
come; but typically, it doesn't infer this very well.

Enclosing code in :{ ... :} is fairly good -- again you can type this in at
the REPL prompt and see how it works -- however, there are gotchas.

a plain block:

#+begin_src haskell
...code...
#+end_src

is okay when you only have a one-liner to evaluate. But again, ob-haskell
seems to do nothing but take the block contents and dump it to the ghci
REPL as though the user had typed it in line-by-line, Enter, Enter...

What would be nice is if a C-c C-c inside a block could somehow act as
though the ghci were being sent a regular  *.hs buffer in haskell-mode --
and that, of course, cumulatively. C-' creates a decent haskell-mode
environment, BTW, so some form of a babel block to haskell-mode connection
does exist

So am I on the right track? It's obvious at this point raw dumps into the
REPL aren't optimal, i.e., are fraught. What is, e.g., geiser doing
that ob-haskell isn't?

LB

PS: Eventually, I'll try to glean some hints from the Jupyter Haskell
 effort.

PPS: GHCI User's Guide

doesn't
really tell me anything other than yes, ob-haskell is raw-dumping into an
environment that isn't designed to play nice with babel.


Re: Unhealthy Haskell babel

2020-12-10 Thread Lawrence Bottorff
Yes -- and I think I came across this long ago during another attempt and
totally forgot about it. I think I'll write this up on emacs.stackexchange
so others will not have to scrounge around. I'm pursuing this because I
really believe emacs org-mode "reproducible research" is superior to all
other methods so far.

On Thu, Dec 10, 2020 at 12:40 PM Immanuel Litzroth <
immanuel.litzr...@gmail.com> wrote:

> Well another possible solution is to wrap the code blocks in
> :{
> xxx
> :}
> in
> (defun org-babel-execute:haskell (body params) -- ob-haskell.el
> Immanuel
>
> On Thu, Dec 10, 2020 at 6:21 PM Lawrence Bottorff 
> wrote:
> >
> > I see your point, i.e., compiled, multi-file projects are not really
> meant for the REPL-dominant world of org-mode babel. Babel's sweet-spot
> would be the interpreted world, the very best probably a Lisp language.
> Still, the ability to add code to a running REPL should be possible. As I
> mentioned, SML is a sibling of Haskell and its babel implementation worked
> fine for me as I worked through an SML course. So yes, this appears to be a
> Haskell REPL issue. I'm just a beginner with Haskell, and all my intro
> texts start you out using the ghci REPL interactively. But then they switch
> you over to a text file compiled in the REPL with :l myfile.hs . . . no
> explanation as to why you can't just continue with the REPL putting the
> program in line-by-line. The fact that I can use the :set +m to include
> multiple lines of code, but cannot do a type definition is rather bizarre,
> though. This is a decision Haskell made with their REPL and babel really
> can't do much about it, I suppose. The Haskell .lhs literate option is
> interesting. Yes, I'd like to see your tangle option, please.
> >
> > On Thu, Dec 10, 2020 at 4:28 AM Immanuel Litzroth <
> immanuel.litzr...@gmail.com> wrote:
> >>
> >> I don't think org-babel is a good fit for compiled languages. If the
> >> idea is to just take 1 snippet,
> >> and "execute" that it means that to have a consistent whole you'd need
> >> to put all the modules of
> >> your program into that snippet (already impossible in Haskell, you can
> >> have only 1 module per file),
> >> compile that, run the resulting binary. Or org mode would have to have
> >> some idea of what needs to
> >> be retangled & rebuilt.
> >> I think that using org-babel for compiled, multifile languages will
> >> only work in very simple cases -- and
> >> even then.. -- but will lead to problems very soon.
> >> Immanuel
> >>
> >> On Thu, Dec 10, 2020 at 4:21 AM Lawrence Bottorff 
> wrote:
> >> >
> >> > I'm looking into Haskell (latest ghci) again on org-mode. This
> >> >
> >> > #+begin_src haskell :results verbatim :exports both
> >> > :set +m
> >> > doubleSmallNumber x = if x > 100
> >> >   then x
> >> >   else x*2
> >> > #+end_src
> >> >
> >> > works, but still the :set +m is necessary for it to see the whole.
> But this
> >> >
> >> > #+begin_src haskell :results verbatim :exports both
> >> > :set +m
> >> > factorial :: Int -> Int
> >> > factorial 0 = 1
> >> > factorial n = n * factorial (n - 1)
> >> > #+end_src
> >> >
> >> > results in this on the REPL side:
> >> >
> >> > Prelude> :set +m
> >> > factorial :: Int -> Int
> >> > factorial 0 = 1
> >> > factorial n = n * factorial (n - 1)
> >> > "org-babel-haskell-eoe"
> >> > Prelude>
> >> > :26:1-23: error:
> >> > • No instance for (Show (Int -> Int)) arising from a use of
> ‘print’
> >> > (maybe you haven't applied a function to enough arguments?)
> >> > • In a stmt of an interactive GHCi command: print it
> >> > Prelude> Prelude> Prelude> "org-babel-haskell-eoe"
> >> >
> >> > which is the same behavior if I try to feed the program into the REPL
> one line at a time, i.e.,
> >> >
> >> > Prelude> factorial :: Int -> Int
> >> >
> >> > :40:1-23: error:
> >> > • No instance for (Show (Int -> Int)) arising from a use of
> ‘print’
> >> > (maybe you haven't applied a function to enough arguments?)
> >> > • In a stmt of an interactive GHCi command: print it
> >> >
> >> > So the :set +m trick (take multiple lines) doesn't help here.
> Obviously, Haskell is not ready to be used with Babel. Can it be fixed?
> BTW, this does work with the regular ghci REPL and haskell-mode. If it
> helps, Standard ML, which has very similar syntax (it was Haskell's
> parent), works fine.
> >> >
> >> > LB
> >>
> >>
> >>
> >> --
> >> -- Researching the dual problem of finding the function that has a
> >> given point as fixpoint.
>
>
>
> --
> -- Researching the dual problem of finding the function that has a
> given point as fixpoint.
>


Re: Unhealthy Haskell babel

2020-12-10 Thread Lawrence Bottorff
I see your point, i.e., compiled, multi-file projects are not really meant
for the REPL-dominant world of org-mode babel. Babel's sweet-spot would be
the interpreted world, the very best probably a Lisp language. Still, the
ability to add code to a running REPL should be possible. As I mentioned,
SML is a sibling of Haskell and its babel implementation worked fine for me
as I worked through an SML course. So yes, this appears to be a Haskell
REPL issue. I'm just a beginner with Haskell, and all my intro texts start
you out using the ghci REPL interactively. But then they switch you over to
a text file compiled in the REPL with :l myfile.hs . . . no explanation as
to why you can't just continue with the REPL putting the program in
line-by-line. The fact that I can use the :set +m to include multiple lines
of code, but cannot do a type definition is rather bizarre, though. This is
a decision Haskell made with their REPL and babel really can't do much
about it, I suppose. The Haskell .lhs literate option is interesting. Yes,
I'd like to see your tangle option, please.

On Thu, Dec 10, 2020 at 4:28 AM Immanuel Litzroth <
immanuel.litzr...@gmail.com> wrote:

> I don't think org-babel is a good fit for compiled languages. If the
> idea is to just take 1 snippet,
> and "execute" that it means that to have a consistent whole you'd need
> to put all the modules of
> your program into that snippet (already impossible in Haskell, you can
> have only 1 module per file),
> compile that, run the resulting binary. Or org mode would have to have
> some idea of what needs to
> be retangled & rebuilt.
> I think that using org-babel for compiled, multifile languages will
> only work in very simple cases -- and
> even then.. -- but will lead to problems very soon.
> Immanuel
>
> On Thu, Dec 10, 2020 at 4:21 AM Lawrence Bottorff 
> wrote:
> >
> > I'm looking into Haskell (latest ghci) again on org-mode. This
> >
> > #+begin_src haskell :results verbatim :exports both
> > :set +m
> > doubleSmallNumber x = if x > 100
> >   then x
> >   else x*2
> > #+end_src
> >
> > works, but still the :set +m is necessary for it to see the whole. But
> this
> >
> > #+begin_src haskell :results verbatim :exports both
> > :set +m
> > factorial :: Int -> Int
> > factorial 0 = 1
> > factorial n = n * factorial (n - 1)
> > #+end_src
> >
> > results in this on the REPL side:
> >
> > Prelude> :set +m
> > factorial :: Int -> Int
> > factorial 0 = 1
> > factorial n = n * factorial (n - 1)
> > "org-babel-haskell-eoe"
> > Prelude>
> > :26:1-23: error:
> > • No instance for (Show (Int -> Int)) arising from a use of ‘print’
> > (maybe you haven't applied a function to enough arguments?)
> > • In a stmt of an interactive GHCi command: print it
> > Prelude> Prelude> Prelude> "org-babel-haskell-eoe"
> >
> > which is the same behavior if I try to feed the program into the REPL
> one line at a time, i.e.,
> >
> > Prelude> factorial :: Int -> Int
> >
> > :40:1-23: error:
> > • No instance for (Show (Int -> Int)) arising from a use of ‘print’
> > (maybe you haven't applied a function to enough arguments?)
> > • In a stmt of an interactive GHCi command: print it
> >
> > So the :set +m trick (take multiple lines) doesn't help here. Obviously,
> Haskell is not ready to be used with Babel. Can it be fixed? BTW, this does
> work with the regular ghci REPL and haskell-mode. If it helps, Standard ML,
> which has very similar syntax (it was Haskell's parent), works fine.
> >
> > LB
>
>
>
> --
> -- Researching the dual problem of finding the function that has a
> given point as fixpoint.
>


Unhealthy Haskell babel

2020-12-09 Thread Lawrence Bottorff
I'm looking into Haskell (latest ghci) again on org-mode. This

#+begin_src haskell :results verbatim :exports both
:set +m
doubleSmallNumber x = if x > 100
  then x
  else x*2
#+end_src

works, but still the :set +m is necessary for it to see the whole. But this

#+begin_src haskell :results verbatim :exports both
:set +m
factorial :: Int -> Int
factorial 0 = 1
factorial n = n * factorial (n - 1)
#+end_src

results in this on the REPL side:

Prelude> :set +m
factorial :: Int -> Int
factorial 0 = 1
factorial n = n * factorial (n - 1)
"org-babel-haskell-eoe"
Prelude>
:26:1-23: error:
• No instance for (Show (Int -> Int)) arising from a use of ‘print’
(maybe you haven't applied a function to enough arguments?)
• In a stmt of an interactive GHCi command: print it
Prelude> Prelude> Prelude> "org-babel-haskell-eoe"

which is the same behavior if I try to feed the program into the REPL one
line at a time, i.e.,

Prelude> factorial :: Int -> Int

:40:1-23: error:
• No instance for (Show (Int -> Int)) arising from a use of ‘print’
(maybe you haven't applied a function to enough arguments?)
• In a stmt of an interactive GHCi command: print it

So the :set +m trick (take multiple lines) doesn't help here. Obviously,
Haskell is not ready to be used with Babel. Can it be fixed? BTW, this does
work with the regular ghci REPL and haskell-mode. If it helps, Standard ML,
which has very similar syntax (it was Haskell's parent), works fine.

LB


Re: Can't turn off hide-stars

2020-03-27 Thread Lawrence Bottorff
I've found a way to side-step this issue by simply evaluating (setq-default
indent-tabs-mode nil). From then on any formatting is just spaces and the
shifting doesn't occur. Still, this is odd behavior.

On Fri, Mar 27, 2020 at 3:26 PM Lawrence Bottorff  wrote:

> Changing my theme didn't help. The foreground-color of hide-face is set to
> the background color of my theme. What I suspect the problem is is the
> spaces and tabs used by sml-mode for indentations. I don't think other
> languages use a mix of spaces and tabs. They use just spaces. Is there a
> way to convert every tab to its size in spaces?
>
> On Fri, Mar 27, 2020 at 2:52 PM Ag Ibragimov 
> wrote:
>
>>
>> > As far as "org-hide face", I'm not sure what you mean.
>>
>> You've said:
>>
>> > I can't find where orgmode is suppressing the display of leading
>> asterisks of headings.
>>
>> The asterisks being displayed/hidden is controlled by 'org-hide' face.
>> Run "M-x describe-face org-hide RET" and see what the foreground of that
>> face is set to. Alternatively, you can try switching to another theme and
>> see if that makes any difference.
>>
>> On Fri 27 Mar 2020 at 12:30, Lawrence Bottorff  wrote:
>>
>> > I did have a monospace font, but changing to a vari-spaced one didn't
>> help.
>> > I can promote/demote the heading above the code block and the alignment
>> of
>> > the code shifts along with it, specifically this sort of block with a
>> let
>> >
>> > #+begin_src sml
>> > fun countUpFrom1 (x : int) =
>> > let
>> > fun count (from : int, to : int) =
>> >if from = to
>> >then to :: []
>> >else from :: count (from+1, to)
>> > in
>> > count (1, x)
>> > end
>> > #+end_src
>> >
>> > Note, this is copied into my gmail from below a heading 4 -- which in
>> the
>> > sml code block looks good. However, as I pasted this into gmail, the
>> spaces
>> > and tabs are behaving differently, e.g., the let is exactly 4 spaces
>> over,
>> > while the second nested fun is just a single tab over, which gmail isn't
>> > honoring. This
>> > is the same behavior I'm seeing at, e.g., a level 3 heading.
>> >
>> > Again, when this file is brought up in a clean emacs -Q where only SML
>> > mode/ob is set up and stars are all showing there is no (spaces v. tabs)
>> > shifting around trouble. If I could definitively turn off star hiding I
>> > could get around this shifting problem. But why this is happening is
>> very
>> > mysterious. As far as "org-hide face", I'm not sure what you mean.
>> >
>> > On Fri, Mar 27, 2020 at 12:19 PM Ag Ibragimov <
>> agzam.ibragi...@gmail.com>
>> > wrote:
>> >
>> >>
>> >> Have you tried tweaking org-hide face? Maybe the problem is with the
>> font
>> >> you use, is it monospaced?
>> >>
>> >> On Thu 26 Mar 2020 at 22:40, Lawrence Bottorff 
>> wrote:
>> >>
>> >> > I have searched high and low through my init/config and I can't find
>> >> where
>> >> > orgmode is suppressing the display of leading asterisks of headings.
>> I've
>> >> > got org-hide-leading-stars set to nil -- but it turns itself back on
>> >> > whenever I open an org file. I can start a clean, blank org file (no
>> >> > #+STARTUP hidestars/showstars) and create a few headings -- to see,
>> once
>> >> > again, the leading stars suppressed. My org-bullets is commented out
>> in
>> >> > init-land. I try an emacs -Q and of course I have leading stars on
>> >> > sub-headings, however deep. Yes, it's something in my init/config,
>> but I
>> >> > just can't find what's suppressing leading stars.
>> >> >
>> >> > The whole reason I'm trying to do this is I'm tinkering with babel
>> SML
>> >> and
>> >> > whenever I have a code block under a heading -- depending on the
>> depth of
>> >> > the heading -- the SML code block can be mis-justified. And if I
>> >> > promote/demote the heading around with M- the SML
>> code
>> >> > alignment dances around depending on the depth. I can do C-c ' and
>> the
>> >> > alignment is perfect; but come back the org file and it's wonky. So
>> if I
>> >> > set up an SML babel environment in an emacs -Q environment -- with
>> >> leading
>> >> > starts -- no problem.
>> >> >
>> >> > This is maddening, to say the least. I need to turn off suppression
>> or
>> >> > figure out why suppressed stars and babel SML blocks don't mix.
>> >> >
>> >> > LB
>> >>
>> >>
>> >>
>>
>>


Re: Can't turn off hide-stars

2020-03-27 Thread Lawrence Bottorff
Changing my theme didn't help. The foreground-color of hide-face is set to
the background color of my theme. What I suspect the problem is is the
spaces and tabs used by sml-mode for indentations. I don't think other
languages use a mix of spaces and tabs. They use just spaces. Is there a
way to convert every tab to its size in spaces?

On Fri, Mar 27, 2020 at 2:52 PM Ag Ibragimov 
wrote:

>
> > As far as "org-hide face", I'm not sure what you mean.
>
> You've said:
>
> > I can't find where orgmode is suppressing the display of leading
> asterisks of headings.
>
> The asterisks being displayed/hidden is controlled by 'org-hide' face. Run
> "M-x describe-face org-hide RET" and see what the foreground of that face
> is set to. Alternatively, you can try switching to another theme and see if
> that makes any difference.
>
> On Fri 27 Mar 2020 at 12:30, Lawrence Bottorff  wrote:
>
> > I did have a monospace font, but changing to a vari-spaced one didn't
> help.
> > I can promote/demote the heading above the code block and the alignment
> of
> > the code shifts along with it, specifically this sort of block with a let
> >
> > #+begin_src sml
> > fun countUpFrom1 (x : int) =
> > let
> > fun count (from : int, to : int) =
> >if from = to
> >then to :: []
> >else from :: count (from+1, to)
> > in
> > count (1, x)
> > end
> > #+end_src
> >
> > Note, this is copied into my gmail from below a heading 4 -- which in the
> > sml code block looks good. However, as I pasted this into gmail, the
> spaces
> > and tabs are behaving differently, e.g., the let is exactly 4 spaces
> over,
> > while the second nested fun is just a single tab over, which gmail isn't
> > honoring. This
> > is the same behavior I'm seeing at, e.g., a level 3 heading.
> >
> > Again, when this file is brought up in a clean emacs -Q where only SML
> > mode/ob is set up and stars are all showing there is no (spaces v. tabs)
> > shifting around trouble. If I could definitively turn off star hiding I
> > could get around this shifting problem. But why this is happening is very
> > mysterious. As far as "org-hide face", I'm not sure what you mean.
> >
> > On Fri, Mar 27, 2020 at 12:19 PM Ag Ibragimov  >
> > wrote:
> >
> >>
> >> Have you tried tweaking org-hide face? Maybe the problem is with the
> font
> >> you use, is it monospaced?
> >>
> >> On Thu 26 Mar 2020 at 22:40, Lawrence Bottorff 
> wrote:
> >>
> >> > I have searched high and low through my init/config and I can't find
> >> where
> >> > orgmode is suppressing the display of leading asterisks of headings.
> I've
> >> > got org-hide-leading-stars set to nil -- but it turns itself back on
> >> > whenever I open an org file. I can start a clean, blank org file (no
> >> > #+STARTUP hidestars/showstars) and create a few headings -- to see,
> once
> >> > again, the leading stars suppressed. My org-bullets is commented out
> in
> >> > init-land. I try an emacs -Q and of course I have leading stars on
> >> > sub-headings, however deep. Yes, it's something in my init/config,
> but I
> >> > just can't find what's suppressing leading stars.
> >> >
> >> > The whole reason I'm trying to do this is I'm tinkering with babel SML
> >> and
> >> > whenever I have a code block under a heading -- depending on the
> depth of
> >> > the heading -- the SML code block can be mis-justified. And if I
> >> > promote/demote the heading around with M- the SML
> code
> >> > alignment dances around depending on the depth. I can do C-c ' and the
> >> > alignment is perfect; but come back the org file and it's wonky. So
> if I
> >> > set up an SML babel environment in an emacs -Q environment -- with
> >> leading
> >> > starts -- no problem.
> >> >
> >> > This is maddening, to say the least. I need to turn off suppression or
> >> > figure out why suppressed stars and babel SML blocks don't mix.
> >> >
> >> > LB
> >>
> >>
> >>
>
>


Can't turn off hide-stars

2020-03-26 Thread Lawrence Bottorff
I have searched high and low through my init/config and I can't find where
orgmode is suppressing the display of leading asterisks of headings. I've
got org-hide-leading-stars set to nil -- but it turns itself back on
whenever I open an org file. I can start a clean, blank org file (no
#+STARTUP hidestars/showstars) and create a few headings -- to see, once
again, the leading stars suppressed. My org-bullets is commented out in
init-land. I try an emacs -Q and of course I have leading stars on
sub-headings, however deep. Yes, it's something in my init/config, but I
just can't find what's suppressing leading stars.

The whole reason I'm trying to do this is I'm tinkering with babel SML and
whenever I have a code block under a heading -- depending on the depth of
the heading -- the SML code block can be mis-justified. And if I
promote/demote the heading around with M- the SML code
alignment dances around depending on the depth. I can do C-c ' and the
alignment is perfect; but come back the org file and it's wonky. So if I
set up an SML babel environment in an emacs -Q environment -- with leading
starts -- no problem.

This is maddening, to say the least. I need to turn off suppression or
figure out why suppressed stars and babel SML blocks don't mix.

LB


Re: Insert PROPERTIES drawer after heading creation

2020-03-11 Thread Lawrence Bottorff
I read that too, but couldn't fathom what they meant. Still, I'm not sure
what they mean by "prefix argument." And why does (shell-command "uuidgen"
t) produces two outputs? For other readers, this is what they look like in
*scratch*

(shell-command "uuidgen" t)
2827
b5da7e0a-84c0-4db8-91f3-871b681f3022

(org-id-uuid)
"0bb7a4e1-9fc2-4428-b8de-a2d9ef5c56ab"

Also, does anyone know how I could have done this by "advise"-ing a
function in org-mode tempo templates? I could never figure out what
function was actually handling the <...-TAB.

On Wed, Mar 11, 2020 at 10:37 AM Diego Zamboni  wrote:

>
> On Wed, Mar 11, 2020 at 2:14 PM Lawrence Bottorff 
> wrote:
>
>> Yes, thanks. That substring was a bad copy. Any insight why the
>> (shell-command "uuidgen" t) wasn't working?
>>
>
> I hadn't looked at it yet, but the documentation for =shell-command= gives
> the answer:
>
> Execute string COMMAND in inferior shell; display output, if any.
> With prefix argument, *insert the COMMAND’s output at point*.
>
>
> So this function does not return a string that can be concatenated with
> others, it actually inserts the output in the buffer, so it's not
> guaranteed it will land where you need it.
>
> To have the output of the command returned as a string, I think you should
> use =shell-command-to-string=.
>
> --Diego
>
>


Re: Insert PROPERTIES drawer after heading creation

2020-03-11 Thread Lawrence Bottorff
Yes, thanks. That substring was a bad copy. Any insight why the
(shell-command "uuidgen" t) wasn't working?

On Wed, Mar 11, 2020 at 3:03 AM Diego Zamboni  wrote:

> Hi LB,
>
> How about using the =org-id-uuid= function instead of shelling out to
> uuidgen? In my quick test the following seems to behave properly:
>
> (defun template-myid ()
>   (insert "\n:PROPERTIES:\n:TIME: "
>   (format-time-string "%Y-%m-%dT%H:%M:%S")
>   "\n:VERTEX: "
>   (org-id-uuid)
>   "\n:EDGES:  \n:END:"))
>
> Note that I also removed the wrapping (substring (format ...)), which
> didn't seem to be necessary.
>
> --Diego
>
>
> On Wed, Mar 11, 2020 at 5:39 AM Lawrence Bottorff 
> wrote:
>
>> I want to insert upon creating a heading a PROPERTIES drawer. So far I
>> have this
>>
>> (defadvice org-insert-heading (after add-id-stuff activate)
>>   (template-myid))
>>
>> (defun template-myid ()
>>   (insert "\n:PROPERTIES:\n:TIME: "
>>   (substring (format "%s" (format-time-string "%Y-%m-%dT%H:%M:%S")))
>>   "\n:VERTEX: "
>>   (substring (format "%s" (shell-command "uuidgen" t)))
>>   "\n:EDGES:  \n:END:"))
>>
>> This is working -- sort of. My problem is the uuid is getting thrown
>> around. The output looks like this
>>
>> * Heading
>> :PROPERTIES:
>> :TIME: 2020-03-10T23:34:17
>> :VERTEX: 12836
>> :EDGES:
>> :END:32bf9499-f9e2-49d9-b8e7-9edb40272411
>>
>> Not sure how to make this behave.
>>
>> LB
>>
>


Insert PROPERTIES drawer after heading creation

2020-03-10 Thread Lawrence Bottorff
I want to insert upon creating a heading a PROPERTIES drawer. So far I have
this

(defadvice org-insert-heading (after add-id-stuff activate)
  (template-myid))

(defun template-myid ()
  (insert "\n:PROPERTIES:\n:TIME: "
  (substring (format "%s" (format-time-string "%Y-%m-%dT%H:%M:%S")))
  "\n:VERTEX: "
  (substring (format "%s" (shell-command "uuidgen" t)))
  "\n:EDGES:  \n:END:"))

This is working -- sort of. My problem is the uuid is getting thrown
around. The output looks like this

* Heading
:PROPERTIES:
:TIME: 2020-03-10T23:34:17
:VERTEX: 12836
:EDGES:
:END:32bf9499-f9e2-49d9-b8e7-9edb40272411

Not sure how to make this behave.

LB


Re: Turn on org-num-mode in init?

2020-03-10 Thread Lawrence Bottorff
Good. That worked. I just put

(require 'org-num)
(add-hook 'org-mode-hook #'org-num-mode)

inside my use-package org 's (massive) :config


On Tue, Mar 10, 2020 at 1:28 AM Eric S Fraga  wrote:

> On Monday,  9 Mar 2020 at 23:31, Lawrence Bottorff wrote:
> > I've tried a few variations of trying to turn on org-num-mode (which now
> > comes standard in org, correct?) in my init, but I keep getting an error
> > buffer upon a fresh startup
>
> Maybe show us what you have right now instead of what others have done?
>
> In any case, this one:
>
> > (use-package org-num
> >   :load-path "lisp/"
> >   :after org
> >   :hook (org-mode . org-num-mode))
>
> should work, as far as I can tell although I don't use use-package at
> all.  Have you tried with a reduced .emacs?
>
> You could try the following:
>
> (require 'org)
> (require 'org-num)
> (add-hook 'org-mode-hook #'org-num-mode)
>
> --
> : Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-354-g9d5880
>


Turn on org-num-mode in init?

2020-03-09 Thread Lawrence Bottorff
I've tried a few variations of trying to turn on org-num-mode (which now
comes standard in org, correct?) in my init, but I keep getting an error
buffer upon a fresh startup

Error (use-package): org/:config: Cannot activate headline numbering
outside Org mode

although when I dismiss it with q and call up an org file, org-num-mode is
on. Any ideas what to do? I saw this

(use-package org-num
  :load-path "lisp/"
  :after org
  :hook (org-mode . org-num-mode))

but I assume he's using the github version. This

(use-package org
  :defer 2
  :ensure nil
  :hook
  ((org-mode . org-num-mode)
   (org-mode . (lambda () ;; this will make sure auto-fill works for
org-mode
 (setq-local comment-auto-fill-only-comments nil)
 (setq-local display-line-numbers-type 'absolute
...

All of these produce the error, but, again, org-num works.

LB


How to tweak org-log-into-file, how to leverage state history.

2020-02-29 Thread Lawrence Bottorff
I've been trying to understand the whole TODO universe, now that I've
finally tackled it. The ability to create all the various states (I haven't
tried SEQ of state groups yet) on an issue entered as a heading in an org
file and then change the status of that heading is marvelous. For example,
I've created states TOGROK, GROKKING, and GROKKED for issues I'm "thinking
hard" about.

My frustration is when I create/change a state (all my states have @ for
"add log blurb"), the LOGBOOK only allows a single rambling sentence, i.e.,
no paragraphs. For example, I want to start out with my own custom
PROPERTIES drawer, then start the text.

To elaborate, I create a heading and give it the status TOGROK. So I say a
lot about this initial state and save it. Then I want to change the state
to GROKKING when I've something new to say. Then I "change" to GROKKING
again -- because some new thing occurs to me. After maybe a few of those, I
change to GROKKED and finalize this whole heading-as-issue. This is exactly
what I want, because this heading-as-issue is leveraging the TODO state
history.

Sure, I could have just done elaborations as they came to me as text,
graphs, pics, whatever under the heading, paragraph after paragraph, *but
then I've lost the whole state change dynamic of attaching new information
to a new state, and with it the tracked history. *

So I see org-log-into-drawer has three possible values in its customize
buffer: nil, LOGBOOK, and Other. The LOGBOOK option allows the nice (but
limited to one sentence) logging of each change of state, creating a history

** GROKKING ...My first attempts at tracking issue
:LOGBOOK:
- State "GROKKING"   from "GROKKING"   [2020-02-29 Sat 23:50] \\
  Still grokking this one.
  But will return to this issue.
- State "GROKKING"   from "TOGROK" [2020-02-29 Sat 23:49] \\
  Will "ask around" on this issue.
- State "TOGROK" from  [2020-02-29 Sat 23:43] \\
  Aware that I need to grok this whole thing.

So what can I do with org-log-into-drawer's Other option? I tried
(org-log-into-drawer  (current-time)), which is apparently just the same
as (org-log-into-drawer  t), i.e., just a LOGBOOK entry happened.

Is there something that can happen in sub-headings that keeps track of the
state history of the main heading?

LB


Re: Customize TODO log drawer

2020-02-28 Thread Lawrence Bottorff
... could the answer be that LOGBOOK is a general drawer and a PROPERTIES
drawer two different classes of drawers? That is, PROPERTIES allows
key/value fields while LOGBOOK just allows text?

On Fri, Feb 28, 2020 at 12:08 PM Lawrence Bottorff 
wrote:

> I've gone to my org-log-into-drawer customize menu and it says "Not into a
> drawer" even though a C-u C-c C-t gets me the org-todo-keyword list, and
> when I chose TODO, I get an LOGBOOK entry form. Good. This is indeed the
> behavior I want, i.e., always make a "log entry" upon a TODO choice.
> However, I'd like to customize the LOGBOOK drawer to include more, for
> example I have this in my tempo templates:
>
> (tempo-define-template "org-PROPERTIES_time-vertex-edge-level"
>   '(":PROPERTIES:" n
> ":HLEVEL: " (borgauf/insert-level) n
> ":Time: " (borgauf/insert-dateutc.1) n
> ":ID: " (borgauf/insert-uuid) n
> ":LINKS: " n
> ":END:" )
>   " 'org-tempo-tags)
>
> So this is what I'd like each "log entry" to have in its drawer besides my
> notes. Is it possible to customize the logging to have this extra stuff in
> the drawer?
>
> LB
>


Customize TODO log drawer

2020-02-28 Thread Lawrence Bottorff
I've gone to my org-log-into-drawer customize menu and it says "Not into a
drawer" even though a C-u C-c C-t gets me the org-todo-keyword list, and
when I chose TODO, I get an LOGBOOK entry form. Good. This is indeed the
behavior I want, i.e., always make a "log entry" upon a TODO choice.
However, I'd like to customize the LOGBOOK drawer to include more, for
example I have this in my tempo templates:

(tempo-define-template "org-PROPERTIES_time-vertex-edge-level"
  '(":PROPERTIES:" n
":HLEVEL: " (borgauf/insert-level) n
":Time: " (borgauf/insert-dateutc.1) n
":ID: " (borgauf/insert-uuid) n
":LINKS: " n
":END:" )
  "

Re: Incident tracking

2020-02-28 Thread Lawrence Bottorff
I can see that an "incident" can be seen as a TODO; indeed, anything event
can start as a TODO, then move on in status to one of your other
org-todo-keyword entries. Question: When I start the TODO process, and then
update the status, once or more times, finally, perhaps with DONE, is there
a record of this "Werdegang," this process?

On Thu, Feb 27, 2020 at 7:50 PM Samuel Wales  wrote:

> i have no right to respond as i have 483 scheduleds and 28 deadlines
> and i get lost even trying to get one thing done per week, but i just
> wanted to add to the advice so far.
>
> there is org-edna for dependencies.  org-depend also, but i think it
> lacks the feature of scheduling a remote org-id header once a local
> one is doneified.
>
> it is useful to stick inactive timestamps at boh on headlines, so you
> can do all sorts of things like visually bisect to find what you are
> looking for, search only the visible headlines, etc.  this makes for
> good logging.  [others will recommend date trees instead.]
>
> i like this type of discussion as we have had few of them in the last
> 8 years or so and there is much insight for usage and even fodder for
> better features or refactoring, i think.
>
> gtd is too labor-intensive for myself, but others will suggest reading
> materials if you think it fits.
>
> org is flexible so it's really a toolkit for figuring out your own
> structures.  i'd suggest not getting too fancy at first because yagni
> sometimes applies.
>
> ===
>
> i find it useful to think of my org forest as an ontology of
> representations of preferably physical objects that become canonical
> locations in it.
>
> thus, your washer is one holon [subtree] and you always know where to
> refile to for it.  then you don't need tags as much; you can use org
> id links to make the forest a digraph.  location determines identity.
>
> this is in contrast to, for example "stuff to do for maintenance".
>
> --
> The Kafka Pandemic
>
> What is misopathy?
>
> https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
>


Incident tracking

2020-02-27 Thread Lawrence Bottorff
What would be the best way in the Emacs org-mode world to "keep track" of
"incidents" that might happen in, e.g., a factory setting? Let's say a
piece of equipment has various things in its life that happen to it:
breakdown, warning, maintenance, etc. that you want to keep track of in an
org-mode way. Would it be something in the TODO/GTD realm, or something
custom?

LB


Re: Running in-line babel code at auto-insert template file open

2020-02-26 Thread Lawrence Bottorff
Got a good answer over at emacs.stackexchange
<https://emacs.stackexchange.com/questions/55754/how-to-run-functions-inside-auto-insert-template>
that
uses Emacs text-buffer lore. Still, it seems like org-mode should be able
to auto-run in-line code just like the solution does. Alas, someday I hope
to be able to just tackle a problem like this and submit the solution. Hope
springs eternal (which Google-Gmail just auto-completed!)...

On Mon, Feb 24, 2020 at 9:51 PM Lawrence Bottorff  wrote:

> Let's say I have a standard org file I want to have created multiple
> times. I've created a template file and told Emacs autoinsert where it is.
> Here's the relevant in my init
>
> (use-package autoinsert
>   :ensure t
>   ...
>   :config
>   (define-auto-insert "poolchem.org?$" "poolchem.org"))
>
> So in this template file poolchem.org I have six table skeletons, but I
> also want various customized additions. For example, I would like the table
> names to reflect the current week starting with the coming Sunday's date
>
> #+tblname: pc1-*src_emacs-lisp[:results raw]{(org-read-date nil nil
> "++sun" nil (org-time-string-to-time "2020-02-24"))}*
>
> which would hopefully show up in the newly created buffer as
>
> #+tblname: pc1-2020-03-01
>
> But then nothing of the sort happens, i.e., the in-line code just comes
> back verbatim when I create a new file, unevaluated. I guess I'm totally
> missing what is going on with in-line code. It seems other methods of
> template creation allow code to be embedded, then to be evaluated. (The
> variable auto-insert-alist has entire templates.) I've experimented with
> eval of org-sbe in # local variables: ... but that was for running code
> blocks upon file open, not individual embedded functions that would
> customize my newly created org file. Any ideas?
>
> LB
>
>


Running in-line babel code at auto-insert template file open

2020-02-24 Thread Lawrence Bottorff
Let's say I have a standard org file I want to have created multiple times.
I've created a template file and told Emacs autoinsert where it is. Here's
the relevant in my init

(use-package autoinsert
  :ensure t
  ...
  :config
  (define-auto-insert "poolchem.org?$" "poolchem.org"))

So in this template file poolchem.org I have six table skeletons, but I
also want various customized additions. For example, I would like the table
names to reflect the current week starting with the coming Sunday's date

#+tblname: pc1-*src_emacs-lisp[:results raw]{(org-read-date nil nil "++sun"
nil (org-time-string-to-time "2020-02-24"))}*

which would hopefully show up in the newly created buffer as

#+tblname: pc1-2020-03-01

But then nothing of the sort happens, i.e., the in-line code just comes
back verbatim when I create a new file, unevaluated. I guess I'm totally
missing what is going on with in-line code. It seems other methods of
template creation allow code to be embedded, then to be evaluated. (The
variable auto-insert-alist has entire templates.) I've experimented with
eval of org-sbe in # local variables: ... but that was for running code
blocks upon file open, not individual embedded functions that would
customize my newly created org file. Any ideas?

LB


ob-prolog is sick. . .

2020-02-22 Thread Lawrence Bottorff
. . . can some nice doctor (with elisp skills beyond my laughable ones)
make a house call? The repo here  has an
outstanding *issue* you can read. Also, if you run the .org test file, it
hangs after a few of the simpler tests. I think they're related. The
original provider says he just doesn't have time.

Besides the bad karma of listing a Babel language that actually doesn't
work, I would like to have Prolog working in Babel because I get the sense
Prolog's stock will slowly rise, mainly due to it being the basis of
querying graph databases. Prolog and RDF, basically.

LB


How to capture export prepended header numbering

2019-12-30 Thread Lawrence Bottorff
Basically, I'd like to know what level each heading of an org file is and
in what order they appear. So if my org file looks like this

* heading a
** sub-heading a.1
** sub-heading a.2
*** sub-sub-heading a.2.1
* heading b
** sub-heading b.1
*** sub-sub-heading b.1.1
* heading c

And an HTML export creates this

1 heading a
1.1 sub-heading a.1
1.2 sub-heading a.2
1.2.1 sub-sub-heading a.2.1
2 heading b
2.1 sub-heading b.1
2.1.1 sub-sub-heading b.1.1
3 heading c

is there a way to capture that prepended export numbering? Actually, I'd
like to capture every heading's rank and order and keep it in a PROPERTIES
drawer. There's obviously some baked in mechanism doing this for exporting.
Is it possible for a mere mortal to know, have?

LB


Turn function into interactive

2019-12-29 Thread Lawrence Bottorff
I've discovered org-outline-level which when in a code block under a given
header delivers as expected:

* This old level
#+BEGIN_SRC emacs-lisp
(org-current-level)
#+END_SRC

#+RESULTS:
: 1

Now, how could I turn this into an interactive callable with M-x? My stab
in the dark

(defun my-insert-level ()
  (interactive)
  (insert (org-outline-level)))

doesn't seem to be working. Or is there already an interactive that will
give me what level I'm at? My goal is to put this into a tempo template for
a PROPERTIES key-value, and I assume this sort of construct

(tempo-define-template "org-PROPERTIES_time-uuid-level"
'(":PROPERTIES:" n
":HLEVEL: " (my-insert-level) n
":Time: " (my-insert-dateutc) n
":UUID: " (my-insert-uuid) n
":END:" )
  "

Table results doesn't work for dotted lists

2019-12-24 Thread Lawrence Bottorff
I've got this

#+begin_src emacs-lisp :results table
'(hline (hi) (there) hline)
#+end_src

#+RESULTS:
|---|
| hi|
| there |
|---|

but then :results table has no effect on this

#+begin_src emacs-lisp :results table
'(hline (hi . bye) (here . there) hline)
#+end_src

#+RESULTS:
: (hline (hi . bye) (here . there) hline)

throwing in quotes to the lists changes it to this

#+begin_src emacs-lisp :results table
'(hline '(hi . bye) '(here . there) hline)
#+end_src

#+RESULTS:
|---+|
| quote | (hi . bye) |
| quote | (here . there) |
|---+|

but that's kludge. Just wondering why it would distinguish between a trad
list and a dotted list.

LB


Re: Properties Drawer versus tags

2019-12-20 Thread Lawrence Bottorff
I might add that a properties/drawer is a sort of "official heading
metadata repo," while tags not so much. It would be nice to see (lots of)
examples.

On Fri, Dec 20, 2019 at 9:18 AM Ken Mankoff  wrote:

>
> On 2019-12-19 at 22:24 -08, Lawrence Bottorff 
> wrote...
> > Very simple, largely philosophical question: When/why use a properties
> > drawer below a heading versus just using tags on the heading? What are
> > the advantages, disadvantages of both?
>
> Tags are binary. They are there or not.
>
> Property drawers allow you to assign values to variables.
>
> I've never fully understood why some property drawers are set to binary.
> For controlling LaTeX export I have both a property ":clearpage: t" and a
> tag ":ignore:", and the tag makes more sense to me. Some of those may only
> exist in my personal config.
>
>   -k.
>


Properties Drawer versus tags

2019-12-19 Thread Lawrence Bottorff
Very simple, largely philosophical question: When/why use a properties
drawer below a heading versus just using tags on the heading? What are the
advantages, disadvantages of both?

LB


Calling/using named babel code blocks

2019-12-18 Thread Lawrence Bottorff
I thought I understood "metaprogramming," i.e., creating generic code
blocks that can be called by any other code block regardless of programming
language -- but apparently I don't. I have this

 #+name: my-random-gen
#+header: :var n=0 :var lim=0
#+BEGIN_SRC emacs-lisp
(loop repeat n collect (random* lim))
#+END_SRC

and I have the variables initialized to zero. But now I don't know how to
call it with another code block. I've tried various versions of this

#+BEGIN_SRC emacs-lisp
my-random-gen(5 1.0)
#+END_SRC

and this various versions of this

#+BEGIN_SRC emacs-lisp :var results=my-random-gen() :var n=5 :var lim=1.0
results
#+END_SRC

to no avail. What am I missing? How can I actually use, call my-random-gen
in other code blocks?

LB


Re: Best way to template a big table

2019-12-12 Thread Lawrence Bottorff
I just figured out that this

#+BEGIN_SRC emacs-lisp :results table
'((H1 H2 H3) (text11 text12 text13) (text21 text22 text23) (... ... ...)
(textN1 textN2 textN3))
#+END_SRC

#+RESULTS:
| H1 | H2 | H3 |
| text11 | text12 | text13 |
| text21 | text22 | text23 |
| ...| ...| ...|
| textN1 | textN2 | textN3 |

is probably a better way all around, i.e., "best practice." If any one
knows how to get the horizontal lines added in. . . .

On Thu, Dec 12, 2019 at 5:29 AM Simon Butler  wrote:

> Hi
>
> On 2019-12-12 07:05, Lawrence Bottorff wrote:
> > I've got a big table that I would like to create a template for, i.e.,
> > the rows and columns and the myriad | and -. Then a key chord would
> > produce it in an org file ready for values to be entered. I've seen
> > the post-9.2 tempo-define-template, but that looks more suited to
> > smaller things. There is Emacs Skeleton, but I'd like to ask people
> > who perhaps have faced this issue before for a "best practice" answer.
> >
> > LB
>
> Not sure about 'best practice', but yasnippet works well.
>
> Simon
>
>
>


Best way to template a big table

2019-12-11 Thread Lawrence Bottorff
I've got a big table that I would like to create a template for, i.e., the
rows and columns and the myriad | and -. Then a key chord would produce it
in an org file ready for values to be entered. I've seen the post-9.2
tempo-define-template, but that looks more suited to smaller things. There
is Emacs Skeleton, but I'd like to ask people who perhaps have faced this
issue before for a "best practice" answer.

LB


[O] Endangered Babel exotic species

2019-06-14 Thread Lawrence Bottorff
So I've investigated two of babel's "exotic species," Haskell and Prolog,
and I've found them not really working -- Haskell, sort of with an
elaborate work-around, Prolog not at all, even though in simple Emacs
modes, they're fine. Maybe they should be taken off the list?

LB


[O] Prolog: REPL hangs

2019-06-04 Thread Lawrence Bottorff
Have a look at this

over
at stackoverflow. I'm once again playing the eternal product tester. This
time Prolog, and it seems like an org-mode problem. Could be wrong, though.

LB


Re: [O] Haskell org-mode problems redux

2019-05-30 Thread Lawrence Bottorff
Gosh, it worked. So I wasn't crazy or remiss, rather, I just didn't know
how deep the rabbit hole was. Thanks! One odd thing still. I tried to run

#+begin_src haskell
:set prompt-cont ""
#+end_src

and like other times before trying to run Haskell blocks it complained
saying

executing Haskell code block...
org-babel-script-escape: ‘org-babel-script-escape’ expects a string

so I add :results output to the #+begin line and it works. Would anyone
know what that is about?


On Thu, May 30, 2019 at 3:25 PM Bruno Barbier  wrote:

>
> Hi Lawrence,
>
>
> Lawrence Bottorff  writes:
>
> > I've been trying to get Haskell to work in babel code blocks for a long
> > time. A year or so ago I tried and eventually gave up. I tried again
> > recently . . . same old problems, i.e., the code block is evaluated
> > exclusively by the ghci REPL, which doesn't understand or play well with
> an
> > org babel code block.
> >
> ...
> > S, any ideas?
>
> I'm using the header arguments:
>
>
> :prologue ":{\n" :epilogue ":}\n"
>
>
>
> to request org to insert those multiline tags :{ :}
> (so, I'm not using ":set +m").
>
> I'm defining these header args as headline properties (so that I don't
> have to enter them again and again).  Something like that:
>
>   #+begin_example
> ,** A title
>:PROPERTIES:
>:header-args:haskell: :prologue ":{\n" :epilogue ":}\n"
>:END:
>   #+end_example
>
> I'm telling ghci to not insert a prompt, when waiting for the end of a
> multiline.
>
> #+begin_src haskell
> :set prompt-cont ""
> #+end_src
>
>
> Configured like this, it seems to be working quite well for me (great
> job org and GHC teams!).
>
>
> #+begin_src haskell
>   doubleSmallNumber x =
>   if x > 10
>   then x
>   else x * 2
> #+end_src
>
> No error.
>
> #+begin_src haskell
> let
> showMe :: Int -> [String]
> showMe x = [show x, show $ doubleSmallNumber x]
> in
>   [ ["x", "doubleSmallNumber x"]
>   , showMe 3
>   , showMe 13
>   ]
> #+end_src
>
> #+RESULTS:
> |  x | doubleSmallNumber x |
> |  3 |   6 |
> | 13 |  13 |
>
>
>
> My config:
>
> | ghci  | 8.6.3 |
> | emacs |  26.1 |
> | org   | 9.2.3 |
> | OS| linux |
>
>
> If it doesn't work for you on GNU/Linux, post the example and I will try
> it on my computer (sorry, I won't be able to help you with Microsoft
> Windows though).
>
>
>
> Bruno
>
>
> > LB
>


[O] Haskell org-mode problems redux

2019-05-30 Thread Lawrence Bottorff
I've been trying to get Haskell to work in babel code blocks for a long
time. A year or so ago I tried and eventually gave up. I tried again
recently . . . same old problems, i.e., the code block is evaluated
exclusively by the ghci REPL, which doesn't understand or play well with an
org babel code block.

Before, the recipe was to add `:set +m` to either the top of the block or
run it in the REPL to allow "multiple lines" declarations, e.g., functions.
Then there was the `let` in front of a function declaration, which is also
a REPL workaround. Now it seems you need the :{ ... :} trick to get all the
code block lines to be seen as together, i.e.,

#+begin_src haskell :results raw
:{
  doubleSmallNumber x =
if x > 10
then x
else x * 2
:}
#+end_src

otherwise the block is treated as though it is being fed into the REPL one
at a time with no idea these lines are together making a function
declaration. I'm on latest org, have installed Haskell stack 8.6.3 on
Ubuntu (Haskell stack 8.6.5 on Windows). The maddening thing is the
intermittent behavior, i.e., sometimes it likes what you're doing:

 #+begin_src haskell :results raw
tripleMe x = x + x + x
#+end_src

and

#+begin_src haskell :results raw
[x | x <- [0..100], x `mod` 2 == 0 && x `mod` 7 == 0]
#+end_src

#+RESULTS:
Prelude> [0,14,28,42,56,70,84,98]
[0,14,28,42,56,70,84,98]

work fine -- but often enough when trying to declare a function with type
declaration first I get cryptic errors -- which are then solved with the :{
... :} REPL kludge. One other oddness is starting a ghci session with babel
creates a different sort of REPL than just starting one with haskell-mode .
. . and the two REPLs seem to clash and not like each other around.
Declaring :session *haskell* doesn't seem to matter. . . .

I was in touch with Rob Moss who claims to have it all working with GHC 4.4
from Debian and spacemacs, but when I tried all that I wasn't able to
reproduce his results, rather, the same old problems.

S, any ideas? It seems like ob-haskell -- which is now built in, not
separate? -- needs some attention. Or somebody who has the proverbial
silver bullet comes forth to save the day.

LB


[O] HTML export of #+RESULTS:

2019-05-20 Thread Lawrence Bottorff
Basically, I'm trying to get my code block :exports both to give me
the #+RESULTS: preamble, i.e., not just the results naked. See this

for
what I've been trying to do/kludge with just CSS. I'm on latest-greatest
everything.

LB


Re: [O] Parens matching off in babel code block

2019-05-02 Thread Lawrence Bottorff
Well, at least there is a sane explanation. Ironically, I was also about to
complain about all my loose ">"s getting flagged. So they are related!
Would there be a way to make an exception for < and > inside of actual code
forms? Languages need them for "greater than" and "less than".

On Thu, May 2, 2019 at 4:39 PM Nicolas Goaziou 
wrote:

> Hello,
>
> Marco Wahl  writes:
>
> > Using < and > as parenthesis in Org is questionable, I think.
>
> In Org syntax, < and > often come in pair (timestamps, some links,
> targets, radio targets). There is at least some interest in the current
> behaviour.
>
> > Also this behavior is not documented AFAICT.
>
> I don't think you can document every single detail. Even if it was
> possible, it wouldn't be desirable.
>
> > What about removing this special?  Or does anyone enjoy this behavior?
>
> This needs to be carefully tested and weighted.
>
> Regards,
>
> --
> Nicolas Goaziou
>
>


Re: [O] Parens matching off in babel code block

2019-05-02 Thread Lawrence Bottorff
Not sure what you mean. This is the problem, i.e., just this code

#+begin_src emacs-lisp
  (> 1 2)
#+end_src

in an org file produces a parens mismatch, which, BTW, check-parens also
flags. Anywhere else (e.g., *scratch*) in Emacs this code produces no
mismatch.

On Thu, May 2, 2019 at 10:35 AM Berry, Charles  wrote:

>
>
> > On May 1, 2019, at 7:56 PM, Lawrence Bottorff  wrote:
> >
> > Wondering if you have seen this over at emacs.stackexchange. Very
> puzzling why the parens mismatch in a babel emacs-lisp block, but not
> anywhere else in Emacs.
>
> I don't know the details but this ECM might help:
>
> #+begin_src emacs-lisp
>   (> 1 2)
> #+end_src
>
> The right broken bracket matches the left parenthesis in org-mode, but not
> in a Lisp Interaction Mode buffer.
>
> HTH
>
> Chuck
>


[O] Parens matching off in babel code block

2019-05-01 Thread Lawrence Bottorff
Wondering if you have seen this

over
at emacs.stackexchange. Very puzzling why the parens mismatch in a babel
emacs-lisp block, but not anywhere else in Emacs.

LB


Re: [O] Greek symbol rendering problem in gnuplot

2019-04-30 Thread Lawrence Bottorff
As I understand, the more "up-to-date" 2017 version is not as comprehensive
as the 2014 version. I got in contact with Bruce Ravel (2014 author) and he
says he's standing by, but I told him to wait to see what the org-mode side
can do first about the :session issue. So in general I'm supposing that
when a language's REPL session is not started, babel sometimes goes
straight the executable on the system and comes back with results. But then
others specifically need a :session named and started -- or at least start
a session.

I guess I'm being manic about this due to the overall difficulty of
producing graphs and diagrams in general in the STEM world. If you're good,
you can transcribe JIT, say, a math lecture on your laptop with org-mode --
prose and LaTeX formulae. But if you need diagrams you're blown away. . .

I've got a copy of Martin Weissman's *An Illustrated Theory of Numbers *which
utilizes LaTeX Tufte with diagrams in TikZ/PGF. Quite a beautiful book. In
general, it's just too damned hard to produce diagrams relative to prose
and formulae. . .  My two farthings. . . .

On Tue, Apr 30, 2019 at 12:10 PM Fraga, Eric  wrote:

> For the list: Lawrence and I have followed this through a bit more.  The
> solution, for those that have a newer version of gnuplot-mode (2017
> version instead of the 2014 version), is to set :session to "none".
>
> I would suggest that there is a bug in ob-gnuplot.el.  Specifically,
> :session is initialized to nil but all the code that checks for session
> assumes that it has to be set to "none" to not use a session.
>
> What hasn't been resolved is how to get sessions to work with the more
> up-to-date gnuplot-mode.
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.2.3-327-g3375f0
>


Re: [O] Greek symbol rendering problem in gnuplot

2019-04-30 Thread Lawrence Bottorff
I've looked at the gnuplot mode 2014 github site
 -- and no issues seem
to have been addressed by the owner in recent years. Will try to debug
myself.

On Tue, Apr 30, 2019 at 1:09 AM Fraga, Eric  wrote:

> Thanks for the long explanation.  I am using the 2014 version of
> gnuplot-mode and gnuplot 5.2.
>
> gnuplot-mode has a customizable variable, gnuplot-program, which
> specifies which command to execute to start gnuplot.  The default value
> for this variable, at least in the 2014 version, is simply "gnuplot" so
> it will pick up the default gnuplot on Linux (if there is more than one
> version installed, I imagine that /etc/alternatives will be used to
> identify the default).
>
> If you think the wrong gnuplot is being picked up, maybe customize this
> variable?  What do you get if you simply invoke "M-x run-gnuplot"?
>
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.2.3-327-g3375f0
>


Re: [O] Greek symbol rendering problem in gnuplot

2019-04-30 Thread Lawrence Bottorff
The 2014 "gnuplot-mode" has the problem of not rendering the greek symbols
when asked to by babel, hence, my switch to "gnuplot-mode" 2017.

C-h v gnuplot-program reports

gnuplot-program’s value is "/usr/bin/gnuplot"
  This variable may be risky if used as a file-local variable.
Documentation:
Not documented as a variable.

. . . which is correct, and, yes, as a stand-alone mode it works, i.e., it
finds the gnuplot executable and renders the greek letters fine. However,
when I attempt it inside a babel gnuplot code block it gives the error of
not finding the executable. This is behavior I've seen when babel doesn't
see a necessary mode that it requires to work with. This is my
supposition/guess. As I recall, when I first tried a babel gnuplot block,
it made this same complaint. Then I realized I hadn't installed the gnuplot
mode. The problem went away when I installed gnuplot-mode 2014. So again,
my educated guess is that babel doesn't see or want to interact with
gnuplot-mode 2017, rather, it want to see gnuplot-mode 2014.

I feel like I'm beating this to death. I can simply hand-edit in the
diagrams with greek letters done correctly into my org file, i.e., just not
do babel gnuplot. Again, gnuplot-mode 2014 in stand-alone will do a "plot
file" of the code correctly, but not a "plot buffer" strangely enough. (I'm
guessing babel gnuplot wants to do a "plot buffer".) OTOH, this is a bug,
i.e., no sane work-around, and we, an advanced species, shouldn't negotiate
with or accommodate insects.

So what is the process of keeping babel up-to-date AFA modes interacting
with their executables is concerned? Who does this? I can look at the
gnuplot-modes and see if I can find anything. But I'm a total noob with
big-time Elisp code.

On Tue, Apr 30, 2019 at 1:09 AM Fraga, Eric  wrote:

> Thanks for the long explanation.  I am using the 2014 version of
> gnuplot-mode and gnuplot 5.2.
>
> gnuplot-mode has a customizable variable, gnuplot-program, which
> specifies which command to execute to start gnuplot.  The default value
> for this variable, at least in the 2014 version, is simply "gnuplot" so
> it will pick up the default gnuplot on Linux (if there is more than one
> version installed, I imagine that /etc/alternatives will be used to
> identify the default).
>
> If you think the wrong gnuplot is being picked up, maybe customize this
> variable?  What do you get if you simply invoke "M-x run-gnuplot"?
>
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.2.3-327-g3375f0
>


Re: [O] Greek symbol rendering problem in gnuplot

2019-04-29 Thread Lawrence Bottorff
Yes, Ubuntu 19.04. Latest-greatest everything else pertinent as well. Here
is are my subscriptions

(setq package-archives '(("ELPA"  . "http://tromey.com/elpa/;)
("gnu"   . "http://elpa.gnu.org/packages/;)
("melpa" . "https://melpa.org/packages/;)
("org"   . "https://orgmode.org/elpa/;)))

And so I discover these two when I do list-packages:

gnuplot 
20141231.2137 available  melpa  drive gnuplot from within emacs

and then this:

 gnuplot-mode    20171013.1616
installed Major mode for editing gnuplot scripts

the former I uninstalled, the latter, as you see, I installed, simply going
on the theory that a later something is more up to date. The babel
languages page lists this:

Gnuplot gnuplot ob-doc-gnuplot gnuplot, gnuplot-mode

which no doubt means gnuplot the actual program, then gnuplot-mode the
Emacs package. So I'm saying the second list-packages offering,
gnuplot-mode- 20171013.1616, is working only as a stand-alone mode and not
working with org-mode babel (It can't find gnuplot when an org gnuplot
block is run.), while the first one, just plain simple
gnuplot-20141231.2137 works in org-mode babel, but gives the long-ago
solved problem of greek symbol display garbling when run in babel code
blocks. (See the links to the github pages.) The confusion is which of the
Emacs packages to use -- both having problems. Both modes seem to know
where gnuplot is (my $PATH has /usr/bin/ and my gnuplot is
/usr/bin/gnuplot), again, they both work fine as stand-alones with gnuplot
code files, but, as I'm saying,  gnuplot-mode-20171013.1616 doesn't work
with org-mode.

Having glanced at the older gnuplot-20141231.2137 mode's code, it seems to
guess version 3.7 if it can't establish which version of gnuplot the user
is running. Odd since it does start up an Emacs gnuplot REPL session --
that readily identifies itself as 5.2.6. So I'm guessing
this gnuplot-mode-20171013.1616 is not the intended mode after all, rather,
gnuplot-20141231.2137. Since there have been more than one stackoverflow
efforts on this issue, I thought it worthy of org-mode's attention -- heavy
users of greek letters or no.

On Mon, Apr 29, 2019 at 12:33 AM Fraga, Eric  wrote:

> Emacs (and hence org) will use whichever gnuplot is found in your $PATH,
> assuming you're on Linux (you did not specify).  You also, for babel,
> need the gnuplot mode.  I don't understand why you removed the gnuplot
> package as it does not have the emacs mode; that is provided by the
> separate gnuplot-mode package.
>
> I don't use greek letters so cannot comment on that aspect.
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.2.3-327-g3375f0
>


[O] Greek symbol rendering problem in gnuplot

2019-04-28 Thread Lawrence Bottorff
Maybe take a look at this

issue,
which describes a tortured trek to find a way to get Gnuplot to properly
render Π (pi) in an output graphic. Apparently, the gnuplot package is from
2014 and doesn't handle Greek symbols. Why it will use latest-greatest
gnuplot 5.2.6 and won't render Greek symbols is mysterious. Also, when
executing an org-mode babel gnuplot block, it reports in the minibuffer
that it is using Gnuplot 3.7. However, C-c C-c in the block does start up a
Gnuplot REPL in Emacs, and output does happen -- just with garbled Greek
letters. Odder is when I put the code in a separate file with the mode
running, I can get it to render pi correctly with gnuplot-run-file -- but
not gnuplot-run-buffer. The latter is garbled, the former good. BTW, a
Gnuplot session started at the command line works with Greek symbols just
fine.

So I uninstalled gnuplot and installed newer gnuplot-mode (last updated
2017). Testing just a stand-alone file with the code with
gnuplot-run-buffer produces good results; however, no REPL in Emacs is
started and the gnuplot codeblock in an org file fails. C-c C-c produces

executing Gnuplot code block...
org-babel-execute:gnuplot: Cannot open load file: No such file or
directory, gnuplot

obviously Gnuplot in org-mode babel is meant to run with the gnuplot
package and not the newer gnuplot-mode package. But now I'm stuck without a
way to render Greek letters in a Gnuplot graphic. Something about the
gnuplot package doesn't do Greek symbols and something about gnuplot-mode
doesn't do org-mode babel gnuplot. Please advise.

LB


[O] install confusion

2019-04-22 Thread Lawrence Bottorff
I've got this in my init, which is in an org file with embedded elisp
blocks:

(use-package org-plus-contrib
  :defer t
  :ensure t
  )

then right after I have

(use-package org
:ensure t
:bind (("C-c a" . org-agenda)
   ("C-c c" . org-capture)
   ("C-c l" . org-store-link))
:config
(setq org-ellipsis " ")
   . . .
)

where the use-package org form has extensive config info in it. Am I wrong
with having both? In my ELPA directory I only see org-plus-contrib-20...
which has such things as org.el. I'm using "https://orgmode.org/elpa/ BTW.

LB


Re: [O] html export entire code block including template?

2019-04-22 Thread Lawrence Bottorff
Just found it here
<https://stackoverflow.com/questions/7431167/escaping-org-mode-example-block-inside-of-an-example-block/7462884#7462884>
.

On Tue, Apr 16, 2019 at 12:08 AM Lawrence Bottorff 
wrote:

> I'm doing this:
>
> #+begin_example
> #+begin_src emacs-lisp :var table=sandbox :exports both
>   (message "%S" table)
> #+end_src
> #+end_example
>
> to force html export into displaying the entire block, including the code
> block wrapper. Is there a more elegant way, perhaps in the #+begin line to
> tell export to include even the wrapper?
>
> LB
>


[O] html export entire code block including template?

2019-04-15 Thread Lawrence Bottorff
I'm doing this:

#+begin_example
#+begin_src emacs-lisp :var table=sandbox :exports both
  (message "%S" table)
#+end_src
#+end_example

to force html export into displaying the entire block, including the code
block wrapper. Is there a more elegant way, perhaps in the #+begin line to
tell export to include even the wrapper?

LB


Re: [O] local variables to initialize org buffer?

2019-04-01 Thread Lawrence Bottorff
I've got this in my config.org , which is called by my init.el:

#+begin_src emacs-lisp
  (defun borgauf/execute-startup-block ()
(interactive)
(progn (org-babel-goto-named-src-block "startup")
   (org-babel-execute-src-block)))
#+end_src

then in my org-mode file I have this at the bottom:

* Comments

#+name: startup
#+BEGIN_SRC emacs-lisp :results silent
;(progn (slime) (org-babel-execute-buffer))
(slime)
(org-babel-execute-buffer)
#+END_SRC

# Local Variables:
# eval: (borgauf/execute-startup-block)
# End:

This is starting the slime repl just fine, but not doing the
(org-babel-execute-buffer). I can then manually run C-c C-v b and it indeed
runs all the code blocks. So, I'm guessing that after the (slime) is
performed, it doesn't return focus to my calling org-mode buffer and
the (org-babel-execute-buffer) is running to no avail in the slime repl
buffer?



On Mon, Apr 1, 2019 at 1:37 AM Eric S Fraga  wrote:

> On Sunday, 31 Mar 2019 at 21:05, Lawrence Bottorff wrote:
> > I'm trying to figure out how to start up slime and do
> > org-babel-execute-buffer when I open a certain org-mode file full of Lisp
> > source code blocks. I guess
> >
> > Local Variables:
> >  eval: (elisp-function)
> >  End:
> >
> > is discouraged.
>
> It is discouraged but not disallowed.  I use this:
>
> # eval: (esf/execute-startup-block)
>
> where
>
> #+begin_src emacs-lisp
>   (defun esf/execute-startup-block ()
> (interactive)
> (org-babel-goto-named-src-block "startup")
> (org-babel-execute-src-block))
> #+end_src
>
> which will execute any org src block named startup whenever I visit the
> file (but with confirmation required).  It is incumbent on me knowing
> that the src block is safe to execute and I only say yes for files that
> are mine.
>
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.2.2-324-gd58827
>


Re: [O] local variables to initialize org buffer?

2019-03-31 Thread Lawrence Bottorff
Sure, but how should it be implemented?

On Sun, Mar 31, 2019 at 9:33 PM Berry, Charles  wrote:

> Will `org-babel-load-file' suffice?
>
> HTH,
>
> Chuck
>
> > On Mar 31, 2019, at 7:05 PM, Lawrence Bottorff 
> wrote:
> >
> > I'm trying to figure out how to start up slime and do
> org-babel-execute-buffer when I open a certain org-mode file full of Lisp
> source code blocks. I guess
> >
> > Local Variables:
> >  eval: (elisp-function)
> >  End:
> >
> > is discouraged. So I looked at in buffer settings, but I don't see
> anything specific to actually running elisp functions -- unless I'm missing
> something. Advice?
> >
> > LB
>
>
>


[O] local variables to initialize org buffer?

2019-03-31 Thread Lawrence Bottorff
I'm trying to figure out how to start up slime and do
org-babel-execute-buffer when I open a certain org-mode file full of Lisp
source code blocks. I guess

Local Variables:
 eval: (elisp-function)
 End:

is discouraged. So I looked at in buffer settings
, but I don't see
anything specific to actually running elisp functions -- unless I'm missing
something. Advice?

LB


[O] Python with org-mode

2019-03-29 Thread Lawrence Bottorff
I've seen many "start using Python" parades, but what is the best way to
use Python with org-mode, i.e., in babel source blocks? I'm on U18.10,
which comes with standard 2 (2.7.15+) and 3 (3.6.7). But then I keep
hearing about Anaconda. Your opinions, experiences, please.

LB


[O] logbook file?

2019-03-26 Thread Lawrence Bottorff
So I can add a logbook entry to my org file with C-c C-z and it goes into a
logbook drawer on that file. Is there a way to associate that entry with an
external file? That is, can I have all logbook entries automatically be
written to, say, a logbook.org file. Or, is there a quick way to simply
tangle out all logbook entries?

Isn't there something similar with a notes.org file?

LB


[O] doi-utils, org-ref-bibtex: separate or included?

2019-03-23 Thread Lawrence Bottorff
I've got this code in my init:

(use-package doi-utils
:ensure t
:after org)

(use-package org-ref-bibtex
:after org
:init
(setq org-ref-bibtex-hydra-key-binding "\C-cj"))

I'm not sure where I got this code, but it errors out. There is no ELPA for
these, correct? What's the best way to install these? So if I've got
org-ref from an ELPA repo (it now shows up as a "dependency"), do doi-utils
and org-ref-bibtex need to be separately installed? If so, what's the best
way?

LB


[O] MathJax font confusion

2019-03-05 Thread Lawrence Bottorff
I'm trying to get odd behavior in an org-mode HTML export cleared up. (See
this .) I've got this

table {
font-family: monospace;
/* font-family:'eulermedium_18'; */
font-size: 1.05em;
margin-left:5%;
margin-right:auto;
margin-top:0.5em;
margin-bottom:0.5em;
line-height: 1.5em;

}

in my custom stylesheet.css, and I've narrowed the inflated font size issue
you can see on the "Therefore exists" line down to the `font-family:
monospace;` above. So with this custom `table` and anything inside $...$, I
get a strange `element.style` thrown in the final HTML, which alters the
font size either up or down crazily. (monospace -> 129%; euler -> 53%).
Again, when I comment out this custom `table`, the `element.style` in the
HTML shows only minor font size alterations; hence, I conclude my
customized table and MathJax aren't playing well together.

So yes, don't try to override a MathJax font with customized css, but how
to do so with MathJax itself? For example, if I want Neo-Euler I can set
`org-html-mathjax-options to Neo-Euler *and/or* add

#+HTML_MATHJAX: font: Neo-Euler

but get no results -- which is why I tried the custom table in the first
place. (BTW, org-html-mathjax-temple seems fine, ergo, I made no changes
there.) By adding the buffer header I get

ide: left font: Neo-Euler

on the outputted page -- as an error message? I can guess the template
isn't really up to snuff after all at running the MathJax javascript, but I
wouldn't know how to test this idea. Any advice appreciated.

LB


[O] Manual available?

2019-02-04 Thread Lawrence Bottorff
Is the latest org-mode manual available as an org file? Is there a github
for it somewhere?

LB


[O] Error in Literal Examples manual?

2019-02-04 Thread Lawrence Bottorff
At the bottom of this  is
a description of adding a `org-store-link` inside of a babel code block
edit called with C-c ' , however, it doesn't seem to work with C-c l ,
although M-x org-store-line does work. Or am I seeing, doing this wrong?

Sorry about previous  version. . . .

LB


[O] (no subject)

2019-02-03 Thread Lawrence Bottorff
At the bottom of this  is
a description of adding a `org-store-link` inside of a babel code block
edit called with C-c ' , however, it doesn't seem to work with C-c l ,
although M-x org-store-line does work. Or am I seeing, doing this wrong?

LB


[O] Definitive answer to org-mode export HTML versus LaTeX

2019-01-29 Thread Lawrence Bottorff
I keep being stymied by the apparent incompatibility of HTML and LaTeX
export. Here's what I have in my .org file header:

#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [american]
#+LATEX_HEADER: \usepackage{tikz}
#+LATEX_HEADER: \usepackage{commath}
#+LATEX_HEADER: \usepackage{stackengine}
#+LaTeX_HEADER: \usepackage{pgfplots}
#+LaTeX_HEADER: \usepackage{sansmath}
#+LATEX_HEADER: \usepackage{mathtools}
#+LaTeX_HEADER: \usepackage{amsmath}

In reality, I don't know if this gets seen by org-mode export to HTML,
perhaps by export to LaTeX? So to start, here is working piece of markup
that displays great in both HTML and LaTeX:

#+begin_src latex :packages '(("" "tikz")) :exports results :results output
raw :file other12.png :imagemagick yes :iminoptions -density 600
:imoutoptions -geometry 500

\usetikzlibrary{decorations.pathreplacing}

  \begin{tikzpicture}[scale=1]
\draw[step=1cm,thin,gray!60] (-6,-6) grid (6,6);
\draw[<->] (-6,0)--(6,0) node[right]{$x$};
\draw[<->] (0,-6)--(0,6) node[above]{$y$};
\draw[line width=2pt,blue,-stealth](0,0)--(4,-3) node[anchor=south
west]{$\boldsymbol{(4,-3)}$};
\draw[line width=2pt,gray,-stealth](2,3)--(6,0) node[anchor=south west];
\draw[line width=2pt,gray,-stealth](-5,4)--(-1,1) node[anchor=south
west];
\draw[line width=2pt,gray,-stealth](-3,-1)--(1,-4) node[anchor=south
west];
\draw
[decorate,color=red,decoration={brace,amplitude=10pt},xshift=-0pt,yshift=0pt]
(-5.0,1.0) -- (-5.0,4.0) node [red,midway,xshift=-0.65cm]
{\footnotesize $-3$};
\draw
[decorate,color=red,decoration={brace,amplitude=10pt,mirror,raise=1pt},xshift=-0pt,yshift=0pt]
(-5,1) -- (-1,1) node [red,midway,yshift=-0.6cm] {\footnotesize $4$};
  \end{tikzpicture}

#+end_src

The following also displays in both HTML and LaTeX correctly:

\begin{align*}
\|x\|&=\sqrt{4^2+(-3)^2} \\
&= \sqrt{25} \\
&= 5
\end{align*}
as well as this:

\begin{equation*}
x = \begin{pmatrix}
\phantom{-} 4 \\
   -3 \\
\end{pmatrix}
 \end{equation*}

but this on the HTML side

\setstackEOL{\\}
\begin{equation*}
x=\parenVectorstack[r]{4\\-3\\2}
\end{equation*}

doesn't know what \setstackEOL{\\} is, nor \parenVectorstack[r] and
displays mangled. The LaTeX export looks fine, though. And if I put it in a
LaTeX babel code block, it disappears from the HTML entirely, while, again,
the LaTeX export displays just fine. Confusing is how the Tikz code block
is displayed in both HTML and LaTeX, but any other attempt at a LaTeX code
block is ignored and left completely out of the HTML export.

My educated guess is that the org-mode HTML export processes is handled by
MathJax, which is a subset of LaTeX. But then I'd like to know definitively
what can be done and what cannot be done LaTeX-wise for the HTML export.

LB


[O] Easy templates broken with 9.2

2019-01-26 Thread Lawrence Bottorff
It seems my easy templates completion is being ignored. I'm  9.2
(9.2-41-g010a35-elpa ...). I've found a reference or two online but the
fix,  i.e., running (require 'org-tempo) only produced error messages. The
"documentation" doesn't really say exactly what the new format is. Here's a
sample of what my old org-structure-template-alist had:

...
("o" "#+name:\n#+begin_src ocaml :exports both :tangle yes :cache yes
:results silent\n?\n#+end_src")
("G" "#+name:\n#+begin_src gnuplot :exports both :file \n?\n#+end_src")
("r" "\\rightarrow")
...

What do I need to change about my old easy templates to work with 9.2? I
understand "

[O] Change HTML export metadata

2018-12-17 Thread Lawrence Bottorff
I've got this:

Date: 2018-12-17T14:47:18
Author: me
Created: 2018-12-17 Mon 14:51
Validate

standard "metadata" coming at the end of whatever I html-export. I'm sure I
can change this, right?

Also, does anyone have a tutorial (or in-depth discussion) of org mode CSS
lore for html export? One issue was good indenting when headings start
getting deep -- then keeping sundry content under a heading to also go
along with that indentation. Typically, whenever I just do an Inspect in
Chrome and start fooling around, I fix one thing and break something else.
Very mysterious. . . .

LB


Re: [O] HTML :exports both problem

2018-11-19 Thread Lawrence Bottorff
That did the trick. Though I'm wondering why the #+name: would cause such
craziness. . . Also, would anyone know why

 #+begin_src lisp :results output :exports both
  (dotimes (x 20)
(dotimes (y 20)
  (format t "~3d " (* (1+ x) (1+ y
(format t "~%"))
#+end_src

produces

#+RESULTS:
#+begin_example
  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18
19  20
  2   4   6   8  10  12  14  16  18  20  22  24  26  28  30  32  34  36
38  40
  3   6   9  12  15  18  21  24  27  30  33  36  39  42  45  48  51  54
57  60
  4   8  12  16  20  24  28  32  36  40  44  48  52  56  60  64  68  72
76  80
  5  10  15  20  25  30  35  40  45  50  55  60  65  70  75  80  85  90  95
100
  6  12  18  24  30  36  42  48  54  60  66  72  78  84  90  96 102 108 114
120
  7  14  21  28  35  42  49  56  63  70  77  84  91  98 105 112 119 126 133
140
  8  16  24  32  40  48  56  64  72  80  88  96 104 112 120 128 136 144 152
160
  9  18  27  36  45  54  63  72  81  90  99 108 117 126 135 144 153 162 171
180
 10  20  30  40  50  60  70  80  90 100 110 120 130 140 150 160 170 180 190
200
 11  22  33  44  55  66  77  88  99 110 121 132 143 154 165 176 187 198 209
220
 12  24  36  48  60  72  84  96 108 120 132 144 156 168 180 192 204 216 228
240
 13  26  39  52  65  78  91 104 117 130 143 156 169 182 195 208 221 234 247
260
 14  28  42  56  70  84  98 112 126 140 154 168 182 196 210 224 238 252 266
280
 15  30  45  60  75  90 105 120 135 150 165 180 195 210 225 240 255 270 285
300
 16  32  48  64  80  96 112 128 144 160 176 192 208 224 240 256 272 288 304
320
 17  34  51  68  85 102 119 136 153 170 187 204 221 238 255 272 289 306 323
340
 18  36  54  72  90 108 126 144 162 180 198 216 234 252 270 288 306 324 342
360
 19  38  57  76  95 114 133 152 171 190 209 228 247 266 285 304 323 342 361
380
 20  40  60  80 100 120 140 160 180 200 220 240 260 280 300 320 340 360 380
400
#+end_example

which is great. How did it know to sandwich the output between
#+begin_example/#+end_example, thereby preserving the linefeeds? That's
amazing. Is there a way to toggle that behavior?

On Mon, Nov 19, 2018 at 3:16 AM Eric S Fraga  wrote:

> On Sunday, 18 Nov 2018 at 23:55, Lawrence Bottorff wrote:
> > Try this at home:
>
> [...]
>
> > Am I missing something?
>
> I don't have lisp installed (or at least Emacs doesn't know which lisp
> to use) so I cannot try what you have actually written.  However, why do
> you have #+name: lines with no actual names?  Maybe add the names to
> these and see if that changes the behaviour?
>
> --
> Eric S Fraga via Emacs 27.0.50, Org release_9.1.14-1034-gafcb1d
>


[O] HTML :exports both problem

2018-11-18 Thread Lawrence Bottorff
Try this at home:

#+begin_src lisp :results output :exports both
  (dotimes (i 4)
(format t "~3d " i))
#+end_src

#+RESULTS:
:   0   1   2   3

#+name:
#+begin_src lisp :exports both
  (defun multabl ()
(dotimes (x 20)
  (dotimes (y 20)
(format t "~3d " (* (1+ x) (1+ y
  (format t "~%")))
#+end_src


#+name:
#+begin_src lisp :exports both
  (defun dt-test ()
(let ((y 0))
(dotimes (x 5 y)
  (format t "~3d " y
#+end_src

What I get when I export to HTML is bizarre, i.e., the results of the first
code block don't appear, rather, the *name* of the last function! If I put
the last two blocks between #+BEGIN_COMMENT and #+END_COMMENT, it behaves
normally and shows the results.

Am I missing something?

LB


[O] Babel SML oddity

2018-11-13 Thread Lawrence Bottorff
I'm following a Coursera course that uses ML. I have SML up and running on
Emacs 26.1/orgmode 9.1.14. So in an orgmode buffer I have

#+begin_src sml
val u = 1;
val v = 2;
val w = u + v;
#+end_src

and C-c C-c produces

#+RESULTS[8b5...]:
: val v = 2 : int

while the REPL (*sml*) produces

- val u = 1;
val v = 2;
val w = u + v;
; "stdIn";
val u = 1 : int
- val v = 2 : int
- val w = 3 : int
- val it = "stdIn" : string

So the RESULTS block in the orgmode buffer is not giving the full results
as does the REPL. More bizarre, I can do something later, e.g.,

#+begin_src sml
fun area_c (r) = Math.pi * r * r;
#+end_src

and the RESULTS simply replaces the RESULTS above, again only including
some of the REPL's response. I'm saying it doesn't do the normal thing of
giving a new RESULTS below the code block, rather just replaces the
previous RESULTS block's contents with incomplete information. I can add
many code blocks -- and I only ever get that lone RESULTS block
overwritten. What am I missing?

LB


Re: [O] Library of Babel confusion

2018-04-11 Thread Lawrence Bottorff
I'll try that, Thomas, but this was set up by simply doing the on-board
customize, i.e., it needs to have this corrected. So how do I request this
correction?

On Tue, Apr 10, 2018 at 3:26 PM, Thomas S. Dye <t...@tsdye.com> wrote:

> Aloha Lawrence,
>
> You probably want (org-babel-lob-ingest  FILE)
>
> All the best,
> Tom
>
>
> Lawrence Bottorff writes:
>
> Thanks for the help. However, one mystery still remains: Why is this
>>
>>  '(org-babel-lob-files (quote  ("~/org/worg/library-of-babel.org")))
>>
>> in my init.el's custom-set-variables not getting handled? I always have to
>> do an org-babel-lob-ingest to actually get library-of-babel.org loaded.
>>
>> On Fri, Apr 6, 2018 at 10:38 PM, Berry, Charles <ccbe...@ucsd.edu> wrote:
>>
>>
>>>
>>> > On Apr 6, 2018, at 4:59 PM, Thomas S. Dye <t...@tsdye.com> > wrote:
>>> >
>>>
>>> [Tom's response covering the main issues deleted]
>>>
>>> > hth,
>>> > Tom
>>> >
>>> > Lawrence Bottorff writes:
>>> >
>>> >> I guess I need more information. For example, what is C-c >> C-v v
>>> doing
>>> >> exactly? Then C-x C-e? And  M-x (symbol-function >> 'myelsquare)
>>> doesn't
>>> work.
>>>
>>>
>>> `C-h k' is really your friend here. If you do not know it, try typing it
>>> twice `C-h k C-h k'.
>>>
>>> As for the specific keystrokes mentioned above:
>>>
>>> ,[ C-h k C-c C-v v ]
>>> | C-c C-v v runs the command org-babel-expand-src-block (found in
>>> | org-mode-map), which is an interactive autoloaded compiled Lisp
>>> | function in ‘ob-core.el’.
>>> |
>>> | It is bound to C-c C-v v, C-c C-v C-v.
>>> |
>>> | (org-babel-expand-src-block  ARG INFO PARAMS)
>>> |
>>> | Expand the current source code block.
>>> | Expand according to the source code block’s header
>>> | arguments and pop open the results in a preview buffer.
>>> |
>>> | [back]
>>> `
>>>
>>> In your case, it shows that the `mtelsquare' src block expands to:
>>>
>>>
>>> ,
>>> | (let ((x (quote 0)))
>>> | (defun myelsquare (x)
>>> |   (* x x))
>>> | )
>>> `
>>>
>>>
>>> ,[ C-h k C-x C-e ]
>>> | C-x C-e runs the command eval-last-sexp (found in global-map), which
>>> | is an interactive compiled Lisp function in ‘elisp-mode.el’.
>>> |
>>> | It is bound to C-x C-e.
>>> |
>>> | (eval-last-sexp EVAL-LAST-SEXP-ARG-INTERNAL)
>>> |
>>> | Evaluate sexp before point; print value in the echo area.
>>> | Interactively, with prefix argument, print output into current buffer.
>>> |
>>> | Normally, this function truncates long output according to the value
>>> | of the variables ‘eval-expression-print-length’ and
>>> | ‘eval-expression-print-level’.  With a prefix argument of zero,
>>> | however, there is no such truncation.  Such a prefix argument
>>> | also causes integers to be printed in several additional formats
>>> | (octal, hexadecimal, and character).
>>> |
>>> | If ‘eval-expression-debug-on-error’ is non-nil, which is the default,
>>> | this command arranges for all errors to enter the debugger.
>>> |
>>> | [back]
>>> `
>>>
>>> So with point at the end of the preview buffer for myelsquare (which has
>>> one `let' expression it it) it has the same effect as running
>>> `eval-buffer'. viz, the elisp function `myelsquare' is created.
>>>
>>> If you have gotten this far, there is an lisp function called
>>> `myelsquare'
>>> and the `symbol-function' expression will return its value when properly
>>> `eval'ed. I misspoke before. I should have said
>>>
>>> M-: (symbol-function 'myelsquare) RET
>>>
>>> And that value is `(lambda (x) (* x x))'. Which simply shows you have
>>> defun'ed a function and what it is.
>>>
>>> Once you have an elisp function, the natural way to call it is
>>> src_emacs-lisp{(myelsquare 1.5)}.
>>>
>>> One thing you can do with LOB blocks is use them in header args of src
>>> blocks just as you would use calls to ordinary src blocks.
>>>
>>> HTH,
>>>
>>> Chuck
>>>
>>>
>>>
>>>
>
> --
> Thomas S. Dye
> http://www.tsdye.com
>


Re: [O] Library of Babel confusion

2018-04-10 Thread Lawrence Bottorff
Thanks for the help. However, one mystery still remains: Why is this

 '(org-babel-lob-files (quote ("~/org/worg/library-of-babel.org")))

in my init.el's custom-set-variables not getting handled? I always have to
do an org-babel-lob-ingest to actually get library-of-babel.org loaded.

On Fri, Apr 6, 2018 at 10:38 PM, Berry, Charles <ccbe...@ucsd.edu> wrote:

>
>
> > On Apr 6, 2018, at 4:59 PM, Thomas S. Dye <t...@tsdye.com> wrote:
> >
>
> [Tom's response covering the main issues deleted]
>
> > hth,
> > Tom
> >
> > Lawrence Bottorff writes:
> >
> >> I guess I need more information. For example, what is C-c C-v v doing
> >> exactly? Then C-x C-e? And  M-x (symbol-function 'myelsquare) doesn't
> work.
>
>
> `C-h k' is really your friend here. If you do not know it, try typing it
> twice `C-h k C-h k'.
>
> As for the specific keystrokes mentioned above:
>
> ,[ C-h k C-c C-v v ]
> | C-c C-v v runs the command org-babel-expand-src-block (found in
> | org-mode-map), which is an interactive autoloaded compiled Lisp
> | function in ‘ob-core.el’.
> |
> | It is bound to C-c C-v v, C-c C-v C-v.
> |
> | (org-babel-expand-src-block  ARG INFO PARAMS)
> |
> | Expand the current source code block.
> | Expand according to the source code block’s header
> | arguments and pop open the results in a preview buffer.
> |
> | [back]
> `
>
> In your case, it shows that the `mtelsquare' src block expands to:
>
>
> ,
> | (let ((x (quote 0)))
> | (defun myelsquare (x)
> |   (* x x))
> | )
> `
>
>
> ,[ C-h k C-x C-e ]
> | C-x C-e runs the command eval-last-sexp (found in global-map), which
> | is an interactive compiled Lisp function in ‘elisp-mode.el’.
> |
> | It is bound to C-x C-e.
> |
> | (eval-last-sexp EVAL-LAST-SEXP-ARG-INTERNAL)
> |
> | Evaluate sexp before point; print value in the echo area.
> | Interactively, with prefix argument, print output into current buffer.
> |
> | Normally, this function truncates long output according to the value
> | of the variables ‘eval-expression-print-length’ and
> | ‘eval-expression-print-level’.  With a prefix argument of zero,
> | however, there is no such truncation.  Such a prefix argument
> | also causes integers to be printed in several additional formats
> | (octal, hexadecimal, and character).
> |
> | If ‘eval-expression-debug-on-error’ is non-nil, which is the default,
> | this command arranges for all errors to enter the debugger.
> |
> | [back]
> `
>
> So with point at the end of the preview buffer for myelsquare (which has
> one `let' expression it it) it has the same effect as running
> `eval-buffer'. viz, the elisp function `myelsquare' is created.
>
> If you have gotten this far, there is an lisp function called `myelsquare'
> and the `symbol-function' expression will return its value when properly
> `eval'ed. I misspoke before. I should have said
>
> M-: (symbol-function 'myelsquare) RET
>
> And that value is `(lambda (x) (* x x))'. Which simply shows you have
> defun'ed a function and what it is.
>
> Once you have an elisp function, the natural way to call it is
> src_emacs-lisp{(myelsquare 1.5)}.
>
> One thing you can do with LOB blocks is use them in header args of src
> blocks just as you would use calls to ordinary src blocks.
>
> HTH,
>
> Chuck
>
>
>


Re: [O] Library of Babel confusion

2018-04-06 Thread Lawrence Bottorff
I guess I need more information. For example, what is C-c C-v v doing
exactly? Then C-x C-e? And  M-x (symbol-function 'myelsquare) doesn't work.
Again,

#+name: myelsquare
#+header: :var x=0
#+begin_src emacs-lisp :var x=0
  (defun myelsquare (x)
(* x x))
#+end_src

is Lisp code where the last thing should be returned. From
library-of-babel.org:

#+name: json
#+begin_src emacs-lisp :var file='() :var url='()
  (require 'json)
  (cond
   (file
(org-babel-with-temp-filebuffer file
  (goto-char (point-min))
  (json-read)))
   (url
(require 'w3m)
(with-temp-buffer
  (w3m-retrieve url)
  (goto-char (point-min))
  (json-read
#+end_src

And this calling a sample json-containing file gives

#+call: json(file="jsontest1")

| glossary | (title . example glossary) | (GlossDiv (title . S) (GlossList
(GlossEntry (ID . SGML) (SortAs . SGML) (GlossTerm . Standard Generalized
Markup Language) (Acronym . SGML) (Abbrev . ISO 8879:1986) (GlossDef (para
. A meta-markup language, used to create markup languages such as DocBook.)
(GlossSeeAlso . [GML XML])) (GlossSee . markup |

which is correct, although not in list form. So again I'm looking at elisp
code that is not in the form of a function. So I'm guessing "functions"
cannot be #+call'ed, just "headless" elisp code. So what advantage does LOB
offer?

On Tue, Apr 3, 2018 at 5:39 PM, Berry, Charles <ccbe...@ucsd.edu> wrote:

>
>
> > On Apr 3, 2018, at 1:31 PM, Lawrence Bottorff <borg...@gmail.com> wrote:
> >
> > I've been trying to grok LOB again. So I've cloned the worg git and
> library-of-babel.el is one of the files. org-babel-lob-injest didn't work,
>
>
> Try
>
> M-x org-babel-lob-ingest RET org/worg/library-of-babel.org RET
>
> Don't be a jester, be an ingester. ;-)
>
>
> > so I customized org-babel-lob-files and inserted
> .../worg/library-of-babel.el . . . and it did in fact get added to my
> init.el under the custom-set-variables:
> >
> >  '(org-babel-lob-files (quote ("~/org/worg/library-of-babel.org")))
> >
> > I checked org-babel-library-of-babel variable, and the new things seemed
> to be there, although it's rather mind-bending to know I will be calling
> LOB code that is internally stored inside of an association list.
> >
> > Now, in my org file I put this:
> >
> > #+lob: write(file="jsontest")
>
>
> See (info"(org) Evaluating code blocks")
>
> The proper idiom is
>
> #+call: write(file="jsontest")
>
> Of course, there needs to be a proper 'write' src block in the file you
> ingested, etc.
>
> >
> > and try C-c C-c on it. Nothing. My minibuffer says "local setup has been
> refreshed". How does one use, call a LOB function? Also, while I'm
> demonstrating my rank noobian-ness, I try this:
> >
> > #+name: myelsquare
> > #+header: :var x=0
> > #+begin_src emacs-lisp
> >   (* x x)
> > #+end_src
> >
> > #+call: myelsquare(x=6)
> >
> > #+RESULTS:
> > : 36
> >
> > but this results in
> >
> > #+name: myelsquare
> > #+header: :var x=0
> > #+begin_src emacs-lisp
> >   (defun myelsquare (x)
> >   (* x x))
> > #+end_src
> >
> > #+call: myelsquare(x=6)
> >
> > #+RESULTS:
> > : myelsquare2
>
>
> Is this *verbatim* ? Did you cut and paste everything (including the
> trailing `2') all at once? If so, I do not get it.
>
> I would have expected
>
> #+RESULTS:
> : myelsquare
>
>  which is the correct behavior.
>
> To see why put point in the myelsquare src block and type C-c C-v v
>
> then move point to the end of the 'preview' buffer and type C-x C-e.
>
> Look at the value echo-ed in the minibuffer.
>
> If it still isn't clear maybe `M-x (symbol-function 'myelsquare)' will
> help.
>
> HTH,
>
> Chuck
>


Re: [O] Library of Babel confusion

2018-04-04 Thread Lawrence Bottorff
The docs <https://orgmode.org/worg/org-contrib/babel/intro.html> have this
example:

#+name: square
#+header: :var x=0
#+begin_src python
return x*x
#+end_src

#+call: square(x=6)

...so yes, "return", but with

(defun myelsquare (x)
   (* x x))

isn't the final thing evaluated what is "returned" with Elisp? AFAIK there
is no explicit return with Elisp. #+call can't really call a function, only
named blocks of REPL-style calculator snippets?

Also, today I find that a new start of Emacs doesn't load my LOB file, i.e.,

(custom-set-variables
...
 '(org-babel-lob-files (quote ("~/org/worg/library-of-babel.org")))
...

was being blown off, i.e., not populating the org-babel-library-of-babel
variable. But today org-babel-lob-injest does seem to work, i.e., it did
populate org-babel-library-of-babel. I wonder what's up.




On Tue, Apr 3, 2018 at 4:44 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr>
wrote:

> Lawrence Bottorff <borg...@gmail.com> writes:
>
> > I've been trying to grok LOB again. So I've cloned the worg git and
> > library-of-babel.el is one of the files. org-babel-lob-injest didn't
> > work,
>
> What doesn't work? You call `org-babel-lob-ingest', specify a file, and
> it stores all source code blocks in the file for later use.
>
> > Now, in my org file I put this:
> >
> > #+lob: write(file="jsontest")
>
> This should be #+call: write(...)
>
> >
> > and try C-c C-c on it. Nothing. My minibuffer says "local setup has been
> > refreshed". How does one use, call a LOB function? Also, while I'm
> > demonstrating my rank noobian-ness, I try this:
> >
> > #+name: myelsquare
> > #+header: :var x=0
> >
> > #+begin_src emacs-lisp
> >   (* x x)
> > #+end_src
> >
> > #+call: myelsquare(x=6)
> >
> > #+RESULTS: : 36
> >
> > but this results in
> >
> > #+name: myelsquare
> > #+header: :var x=0
> >
> > #+begin_src emacs-lisp
> >   (defun myelsquare (x)
> >   (* x x))
> > #+end_src
> >
> > #+call: myelsquare(x=6)
> >
> > #+RESULTS:
> > : myelsquare2
> >
> > After a #+call:... I use C-c C-c to evaluate it. What am I missing
> > here?
>
> Your second block defines a function, but doesn't return its results.
> "#+call: myelsquare(...)" expects to find a block named "myelsquare",
> not an Elisp function named "myelsquare".
>
> Regards,
>
> --
> Nicolas Goaziou
>


[O] Library of Babel confusion

2018-04-03 Thread Lawrence Bottorff
I've been trying to grok LOB again. So I've cloned the worg git and
library-of-babel.el is one of the files. org-babel-lob-injest didn't work,
so I customized org-babel-lob-files and inserted
.../worg/library-of-babel.el . . . and it did in fact get added to my
init.el under the custom-set-variables:

 '(org-babel-lob-files (quote ("~/org/worg/library-of-babel.org")))

I checked org-babel-library-of-babel variable, and the new things seemed to
be there, although it's rather mind-bending to know I will be calling LOB
code that is internally stored inside of an association list.

Now, in my org file I put this:

#+lob: write(file="jsontest")

and try C-c C-c on it. Nothing. My minibuffer says "local setup has been
refreshed". How does one use, call a LOB function? Also, while I'm
demonstrating my rank noobian-ness, I try this:

#+name: myelsquare
#+header: :var x=0
#+begin_src emacs-lisp
  (* x x)
#+end_src

#+call: myelsquare(x=6)

#+RESULTS:
: 36

but this results in

#+name: myelsquare
#+header: :var x=0
#+begin_src emacs-lisp
  (defun myelsquare (x)
  (* x x))
#+end_src

#+call: myelsquare(x=6)

#+RESULTS:
: myelsquare2

After a #+call:... I use C-c C-c to evaluate it. What am I missing here?

LB


[O] tangle versus org-babel-load-file

2018-04-03 Thread Lawrence Bottorff
I'm experimenting with Uncle Dave's config which is using a minimum init.el
to launch config.org, which is full of elisp babel source blocks. Here's
his relevant launching code:

(when (file-readable-p "~/.emacs.d/config.org")
  (org-babel-load-file (expand-file-name "~/.emacs.d/config.org")))

However, I've seen this example:

(require 'org)
(require 'ob-tangle)
(org-babel-load-file (expand-file-name "~/.emacs.d/myemacs.org"))

which seems to want (require 'ob-tangle). The Uncle Dave setup is working
fine. I guess I don't know how it's tangling (which means running all the
code blocks in the org file, right?) without somehow being told to. But
then what is org-babel-tangle-file doing other than running all the code
blocks in a file? And then there's the :tangle yes parameter on an
individual code block. I'm missing something here. It seems
org-babel-load-file is creating a config.el from the config.org -- which is
a tangle behavior.

LB


[O] Soft return in footnote text?

2018-03-12 Thread Lawrence Bottorff
I'm getting carried away with a footnote and want to have it be many
paragraphs long when I export it to HTML. I can put in latex math formulae,
and that breaks things up. But is there a way to simply have separate text
paragraph in an org-mode footnote?

LB


[O] Suppress table when creating gnuplot on HTML export?

2018-02-27 Thread Lawrence Bottorff
I've got this:

#+tblname: mydata
| -2 | 0 |
| -0.015 | 0 |
||   |
|  0.015 | 1 |
|  2 | 1 |

##+begin_src gnuplot :var data=mydata :exports results :file images/gap1.png
#+begin_src gnuplot :var data=mydata :results output :file images/gap1.png
reset
set terminal png size 350,262
set border linewidth 1.5
# set style line 1 lc rgb '#0060ad' lt 1 lw 2 pt 6 ps 1.25 # --- blue
set style line 1 lc rgb '#0060ad' lt 1 lw 2 # --- blue
set data missing

unset key

set ytics 1
set tics scale 0.75

set xrange [-2:2]
set yrange [-0.5:1.5]
set xzeroaxis linetype 2 linewidth 1
set yzeroaxis linetype 2 linewidth 1
set tics scale 0.75
set xtics 1
set ytics 0.5

# Defining a step function
#s(x) = x<0 ? 0.0 : 1.0

plot data with lines ls 1
#+end_src

which works fine producing exactly the image I want. However, I don't
really need the table showing up on an export (to html at the moment). Is
there a way to suppress the table `mydata` from being shown?

LB


[O] Exploring picolisp

2018-02-25 Thread Lawrence Bottorff
I'm looking at picolisp -- and wondering how it works, or better, why it
doesn't really work work with babel. First problem, I couldn't get any form
of picolisp to work in Emacs -- until I stopped starting Emacs with

emacsclient -c -a ''

which sets up my daemon first. Got abstruse error -- and it creates a file
called `editor-orig` in `~/.pil` which blocks any further attempts. After
tearing stuff out of my init diaspora for hours, I finally found that a
straight

>emacs &

made picolisp-mode work, otherwise, not. Very weird. But then I see this
 and, yes, picolisp babel seems to
work for all the examples. However, a regular function declaration

#+name: hello
#+begin_src picolisp
(de hello (X)
   (prinl "Hello " X) )
#+end_src

-- goes nowhere. But then C-c C-c in a picolisp code block isn't firing up
a REPL, so where can it go? Nowhere. Lisp, Scheme & Cie. all require a
running REPL that org-mode knows about. And if I just bring up
picolisp-mode with a picolisp file and fire up a REPL, that REPL doesn't
know anything about my org-mode picolisp code blocks.

I don't mean to complain or sound negative, but picolisp as is can't really
be included as a babel language, can it? Maybe it worked once, but doesn't
now?

LB


[O] texi to org?

2018-02-18 Thread Lawrence Bottorff
Is there such a thing as a converter from a raw texi file to an org file?
I'm experimenting with manual formats and would like to take texi/info
files and convert them to org files. I've tried two approaches with pandoc,
namely, html to org and text (markdown) to org -- and they've produced org
files that lock up Emacs (25.3) - Org (9.1.6). Yes, they come up after a
good half hour, but Emacs is still locked up with my CPUs racing. Right now
I'm working with Emacs Calc
's single
html manual. I've done

>pandoc -f html -t org -o GNUEmacsCalcManual.org GNUEmacsCalcManual.html

and it produces a 2.3 mb file that, as I say, doesn't come up well. This
was following Using Emacs Pandoc
.

I don't necessarily need to do this, but I've had this issue before with
semi-large org files, e.g., a mg-sized file with lots of scheduling stuff.
What sort of processing is going on to open an org file that it would bog
down so badly? Is there anything I can do outside of Emacs to help my
pandoc-produced org file?

LB


[O] Prompt org-capture for buffer?

2018-02-06 Thread Lawrence Bottorff
I've got this

 '(org-capture-templates
   (quote
(("a" "Normal add" entry (file "~/org/notes.org")
  "* %(plainutc)\n%x%?"

But it wants to put my captured things into ~/org/notes.org . Is there any
way to have it prompt for which buffer to add to -- or even just put it in
the active buffer?

LB


Re: [O] Ad-hoc, mix-and-match tag hierarchies?

2018-02-01 Thread Lawrence Bottorff
So a left-to-right listing of (colon-separated) tags after the heading
cannot imply a higher-to-lower hierarchical order? So there is no hierarchy
unless you create it, e.g.,

(setq org-tag-alist '((:startgrouptag)
   ("GTD")
  (:grouptags)
  ("Control")
  ("Persp") ...

-- is what I'm hearing.

What I meant to do is to be able to use tags alone or together. And when
used together, to somehow imply hierarchy. So if I have

* header 1:emacs:

** header 1.1   :orgmode:

*** header 1.1.1   :lisp:
stuff about Emacs' org-mode's lisp code

this implies subject hierarchy simply from the headers' hierarchy. However
this

* header 1   :emacs:
stuff about Emacs
* header 2  :emacs:orgmode:lisp
stuff about Emacs' org-mode's lisp code
* header 3 :lisp:
stuff about just Common Lisp
* header 4 :emacs:orgmode:
stuff about Emacs' org-mode
* header 5  :emacs:
more stuff about Emacs

is all peers header-wise, while the tags (if using left-to-right listing to
mean higher to lower in hierarchy) tell us the depth level of
specialization of a topic. The first set of headers is relying (clumsily)
on the header level to indicate depth of specialization, which is not
always realistic. If I wanted, ad-hoc, to indicate levels of some hierarchy
with tags, that is, not be forced to create empty superior headers, it
seems  there's no prescribed way to do this. And creating tag hierarchies
by hand, i.e., (setq org-tag-alist '((:startgrouptag)..., makes me play the
combinatorics game of imagining all different possible hierarchy
combinations. Or am I missing something?

On Thu, Feb 1, 2018 at 10:36 AM, Kaushal Modi 
wrote:

> On Thu, Feb 1, 2018 at 10:30 AM John Kitchin 
> wrote:
>
>> I was not aware of any implied hierarchy with tags. The order is not
>> important as far as I know, and what you describe as mix-and-match seems
>> ok. There is an idea of inheritance, e.g. sub-headings can inherit tags
>> from higher headings.
>>
>
> Same here.
>
>
>> I am not sure about the org-mode tag.
>>
>
> "-" is an invalid tag character.. the tag can be "org_mode", but not
> "org-mode". Last time I tried using hyphen, I remember that the tag
> auto-alignment would stop working (C-u C-c C-q) and also the tag face won't
> be applied.
>
> @Lawrence:
>
> You can have tag inheritance this way:
>
> * Emacs :emacs:
> Emacs stuff
> ** Lisp :lisp:
> Emacs lisp stuff here
> *** Org :org_mode:
> Emacs + Lisp + Org mode stuff
> ** Org :org_mode:
> Emacs + Org mode stuff (but not lisp)
> --
>
> Kaushal Modi
>


[O] Ad-hoc, mix-and-match tag hierarchies?

2018-02-01 Thread Lawrence Bottorff
Is it possible to have two or more tags that are "peers," i.e., all equal,
not in a hierarchy, be in an ad-hoc, as-needed way be hierarchical? For
example, I have the tags *org-mode, lisp, *and *emacs, *and I want to have
a header with the tags

* my header:emacs:org-mode:lisp:

So the above should be an ad-hoc hierarchy of

- emacs
   - org-mode
  - lisp

As I understand, the order indicates the level in a hierarchy. True? So the
above has *emacs* at the top of the tag hierarchy, then *org-mode, *then *lisp.
*Correct? So yes, I could simply set up this hierarchy. But what I really
want is to not have these tags in any set hierarchy, rather, be able to use
them independently, mix-and-match, e.g.,

* Another Header:emacs:lisp:

or maybe

* Yet Another Header   :lisp:

and this would be just about non-Emacs, non-org-mode Lisp. Is this
mix-and-match possible?

LB


[O] How to set org-tag-alist

2018-01-23 Thread Lawrence Bottorff
This  describes
a org-tag-alist for setting up globally a list of tags, but I'm not sure
how to alter org-tag-alist. I'm used to doing an M-x customize-variable,
but there is no org-tag-alist. Later on the page it has this form:

(setq org-tag-alist '(("@work" . ?w) ("@home" . ?h) ("laptop" . ?l)))

which seems to be something to put in my .emacs, i.e., org-tag-alist is not
an existing variable?

LB


Re: [O] "Reference Dump" rant

2017-11-21 Thread Lawrence Bottorff
Yes, Worg is great. If a user is really driven they can scarf up all the
various tutorial bits and pieces and begin to have a clue. BTW, where can I
get the source for the latest manual?

On Tue, Nov 21, 2017 at 9:03 PM, Thomas S. Dye <t...@tsdye.com> wrote:

>
> Lawrence Bottorff writes:
>
> >> > I guess I'm saying it would be nice to have a big omnibus
> O'Reilly-style
> >> > tutorial on how to use org-mode. I've hung with org-mode because I
> think
> >> > it's great and, IMHO, should become a standard tool in all
> >> > STEM/STEM-education settings. Think of all those high schools (and
> even
> >> > colleges) forcing students to use "graphic calculators." What a waste!
>
> Worg has some fits and starts in the direction of tutorials and such.
> It might be a good place to start.
>
> All the best,
> Tom
>
> --
> Thomas S. Dye
> http://www.tsdye.com
>


Re: [O] "Reference Dump" rant

2017-11-21 Thread Lawrence Bottorff
So yes, the complainer (that's me) shouldn't just complain, he should
become the improver. Yes, let me see what I can come up with.

On Tue, Nov 21, 2017 at 3:52 PM, Tim Cross <theophil...@gmail.com> wrote:

> Hi Lawrence,
>
> glad you like org-mode. I also think it is a great tool.
>
> One of the great things about org-mode is that it is used by a very wide
> range of people. I know of a couple of people who are not at all
> technical who use org-mode just for general organisation and writing. It
> certainly isn't something just for the 'Sheldons'.
>
> If you believe there are some areas of the org documentation which needs
> to be improved or augmented, I would strongly encourage you to
> contribute. One of the bigger challenges faced by community efforts like
> org-mode is documentation. Often, those who write and develop the
> solution are too close to it to write clear and comprehensive
> documentation. It needs contributions from users like yourself who don't
> have the low level knowledge which can blind you to higher level
> usability issues. As you will see from this list, documentation fixes
> and contributions are not uncommon and are certainly welcomed - in fact,
> that is one of the nice things about org-mode, the extent to which
> community contributions are accepted.
>
> regards,
>
> Tim
>
> Lawrence Bottorff <borg...@gmail.com> writes:
>
> > As many might gather from seeing so many of my beginner posts, I'm not
> > exactly a Sheldon Cooper type, i.e., someone who has the A-ha! angel
> > standing by 24/7 with her hand on his shoulder. So today I thought I'd
> > upgrade my knowledge of org-mode tables. So I go to the section of the
> > "manual" on tables. Experimenting on the commands, I get this fairly
> > quickly:
> >
> > | p | q | p implies q |
> > |---+---+---|
> > | T | T | T|
> > | T | F | F|
> > | F | T | T|
> > | F | F | T|
> >
> > which looks perfect in my buffer, but not so good on an HTML export,
> i.e.,
> > the third column values seem too crowded to the left. Hence, how does one
> > justify that last column to be center? Googling, I kept being directed to
> > this
> > <http://orgmode.org/manual/Column-width-and-alignment.
> html#Column-width-and-alignment>
> > page,
> > which supposedly tells me how. Long story short, the A-ha! angel smiled,
> > and in the end I guessed that I'm supposed to do this:
> >
> > | p | q | p implies q |
> > |---+---+---|
> > | T | T | T|
> > | T | F | F|
> > | F | T | T|
> > | F | F | T|
> > |||  |
> >
> > which does in fact move the third column contents to the center -- on
> > export only. But that's not the norm for me, mainly because the
> explanation
> > has no example. Sure, it said, *To set the width of a column, one field
> > anywhere in the column may contain just the string ‘’ where ‘N’ is an
> > integer specifying the width of the column in characters. *But it's
> really
> > not so obvious that you create an extra dummy row and stick  in it --
> at
> > least not to me.
> >
> > I know from math courses that a text passage can be terribly opaque --
> *until
> > you get it -- *then it seemed obvious. However, I can see any beginner
> with
> > org-mode getting frustrated often with the Manual. And of course I can
> site
> > many similar examples where only the Sheldon types would get it.
> >
> > I guess I'm saying it would be nice to have a big omnibus O'Reilly-style
> > tutorial on how to use org-mode. I've hung with org-mode because I think
> > it's great and, IMHO, should become a standard tool in all
> > STEM/STEM-education settings. Think of all those high schools (and even
> > colleges) forcing students to use "graphic calculators." What a waste!
> >
> > LB
>
>
> --
> Tim Cross
>


[O] "Reference Dump" rant

2017-11-21 Thread Lawrence Bottorff
As many might gather from seeing so many of my beginner posts, I'm not
exactly a Sheldon Cooper type, i.e., someone who has the A-ha! angel
standing by 24/7 with her hand on his shoulder. So today I thought I'd
upgrade my knowledge of org-mode tables. So I go to the section of the
"manual" on tables. Experimenting on the commands, I get this fairly
quickly:

| p | q | p implies q |
|---+---+---|
| T | T | T|
| T | F | F|
| F | T | T|
| F | F | T|

which looks perfect in my buffer, but not so good on an HTML export, i.e.,
the third column values seem too crowded to the left. Hence, how does one
justify that last column to be center? Googling, I kept being directed to
this

page,
which supposedly tells me how. Long story short, the A-ha! angel smiled,
and in the end I guessed that I'm supposed to do this:

| p | q | p implies q |
|---+---+---|
| T | T | T|
| T | F | F|
| F | T | T|
| F | F | T|
|||  |

which does in fact move the third column contents to the center -- on
export only. But that's not the norm for me, mainly because the explanation
has no example. Sure, it said, *To set the width of a column, one field
anywhere in the column may contain just the string ‘’ where ‘N’ is an
integer specifying the width of the column in characters. *But it's really
not so obvious that you create an extra dummy row and stick  in it -- at
least not to me.

I know from math courses that a text passage can be terribly opaque -- *until
you get it -- *then it seemed obvious. However, I can see any beginner with
org-mode getting frustrated often with the Manual. And of course I can site
many similar examples where only the Sheldon types would get it.

I guess I'm saying it would be nice to have a big omnibus O'Reilly-style
tutorial on how to use org-mode. I've hung with org-mode because I think
it's great and, IMHO, should become a standard tool in all
STEM/STEM-education settings. Think of all those high schools (and even
colleges) forcing students to use "graphic calculators." What a waste!

LB


Re: [O] Bizarre gnuplot file creation error

2017-11-07 Thread Lawrence Bottorff
Still haven't tracked down the exact steps to reproduce this problem, but
it happened again recently -- and starting a new emacs from the command
line solved it, i.e., my usual daemon-run emacs seems to be "crudding up"
somehow.

On Sat, Nov 4, 2017 at 1:05 PM, Lawrence Bottorff <borg...@gmail.com> wrote:

> Trying the babel gnuplot the other day, I had trouble getting the results
> to C-c C-c to actually materialize in the place I'd given. Taking the
> example from the org-mode babel gnuplot page, (changing the location):
>
> #+begin_src gnuplot :exports both :file omnigraphics/omnig10.png
> reset
>
> set title "Putting it All Together"
>
> set xlabel "X"
> set xrange [-15:15]
> set xtics -15,2,15
>
>
> set ylabel "Y"
> set yrange [-15:15]
> set ytics -15,2,15
>
> f(x) = sqrt(x - 1) + 1
> g(x) = x**3
> h(x) = sqrt(-x - 1) + 1
>
> plot f(x) w lp lw 1, g(x) w lp lw 1, h(x) w l lw 1
> #+end_src
>
> The system was not creating the png in the given folder. Finally it
> occurred to me to look in another place where I'd previously been creating
> org-mode gnuplot pngs -- and there it was! I could do C-c C-c again and
> again and see new versions of the png being created each time in
> yesterday's folder, i.e., not the location given with :file. So the
> :file omnigraphics/omnig10.png was being blown off and org-mode internal
> had remembered where I'd previously created pngs and kept creating them
> there. I've tried to recreate this scenario with just the code snippet
> above -- fresh (non-daemon) emacs processes, changing the :file location
> each time -- and I've reproduced the problem sometimes. I've combed through
> my personal init els and it's definitely nothing I'm telling it. Strange. .
> . .
>
> LB
>


[O] Bizarre gnuplot file creation error

2017-11-04 Thread Lawrence Bottorff
Trying the babel gnuplot the other day, I had trouble getting the results
to C-c C-c to actually materialize in the place I'd given. Taking the
example from the org-mode babel gnuplot page, (changing the location):

#+begin_src gnuplot :exports both :file omnigraphics/omnig10.png
reset

set title "Putting it All Together"

set xlabel "X"
set xrange [-15:15]
set xtics -15,2,15


set ylabel "Y"
set yrange [-15:15]
set ytics -15,2,15

f(x) = sqrt(x - 1) + 1
g(x) = x**3
h(x) = sqrt(-x - 1) + 1

plot f(x) w lp lw 1, g(x) w lp lw 1, h(x) w l lw 1
#+end_src

The system was not creating the png in the given folder. Finally it
occurred to me to look in another place where I'd previously been creating
org-mode gnuplot pngs -- and there it was! I could do C-c C-c again and
again and see new versions of the png being created each time in
yesterday's folder, i.e., not the location given with :file. So the
:file omnigraphics/omnig10.png was being blown off and org-mode internal
had remembered where I'd previously created pngs and kept creating them
there. I've tried to recreate this scenario with just the code snippet
above -- fresh (non-daemon) emacs processes, changing the :file location
each time -- and I've reproduced the problem sometimes. I've combed through
my personal init els and it's definitely nothing I'm telling it. Strange. .
. .

LB


Re: [O] MathJax beyond org-html-mathjax-options?

2017-11-03 Thread Lawrence Bottorff
Bottom line: we can't expand org-html-mathjax-options to add in MathJax's
cancel.js, etc. Yes, your first "quick-and-dirty" worked just fine. Q: How
did you know how to format #+html: \(\require{cancel}\) ? Also, how does
the org world know that we're talking about loading MathJax's cancel.js? As
you all know I'm not a "developer-class" poster here, so my questions often
look dull-witted. Will try the patch once I learn a bit more diff in Emacs
lore. . . .

On Thu, Nov 2, 2017 at 9:12 AM, Rasmus <ras...@gmx.us> wrote:

> Lawrence Bottorff <borg...@gmail.com> writes:
>
> > I'm trying to get a typical Latex strikethrough with MathJax in an HTML
> > export, i.e., \cancel{thing} puts line through "thing". This
> > <http://docs.mathjax.org/en/latest/tex.html#cancel> tells me how. But I
> > don't know how to include this MathJax markup in an org file for HTML
> > export. If I forego MathJax -- i.e., #+OPTIONS: tex:dvipng instead
> > of #+OPTIONS: tex:t -- \cancel works, but I need to use MathJax. It
> doesn't
> > look like orhg-html-mathjax-options is expandable. . . .
>
> For now this works for me:
>
> #+html: \(\require{cancel}\)
> \begin{equation}
> \cancel{x = 1}
> \end{equation}
>
> Cf. http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-extensions
> You could also autoload the extension, cf. https://github.com/mathjax/
> MathJax/blob/master/test/sample-autoload.html
>
>
> That being said, I don’t think extensions were available at the time
> #+HTML_MATHJAX was introduced.  We could add extension support, but the
> questions would be whether to add them to #+HTML_MATHJAX or make a new
> keyword, e.g.
>
> #+HTML_MATHJAX_EXTENSIONS: ext1 ext2 ... extN
>
> I guess it would default to the "autoload-all" extension.
>
> One issue is that some of them have configuration options, like "noError".
>
> If you want, you can try the attached patch.
>
> Rasmus
>
> --
> Vote for proprietary math!
>


[O] MathJax beyond org-html-mathjax-options?

2017-10-31 Thread Lawrence Bottorff
I'm trying to get a typical Latex strikethrough with MathJax in an HTML
export, i.e., \cancel{thing} puts line through "thing". This
 tells me how. But I
don't know how to include this MathJax markup in an org file for HTML
export. If I forego MathJax -- i.e., #+OPTIONS: tex:dvipng instead
of #+OPTIONS: tex:t -- \cancel works, but I need to use MathJax. It doesn't
look like org-html-mathjax-options is expandable. . . .

LB


[O] exporting Racket images

2017-10-23 Thread Lawrence Bottorff
I'm using a nice package from a Racket user called MetaPict
, however, I don't know how to export
the image produced. Here's some Racket code calling MetaPict:

#+begin_src scheme :session mainsession :exports both
(require racket/draw metapict metapict/graph)

(set-curve-pict-size 300 300)  ; width and height of image
(ahlength  1.0); size of arrow head

(define (f x) (sin x))

(define p
  (with-window (window -12 12 -12 12) ; xmin, xmax, ymin, ymax
(draw (draw-arrow (curve (pt -10   0) -- (pt 10  0)))  ; x-axis
  (draw-arrow (curve (pt   0 -10) -- (pt  0 10)))  ; y-axis
  (label-rt  "x" (pt 10.2 0))  ; label for x
axis
  (label-top "y" (pt 0 10.2))  ; label for y
axis
  (color "blue" (draw (circle (pt 2 1) 3))); center (2,1)
radius 3
  (color "red"  (draw (graph f -10 10 #:samples 50))

(define (save-pict-as-svg p width height filename [exists 'replace])
  (define dc (new svg-dc%
  [width width]
  [height height]
  [output filename]
  [exists exists]))
  (send dc start-doc "An SVG Test")  ; a message
  (send dc start-page)
  (draw-pict p dc 0 0)
  (send dc end-page)
  (send dc end-doc))

(save-pict-as-svg p 300 300 "images/outtestmetapict1.svg")
#+end_src

No surprise, but orgmode doesn't know that the image output

(save-pict-as-svg p 300 300 "images/outtestmetapict1.svg")

should be the code block's results. And adding #+RESULTS: over a hand-added
[[file:images/outtestmetapict1.svg]] link makes it not display. I'm
guessing this means orgmode does things internally with, say, gnuplot to
make the generated image the results *and *obey the :exports both . . . Any
ideas how I can get this gnuplot-like behavior with Racket MetaPict? I'm
guessing a customization of the underlying babel code is necessary. . . .

LB


Re: [O] HTML output of gnuplot pic

2017-10-14 Thread Lawrence Bottorff
That did it. Thanks.

On Sat, Oct 14, 2017 at 1:58 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr>
wrote:

> Lawrence Bottorff <borg...@gmail.com> writes:
>
> > I don't get the image displayed -- without manually taking out the
> >
> > #+RESULTS: line. I'm saying
> >
> > #+begin_src gnuplot :exports code :file images/test1.png
> > reset
> > set title "Putting it All Together"
> > set xlabel "X"
> > set xrange [-8:8]
> > set xtics -8,2,8
> > set ylabel "Y"
> > set yrange [-2:70]
> > set ytics -20,10,70
> > f(x) = x**2
> > g(x) = x**3
> > h(x) = 10*sqrt(abs(x))
> > plot f(x) w lp lw 1, g(x) w p lw 2, h(x) w l lw 3
> > #+end_src
> >
> >
> > #+RESULTS:
> > [[file:images/test1.png]]
> >
> > doesn't display the plot image, while. . .
> >
> > #+begin_src gnuplot :exports code :file images/test1.png
> > reset
> > set title "Putting it All Together"
> > set xlabel "X"
> > set xrange [-8:8]
> > set xtics -8,2,8
> > set ylabel "Y"
> > set yrange [-2:70]
> > set ytics -20,10,70
> > f(x) = x**2
> > g(x) = x**3
> > h(x) = 10*sqrt(abs(x))
> > plot f(x) w lp lw 1, g(x) w p lw 2, h(x) w l lw 3
> > #+end_src
> >
> > [[file:images/test1.png]]
> >
> > . . . does display the plot image:
>
> Try
>
>   :exports both
>
> instead of
>
>   :exports code
>
> then.
>
> Regards,
>


Re: [O] HTML output of gnuplot pic

2017-10-14 Thread Lawrence Bottorff
I don't get the image displayed -- without manually taking out the
#+RESULTS: line. I'm saying

#+begin_src gnuplot :exports code :file images/test1.png
reset
set title "Putting it All Together"
set xlabel "X"
set xrange [-8:8]
set xtics -8,2,8
set ylabel "Y"
set yrange [-2:70]
set ytics -20,10,70
f(x) = x**2
g(x) = x**3
h(x) = 10*sqrt(abs(x))
plot f(x) w lp lw 1, g(x) w p lw 2, h(x) w l lw 3
#+end_src

#+RESULTS:
[[file:images/test1.png]]

doesn't display the plot image, while. . .

#+begin_src gnuplot :exports code :file images/test1.png
reset
set title "Putting it All Together"
set xlabel "X"
set xrange [-8:8]
set xtics -8,2,8
set ylabel "Y"
set yrange [-2:70]
set ytics -20,10,70
f(x) = x**2
g(x) = x**3
h(x) = 10*sqrt(abs(x))
plot f(x) w lp lw 1, g(x) w p lw 2, h(x) w l lw 3
#+end_src

[[file:images/test1.png]]

. . . does display the plot image:

. . .





On Sat, Oct 14, 2017 at 1:30 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Lawrence Bottorff <borg...@gmail.com> writes:
>
> > I'm playing with the tutorial for babel-gnuplot
> > <http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-gnuplot.html>
> ,
> > however I keep getting this upon C-c C-c:
> >
> > #+begin_src gnuplot :exports code :file images/test1.png
> > reset
> >
> > set title "Putting it All Together"
> >
> > set xlabel "X"
> > set xrange [-8:8]
> > set xtics -8,2,8
> >
> >
> > set ylabel "Y"
> > set yrange [-2:70]
> > set ytics -20,10,70
> >
> > f(x) = x**2
> > g(x) = x**3
> > h(x) = 10*sqrt(abs(x))
> >
> > plot f(x) w lp lw 1, g(x) w p lw 2, h(x) w l lw 3
> > #+end_src
> >
> > #+RESULTS:
> > [[file:images/test1.png]]
> >
> > Many different :results attempts keep giving me
> >
> > #+RESULTS:
> > [[file:images/test1.png]]
> >
> > . . . which doesn't export to HTML.
>
> Why? I have no trouble exporting to HTML this document.
>
> Regards,
>
> --
> Nicolas Goaziou
>


[O] HTML output of gnuplot pic

2017-10-14 Thread Lawrence Bottorff
I'm playing with the tutorial for babel-gnuplot
 ,
however I keep getting this upon C-c C-c:

#+begin_src gnuplot :exports code :file images/test1.png
reset

set title "Putting it All Together"

set xlabel "X"
set xrange [-8:8]
set xtics -8,2,8


set ylabel "Y"
set yrange [-2:70]
set ytics -20,10,70

f(x) = x**2
g(x) = x**3
h(x) = 10*sqrt(abs(x))

plot f(x) w lp lw 1, g(x) w p lw 2, h(x) w l lw 3
#+end_src

#+RESULTS:
[[file:images/test1.png]]

Many different :results attempts keep giving me

#+RESULTS:
[[file:images/test1.png]]

. . . which doesn't export to HTML. Of course removing #+RESULTS: and the
image displays. How can I get results without the #+RESULTS: label above,
which HTML export doesn't like?

LB


[O] org-babel-script-escape problem

2017-09-14 Thread Lawrence Bottorff
In a fresh org file I try this:

#+begin_src scheme :session mainsession
(define (mysquare x)
  (* x x))
#+end_src

and get this:

executing Scheme code block...
=> #
: ‘org-babel-script-escape’ expects a string

I'm using latest elpa everything (orgmode, geiser) with Racket v6.10.1 as
of this morning. Just started happening. . . .

LB


Re: [O] Strange latex symbol behavior on html export

2017-09-13 Thread Lawrence Bottorff
#+options: tex:dvipng is not good because it turns all your latex symbol
markup into images, which are inserted into the web page as images, i.e.,
it's not doing MathJax. Also bad because they don't really fit the text
lines, either. I use

# this makes MathJax work
#+OPTIONS: tex:t

I just now found this caption weirdness because I started a new .org file
with no latex symbol markup besides in the caption. Quite bizarre that when
my file sees other latex symbols, the caption symbols then render
correctly.

BTW: What does

executing Scheme code block (square)...
=> #
org-babel-script-escape: ‘org-babel-script-escape’ expects a string

mean? I'm suddenly getting this in an org file which has scheme babel code
blocks, images, and lots of latex symbol markup. It first popped up when I
tried to C-c C-c a scheme code block.






On Wed, Sep 13, 2017 at 6:55 PM, Nick Dokos <ndo...@gmail.com> wrote:

> Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:
>
> > Hello,
> >
> > Lawrence Bottorff <borg...@gmail.com> writes:
> >
> >> Consider this markup:
> >>
> >> 
> >> * MATHEMATICS AUXILIARY
> >>
> >> ** deriving sines and cosines
> >>
> >> #+caption: Right triangle with two $\pi\big/4$ angles.
> >> [[file:images/45-45-triangle.png]]
> >>
> >> $\big/$
> >> 
> >>
> >> If I remove the second $\big/$, the first latex, $\pi\big/4$, in the
> >> caption will not properly render on export to html. Include it and both
> >> render just fine. Without the second, the first looks like this:
> >>
> >> Figure 1: Right triangle with two \(\pi\big/4\) angles.
> >>
> >> Is this a bug?
> >
> > If you use
> >
> >   #+options: tex:dvipng
> >
> > the symbol in the caption is correctly rendered. It may be a bug in
> Mathjax.
> >
>
> I looked at the diff between html files produced with and without the
> $\big/$ addition.
> The one without does not include any of the mathjax configuration code at
> all. Is that
> code included conditionally perhaps when a latex construct is seen? Maybe
> the latex construct
> in the caption does not trigger the inclusion?
>
> --
> Nick
>
>
>


[O] Strange latex symbol behavior on html export

2017-09-12 Thread Lawrence Bottorff
Consider this markup:


* MATHEMATICS AUXILIARY

** deriving sines and cosines

#+caption: Right triangle with two $\pi\big/4$ angles.
[[file:images/45-45-triangle.png]]

$\big/$


If I remove the second $\big/$, the first latex, $\pi\big/4$, in the
caption will not properly render on export to html. Include it and both
render just fine. Without the second, the first looks like this:

Figure 1: Right triangle with two \(\pi\big/4\) angles.

Is this a bug?

LB


[O] Justifying a formula

2017-03-07 Thread Lawrence Bottorff
Here's what I have in a buffer:

* This basic pseudo-code tells of an internally-defined variable that
holds, /accumulates/ as the recursion drills down:

\begin{align*}
sumprod(x) \equiv if \; eq(x,NIL) \; then \; 2.list(s,p) \\
 else \\
  \{let \; z = sumprod(cdr(x)) \\
2.list(car(z) + car(x), car(cdr(z) \cdot car(x))\}
\end{align*}

which produces this as HTML:

sumprod(x) ≡ if eq(x,NIL) then 2.list(s,p)
else
 {let z = sumprod(cdr(x))
 2.list(car(z) + car(x), car(cdr(z) ⋅ car(x))}

which seems to be right justified. How can I get normal left justification?

BTW,

#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler

seems to be ignored. Latex seems to have

\usepackage[fleqn]{amsmath}

but I'm assuming org-mode HTML export doesn't really use this. (Actually,
Latex export ignores

#+LaTeX_HEADER: \usepackage{mathtools}
#+LaTeX_HEADER: \usepackage[fleqn]{mathtools}

as well.)

Latest, greatest everything.

LB


Re: [O] Babel doesn't like some Racket comments

2017-03-01 Thread Lawrence Bottorff
This produces no Backtrace. Here's my *Messages*

Debug on Quit enabled globally
executing Scheme code block (set-example1)...
Starting Geiser REPL for racket ...
There is no ElDoc support in this buffer
Starting Geiser REPL for racket ... [2 times]
Racket REPL up and running!
=>
""
Quit

. . . and no *Backtrace* buffer. I used this code:

#+name:set-example1
#+begin_src scheme :session f1 :exports both :tangle yes :cache yes
:results silent
(define A (set 1 2 3 4))
(define B (set 3 4 5 6))
(define C (set 4 5))

(set-union A B) ; gives (set 1 2 3 4 5 6)
(set-intersect A B) ; gives (set 3 4)
(set-subtract A B)  ; gives (set 1 2)
(set=? A B) ; gives #f
(subset? C A)   ; gives #f
(subset? C B)   ; gives #t
#+end_src

and upon C-c C-c, Emacs worked for a long time, finally producing a dead,
unresponsive Racket REPL buffer. Again, if I kill the REPL, then try this
code:

#+name:set-example2
#+begin_src scheme :session f1 :exports both :tangle yes :cache yes
:results silent
(define A (set 1 2 3 4))
(define B (set 3 4 5 6))
(define C (set 4 5))

(set-union A B)
(set-intersect A B)
(set-subtract A B)
(set=? A B)
(subset? C A)
(subset? C B)
#+end_src

it works:

Welcome to Racket v6.8.
racket@> A
(set 1 3 2 4)
racket@>

On Wed, Mar 1, 2017 at 8:40 AM, Nicolas Goaziou <m...@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Lawrence Bottorff <borg...@gmail.com> writes:
>
> > C-c C-c-ing this code
> >
> > #+begin_src scheme
> > (define (foo x)
> >   ;just add one
> >   (+ 1 x)) ; comment
> > #+end_src
> >
> > causes Racket (geiser) to freeze up. Sometimes I see a
>
> Could you use M-x toggle-debug-on-quit, reproduce the freezing, hit C-g
> and paste the backtrace?
>
> Regards,
>
> --
> Nicolas Goaziou
>


[O] Babel doesn't like some Racket comments

2017-02-28 Thread Lawrence Bottorff
C-c C-c-ing this code

#+begin_src scheme
(define (foo x)
  ;just add one
  (+ 1 x)) ; comment
#+end_src

causes Racket (geiser) to freeze up. Sometimes I see a

Code block evaluation complete.
geiser-repl--maybe-send: Args out of range: 61, 62

-like message. The culprit is the *; comment *next to the `(+ 1 x))` line.
If I take it out the *; just add one* doesn't cause a problem. This
behavior doesn't happen in naked racket or regular geiser on racket.

LB


Re: [O] Logbook not working?

2017-02-23 Thread Lawrence Bottorff
Aaaag! I have every confidence that someday I'll stop making a fool of
myself to you good people. . . .

On Thu, Feb 23, 2017 at 2:55 PM, Nicolas Goaziou <m...@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Lawrence Bottorff <borg...@gmail.com> writes:
>
> > I set `debug-on-error` to `t` and went through creating a log entry:
> >
> > Debugger entered--Lisp error: (error "Before first headline at position
> > 1151 in buffer test3.org")
> >   signal(error ("Before first headline at position 1151 in buffer
> test3.org
> > "))
> >   error("Before first headline at position %d in buffer %s" 1151 # > test3.org>)
> >   org-back-to-heading(t)
> >   org-end-of-meta-data(nil)
> >   org-log-beginning(t)
> >   org-store-log-note()
> >   org-ctrl-c-ctrl-c(nil)
> >   funcall-interactively(org-ctrl-c-ctrl-c nil)
> >   #(org-ctrl-c-ctrl-c nil nil)
> >   ad-Advice-call-interactively(#
> org-ctrl-c-ctrl-c
> > nil nil)
> >   apply(ad-Advice-call-interactively #
> > (org-ctrl-c-ctrl-c nil nil))
> >   call-interactively(org-ctrl-c-ctrl-c nil nil)
> >   command-execute(org-ctrl-c-ctrl-c)
> >
> > Here's ECM, which only contains all my (kudgy, inefficient, wrong?)
> header
> > stuff:
> >
> > #+TITLE: \zwnj^{147}Pm
> > #+AUTHOR: 147Pm
> >
> > #+EMAIL: borg...@sdf.org
> > #+DATE: 2017-02-08T14:26:12
> >
> > #+Filetags: :CompleteReWrite:
> > #+LANGUAGE:  en
> >
> > # #+INFOJS_OPT: view:showall ltoc:t mouse:underline path:
> > http://orgmode.org/org-info.js
> > #+HTML_HEAD:  > type="text/css">
> > #+EXPORT_SELECT_TAGS: export
> > #+EXPORT_EXCLUDE_TAGS: noexport
> >
> > #+OPTIONS: H:15 num:15 toc:nil \n:nil @:t ::t |:t _:{} *:t ^:{} prop:t
> > #+OPTIONS: prop:t
> >
> > # This makes MathJax not work
> > # #+OPTIONS: tex:imagemagick
> > # this makes MathJax work
> >
> > #+OPTIONS: tex:t
> > #+LATEX_CLASS: article
> >
> > #+LATEX_CLASS_OPTIONS: [american]
> > # Setup tikz package for both LaTeX and HTML export:
> > #+LATEX_HEADER: \usepackage{tikz}
> > #+LATEX_HEADER: \usepackage{commath}
> > #+LaTeX_HEADER: \usepackage{pgfplots}
> > #+LaTeX_HEADER: \usepackage{sansmath}
> > #+LaTeX_HEADER: \usepackage{mathtools}
> > # #+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
> >
> > #+PROPERTY: header-args:latex+ :packages '(("" "tikz"))
> > #
> >
> > #+PROPERTY: header-args:latex+ :exports results :fit yes
> > #
> >
> > #+STARTUP: showall
> > #+STARTUP: align
> >
> > #+STARTUP: indent
> > #+STARTUP: entitiespretty
> >
> > #+STARTUP: logdrawer
> >
> > * Test
> >
> > -
>
> Is point at "* Test" or below when you use C-c C-z ? Position 1151 seems
> to be above. You can only attach notes to headlines.
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] Logbook not working?

2017-02-23 Thread Lawrence Bottorff
I set `debug-on-error` to `t` and went through creating a log entry:

Debugger entered--Lisp error: (error "Before first headline at position
1151 in buffer test3.org")
  signal(error ("Before first headline at position 1151 in buffer test3.org
"))
  error("Before first headline at position %d in buffer %s" 1151 #)
  org-back-to-heading(t)
  org-end-of-meta-data(nil)
  org-log-beginning(t)
  org-store-log-note()
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  #(org-ctrl-c-ctrl-c nil nil)
  ad-Advice-call-interactively(# org-ctrl-c-ctrl-c
nil nil)
  apply(ad-Advice-call-interactively #
(org-ctrl-c-ctrl-c nil nil))
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)

Here's ECM, which only contains all my (kudgy, inefficient, wrong?) header
stuff:

#+TITLE: \zwnj^{147}Pm
#+AUTHOR: 147Pm
#+EMAIL: borg...@sdf.org
#+DATE: 2017-02-08T14:26:12
#+Filetags: :CompleteReWrite:
#+LANGUAGE:  en
# #+INFOJS_OPT: view:showall ltoc:t mouse:underline path:
http://orgmode.org/org-info.js
#+HTML_HEAD: 
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+OPTIONS: H:15 num:15 toc:nil \n:nil @:t ::t |:t _:{} *:t ^:{} prop:t
#+OPTIONS: prop:t
# This makes MathJax not work
# #+OPTIONS: tex:imagemagick
# this makes MathJax work
#+OPTIONS: tex:t
#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [american]
# Setup tikz package for both LaTeX and HTML export:
#+LATEX_HEADER: \usepackage{tikz}
#+LATEX_HEADER: \usepackage{commath}
#+LaTeX_HEADER: \usepackage{pgfplots}
#+LaTeX_HEADER: \usepackage{sansmath}
#+LaTeX_HEADER: \usepackage{mathtools}
# #+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
#+PROPERTY: header-args:latex+ :packages '(("" "tikz"))
#
#+PROPERTY: header-args:latex+ :exports results :fit yes
#
#+STARTUP: showall
#+STARTUP: align
#+STARTUP: indent
#+STARTUP: entitiespretty
#+STARTUP: logdrawer

* Test

-

I'm on Emacs 25.1.1 and Org mode version 9.0.5 (9.0.5-elpaplus @
.../.emacs.d/elpa/org-plus-contrib-20170210/)




On Thu, Feb 23, 2017 at 11:50 AM, Nicolas Goaziou <m...@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Lawrence Bottorff <borg...@gmail.com> writes:
>
> > I'm trying to create Logbook entries with C-c C-z -- which has worked
> fine
> > in the past. But now whenever I try I get
> >
> > org-back-to-heading: Before first headline at position 1151 in buffer
> > current.org
> >
> > . . . i.e., my entry doesn't show up anywhere. What have I inadvertently
> > messed up?
>
> Could you paste a full backtrace, or, better, an ECM?
>
> Regards,
>
> --
> Nicolas Goaziou
>


[O] Logbook not working?

2017-02-23 Thread Lawrence Bottorff
I'm trying to create Logbook entries with C-c C-z -- which has worked fine
in the past. But now whenever I try I get

org-back-to-heading: Before first headline at position 1151 in buffer
current.org

. . . i.e., my entry doesn't show up anywhere. What have I inadvertently
messed up?

LB


[O] Publishing versus normal exporting

2017-02-17 Thread Lawrence Bottorff
I'm looking at this
 which
seems to suggest a difference between "publishing" and normal export (e.g.,
C-c C-e h o to get an HTML export). The Emacs configuration given here
 would or
would not be in force with a normal export? What this "complex publishing
configuration" gives is exactly what I want, but only for one project. Is
there a way to keep normal export -- and possibly multiple projects --
separate?

LB


[O] :results raw for html export problem

2017-01-30 Thread Lawrence Bottorff
Here's some Lisp in an org file that I export to html

#+begin_src lisp :exports both :results raw
(write (setf my-array (make-array '(10
(terpri) ; goo.gl/lCcdDU / Function TERPRI, FRESH-LINE
(setf (aref my-array 0) 25)
(setf (aref my-array 1) 23)
(setf (aref my-array 2) 45)
(setf (aref my-array 3) 10)
(setf (aref my-array 4) 20)
(setf (aref my-array 5) 17)
(setf (aref my-array 6) 25)
(setf (aref my-array 7) 19)
(setf (aref my-array 8) 67)
(setf (aref my-array 9) 30)
(write my-array)
#+end_src

#+RESULTS:
#(25 23 45 10 20 17 25 19 67 30)

. . . but the results look munged after an html export:

#(25 23 45 10 20 17 25 19 67 30) #(25 23 45 10 20 17 25 19 67 30)

. . . not the mono-space font and the answer is repeated. However, this
code behaves well:

#+begin_src lisp :exports both
(setf x (make-array '(3 3)
   :initial-contents '((0 1 2 ) (3 4 5) (6 7 8)))
)
(write x)
#+end_src

#+RESULTS:
: #2A((0 1 2) (3 4 5) (6 7 8))

and exports well. Please advise. I'm on latest, greatest everything
(25.1.1; 9.0.4;U16.10; SBCL1.3.14; fresh quicklisp slime).

LB


Re: [O] Babel prolog not working

2017-01-25 Thread Lawrence Bottorff
I did an issue at https://github.com/ljos/ob-prolog.

On Wed, Jan 25, 2017 at 9:38 PM, Thomas S. Dye <t...@tsdye.com> wrote:

> Aloha Lawrence,
>
> Lawrence Bottorff writes:
>
> > On my original system, as well on a built-from-scratch system, babel
> prolog
> > won't work for me. I've got latest swi-prolog 7.4.0 installed, along with
> > Emacs 25.1.1, and org 9.0.4, along with ob-prolog 20170102.953, and
> prolog
> > (major mode) 1.22. Anything I put in a code block, e.g.,
> >
> > #+BEGIN_SRC prolog
> > [likes.pl].
> > #+END_SRC
> >
> > results in (*Messages*)
> >
> > executing Prolog code block...
> > executing Prolog source code block
> > org-babel-variable-assignments:prolog: Wrong number of arguments: (1 .
> 1), 2
> >
> > Doing C-h f brings up
> >
> > org-babel-variable-assignments:prolog is a compiled Lisp function in
> > ‘ob-prolog.el’.
> > (org-babel-variable-assignments:prolog PARAMS)
> > Not documented.
> >
> > . . . and I found it in
> > https://github.com/ljos/ob-prolog/blob/master/ob-prolog.el, but can't
> > fathom what is going wrong.
> >
> > Regular, non-org prolog major mode interactions work fine.
> >
> > I know I try everyone's patience on this list, but I'm trying out many
> > different languages' babel capabilities -- and reporting my "findings."
>
> Perhaps you could also open an issue with the ob-prolog developer:
> https://github.com/ljos/ob-prolog
>
> One way to report "findings" is the Babel languages page on Worg:
> http://orgmode.org/worg/org-contrib/babel/languages.html
>
> That page could always use more love.
>
> All the best,
> Tom
>
> --
> Thomas S. Dye
> http://www.tsdye.com
>


  1   2   3   >