emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* map function definitions to org src blocks?
@ 2018-11-08 22:27 Matt Price
  2018-11-08 23:02 ` John Kitchin
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Price @ 2018-11-08 22:27 UTC (permalink / raw)
  To: Org Mode

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

I feel like I saw someone do this but can't find it in my notes. When
tangling code to elisp, is it possible to point ~describe-function~ to the
original org-mode source (or at least the src block) as the "source code"
for the function, rather than the resultant .e file produced by
org-babel-tangle? Seems like this would make a whole lot of things
significantly easier when writing emacs inits, for instnace.

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

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

* Re: map function definitions to org src blocks?
  2018-11-08 22:27 map function definitions to org src blocks? Matt Price
@ 2018-11-08 23:02 ` John Kitchin
  2018-11-09  3:22   ` Matt Price
  0 siblings, 1 reply; 4+ messages in thread
From: John Kitchin @ 2018-11-08 23:02 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

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

I wrote something kind of like this at
https://github.com/jkitchin/scimax/blob/master/scimax-literate-programming.el


It might solve a different problem related to navigating code embedded in
org files.

I don't think it works on describe-function. That would be an interesting
addition perhaps. I guess though that describe-function would go to the
elisp code. I never figured out how to get links in the tangled code to
jump back to the org file though.

On Thu, Nov 8, 2018 at 5:39 PM Matt Price <moptop99@gmail.com> wrote:

> I feel like I saw someone do this but can't find it in my notes. When
> tangling code to elisp, is it possible to point ~describe-function~ to the
> original org-mode source (or at least the src block) as the "source code"
> for the function, rather than the resultant .e file produced by
> org-babel-tangle? Seems like this would make a whole lot of things
> significantly easier when writing emacs inits, for instnace.
>
-- 
John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

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

* Re: map function definitions to org src blocks?
  2018-11-08 23:02 ` John Kitchin
@ 2018-11-09  3:22   ` Matt Price
  2018-11-09 14:40     ` John Kitchin
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Price @ 2018-11-09  3:22 UTC (permalink / raw)
  To: John Kitchin; +Cc: Org Mode

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

THanks John. I guess I should always just start my search for "something
cool I saw" in scimax...

Yes, thisis pretty great. I havebeen using ~helpful~ which hasa nice
interface for some extra functions, but these functions do most of what I
felt was missing.

On Thu, Nov 8, 2018 at 6:02 PM John Kitchin <jkitchin@andrew.cmu.edu> wrote:

> I wrote something kind of like this at
>
> https://github.com/jkitchin/scimax/blob/master/scimax-literate-programming.el
>
>
> It might solve a different problem related to navigating code embedded in
> org files.
>
> I don't think it works on describe-function. That would be an interesting
> addition perhaps. I guess though that describe-function would go to the
> elisp code. I never figured out how to get links in the tangled code to
> jump back to the org file though.
>
> On Thu, Nov 8, 2018 at 5:39 PM Matt Price <moptop99@gmail.com> wrote:
>
>> I feel like I saw someone do this but can't find it in my notes. When
>> tangling code to elisp, is it possible to point ~describe-function~ to the
>> original org-mode source (or at least the src block) as the "source code"
>> for the function, rather than the resultant .e file produced by
>> org-babel-tangle? Seems like this would make a whole lot of things
>> significantly easier when writing emacs inits, for instnace.
>>
> --
> John
>
> -----------------------------------
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>

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

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

* Re: map function definitions to org src blocks?
  2018-11-09  3:22   ` Matt Price
@ 2018-11-09 14:40     ` John Kitchin
  0 siblings, 0 replies; 4+ messages in thread
From: John Kitchin @ 2018-11-09 14:40 UTC (permalink / raw)
  To: Matt Price; +Cc: org-mode-email

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

It looks like it is possible to get describe-func to point to an org-file.
Suppose I have a file /Users/jkitchin/vc/journal/2018/11/09/2018-11-09.org
that has src blocks that tangle to
/Users/jkitchin/vc/journal/2018/11/09/test.el. When test.el is loaded, it
adds a bunch of stuff to the variable load-history that describe-function
can use to get information. For example:

#+BEGIN_SRC emacs-lisp
(assoc "/Users/jkitchin/vc/journal/2018/11/09/test.el" load-history)
#+END_SRC

#+RESULTS:
: (/Users/jkitchin/vc/journal/2018/11/09/test.el (defun . some-func))

One solution is to just change the file name in load-history like this.

#+BEGIN_SRC emacs-lisp
(setf (car (assoc "/Users/jkitchin/vc/journal/2018/11/09/test.el"
load-history)) "/Users/jkitchin/vc/journal/2018/11/09/2018-11-09.org")
#+END_SRC
John

Something like this could be handled in an :after advice for example.

This is only lightly tested... I don't know if it has other implications.

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Thu, Nov 8, 2018 at 10:22 PM Matt Price <moptop99@gmail.com> wrote:

> THanks John. I guess I should always just start my search for "something
> cool I saw" in scimax...
>
> Yes, thisis pretty great. I havebeen using ~helpful~ which hasa nice
> interface for some extra functions, but these functions do most of what I
> felt was missing.
>
> On Thu, Nov 8, 2018 at 6:02 PM John Kitchin <jkitchin@andrew.cmu.edu>
> wrote:
>
>> I wrote something kind of like this at
>>
>> https://github.com/jkitchin/scimax/blob/master/scimax-literate-programming.el
>>
>>
>> It might solve a different problem related to navigating code embedded in
>> org files.
>>
>> I don't think it works on describe-function. That would be an interesting
>> addition perhaps. I guess though that describe-function would go to the
>> elisp code. I never figured out how to get links in the tangled code to
>> jump back to the org file though.
>>
>> On Thu, Nov 8, 2018 at 5:39 PM Matt Price <moptop99@gmail.com> wrote:
>>
>>> I feel like I saw someone do this but can't find it in my notes. When
>>> tangling code to elisp, is it possible to point ~describe-function~ to the
>>> original org-mode source (or at least the src block) as the "source code"
>>> for the function, rather than the resultant .e file produced by
>>> org-babel-tangle? Seems like this would make a whole lot of things
>>> significantly easier when writing emacs inits, for instnace.
>>>
>> --
>> John
>>
>> -----------------------------------
>> Professor John Kitchin
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu
>>
>>

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

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

end of thread, other threads:[~2018-11-09 14:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-08 22:27 map function definitions to org src blocks? Matt Price
2018-11-08 23:02 ` John Kitchin
2018-11-09  3:22   ` Matt Price
2018-11-09 14:40     ` John Kitchin

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

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

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