Re: [BUG] Contents of the *Warnings* buffer, which has begun popping up at random intervals

2023-05-13 Thread George Mauer
Not at my computer now, but that looks like a warning I've been getting
pretty constantly for a few weeks and have an investigated. I assumed it
was coming from org-ai as I just recently added to that to my workflow and
use it a lot, but maybe not

On Sat, May 13, 2023, 17:22 Tom Davey  wrote:

> I was prompted by a buffer named *Warnings* to send an email to
>
> emacs-orgmode@gnu.org.
>
>
>
> This buffer appears seemingly at random every few days or so (I use
>
> Emacs and Org mode for about eight hours a day). The warnings began
>
> after I upgraded to Org 9.6.3. Find the contents of that buffer below.
>
>
>
> Thank you for the work on Org mode, which is magnificent and
>
> without peer.
>
>
>
> Tom Davey
>
>
>
> 
>
>
>
> ■  Warning (org-element-cache): org-element--cache: Org parser error in
> journal.org::18359990. Resetting.
>
> The error was: (error "Invalid search bound (wrong side of point)")
>
>
>
> Emacs  : GNU Emacs 29.0.50 (build 1, x86_64-w64-mingw32)
>
> of 2022-09-14
>
> Package: Org mode version 9.6.3 ( @
> c:/Users/tdavey/Documents/Dropbox/Emacs/Prod/.emacs.d/load-path-subdirs/td-esdf/td-startup-lisp/Elpa/org-9.6.3/)
>
>
>
> current state:
>
> ==
>
> (setq
>
> org-archive-location "%s_archive::datetree/"
>
> org-link-elisp-confirm-function 'yes-or-no-p
>
> org-directory "~/org-files"
>
> org-yank-adjusted-subtrees t
>
> org-tag-faces '(("PROJ" :background "indianred3" :foreground "cornsilk2"
> :weight bold))
>
> org-agenda-custom-commands '(("c" "Computers and Project Tags"
>
>((agenda "") (tags-todo "project")
> (tags-todo "orgmode") (tags-todo "emacs")
>
> (tags-todo "computers"))
>
>)
>
>   ("e" "Email tag" ((tags-todo "email")
> (agenda "")))
>
>   ("g" "Microscheduling tag" ((tags-todo
> "microscheduling") (tags-todo "today") (agenda "")))
>
>   ("h" "Housing tags"
>
>((tags "+Strivers") (tags "+SGCagenda")
> (tags "+SGCbudget") (tags "+SGCcuo")
>
> (tags "+SGCdiscussion") (tags
> "+SGChouseRules") (tags "+SGCminutes") (tags "+SGCstaff")
>
> (tags "+SGCunit") (tags "+SGCvote") (tags
> "+improvement") (tags "+household"))
>
>((org-columns-default-format "%CATEGORY
> %75ITEM %TODO %TAGS %25CREATED %25TIMESTAMP")))
>
>   ("n" "Agenda and all TODOs" ((agenda "")
> (alltodo "")))
>
>   ("p" "People tags"
>
>((agenda "") (tags-todo "atrajkov")
> (tags-todo "apotter") (tags-todo "dmcewan")
>
> (tags-todo "espector") (tags-todo
> "jbousley") (tags-todo "kmandel") (tags-todo "rosoria")
>
> (tags-todo "twasson") (tags-todo
> "cfrappier") (tags-todo "cmorales") (tags-todo "cwolan")
>
> (tags-todo "dbolen") (tags-todo
> "jterranella") (tags-todo "lortiz") (tags-todo "malzuru")
>
> (tags-todo "dhalsey") (tags-todo
> "jkendall") (tags-todo "kolson"))
>
>)
>
>   ("b" "Tom's basic block agenda"
>
>((agenda "") (tags-todo
> "+homeImprovement-household") (tags-todo "FAredesign")
>
> (tags-todo "rhaass") (tags-todo "kolson")
> (tags-todo "dhalsey") (tags-todo "hr")
>
> (tags-todo "lhammes") (tags-todo
> "StaffMeeting") (tags-todo "cfrappier") (tags-todo "espector")
>
> (tags-todo "ahenry") (tags-todo "atrajkov")
>
> (tags-todo
>
>
> "+work-rhaass-kolson-cfrappier-jmcgrath-tkatavic-egosselin-aqualls-cshehadi-espector-pituk-ahalliday-metchison-nfreiberg-lhammes-emacs-lifelongLearning")
>
> (tags-todo "computers") (tags-todo "desk")
> (tags-todo "errands") (tags-todo "household")
>
> (tags-todo "lifelongLearning") (tags-todo
> "reading") (tags-todo "social"))
>
>)
>
>   )
>
> org-log-into-drawer t
>
> org-use-fast-tag-selection t
>
> org-agenda-files '("~/org-files/")
>
> org-capture-templates '(("a" "Appointments & Meetings
> :appt:   timestamp" entry
>
>   (file+olp+datetree "~/org-files/calendar.org")
> "* %? :appt:\nAppt time: %^T\n%i\n\n")
>
>  ("b" "Bills & paperwork at home
> :desk:" entry (file+olp+datetree "~/org-files/desk.org")
>
>   "* TODO %?  :desk:")
>
>  ("c" "Capture no
> tag  planning" entry
>
>   

Re: Interest in an Org video meetup?

2023-04-27 Thread George Mauer
 ✋ Interested as well

On Thu, Apr 27, 2023, 07:43 Dave Marquardt  wrote:

> Russell Adams  writes:
>
> > Would there be any interest in a monthly 1-2 hour long ad-hoc screen
> > sharing and video discussion for Org-mode?
>
> I'm interested.
>
> -Dave
>
>
>


Re: A dream?

2023-04-03 Thread George Mauer
Emacs is a complex tool that itself can take a semester or more to get
productive in. I know I myself tried for years to move to it and was only
able to after learning vim bindings pretty well, and starting to use
Spacemacs. Forcing students to use emacs, much less org - especially in
this day and age where students *will* ask online, and *will* get a
response of "no one actually uses that" - will probably meet with a ton of
resistance.

On Mon, Apr 3, 2023 at 9:03 AM Marko Schuetz-Schmuck 
wrote:

> Dear All,
>
> I teach some software engineering courses and in each of them students
> work on semester-long projects in teams. So far, have let them choose
> their own tools for all the tasks (implementation language,
> documentation tools, etc.). Personally, I have been using org-mode for
> what feels like forever. I was thinking that it would be nice to have
> students use org-mode also for their project. I can see it provide so
> many features that would benefit the projects: easy links for
> e.g. traceability, tagging of requirements for categorizing, responsible
> developer,..., of course todo lists, priorities, progress tracking,
> rendering to web page, PDF,...
>
> Since these are students from a very technical background I would hope
> they would be open to this.
>
> Anyway, does anyone have any experience related to this, maybe not
> specifically related to teaching, but software engineering projects
> (with documentation of domain, requirements, project approach, progress,
> references, source code, testing, design, etc. etc. etc.)?
>
> Best regards,
>
> Marko
>


Re: Thoughts on this ob language generator

2023-01-14 Thread George Mauer
Thanks a lot Tim, I really appreciate you responding (as you said, it can
be discouraging to not get any response)

For the record, I just tried this simple example and it works

#+begin_src emacs-lisp :results silent
  (create-ob-npx :name "ob-nbb"
 :language "clojurescript"
 :npx-arguments "nbb")
#+end_src

#+begin_src clojurescript
  (prn (+ 1 2 3))
#+end_src

#+RESULTS:
: 6


Never pushed anything to MELPA before but will have to take a look at how
to do this.

On Sat, Jan 14, 2023 at 7:41 PM Tim Cross  wrote:

> George Mauer  writes:
>
> > I had a need the other day to execute some typescript in an org
> document. Now I know that there's an
> > ob-typescript package but that doesn't quite work the way I want and
> expects typescript to be installed
> > globally (which runs into a variety of versioning issues).
> >
> > There is a better option available with the `npx` program (installed
> alongside `npm`) which can install a
> > package along with its dependencies into a temporary sandbox and run its
> binaries.
> >
> > I rewrote the typescript babel plugin to do this and then realized that
> there was relatively little in it
> > beyond variable and function names that was typescript-specific. The
> exact same process can be used for
> > anything that has an interpreter up on npm. Coffeescript, mermaidjs, all
> sorts of things.
> >
> > So I made a macro. I'm interested what people here think:
> https://github.com/togakangaroo/create-ob-npx
>
> This looks interesting and could have some great potential. As you say,
> tehre is a growing class of languages which could be supported using
> this method. I'm interested in trying out the nbb package (Clojurescript
> on node) using this method, but right now, no time.
>
> Really just wanted to give feedbac as I noticed nobody else responded
> and didn't want to give the impression there was no interest.
>
>


Thoughts on this ob language generator

2023-01-13 Thread George Mauer
I had a need the other day to execute some typescript in an org document.
Now I know that there's an ob-typescript package but that doesn't quite
work the way I want and expects typescript to be installed globally (which
runs into a variety of versioning issues).

There is a better option available with the `npx` program (installed
alongside `npm`) which can install a package along with its dependencies
into a temporary sandbox and run its binaries.

I rewrote the typescript babel plugin to do this and then realized that
there was relatively little in it beyond variable and function names that
was typescript-specific. The exact same process can be used for anything
that has an interpreter up on npm. Coffeescript, mermaidjs, all sorts of
things.

So I made a macro. I'm interested what people here think:
https://github.com/togakangaroo/create-ob-npx


Re: Get the "closest" property value

2022-10-12 Thread George Mauer
Thanks a lot Ihor, while that doesn't seem to "cascade" upwards, it was
enough of a clue to get me there. What i'm looking for is (org-entry-get
(point) "workspace-directory" 't) with the third "inherit" parameter set

Thanks again! That's going to open up a few new workflows for me.

On Wed, Oct 12, 2022 at 4:29 AM Ihor Radchenko  wrote:

> George Mauer  writes:
>
> > If I have a document what looks like the following. What code could I run
> > for the ??? to get the property value for "workspace-directory" that is
> > closest in the outline to the location running the code?
> >
> > * Top Level
> >   :PROPERTIES:
> >   :workspace-directory: /tmp
> >   :END:
> >
> >#+begin_src emacs-lisp
> >  (???) ; /tmp
> >#+end_src
>
> #+begin_src emacs-lisp :var prop-value=(org-entry-get (point)
> "workspace-directory")
> prop-value
> #+end_src
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


Get the "closest" property value

2022-10-08 Thread George Mauer
If I have a document what looks like the following. What code could I run
for the ??? to get the property value for "workspace-directory" that is
closest in the outline to the location running the code?

* Top Level
  :PROPERTIES:
  :workspace-directory: /tmp
  :END:

   #+begin_src emacs-lisp
 (???) ; /tmp
   #+end_src

** L2 Heading
   :PROPERTIES:
   :workspace-directory: ~/whatever
   :END:

   #+begin_src emacs-lisp
 (???) ; "~/whatever"
   #+end_src

** Another L2 Heading

   #+begin_src emacs-lisp
 (???) ; /tmp
   #+end_src


Re: Interest in an Org video meetup?

2022-10-07 Thread George Mauer
I would try to join.

One thing I always mention when conversations about recording come up is
that if you promote recordings as a resource, it is considered good form to
have transcription available. I'm pretty sure a community effort like this
world be under no ADA obligations (unlike company meetings) but still good
form.

On Fri, Oct 7, 2022, 05:45 Juan Manuel Macías 
wrote:

> Russell Adams writes:
>
> >> Even if there is a recording, where can we publish the recorded videos?
> >
> > Exactly.
> >
> > Recording brings with it extra logistics, which is why I deferred the
> > issue. ;]
>
> I was just asking, out of curiosity, if it was planned to be published.
> I really don't know where it could be published. I know PeerTube exists,
> but I don't know how it works.
>
> There is the YouTube option, which I imagine no one would like (me
> neither). The only thing in its favor is that Invidious can be used to
> watch the videos. BTW, I watch YT videos through Invidious in Emacs,
> with the Ytel package and EMMS/MPV.
>
> Best regards,
>
> Juan Manuel
>
> --
> --
> --
> Juan Manuel Macías
>
> https://juanmanuelmacias.com
>
> https://lunotipia.juanmanuelmacias.com
>
> https://gnutas.juanmanuelmacias.com
>
>


Re: Simple but repetitive http links

2022-09-07 Thread George Mauer
Also worth mentioning that revert-buffer is your go to "kill buffer and
reopen" command

On Wed, Sep 7, 2022, 08:51 Christian Moe  wrote:

>
> Hi,
>
> Org scans the file for link definitions when you visit it, so when you
> type in the link definition in the buffer, Org is not automatically
> aware that it exists. To refresh setup without reloading the file, you
> can `C-c C-c' with point on the line with the definition. That should do
> it.
>
> Also, if you don't particularly need or like the behavior of querying
> for creating a new headline when none is found, you can turn it off by
> customizing org-link-search-must-match-exact-headline to nil (the default
> is
> 'query-to-create).
>
> Yours,
> Christian
>
> Perry Smith writes:
>
> > I'm new to Org mode.  I found this page
> > https://orgmode.org/manual/Link-Abbreviations.html about Link
> > Abbreviations but I wanted to report my confusion.
> >
> > I added:
> >
> > #+LINK: rails  https://rubyonrails.org
> >
> > to my org file and then I wrote [[rails][Rails]] and when I clicked
> > the text, it asked me if I wanted to create a section.  I had to kill
> > the buffer and reload it to get it to work.  That's fine but I'm
> > wondering if there is a way to make it active without killing the
> > buffer.  And I also wanted to suggest adding something about that in
> > the manual.
> >
> > Perhaps this is a common fact with many of Org modes features that I
> > missed somewhere?
> >
> > Thank you for your time,
> > Perry
>
>


Re: Utility of description lists

2022-06-17 Thread George Mauer
It is not quite true that it's just a way of formatting, there is a
semantic element to it as well where someone parsing your document
programmatically can now know that what you have is a list of terms paired
with their descriptions. In fact, when exporting to html you get a
description list
 which is one
of the most underused-yet-everyone-should-use-it-more html elements.

On Fri, Jun 17, 2022 at 8:37 AM William Denton  wrote:

> On 17 June 2022, Cletip Cletip wrote:
>
> > Final question : why do you use description lists and not another ?
>
> When I have a list of things I want to briefly descibe!  That's all.  It's
> just
> a way of formatting a list of things where there's a term (a word, a name,
> a
> title) that has some descriptive text.  Sometimes I use them when there's
> an
> obvious term/description pairing, and sometimes when I have a text-heavy
> list of
> things and I want to have a brief summary of each to make it easier to
> read.
>
>
> Bill
>
> --
> William Denton
> https://www.miskatonic.org/
> Librarian, artist and licensed private investigator.
> Toronto, Canada
>
>


Re: Time Based Log Formatting

2022-02-11 Thread George Mauer
If tab doesn't work because tab is bound to a command, you can often insert
a literal tab with C-q Tab

On Fri, Feb 11, 2022, 14:14 Robert Love  wrote:

> I use Org Mode to log data while monitoring events.  I used YASnippets to
> insert time but Org mode flushes every thing left.   What I get looks like
>
> 09:12  All Systems started OK
> 09:15  Remote system xyzzy reports problems with the framistat cluster.
> It was restarted with the same configuration
> 09:16 xyzzy failed again, changing configuration.
> 09:17 successful restart
>
>
> What I want looks like
>
> 09:12  All Systems started OK
> 09:15  Remote system xyzzy reports problems with the framistat cluster.
>It was restarted with the same configuration
> 09:16 xyzzy failed again, changing configuration.
> 09:17 successful restart
>
> Tab doesn’t work to move the text over.   How can I make to continue
> lines, that is not starting with a timestamp, indent?
>
> There are many bullets that describe the equipment and set up and are not
> part of the time based log.  I guess I only want the time records to format
> this way.
>
> Thanks for any suggestions.
>
>
>
>


call blocks as a function from inside elisp code

2022-01-19 Thread George Mauer
Hi everyone,

I know that I can call a source block as a function in a header argument
such as :var, inside noweb annotations, or with a #+call: as described here
https://orgmode.org/manual/Evaluating-Code-Blocks.html

I am interested in going one step further though.

I have one emacs-lisp block that generates a list of python files which
mention a search term provided by a variable (eg
gim/get-file-list(search="_utilities") )

I have another code block written in python that given a python filename
will do some ast parsing to tell me some interesting facts about it (eg
#+call: gim/get-python-program-info(filename="foo/bar/some_module.py") )

What I would like to do is to chain the two together (ideally inside a code
block so I can dynamically format the output) so that I can get info on
*each* of the files produced by the first block.

So is there a way to do the equivalent of #+call:
gim/get-python-program-info(filename="foo/bar/some_module.py") from
*inside* an elisp code block? I am aware that I can call things via noweb,
but I'm trying to see if I can avoid that for several other reasons


Re: Orgdown: negative feedback & attempt of a root-cause analysis

2021-12-01 Thread George Mauer
Thank you for writing all this down Karl. Thank you for your efforts and I
truly am sorry for everything you've been put through emotionally. I know
very well how a few particularly nasty comments can sap your energy as the
brain cycles on them over and over.

I hope you come out of this the stronger and so does the project

On Wed, Dec 1, 2021, 17:44 Karl Voit  wrote:

> Hi,
>
> I've summarized my current state of mind about the whole Orgdown
> fiasco into a blog article:
> https://karl-voit.at/2021/12/02/Orgdown-feedback/
>
> Don't worry, I tried to analyze my own faults as well so that others
> might be able to learn from this unfortunate situation.
>
> --
> get mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML into Org-mode:
>> get Memacs from https://github.com/novoid/Memacs <
> Personal Information Management > http://Karl-Voit.at/tags/pim/
> Emacs-related > http://Karl-Voit.at/tags/emacs/
>
>
>


Re: "Orgdown", the new name for the syntax of Org-mode

2021-11-28 Thread George Mauer
Agree with Joost. If I remember correctly, the "down" part of markdown was
meant as a play on words to indicate that, unlike a proper markup language,
markdown has a direction and a value system but no defined standard. Since
org is definitely not that why must the waters? Just go for clarity.

On Sun, Nov 28, 2021, 17:30 Joost Kremers  wrote:

>
> On Sun, Nov 28 2021, Tom Gillespie wrote:
> > PS Another brainstormed name: Orgsyn?
>
> Why not just use the term "Org markup"?  It's descriptive and should be
> understandable to people familiar with the concept of markup languages.
>
> --
> Joost Kremers
> Life has its moments
>
>


Cascading cookie counts

2021-07-23 Thread George Mauer
* Cascading Checkbox Cookie Counts
  I would like checkbox cookies to show the total of all cookies beneath
them regardless of hierarchy nesting.
  The code for ~org-update-checkbox-count~ is more complex than I expected
so before spending time digging into this, maybe someone here has a tip?

** This should show 3/5 [1/2]
   - [X] Done
   - [ ] Not Done
** Nesting level 1
   - [ ] Not Done
   - [X] Done
** Nesting level 2
*** Nesting level 2.1
- [X] Done

** Cookie data recursive doesn't seem to affect this
   My understanding is that there's a cookie data ~~ property
flag you can use. I assumed that's what this was for but it seems to not
affect things (I've tried both with and without the angle braces, but the
regex seems to imply braces which is odd)
*** This should show 3/5 [1/2]
:PROPERTIES:
:COOKIE_DATA: 
:END:
- [X] Done
- [ ] Not Done
*** Nesting level 1
- [ ] Not Done
- [X] Done
*** Nesting level 2
 Nesting level 2.1
 - [X] Done


Re: A requires/provides approach to linking source code blocks

2021-07-13 Thread George Mauer
In implementing an extension you might consider doing it as a generalized
form of what I did with ob-racket (https://github.com/togakangaroo/ob-racket
).

I think it is best to rely on the import/require/include mechanism of the
language you're using. Pretty much all of them support adjacent files. The
problem with code block execution is that it expands the block and writes
it to a temporary directory in a non-predictable location. If you want to
reference other blocks, you need them to *also* write into files in the
same folder.

What I do in ob-racket is support a header :adjacent-file which allows you
to pass in the name of another block and then writes it into the same
folder as the file to be executed with a predictable name (the name of the
block)

So something like this

  #+begin_src racket :adjacent-file stacker-reader-expander.rkt
#lang reader "./stacker-reader-expander.rkt"

Will make sure the block named `stacker-reader-expander.rkt` is written
into that same temporary directory with that same name. There's a few rough
edges but for the most part it works well. Would love to see someone take
this and generalize it into its own extension.

On Tue, Jul 13, 2021 at 2:18 PM Tom Gillespie  wrote:

> We have been receiving many new feature suggestions and requests
> coming in for org babel. I think that Tim's suggestion is the right
> one. Nearly all of these need to be implemented as an extension first
> and tested independently. Further, even if this is done, it should be
> clear that there is zero expectation that such extensions will be
> incorporated.
>
> Once I wrap up the formal grammar for org, one of the next things I
> plan to work on is a clear specification for org babel. This is
> critical because so many of the suggestions that come in deal with
> individuals' specific problems and thus fail to account for how such
> features interact with existing features and how the newly proposed
> feature would block some other features in the future, confuse users,
> etc. Such suggestions also often fail to account for increased
> complexity, nor have they been exposed to a sufficient number of
> examples to reveal fundamental ambiguities in how they could be
> interpreted. The issues with variable behavior between ob langs for
> :pre :post :prologue :epilogue etc. are already enough to keep us busy
> for quite some time.
>
> With regard to this thread in particular, it is of some interest, but
> there are fundamental issues, including the fact that certain
> languages (e.g. racket) expect module code to exist somewhere on the
> file system. There are ways around many of these issues, in fact there
> are likely many ways around any individual issue, so org babel needs
> to systematically consider the issues and provide a clear
> specification, or at least a guide for how such cases should be
> handled.
>
> To give an example from one of my continual pain points: I start
> writing python or racket in an org src block and then I want it to be
> a library so that it can be reused by other code both inside and
> outside the org file without having to resort to noweb.
>
> What is the best way to handle this? I don't know. Right now I tangle
> things and resort to awful hacks for the reuse-in-this-org-file case, but
> I'm guessing there is a better generic solution which would allow _any_
> org block to be exported as a library instead of nowebbed in.
>
> Before jumping for any particular suggestion for how to handle this
> we need to explore the diversity of cases that various ob langs
> present, so that we can find a solution that will work for all of
> them. After all, packaging code to a library for reuse is an
> extremely common pattern that org babel should be able to
> abstract, but it is a major undertaking, not just the addition of a
> keyword here and there.
>
> In short I suggest that we issue a general moratorium on new org babel
> feature suggestions until we can stabilize what we already have and
> provide a clear specification for correct behavior. Until we have that spec
> we could encourage users to create extensions that implement those
> features.
>
> Best,
> Tom
>
>
> PS The other next thing that I am working on might be another way out
> for this particular feature request. Namely, it is simplifying and
> extending org keyword syntax so that new keywords (with options) and
> associated keywords can be specified using keyword syntax within a
> single org file. This would make it possible to get useful high level
> keyword behavior in a single file without burdening the core
> implementation with more special cases for associated keywords, and it
> would allow users to write small elisp functions that could do some of
> what is suggested here, all without need to add anything to the core
> org implementation.
>
>


Re: Export Org mode files to (gag, barf) MS Office?

2021-06-26 Thread George Mauer
For anyone who has never tried it, I'll add that the open office formats
are an absolute beast to export to. I can't say for sure about docx but
I've done my time building a PowerPoint exporter (on top of Microsoft
provided ooxml libraries even). It is complex enough that I'm not even sure
such an exporter's maintenance is possible without a full time dedicated
team

On Sat, Jun 26, 2021, 17:17 Tim Cross  wrote:

>
> Brandon Taylor  writes:
>
> > I know we’re not supposed to really even TALK about proprietary software
> in FOSS communities like this one, but I can’t help but wonder if someone
> > might consider making (an) Emacs plugin(s) that allow(s) a user to
> export Org mode files to Microsoft Office file formats such as .docx, .xlsx
> and the
> > like? Or is/are there already (a) plugin(s) in the MELPA that can do
> this?
> >
>
> I don't think you will ever see full proprietary support for MS Office
> file formats. In addition to the philosophical issues, there are also
> practical constraints. As these formats are closed proprietary formats
> owned by MS, they can be changed at will and without notice by MS, which
> creeates maintenance problems, plus there is the risk you may run foul
> of MS copyright or patent restrictions and you have the added overhead
> of having to work with a format which is not openly documented.
>
> Probably the best you can hope for is support for open standards which
> are also supported by MS Office. For example, ODT, CSV and maybe XML.
> Unlike native MS formats, such open formats are likely to be even more
> accessible (such as by other office like products) and last longer
> because they are not based on some version of a proprietary format which
> may arbitrarily change in the future.
>
> --
> Tim Cross
>
>


Re: appearance of list as results from evaluating code blocks

2021-06-23 Thread George Mauer
What about :results code
The default is a elisp code block so you get syntax coloring

On Wed, Jun 23, 2021, 16:22 Rodrigo Morales 
wrote:

> Johannes Brauer  writes:
>
> Johannes Brauer writes:
>
> > thanks, that works
>
> While that works, you might be interested in ":results verbatim" instead
> of ":results raw" since when using "verbatim" the results are replaced
> when re-evaluating the code block. See minimal working example below.
>
> After pressing =C-c C-c= five times
>
> #+BEGIN_SRC elisp :results raw
> (list 1 2 3)
> #+END_SRC
>
> #+RESULTS:
> (1 2 3)
> (1 2 3)
> (1 2 3)
> (1 2 3)
> (1 2 3)
>
> After pressing =C-c C-c= five times
>
> #+BEGIN_SRC elisp :results verbatim
> (list 1 2 3)
> #+END_SRC
>
> #+RESULTS:
> #+begin_example
> (1 2 3)
> #+end_example
>
> PS: If you haven't customized Org Mode enough, you might get a ":" as
> the prefix of some of your results.
>
> #+BEGIN_SRC elisp :results verbatim
> (list 1 2 3)
> #+END_SRC
>
> #+RESULTS:
> : (1 2 3)
>
> As can be seen above, the results are not enclosed within
> #+begin_example and #+end_example. To enable this, set the following.
>
> #+BEGIN_SRC elisp
> (setq org-babel-min-lines-for-block-output 0)
> #+END_SRC
>
> Once you set the option shown above, you might get the following when
> evaluating the code block.
>
> #+BEGIN_SRC elisp :results verbatim
> (list 1 2 3)
> #+END_SRC
>
> #+RESULTS:
> #+begin_example
> (1 2 3)
> #+end_example
>
>


Re: Hiding results using :post

2021-06-07 Thread George Mauer
Cool, thanks!

On Mon, Jun 7, 2021 at 4:31 PM John Kitchin  wrote:

> it is the name of blocks that use emacs-jupyter (
> https://github.com/nnicandro/emacs-jupyter)  (instead of ob-ipython).
> Basically it is a connection between org-src blocks and a jupyter kernel
> (it does not have to be python, it can be julia, R, etc.) I am trying it
> out this summer.
>
> I think that code should work on most src-blocks though.
>
> John
>
> ---
> Professor John Kitchin (he/him/his)
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
>
> On Mon, Jun 7, 2021 at 5:21 PM George Mauer  wrote:
>
>> Woah woah. What is the jupyter-python language, John?
>>
>> On Mon, Jun 7, 2021, 15:44 John Kitchin  wrote:
>>
>>> This is doable with a hook and advice I think. The hook will hide the
>>> results if you use :results hide in the header.
>>>
>>> I had to use the advice to remove the results before hand, so that you
>>> toggle the visibility off. This is pretty lightly tested. you could
>>> eliminate
>>>
>>> (defun hide-results (  args)
>>>   (let ((results (cdr (assoc :results (third
>>> (org-babel-get-src-block-info 'light))
>>> (when (string-match "hide" results)
>>>   (org-babel-hide-result-toggle t
>>>
>>> (add-hook 'org-babel-after-execute-hook 'hide-results)
>>>
>>> (advice-add 'org-babel-execute-src-block :before (lambda ( args)
>>> (org-babel-remove-result)))
>>>
>>> I guess there are other ways that might work too.
>>>
>>> #+BEGIN_SRC jupyter-python :results hide
>>> print(5)
>>> #+END_SRC
>>>
>>> #+RESULTS:
>>> : 5
>>>
>>>
>>> John
>>>
>>> ---
>>> Professor John Kitchin (he/him/his)
>>> Doherty Hall A207F
>>> Department of Chemical Engineering
>>> Carnegie Mellon University
>>> Pittsburgh, PA 15213
>>> 412-268-7803
>>> @johnkitchin
>>> http://kitchingroup.cheme.cmu.edu
>>>
>>>
>>>
>>> On Mon, Jun 7, 2021 at 10:03 AM Nick Savage  wrote:
>>>
>>>> My initial thoughts are that this is very possible. This might be an
>>>> area where we could add a new defcustom on always hiding the results to
>>>> allow the user to choose it. Without looking at the code, I think it
>>>> would be pretty straight forward to make an excursion to the results
>>>> line, toggle showing it, then going back to where the point was.
>>>>
>>>> I can take a crack at a patch in the next day or so if no one else
>>>> wants
>>>> to or gets there first.
>>>>
>>>> On 6/7/21 8:51 AM, Roger Mason wrote:
>>>> > Hello,
>>>> >
>>>> > I'd like to be able to hide results, for example when I expect the
>>>> > them to span many lines.  I know I can hit =tab= on the #+RESULTS:
>>>> line,
>>>> > but I'd like to be able to set this automatically.
>>>> >
>>>> > My most recent effort:
>>>> >
>>>> > #+name: hideresults
>>>> > #+begin_src emacs-lisp :results none :exports none
>>>> > (add-to-invisibility-spec '(org-babel-hide-result . t))
>>>> > #+end_src
>>>> >
>>>> > run like this
>>>> >
>>>> > #+header: :engine postgresql :dbhost "localhost"  :dbuser "rmason"
>>>> :database "test" :colnames yes
>>>> > #+header: :post hideresults
>>>> > #+name: pgquery
>>>> > #+begin_src sql
>>>> > select timestamp,nempty0 from settings where timestamp like
>>>> '%20210528%'
>>>> > #+end_src
>>>> >
>>>> > produces
>>>> >
>>>> > #+RESULTS: pgquery
>>>> > : nil
>>>> >
>>>> > I'm sure there is a way to do this, but I need some pointers as to
>>>> how.
>>>> >
>>>> > Thanks for any help.
>>>> >
>>>> > Roger
>>>> >
>>>> > Org mode version 9.2.3 (release_9.2.3-390-gfb5091 @
>>>> > /home/rmason/.emacs.d/org-git/lisp/)
>>>> >
>>>> > GNU Emacs 27.2 (build 1, amd64-portbld-freebsd11.4, X toolkit, cairo
>>>> version 1.16.0, Xaw3d scroll bars)
>>>> >
>>>>
>>>>


Re: Hiding results using :post

2021-06-07 Thread George Mauer
Woah woah. What is the jupyter-python language, John?

On Mon, Jun 7, 2021, 15:44 John Kitchin  wrote:

> This is doable with a hook and advice I think. The hook will hide the
> results if you use :results hide in the header.
>
> I had to use the advice to remove the results before hand, so that you
> toggle the visibility off. This is pretty lightly tested. you could
> eliminate
>
> (defun hide-results (  args)
>   (let ((results (cdr (assoc :results (third (org-babel-get-src-block-info
> 'light))
> (when (string-match "hide" results)
>   (org-babel-hide-result-toggle t
>
> (add-hook 'org-babel-after-execute-hook 'hide-results)
>
> (advice-add 'org-babel-execute-src-block :before (lambda ( args)
> (org-babel-remove-result)))
>
> I guess there are other ways that might work too.
>
> #+BEGIN_SRC jupyter-python :results hide
> print(5)
> #+END_SRC
>
> #+RESULTS:
> : 5
>
>
> John
>
> ---
> Professor John Kitchin (he/him/his)
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
>
> On Mon, Jun 7, 2021 at 10:03 AM Nick Savage  wrote:
>
>> My initial thoughts are that this is very possible. This might be an
>> area where we could add a new defcustom on always hiding the results to
>> allow the user to choose it. Without looking at the code, I think it
>> would be pretty straight forward to make an excursion to the results
>> line, toggle showing it, then going back to where the point was.
>>
>> I can take a crack at a patch in the next day or so if no one else wants
>> to or gets there first.
>>
>> On 6/7/21 8:51 AM, Roger Mason wrote:
>> > Hello,
>> >
>> > I'd like to be able to hide results, for example when I expect the
>> > them to span many lines.  I know I can hit =tab= on the #+RESULTS: line,
>> > but I'd like to be able to set this automatically.
>> >
>> > My most recent effort:
>> >
>> > #+name: hideresults
>> > #+begin_src emacs-lisp :results none :exports none
>> > (add-to-invisibility-spec '(org-babel-hide-result . t))
>> > #+end_src
>> >
>> > run like this
>> >
>> > #+header: :engine postgresql :dbhost "localhost"  :dbuser "rmason"
>> :database "test" :colnames yes
>> > #+header: :post hideresults
>> > #+name: pgquery
>> > #+begin_src sql
>> > select timestamp,nempty0 from settings where timestamp like '%20210528%'
>> > #+end_src
>> >
>> > produces
>> >
>> > #+RESULTS: pgquery
>> > : nil
>> >
>> > I'm sure there is a way to do this, but I need some pointers as to how.
>> >
>> > Thanks for any help.
>> >
>> > Roger
>> >
>> > Org mode version 9.2.3 (release_9.2.3-390-gfb5091 @
>> > /home/rmason/.emacs.d/org-git/lisp/)
>> >
>> > GNU Emacs 27.2 (build 1, amd64-portbld-freebsd11.4, X toolkit, cairo
>> version 1.16.0, Xaw3d scroll bars)
>> >
>>
>>


Re: plantuml, png and caching

2021-04-15 Thread George Mauer
I would expect it to work. After all, it could be incredibly useful to bump
that up to a :header-args:plantuml: property on the heading

On Thu, Apr 15, 2021 at 12:48 PM CS Suehs  wrote:

> Nick,
> I had the :cache yes on the same line with #+BEGIN like
> #+BEGIN_SRC plantuml :file helloworld.png :cache yes
>
> When I change to your method, caching seems to work.
> It looks like setting it as a section property also works.
>
> Thank you.
> Should I expect the setting on the BEGIN_SRC line to work?
>
> On Tue, Apr 13, 2021 at 7:16 PM Nick Daly
>  wrote:
> >
> > CS Suehs  writes:
> >
> > > Should I expect PlantUML source blocks and their resulting images to
> > > be cached and respect `:cache true` ?
> >
> > Yes.
> >
> > > In my experience they regenerate every export, even with :cache true.
> >
> > Can you provide an example?
> >
> > This example caches correctly for me on v9.1.14.
> >
> > #+name: helloworld
> > #+header: :cache yes
> > #+BEGIN_SRC plantuml :file helloworld.png
> >   @startuml
> >   Hello --> World
> >   @enduml
> > #+END_SRC
> >
> > #+RESULTS[f29ead8751dde1b4c4ee1b8fcb97e133c75eed0d]: helloworld
> > [[file:helloworld.png]]
> >
> > The only time I've seen caching break is if the diagram imports an
> > external file.  In that case, the diagram doesn't regenerate often
> > enough, because org doesn't notice that the external file changed.  The
> > fix to that is to include the hash of the external file as a dependent
> > var.
> >
> > #+name: md5
> > #+BEGIN_SRC shell :cache no :var afile="PLACEHOLDER"
> >   md5sum $afile
> > #+END_SRC
> >
> > #+name: cache-correctly
> > #+header: :var md5input=md5("data.txt")
> > #+BEGIN_SRC R :exports results :results output graphics :file
> data.svg
> >   aData <- read.csv("data.txt")
> >   ggplot(data = aData,
> >  mapping = aes(x = aData$id, y = aData$value))
> > #+END_SRC
> >
> > Thanks,
> > Nick
>
>


Re: Using backticks for the inline code delimeter?

2021-03-31 Thread George Mauer
The point I'm making is that this is already the de-facto thing. People on
this email list do it, people in talking in irc and in forums do it. I
don't think it has so much to do with markdown documents as it does with
Slack, Discord, Teams, even google chat adopting that convention. All our
fingers are getting trained to backticks everywhere *except* org documents.
As those already have trained us to use this construction, it might be a
good idea to just swallow the pill.

I don't think there's much of a slippery slope here. Most popular chat
programs don't support making headings markdown-style for example, and even
if they did I don't see many people attempting to use that.

Trying to enumerate syntax that I feel falls squarely in this category I
come up with only a few

- lists with dashes, org supports that just fine
*bold text* with stars, again org already does this
`backtick code`, org doesn't handle this and actually uses the tilde as a
delimeter which is extra jarring since its a strikethrough in many chat apps

That's really it. You could maybe also argue
> gt for quotation - that would be be nice as we're used to it from email
as well, but I don't see people using it all that much

but that's really it as far as common usage right now. Sure that list might
grow as different usages become common, but I would hope org is not against
evolving in small and reasonable ways as the expectations of users shift.

On Wed, Mar 31, 2021 at 3:31 PM Diego Zamboni  wrote:

> The approach I've taken is to try and stop using Markdown altogether and
> write everything in Org, exporting to Markdown for those destinations that
> need it.
>
> You could even use https://github.com/tecosaur/org-pandoc-import to
> automatically convert/reconvert other formats as needed, and
> https://github.com/tecosaur/emacs-everywhere to do it even in other
> applications.
>
> It's not perfect - I still have to type Markdown sometimes, but you
> can eventually start losing the ingrained backtick habit :)
>
> --Diego
>
>
>
> On Wed, Mar 31, 2021 at 8:49 PM George Mauer  wrote:
>
>> Markdown uses backticks to denote inline code which should get special
>> (typically monospace) formatting, org uses the tilde character.
>>
>> Now I know that org is not markdown, is far more powerful than markdown,
>> and is not (mostly) the same use cases as markdown. But this one use case
>> *does* overlap. And the backticks thing is becoming so ingrained that not
>> only do I reach for it all the time, but I've seen it crop up on this very
>> mailing list and even in some README.org documents.
>>
>> I would like to submit that org consider adopting backticks as an
>> alternate way of denoting inline code.
>>
>> Aside from any official movement, I would like to add this to my own
>> files - is there a straightforward way to extend the org parser to do this?
>>
>


Using backticks for the inline code delimeter?

2021-03-31 Thread George Mauer
Markdown uses backticks to denote inline code which should get special
(typically monospace) formatting, org uses the tilde character.

Now I know that org is not markdown, is far more powerful than markdown,
and is not (mostly) the same use cases as markdown. But this one use case
*does* overlap. And the backticks thing is becoming so ingrained that not
only do I reach for it all the time, but I've seen it crop up on this very
mailing list and even in some README.org documents.

I would like to submit that org consider adopting backticks as an alternate
way of denoting inline code.

Aside from any official movement, I would like to add this to my own files
- is there a straightforward way to extend the org parser to do this?


Re: How to get shell source blocks to read my profile?

2021-03-16 Thread George Mauer
I understand why you say that maxim but testing that this worked was the
first thing I did and it does work. I was surprised as well. I haven't
debugged all the way into the eval functions to see why this works but my
guess is that the authors were pretty smart about figuring out which
executable to invoke.

As for the problem I'm trying to solve, there isn't one exactly. This is
more me hacking on something I don't fully understand because it regularly
trips me up.

I do still wonder what would be the disadvantage of just configuring it to
do --login by default and doing all configuration in profile scripts. It
would be unconventional yes, but it would also make dynamic scoping of
environment variable effectively opt-in via --noprofile rather than opt-out
(which imo is how it should be). I would assume that uses extra resources
or risks improperly handling crashed processes, but I can't find anything
to that effect in the docs

On Tue, Mar 16, 2021, 07:32 Maxim Nikulin  wrote:

> On 16/03/2021 00:49, George Mauer wrote:
> >shell-file-name: "/bin/zsh -i"
>
> I am afraid, you should be prepared to face some problem accidentally.
> The value of this variable is used to execute the specified file
> ("zsh -i" in the "/bin" directory, I do not think, you have such file),
> not as a part of shell command. shell-file-name in namely file name to
> be executed with shell-command-switch as first argument (separate
> arguments, not merged into a string) to run shell commands (next argument).
>
> Environment variables could be set on OS level, inside emacs
> https://www.gnu.org/software/emacs/manual/html_node/emacs/Environment.html
> , etc. It is hard to suggest something since you have not described the
> problem you are trying to solve. Tim in details explained why you
> attempt to solve it did not work, but the problem (or the goal) is still
> unknown.
>
>
>


Re: How to get shell source blocks to read my profile?

2021-03-15 Thread George Mauer
Thanks a lot! The interactive/non-interactive was indeed the core issue.
Extra frustrating because it seems like supplying `--rcfile` does nothing
if you *do* use `-c` but *don't* use `-i`...ah ad-hoc cli design.

As a general solution, I've found that adding this block in my org buffer
will make shell (which is zsh in my case) run in interactive mode for all
of these

* Local Variables :noexport:
  :PROPERTIES:
  :VISIBILITY: folded
  :END:
  local variables:
  shell-file-name: "/bin/zsh -i"
  end:

On Sun, Mar 14, 2021 at 11:04 PM Tim Cross  wrote:

>
> comments in-line ...
>
> George Mauer  writes:
>
> > Hey Tim, thanks for helping out. I commented inline to your response
> below but I'll sum up and ask the outstanding questions more directly here
> as well.
> >
> > I think you might have misread what I was doing - I had 3 different
> variables set in 3 different places precisely because I want to dissect
> things and figure
> > out which profile/rc scripts were run.
> >
> > Yes, this is emacs running in GUI mode so yes, it doesn't have a shell
> as a parent. But that only explains why these environment variables aren't
> in
> > emacs itself, not the spawned bash or zsh processes
> >
>
> To clarify, the GUI mode is unrelated. You can run in GUI mode from a
> terminal and the emacs process will inherit the environment in the
> terminal. If that terminal is a login terminal (i.e. terminal shell was
> run as a login shell), the 'profile' file will be sourced and the 'rc'
> file will have been sourced. If not a login shell, only the rc file will
> have been sourced.
>
> If on the other hand, Emacs is started from the dock, it is started in a
> completely different process chain and is not a child of a login
> process. This is why, if you want your emacs to have /usr/local/bin in
> the path, you have to add it to /etc/paths or /etc/path.d whereas if you
> start emacs from within a terminal (GUI or text mode), you only need to
> add /usr/local/bin to your PATH setting in .profile (just an example to
> highlight the difference between running from in a terminal and running
> from the dock).
>
> > So to sum up the specific questions. My ~shell-file-name~ is ~/bin/zsh~
> which seems to be what ~ob-shell~ is passing down to be run. So why on earth
> > does my ~GIM_ZSHRC~ variable not show up here?
> >
> >   #+begin_src shell
> > env
> >   #+end_src
> >
> > When I actually directly call bash
> >
> >  #+begin_src shell
> > bash -c env
> >   #+end_src
> >
>
> Have a closer look on the section in the bash manual on the difference
> between interactive and non-interactive shells. (also holds for zsh).
> Basically, the 'rc' files are not sourced for non-interactive shells.
>
> > Why would the output not include ~GIM_BASHRC~ - it should have been run,
> right?
> >
>
> No. Adding the -c means it is a non-interactive shell, so no .bashrc
> sourcing.
>
>
> > What about when I call this? Even with explicitly selecting the rc file
> to run, it seems to not
> >
> >   #+begin_src shell
> > bash --rcfile ~/.bashrc -c env
> >   #+end_src
> >
>
> Same issue here. --rcfile only has effect in interactive shells.
>
> > Finally, the outstanding question about ~ob-shell~ is if there is any
> way to force it to run the shell processes' rc-script? I really would have
> expected it to
> > be run in the above situations already...
> >
>
> You could try sourcing it e.g.
>
> #+begin_src shell
> source ~/.bashrc
> env
> #+end_src
>
> or use 'shorthand' dot
>
> #+begin_src shell
> . ~/.bashrc
> env
> #+end_src
>
> there are also some options you can add at the 'shebang' line i.e.
>
> #!/bin/bash -l
>
> or
>
> #!/bin/bash -i
>
> which will change the behaviour.
>
> There is a lot of 'meat' in the bash man page and there is a lot of
> additional information in the bash info pages. However, both can be a
> bit terse and because the info is very 'dense', it is very easy to miss
> key points.
>
> In order to have environment variables available inside your org source
> blocks, you really need to
>
> - have them in the environment inherited by emacs when it starts. This
>   will depend how you start Emacs (i.e from within an interactive shell
>   vs from the dock). Note that you typically don't see this issue under
>   Linux because in most Linux setups, the X environment is started
>   inside a login shell. So everything started as part of the X session,
>   like a dock, is a child of the login process and therefore inherits
>   the login environment. On a mac, the dock is not part o

Re: How to get shell source blocks to read my profile?

2021-03-14 Thread George Mauer
ported mixed in across all these files.


Don't forget that many tools from homebrew to pyenv install scripts to
ansible will start modifying these for you


> This is a source of
> terrible confusion and unexpected results. Some 'canned' shell
> configurations, like 'oh-my-zsh' also try to be extra helpful by
> sourcing files which are not normally sourced by that shell (to make
> smoother migration from bash shells for example). Sometimes, it can be
> helpful to put a line like the following into each of these files
>
> echo "Executing  at `date`" >> ~/profile.log
>
> just to see what is getting executed when (you won't want to leave this
> there - just for diagnostic and experimentation to help understand when
> things are being sourced. You could even dump out the output of 'env' so
> that you can see how the environment is being changed as each of these
> files executes.
>
>
Yup, thanks.


> George Mauer  writes:
>
> > I am confused why no matter how I try to run shell commands they seem to
> be missing variables exported in profiles.
> >
> > I have added 3 variables to various startup scripts
> >
> >   - ~./bash-profile~ :: ~export GIM_BASH_PROFILE="yes"~
> >   - ~./bashrc~ :: ~export GIM_BASHRC="yes"~
> >   - ~./zshrc~ :: ~export GIM_ZSHRC="yes"~
> >
> > I am running emacs in GUI mode so I get why none of these are available
> *directly* in emacs, so then I try
> >
> >   #+begin_src shell :results list
> > env | grep GIM
> >   #+end_src
> >
> >   #+RESULTS:
> >
> > Ok that's kinda surprising, but I suppose it could be running ~/bin/zsh~
> (that's my ~shell-file-name~) directly
> >
> > what about
> >
> >   #+begin_src shell :results list
> > bash -c env | grep GIM
> >   #+end_src
> >
> >   #+RESULTS:
> >
> > That's pretty surprising. I would have expected running it directly to
> actually run my profile.
> >
> > Shockingly
> >
> >   #+begin_src shell :results list
> > bash --rcfile ~/.bashrc -c env | grep GIM
> >   #+end_src
> >
> >   #+RESULTS:
> >
> > That is *still* nothing!
> >
> > Sanity is restored slightly when I run
> >
> >   #+begin_src shell :results list
> > bash --login -c env | grep GIM
> >   #+end_src
> >
> > which *does* indeed visit ~.bash_profile~ but only slightly.
> >
> > What is going on, and is there a straightforward way in which I can get
> shell block to read from a profile?
>
>
> --
> Tim Cross
>
>


How to get shell source blocks to read my profile?

2021-03-14 Thread George Mauer
I am confused why no matter how I try to run shell commands they seem to be
missing variables exported in profiles.

I have added 3 variables to various startup scripts

  - ~./bash-profile~ :: ~export GIM_BASH_PROFILE="yes"~
  - ~./bashrc~ :: ~export GIM_BASHRC="yes"~
  - ~./zshrc~ :: ~export GIM_ZSHRC="yes"~

I am running emacs in GUI mode so I get why none of these are available
*directly* in emacs, so then I try

  #+begin_src shell :results list
env | grep GIM
  #+end_src

  #+RESULTS:

Ok that's kinda surprising, but I suppose it could be running ~/bin/zsh~
(that's my ~shell-file-name~) directly

what about

  #+begin_src shell :results list
bash -c env | grep GIM
  #+end_src

  #+RESULTS:

That's pretty surprising. I would have expected running it directly to
actually run my profile.

Shockingly

  #+begin_src shell :results list
bash --rcfile ~/.bashrc -c env | grep GIM
  #+end_src

  #+RESULTS:

That is *still* nothing!

Sanity is restored slightly when I run

  #+begin_src shell :results list
bash --login -c env | grep GIM
  #+end_src

which *does* indeed visit ~.bash_profile~ but only slightly.

What is going on, and is there a straightforward way in which I can get
shell block to read from a profile?


noweb expansion when eval and not tangle?

2021-02-19 Thread George Mauer
I would like noweb to expand during eval but *not* tangle. Is this possible?

I realize I can achieve the same effect with multiple code blocks but it
seems an odd asymmetry to not be able to do this directly.

Is it possible and just not documented?


Re: ist here a :post header arg for tangling?

2021-01-04 Thread George Mauer
So like I said, I would like to run some code to post-process files.
Nothing super-concrete, but a bunch of small use cases I've run into such as

- Running tests on every tangle
- Executing a code block in the same document and running tests after all
tangles
- Running a code-formatter such as prettierjs (or the python one which name
escapes me - autopep?) and potentially de-tangling back

I realize some of these things I could do with a file watcher, but not
really the ones that require modifying the document again

On Fri, Jan 1, 2021 at 6:29 AM Immanuel Litzroth <
immanuel.litzr...@gmail.com> wrote:

> I don't think there is an arg for that. I have written a tangler that
> reuses a lot
> of the org-babel machinery and has a more flexible mechanism to decide what
> to do with the tangled code -- I use it for example to not write a
> tangled file if it
> hasn't changed, meaning that it will not trigger recompile.
> The project is private now but if you're interested I can give you access
> to it.
> What exactly are you trying to do?
> Immanuel
>
> On Fri, Jan 1, 2021 at 2:09 AM George Mauer  wrote:
> >
> > I'd like to run some code to post-process files after they are tangled.
> Is there a header-arg for that?
>
>
>
> --
> -- Researching the dual problem of finding the function that has a
> given point as fixpoint.
>


ist here a :post header arg for tangling?

2020-12-31 Thread George Mauer
I'd like to run some code to post-process files after they are tangled. Is
there a header-arg for that?


Re: Emacs as an Org LSP server

2020-12-13 Thread George Mauer
I think maybe you might be thrown off by the word "server"? Lsp is just a
standardization of how an editor can do language-specific things. The fact
that standardization exists makes the whole thing pluggable by various
services. These typically run in a separate process - which is a good idea
anyways - on the same machine and the plugin just starts that prices and
communicated to it.

Typescript, c#, I think python, and JavaScript (and maybe Java?) plugins
already do this

On Sun, Dec 13, 2020, 14:34 Jean Louis  wrote:

> * TEC  [2020-12-13 20:35]:
> > > From a perspective that some server has to know what user is writing
> > > it is advisable to use one own's servers. But if idea gets popular
> > > some company will commercialize it and centralize user's data and
> > > privacy is gone.
> >
> > FYI the nature of LSP (as I understand it) is that the "server" is a
> > locally running service that responds to signals from a "client" (code
> > editor / IDE).
>
> That is how it starts until corporation like Github or somebody else
> takes it over. Just look at Github pattern. Git was decentralized
> system that they centralized for 50 million developers and included
> eye candies that one cannot self-host as one wants.
>
> Jean
>
>


Html export custom container with attribute

2020-12-12 Thread George Mauer
I know I can have a headline render to a custom container during export to
html with a property eg HTML_CONTAINER: details

But what If I want an attribute to set the state? Specifically I want the
container to be `` in some situation and just plain
`` in some others.

What are my options?

Thanks a lot,
George


Why are some headings html exported as lists while others aren’t?

2020-12-08 Thread George Mauer
I am practicing with org->html conversion by trying to export an html
resume.

I have the following

* Resume
** About
   :PROPERTIES:
   :HTML_CONTAINER: header
   :END:
*** George Mauer
:PROPERTIES:
:HTML_CONTAINER: h1
:END:
*** Contact
:PROPERTIES:
:HTML_CONTAINER: article
:HTML_CONTAINER_CLASS: contact
:END:
 Location
 :PROPERTIES:
 :HTML_CONTAINER: aside
 :HTML_CONTAINER_CLASS: city-state
 :END:
 New Orleans, LA
 Email
 :PROPERTIES:
 :HTML_CONTAINER_CLASS: email
 :END:
 [[mailto:gma...@gmail.com][gma...@gmail.com]]
 Blog
 :PROPERTIES:
 :HTML_CONTAINER_CLASS: blog
 :END:
 [[http://georgemauer.net][georgemauer.net]]
 LinkedIn
 :PROPERTIES:
 :HTML_CONTAINER_CLASS: linkedin
 :END:
 [[https://www.linkedin.com/in/george-mauer/][LinkedIn]]
 StackOverflow
 :PROPERTIES:
 :HTML_CONTAINER_CLASS: stackoverflow
 :END:
 [[https://stackoverflow.com/users/5056/george-mauer][StackOverflow]]
 GitHub
 :PROPERTIES:
 :HTML_CONTAINER_CLASS: github
 :END:
 [[https://github.com/togakangaroo/][GitHub]]


And the following .dir-locals.el

((org-mode . ((org-export-with-section-numbers . nil)
  (org-html-html5-fancy . 't)
  (org-export-with-toc . nil)
  (org-html-postamble . nil


When I export this to html the HTML_CONTAINER and HTML_CONTAINER_CLASS
properties are working for the Contact and my name and About headers, but
all the headers underneath Contact appear as `ul` with no classes.

It would seem that there's some sort of "level" beyond which heading are
not customizable.

Is that how it works? I'm not finding a variable I can override if it is.


Re: How to evaluate source code while in the edit buffer?

2020-12-04 Thread George Mauer
+1 to this question. I have the exact same annoyance (would also be nice to
do some threading so it doesn't lock up emacs for a few seconds)

On Fri, Dec 4, 2020 at 2:28 PM Pankaj Jangid  wrote:

> Mirko Vukovic  writes:
>
> > My current workflow is
> >
> >1. Enter edit buffer (C-c ')
> >2. Perform edits in the window
> >3. Exit edit mode (C-c ')
> >4. Evaluate code (C-c C-c)
> >5. Monitor changes to resulting png file
> >
> > I would prefer instead to skip step 3, and evaluate the code from within
> > the edit mode.
> >
> > Is it possible to execute code from the edit buffer?
>
> 1. When I enter the edit mode (C-c ') it connects to plantuml server
> (that I don't like), and produces the error that you have specified:
> "Wrong type argument: stringp, nil".
>
> 2. Pressing C-c C-c in the edit buffer opens up plantuml preview but it
> gives some error: "The plugin you are using seems to generate a bad
> URL".
>
> I am on Emacs 28.x and default org 9.3.
>
>


Re: Remembrance Agents

2020-11-28 Thread George Mauer
As far as I know the only thing remotely like that is the org-roam buffer
when you are in a file managed by org-roam. This would be simply a linkable
list of other roam notes which reference the currently viewed note

So not exactly what you're looking for I suspect but a similarish concept

On Sat, Nov 28, 2020, 11:01 Gerardo Moro  wrote:

> Is there currently any (good) implementation of the idea of the
> Remembrance Agents in Emacs?
> Thanks!
>


Re: How to get a block’s contents by name

2020-11-27 Thread George Mauer
Well that pains me on a software-engineer-aip-design level but that works!
Thanks a lot.

On Fri, Nov 27, 2020 at 8:22 PM Kyle Meyer  wrote:

> George Mauer writes:
>
> > I'm trying to figure out how I could fetch the contents of another block
> by
> > name from an elisp script
> >
> > I've seen `org-sbe` but I just want to get the block contents, (ideally
> > with noweb and vars filled in - just as it would be tangled if we were to
> > tangle it)
> >
> > How do I do that?
>
> How about something like this?
>
>   (save-excursion
> (goto-char (org-babel-find-named-block "b"))
> (org-babel-expand-src-block))
>


How to get a block’s contents by name

2020-11-27 Thread George Mauer
I'm trying to figure out how I could fetch the contents of another block by
name from an elisp script

I've seen `org-sbe` but I just want to get the block contents, (ideally
with noweb and vars filled in - just as it would be tangled if we were to
tangle it)

How do I do that?


Cannot load om while trying to load org

2020-10-25 Thread George Mauer
This might be a spacemacs-specific error, but maybe people here can help me
out?

I am getting the following error on org load
> (file-missing "Cannot open load file" "No such file or directory" "om")

(full stacktrace below)

Indeed, I get this:

> (require 'om)
> *** Eval error ***  Cannot open load file: No such file or directory, om

Yet `describe-package` shows that om *is* installed

```
om is a dependency package.

 Status: Installed in ‘om-20200927.1406/’ (unsigned).
Version: 20200927.1406
Summary: No description available.
```

Very possible that I don't know what I'm doing here, but it seems like
`require` should absolutely work should it not?

```
Debugger entered--Lisp error: (file-missing "Cannot open load file" "No
such file or directory" "om")
  require(om)
  (lambda nil (require (quote om)) t)()
  run-hooks(use-package--org--post-config-hook)
  (progn t (run-hooks (quote use-package--org--post-config-hook)))
  (if (run-hook-with-args-until-failure (quote
use-package--org--pre-config-hook)) (progn t (run-hooks (quote
use-package--org--post-config-hook
  (progn (if (run-hook-with-args-until-failure (quote
use-package--org--pre-config-hook)) (progn t (run-hooks (quote
use-package--org--post-config-hook t)
  (condition-case err (progn (if (run-hook-with-args-until-failure (quote
use-package--org--pre-config-hook)) (progn t (run-hooks (quote
use-package--org--post-config-hook t) ((debug error) (funcall
use-package--warning1336 :config err)))
  (lambda nil (condition-case err (progn (if
(run-hook-with-args-until-failure (quote
use-package--org--pre-config-hook)) (progn t (run-hooks (quote
use-package--org--post-config-hook t) ((debug error) (funcall
use-package--warning1336 :config err()
  eval-after-load(org (lambda nil (condition-case err (progn (if
(run-hook-with-args-until-failure (quote
use-package--org--pre-config-hook)) (progn t (run-hooks (quote
use-package--org--post-config-hook t) ((debug error) (funcall
use-package--warning1336 :config err)
  (progn (if (fboundp (quote org-clock-out)) nil (autoload (function
org-clock-out) "org" nil t)) (if (fboundp (quote
org-occur-in-agenda-files)) nil (autoload (function
org-occur-in-agenda-files) "org" nil t)) (if (fboundp (quote
org-agenda-files)) nil (autoload (function org-agenda-files) "org" nil t))
(condition-case err (if (run-hook-with-args-until-failure (quote
use-package--org--pre-init-hook)) (progn (progn (setq
org-startup-with-inline-images t org-src-fontify-natively t org-imenu-depth
8) :config (progn (font-lock-add-keywords (quote org-mode) (quote ...))
(evil-delay (quote ...) (quote ...) (quote after-load-functions) t nil
(format "evil-define-key-in-%s" ... (run-hooks (quote
use-package--org--post-init-hook ((debug error) (funcall
use-package--warning1336 :init err))) (eval-after-load (quote org)
(function (lambda nil (condition-case err (progn (if
(run-hook-with-args-until-failure ...) (progn t ...)) t) ((debug error)
(funcall use-package--warning1336 :config err)))
  (condition-case err (progn (if (fboundp (quote org-clock-out)) nil
(autoload (function org-clock-out) "org" nil t)) (if (fboundp (quote
org-occur-in-agenda-files)) nil (autoload (function
org-occur-in-agenda-files) "org" nil t)) (if (fboundp (quote
org-agenda-files)) nil (autoload (function org-agenda-files) "org" nil t))
(condition-case err (if (run-hook-with-args-until-failure (quote
use-package--org--pre-init-hook)) (progn (progn (setq
org-startup-with-inline-images t org-src-fontify-natively t org-imenu-depth
8) :config (progn (font-lock-add-keywords ... ...) (evil-delay ... ... ...
t nil ...))) (run-hooks (quote use-package--org--post-init-hook ((debug
error) (funcall use-package--warning1336 :init err))) (eval-after-load
(quote org) (function (lambda nil (condition-case err (progn (if ... ...)
t) ((debug error) (funcall use-package--warning1336 :config err)))
((debug error) (funcall use-package--warning1336 :catch err)))
  (progn (defvar use-package--warning1336 (function (lambda (keyword err)
(let ((msg (format "%s/%s: %s" ... keyword ...))) (display-warning (quote
use-package) msg :error) (condition-case err (progn (if (fboundp (quote
org-clock-out)) nil (autoload (function org-clock-out) "org" nil t)) (if
(fboundp (quote org-occur-in-agenda-files)) nil (autoload (function
org-occur-in-agenda-files) "org" nil t)) (if (fboundp (quote
org-agenda-files)) nil (autoload (function org-agenda-files) "org" nil t))
(condition-case err (if (run-hook-with-args-until-failure (quote
use-package--org--pre-init-hook)) (progn (progn (setq
org-startup-with-inline-images t org-src-fontify-natively t org-imenu-depth
8) :config (progn ... ...)) (run-hooks (quote
use-package--org--post-init-hook ((debug error) (funcall
use-package--warning1336 :init err))) (eval-after-load (quote org)
(function (lambda nil (condition-case err (progn ... t) (... ...))
((debug error) (funcall use-package--warning1336 :catch 

Control where files are emitted during block eval

2020-09-16 Thread George Mauer
I would like to create a playground.org file inside my node project where I
will put bits of code that I'm playing with during development.

The problem is that when I actually evaluate a source block it gets written
into a temporary location that I do not control - I therefore cannot
`require` my project's node modules as they will not be found.

Is there a way to control the location the temp file is written? Maybe -
assuming it uses `with-temp-file` - a way to control its directory and file
name generation algorithm via a header?


Re: Can you automatically noweb include?

2020-08-08 Thread George Mauer
For what its worth, I maintain (well maintain is a big word when I'm also
probably the only person to use it) this fork of xchrishawk/ob-racket:
https://github.com/togakangaroo/ob-racket

It seems to have more features than the wallyqs one supporting :var headers.
I can look at how prologue support works in others and add it, but I also
am surprised that this is up to the plugin authors *at all*. As you pointed
out, that means that it can't possibly support noweb expansion

On Fri, Aug 7, 2020 at 11:47 PM Tom Gillespie  wrote:

> After a bit of investigation, it seems that wallyqs implementation of
> ob-racket does not treat/manage :prologue arguments correctly, which
> is worrying because I would assume that the semantics for how prologue
> works should not be something that could be accidentally broken by
> ob-* implementations (but that is a separate issue). More relevant to
> this thread is that python the prologue works as others have reported,
> but if you include a noweb reference in the prologue it does not get
> expanded. It is quite possible that this should be considered a bug
> since it means that prologues are added only after the main block is
> expanded. This seems incorrect, and I suspect that it is another bug
> related to the one fixed in df5a83637518ad9aa586d49884a6271f11afc592
> (discussion here
>
> https://orgmode.org/list/ca+g3_pni3umvbiwgbdkuc3c6vjt1t1j-rkh43lrqybr+4ns...@mail.gmail.com/
> ).
> The fact that prologue is not expanded means that you can modify what
> code is run by putting it in a prologue and org mode will be none-the
> wiser. The sha1 changes if you set :cache yes, which means that
> something in the execution code is doing something different than in
> the block hashing code. Further investigation required.
>
> * Use the code
> :PROPERTIES:
> :header-args:python: :prologue "<>"
> :END:
>
> #+name: python-helper
> #+begin_src python
> asdf = lambda : 'result'
> #+end_src
>
> #+begin_src python :noweb yes
> return asdf()
> #+end_src
>
> On Fri, Aug 7, 2020 at 9:20 PM Tom Gillespie  wrote:
> >
> > Hah, this is what I get for not reading carefully enough. I wonder if
> > it is possible to stick <> in the prologue and have it
> > expand.
> >
> > On Fri, Aug 7, 2020 at 9:18 PM Tom Gillespie  wrote:
> > >
> > > I don't see a direct answer to the original question in the thread, so
> > > here is an example of how I do it taken from
> > >
> https://raw.githubusercontent.com/SciCrunch/sparc-curation/master/docs/developer-guide.org
> .
> > > You can ctrl-f for racket-graph-helper to see the relevant blocks. A
> > > reduced version is below. Recall that I use
> > > https://github.com/wallyqs/ob-racket. I use this pattern all over the
> > > place in my org blocks. Best,
> > > Tom
> > >
> > > * Use the code
> > > :cache yes"
> > > #+begin_src racket :lang racket/base :noweb yes
> > > <>
> > > (helper-function "this should work")
> > > #+end_src
> > >
> > > #+RESULTS:
> > > : this should work hello world
> > >
> > >
> > > * Define the helpers
> > > #+name: racket-helper
> > > #+header: :prologue "#lang racket/base"
> > > #+begin_src racket :lang racket/base
> > > (define (helper-function arg)
> > >   (string-append arg " hello world"))
> > > #+end_src
>


Re: Can you automatically noweb include?

2020-08-07 Thread George Mauer
Is there a straightforward way to have a multiline prologue? Or maybe use
the body of named block as prologue?

On Fri, Aug 7, 2020 at 5:02 PM William McCoy  wrote:

> Yes, of course, that was it!  I ran into that issue a few months ago and
> then I forgot about again!
>
> Thanks both for your help!
>
> Bill
>
> On 8/7/20 5:25 PM, Berry, Charles wrote:
> > Good catch. Also it works if you put the property block at the very
> beginning of the file.
> >
> > This sometimes helps:
> >
> > M-x org-lint RET
> >
> > which in this case reports "Incorrect contents for PROPERTIES drawer"
> >
> > which is a bit cryptic IMO, but does point to any issue with the
> property.
> >
> > HTH,
> >
> > Chuck
> >
> >> On Aug 7, 2020, at 2:18 PM, Thomas S. Dye  wrote:
> >>
> >> It works here if you remove the blank line between the headline and the
> PROPERTIES block.
> >>
> >> William McCoy writes:
> >>
> >>> Chuck,
> >>>
> >>> Thanks very much for your response.  I didn't know about those
> options.  When I
> >>> use C-c C-v C-i, I get the following:
> >>>
> >>> Lang: python
> >>> Properties:
> >>> :header-argsnil
> >>> :header-args:python nil
> >>> Header Arguments:
> >>> :cache  no
> >>> :exportscode
> >>> :hlines no
> >>> :noweb  no
> >>> :resultsoutput replace
> >>> :sessionnone
> >>> :tangle no
> >>>
> >>> And C-c C-v C-v, shows that the import statements in the header do not
> get
> >>> expanded into the code block.
> >>>
> >>> So I am obviously doing something wrong.  There appear to be no typos
> or
> >>> misspellings and the org file containing the coded is exactly this:
> >>>
> >>> * Test of prologue header
> >>>
> >>> :PROPERTIES:
> >>> :header-args:python+: :prologue "import numpy as np; import os"
> >>> :END:
> >>>
> >>> #+BEGIN_SRC python :results output
> >>> print(np.__version__)
> >>> #+END_SRC
> >>>
> >>> #+RESULTS:
> >>>
> >>>
> >>> My init file has no org babel header arguments defined.
> >>>
> >>> I am using C-c C-v C-b or C-c C-v C-s to evaluate and I get
> >>>
> >>> "Code block produced no output." in the mini-buffer.
> >>>
> >>>
> >>> If I use C-c C-c directly on the code block itself I get:
> >>>
> >>> Traceback (most recent call last):
> >>>   File "", line 1, in 
> >>> NameError: name 'np' is not defined
> >>>
> >>> Is there something else I need to do to get babel to recognize the
> header-args?
> >>>
> >>> Thanks
> >>>
> >>>
> >>> On 8/7/20 12:51 PM, Berry, Charles wrote:
> >>>>> On Aug 7, 2020, at 8:39 AM, William McCoy  wrote:
> >>>>>
> >>>>> This use of :prologue appeared to me to be very useful.  But for
> some reason when I try it out it does not work for me.  I just get a
> message that the code block produced no output and that 'np' is not
> defined.  Just to check, when I put the import statements directly within
> my code block it works fine.
> >>>>>
> >>>>> I am running:  Org mode version 9.3.7 (9.3.7-16-g521d7f-elpa
> >>>>>
> >>>>> Any idea what I'm doing wrong?
> >>>>>
> >>>>>
> >>>> It is sometimes useful to use C-c C-v C-i to see what header args org
> has detected for a source block. Misspelled words sometimes wreak havoc and
> invisible characters can cause real pain.
> >>>>
> >>>>
> >>>> Also, it helps to use C-c C-v C-v to to see the expanded code block.
> When I do this with Kens' ECM, I get
> >>>>
> >>>> import numpy as np; import os
> >>>> print(np.__version__)
> >>>>
> >>>> in the preview buffer.
> >>>>
> >>>> HTH,
> >>>>
> >>>> Chuck
> >>>>
> >>>>
> >>>>> On 8/6/20 2:12 PM, Ken Mankoff wrote:
> >>>>>> Actual example:
> >>>>>>
> 

Can you automatically noweb include?

2020-08-05 Thread George Mauer
Use case:

I'm using ob-racket  but this
would apply just as well to a few other workflows I have with python or js.

I would like to write a helper function in a src block and then
automatically have access to it in other src blocks further down the
document. I don't really want a stateful session (nor does ob-racket
support sessions) so I essentially want the equivalent of automatically
including it everywhere so I don't have to type it out all the time (and
have it screw up syntax coloring/indentation).

Is this currently possible? Does anyone have any ideas for how to extend
things so it is?


Updates to ob-racket mode, code review request

2020-07-09 Thread George Mauer
I'm a big fan of using org mode to learn languages and have been using it
for Racket (sorry Dr Racket, I just love emacs too much). It's been mostly
fine and I've made a few patches to the [`ob-racket`](
https://github.com/xchrishawk/ob-racket) I've been using. Recently I've
started to move into the build-your-own-language parts of Racket and found
that ob-racket didn't support custom language directives. So [I modified it
to support them](https://github.com/togakangaroo/ob-racket).

I'm pretty new at elisp, so would anyone be willing to give me a code
review to make sure I didn't do anything completely stupid? [It is a single
not-too-large file](
https://github.com/togakangaroo/ob-racket/blob/master/ob-racket.el).

Also looking for opinions on whether this is helpful enough/good enough to
be worth pushing to melpa.


Get generators working in an src block?

2020-07-04 Thread George Mauer
I prefer to use source blocks for pretty much all my language learning.

I am trying to figure out generators in emacs-lisp but can't seem to run it
in a block.

I have

```
#+begin_src emacs-lisp :results output
  (setq lexical-binding t)
  (require 'generator)

  (iter-defun my-iter (x)
(let (val (iter-yield (1+ x)))
  (iter-yield (1+ val)))
-1)

  (let* ((it1 (my-iter 5))
 (it2 (my-itr 0)))
(print (iter-next it1))
(print (iter-next it1 8))
(print (iter-next it2 nil))
(condition-case x
(iter-next it1)
  (iter-end-of-sequence
   (print (cdr x)
#+end_src
```

But running that gives me

> executing Emacs-Lisp code block...
> cl--assertion-failed: Assertion failed: lexical-binding

I thought that setting lexical-binding to t was enough, but apparently
something else is needed?


Bug: Export to html not working [9.3.7 (9.3.7-2-g706970-elpaplus @ /Users/gmauer/.emacs.d/elpa/develop/org-plus-contrib-20200608/)]

2020-06-12 Thread George Mauer
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


I wrote the following literate-programming style org file
https://github.com/togakangaroo/daily-programmer/blob/master/get-directories/README.org

When I run org-export-dispatch on this and export it to an html file it
creates a single file which - aside from the footer - contains only a
single letter `n` as contents

Emacs  : GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS
appkit-1671.20 Version 10.14.3 (Build 18D109))
 of 2019-09-02
Package: Org mode version 9.3.7 (9.3.7-2-g706970-elpaplus @
/Users/gmauer/.emacs.d/elpa/develop/org-plus-contrib-20200608/)

current state:
==
State could not be dumped due to the following error:

(invalid-function evil-define-key)

You should still send this bug report.


Re: Get Grades Done: the joys of Org's simple power

2020-06-10 Thread George Mauer
You know...I believe some people have gotten emacs running in browser...
You could do it by compiling it to wasm. So in theory you could create a
completely in-browser emacs which is optimized primarily for org mode usage.

Would be kind of an awesome thing for someone to tackle as it would greatly
increase the reach of org. Not easy though. Could probably be a whole
thesis project.

Not sure how well it would work with screen readers and other accessibility
tech though. That would be even more work

On Wed, Jun 10, 2020, 10:24 PM Russell Adams 
wrote:

> On Wed, Jun 10, 2020 at 03:38:43PM -0500, Devin Prater wrote:
> > Now, I do wish I could share these “self-grading” performance tests with
> > others. I’ve tried exporting one to HTML, but the grade doesn’t seem to
> update
> > automatically like it does in Org-mode.
>
> Unfortunately updating the count is performed by a hook in Org when you
> use C-c
> C-c to check/uncheck a box. That information is static in the text, and
> static
> in html.
>
> I'm not aware of a built-in way to handle that case. Sorry.
>
> --
> Russell Adamsrlad...@adamsinfoserv.com
>
> PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/
>
> Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
>
>


How to supply multiples of a custom src block header arg

2020-05-31 Thread George Mauer
It would seem that `:var` in src blocks gets special treatment.

I am hacking on ob-racket trying to add the ability to require from a
header (the `:results value` mode wraps everything in a `let` so you need
something special to put requires at the top level).

I do this

```
#+begin_src racket :require rebellion/collection/list :require
rebellion/streaming/transducer :var foo=1 :var bar=2
  (transduce (in-range 1 10)
 (folding + 0)
 #:into into-list)
#+end_src
```

Note there’s two `:var` headers and two custom `:require` headers

Yet when in my `org-babel-execute:racket` function I log `params`

```
(defun org-babel-execute:racket (body params)
  "Executes a Racket code block."
  (message "==params %s" params)
  ...
```

I get

```
==params ((:var foo . 1) (:var bar . 2) (:colname-names) (:rowname-names)
(:result-params replace) (:result-type . value) (:results . replace)
(:exports . code) (:session . none) (:cache . no) (:noweb . no) (:hlines .
no) (:tangle . no) (:lang . racket) (:require .
rebellion/streaming/transducer))
```

Note that both `:var` headers have corresponding cons cells but only the
last `:require` header does

What is causing this behavior and how would I modify it?


How to both export html and show the code?

2020-05-27 Thread George Mauer
I would like to both render html and show a source block for the rendered
html (I am aware of ob-browser, but I want this to be dynamic html content,
not an image)

I would have thought the following would work, but noweb returns an empty
string

Well, this is solvable with css is it not?

#+name: challenge-1-solution
#+begin_export html

  
  
#gradient-colors div {
  width: 400px;
  height: 200px;
  animation: gradient 5s infinite linear;
}
@keyframes gradient {
  0% {
background-color: hsl(0, 100%, 50%);
  }
  25% {
background-color: hsl(90, 100%, 50%);
  }
  50% {
background-color: hsl(180, 100%, 50%);
  }
  75% {
background-color: hsl(270, 100%, 50%);
  }
  100% {
background-color: hsl(360, 100%, 50%);
  }
}
  

#+end_export
#+begin_src html :eval no :exports code :noweb yes
  <>
#+end_src


How to get all headings from current location up to the root

2020-04-11 Thread George Mauer
I feel silly that I can’t figure this out but how do I get the current
heading, its parent, its parent parent, etc via elisp?


Improving Org Mode for VSCode - Thinking Aloud

2020-04-01 Thread George Mauer
With VSCode becoming ever-popular it seems like there might be some value
in getting org mode working there simply as a way of promoting org as an
excellent literate coding notebook.

VSCode already has a halfway decent org-mode but it doesn’t support
anything from Babel. I’m trying to think of relatively easy ways of adding
that ability. Here’s a thought: Most of babel that technically works
against the document itself, it doesn’t really need much document
integration with the editor. So could you get it working in vscode so long
as someone has a properly configured version of emacs installed locally?
“Evaluate/Export/etc” would just write the document, then use emacs to run
the appropriate commands on it and refresh the document view.

Of course features like the separate editor for src blocks and
folding #results would be nice too, but if the basics could work that would
be a huge win for org.

Any thoughts on the feasibility of this?


results block doesn't get replaced when doing :results raw

2020-03-10 Thread George Mauer
I've seen this happening a lot in a variety of modes. When I do `:results
raw`, on subsequent  evaluations, rather than replacing the results block,
it gets appended to.

This is almost never what I want. I remember seeing some use of `:results
raw replace` in some manual or another but that never really seems to work
for me.

Is there a property or something that can be set to always replace?


Re: Powershell scripting with org-babel

2020-02-10 Thread George Mauer
> Micro$loth WindBlows is a computer virus

Well that's mature and appropriate.

I recently did an implementation of `ob-pwsh` for supporting powershell
core (it assumes there’s a pwsh command available on PATH though thats
configurable with `org-babel-command:pws`). Here’s the link
https://github.com/togakangaroo/ob-pwsh. Instructions for installing are in
the README

It works ok and even supports variables but was a 3 hour hack job, plenty
of features missing. I hadn’t even announced it on this list before. The
code is pretty small though - under 60 loc if you want to contribute to it,
I’m game.

I also saw this a while ago but haven’t really dug in
https://old.reddit.com/r/emacs/comments/dkz0n1/babel_with_powershell/?st=k5jqc8es=b464c181

Oh, and powershell is awesome. It’s 2020, we *should* have a runtime in our
terminal (eshell somewhat does this and is pretty good because of it). One
of the things that would be really nice to do some day would be some sort
of conversion between powershell and lisp structures so that we could pass
structured data as hashes and lists between languages - not just strings.

On Mon, Feb 10, 2020 at 7:59 PM briangpowell . 
wrote:

> Micro$loth WindBlows is a computer virus
>
> But if you must use Windows, suggest you use Cygwin and BASH and/or EShell
> {the Emacs Shell}--you can do much more than PowerSh3ll
>
> And Emacs & OrgMode work very nicely on Cygwin
>
> On Mon, Feb 10, 2020 at 11:58 AM MS Window 
> wrote:
>
>> Hello,
>>
>> can you help me ? I want to use org-babel for Powershell scripting. I
>> found this code chunk on the internet for customizing org-babel for
>> Powershell on github:
>>
>> https://gist.github.com/cbilson/ae0d90d163be4d769f8a15ddb58292bc
>>
>> There is no explanation there I should put the configuration. The
>> org-babel documentation is too brief for me as beginner to understand.
>>
>> Yours sincerely
>>
>> Claus Keller
>>
>>
>>
>>


Have :var reference a value

2019-12-08 Thread George Mauer
I'm playing around with learning racket in an org buffer and I have a bunch
of blocks that look like this

   #+begin_src racket :var value="abbracadaabra"
   ...do stuff with value...
   #+end_src


   #+begin_src racket :var value="abbracadaabra"
   ...do other stuff with value...
   #+end_src

Is there a way to move the "abbracadaabra" string into a single location so
that I can just pull the var from that? I know I can put it in a table or a
list, but how about into a single value?


Re: “Literate” python?

2019-11-29 Thread George Mauer
I've used noweb references to actually assemble what will be tangled all at
once. See how I did it here

.

The reason why the "incorrect" block is outdented is that tangle
automatically tries to guess indentation level. (Take that as a handwavy
thing - I don't know exactly how it does that nor how configurable it is)
The solution I've found is noweb - basically you *wouldn't* tangle any of
those blocks, but would create another non-evaluated or exportable block
that has noweb references to the above blocks and how you want them
arranged. *This* is the block you tangle.

I haven't yet figured out how, but it should be possible to automatically
configure things to run autopep8 after tangling - that would take care of
indentation issues.

Also I'm pretty sure there's no :weave header arg...at least I haven't seen
it used and can't find it documented anywhere.

On Fri, Nov 29, 2019 at 12:08 PM Norman Walsh  wrote:

> Hi,
>
> I’ve seen a couple of pointers recently to using Org mode and tangle
> to write more literate Emacs configurations. I use Org+babel all the
> time to write “interactive” documents, so I thought I’d try out tangle
> from Org.
>
> I didn’t want to start with something as comlicated as my Emacs
> config :-) so I figured I’d kick the tires with a small python
> program. That did not end well.
>
> Consider:
>
> #+TITLE: Python literate programming
> #+OPTIONS: html-postamble:nil
>
> It starts off as a completely standard Python3 program.
>
> ---%<--
> #+BEGIN_SRC python :tangle yes :weave no
> #!/usr/bin/env python3
>
> #+END_SRC
>
> It defines ~a~.
>
> #+BEGIN_SRC python :tangle yes
> def a():
> print("a")
>
>
> #+END_SRC
>
> And ~b~.
>
> #+BEGIN_SRC python :tangle yes
> def b():
> print("b")
>
>
> #+END_SRC
>
> Now ~c~ is a little more complicated:
>
> #+BEGIN_SRC python :tangle yes
> def c():
>print("c")
> #+END_SRC
>
> Not only does ~c~ print “c”, it calls ~a()~ and ~b()~.
>
> #+BEGIN_SRC python :tangle yes
>b()
>a()
> #+END_SRC
>
> Finally, make it importable. Not that you’d want to.
>
> #+BEGIN_SRC python :tangle yes
> if __name__ == "__main__":
> main()
> #+END_SRC
> --->%--
>
> That’s the script. It weaves into HTML more-or-less ok (there’s a
> weird black box at the front of indented lines, but I can come back to
> that later).
>
> It’s a complete mess when tangled.
>
> The extra blank lines between functions (to make pylint happy with
> some PEP guideline) have disappeared. I guess I could live with that,
> but the complete failure to preserve indention in the penultimate code
> block is a show stopper:
>
> #!/usr/bin/env python3
>
> def a():
> print("a")
>
> def b():
> print("b")
>
> def c():
>print("c")
>
> b()
> a()
>
> if __name__ == "__main__":
> main()
>
> (Also, why is there an extra blank line before the incorrectly
> indented block?)
>
> Is this user error on my part somehow? I suppose I could write my own
> version of tangle, though I’m not clear if the whitespace is lost in
> the tangle function or in the Org mode data model.
>
> Thoughts?
>
> Be seeing you,
>   norm
>
> --
> Norman Walsh  | We discover in ourselves what others
> http://nwalsh.com/| hide from us, and we recognize in
>   | others what we hide from
>   | ourselves.--Vauvenargues
>


Re: Org export to HTML with encrypted information ??

2019-11-29 Thread George Mauer
Basic "I'm not too worried about it" level of security: stick it on a
webserver using .htaccess to demand a password. Make that password halfway
decent.

Better option: export to PDF by either exporting to HTML or latex and then
using that system's PDF export. Keep both PDF and original in a folder on
Google drive or Dropbox that is shared only with those who need access. (No
password needed at all so you won't have someone compromising you with a
crap password)

Best option: same thing but store those files in a respected password
manager like 1password or keepass. Train your family to use the password
manager. Use it as a vault for all sorts of "just in case, they should
know" info.

In theory, you could even automate things to work on a deadman's switch.
Have a system that pings you via email, SMS, or another communications
mechanism weekly. If you don't respond within a few days, it automatically
shares the aforementioned files using gdrive, Dropbox, 1password, etc (not
email though - email is not secure)

On Fri, Nov 29, 2019, 5:56 AM Marcin Borkowski  wrote:

>
> On 2019-11-29, at 08:24, David Masterson  wrote:
>
> > My use-case is this:
> >
> > I'd like to use Org to write up *all* the information about my family
> > life (so to speak) including medical histories of my family, issues with
> > the house, bank accounts, financial information, etc., so that my family
> > has all the information to refer to when necessary in a (hopefully)
> > well-structured form.  Naturally, this is going to have a fair amount of
> > really sensitive information.  By carefully outlining the information, I
> > can structure the sensitive information to be in key parts of the
> > documents that I can then encrypt using org-crypt.
> >
> > That part is straightforward.  The tricky part is that my family is not
> > "Emacs literate" and, so, I'm thinking the best idea is to export the
> > information from Org files to HTML files so that I can then present to
> > them as a website.  They are used to browsing the web, so this should be
> > more natural to them.  The problem that I'm looking for help with is how
> > to deal with the encrypted information?  Any suggestions?
>
> This is a very interesting and important question.  I don't have any
> advice, but I would very much like to hear what others have to say.
>
> While this does not answer your question (but is related): who is going
> to have the password/passphrase?  Have you considered using a secret
> sharing scheme?
>
> Best,
>
> --
> Marcin Borkowski
> http://mbork.pl
>
>