emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Arthur Miller <arthur.miller@live.com>
To: Tim Cross <theophilusx@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Helo for defun/macro arguments list in minibuffer when in org-babel src blocks?
Date: Sun, 25 Jul 2021 10:50:30 +0200	[thread overview]
Message-ID: <DB9PR09MB49869671F514CE13214DEA1E96E79@DB9PR09MB4986.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <871r7ngrzt.fsf@gmail.com> (Tim Cross's message of "Sun, 25 Jul 2021 10:05:05 +1000")

Tim Cross <theophilusx@gmail.com> writes:

> Hi,
>
> when you are editing source blocks are you using org-edit-special, normally
> bound to C-c ') or are you just editing the source blocks directly within the
> org buffer?
No I don't narrow.

> The functionality you are referring to sounds like eldoc minor mode.
Yes it is, I was just looking at elisp-mode.el, and saw the eldoc
support. I tried to defadvice around with that scimax spoof function
from J.K's article, but I don't really get it to work.

> If you open a dedicated buffer to edit a file in the same language as your
> source blocks, do you see the behaviour you want. For example, open a file
> called test.el and edit some Emacs lisp. If you don't see the behaviour your
> after, you need to configure emacs-lisp-mode to load eldoc mode. Try typing M-x
> eldoc-mode <ret> and see if you then get the behaviour your after. If you do,
> then read up on eldoc-mode and how to enable it.

>                   Using org-edit-special ensures this occurs when necessary.
> Editing the source blocks directly does not.

I know, I would kind of like to skip to narrow back and forth. I
understand I maybe stretching it a bit, but kind-a cool if it could work
directly in src blocks without narrowing. 

> The environment you get with a dedicated buffer and that you get with
> org-edit-special should be roughly the same. So the trick is to get things
> working how you like them using a dedicated *.el buffer and then use
> org-edit-special whenever you need to edit source blocks. There is also another
> good reason to use org-edit-special - there are some situations where org needs
> to add some special escaping characters in source blocks to enable things to be
> parsed correctly.

Indeed. I had to introduce some macros because of <>[] chars being
parsed wrongly so syntax highlight and identation in src blocks get
screwed. I think I asked for helped about it. J.K. posted his answer in
SX, but I couldn't get that to work, so I just wrote few simple macros
that fixed at least syntax and indenting. Lispy is also really badly
screwed in org-buffer directly, at least for me cursor jumps all over
the place.

Anyway, after trying the "scimax-hack" (if I can call it so), which
works so fine with keymaps, I thought it might work with eldoc and
company too. I am just not sure which things to hook into that spoof
function.

(advice-add 'eldoc-mode :around 'scimax-spoof-mode)

That one let me enabke eldoc-mode which otherwise does not want to run
in org mode (for me at least). However I still don't see the defun
signature in echo area. I tried to hook via those two below:

(advice-add 'elisp-completion-at-point :around 'scimax-spoof-mode)
(advice-add 'elisp-eldoc-documentation-function :around 'scimax-spoof-mode)

but still nothing in echo area :).

Anyway, thanks for any help!

> Arthur Miller <arthur.miller@live.com> writes:
>
>> I have been doing quite some programming with elisp in org mode, and one
>> thing I am missing is this help that Emacs shows in minibuffer for
>> functions and macros. You can see the example in the attached image. I
>> am not sure what I have to enable (or disable? :)) to get it to work in
>> babel src blocks? Or is it even possible?
>>
>> Some few days ago I stumbled on a blog post by J. Kitchin about enabling
>> orignal mode maps in src block:
>>
>> <https://kitchingroup.cheme.cmu.edu/blog/2017/06/10/Adding-keymaps-to-src-blocks-via-org-font-lock-hook/>
>>
>> That was another thing I was missing, and that one work really well.
>> Thank yuu John!
>>
>> Can that hack be used to enable this help to pup up in minibuffer as
>> well. I am not familiar what causes that lookup, but I see it happends
>> even when Emacs is started with -Q option, so it is something built-in
>> and enabled by default, probably in elisp-mode itself.
>>
>> Last thing I miss is company doing it's thing. I can complete by
>> pressing TAB, but I would still like it to happen automatically. Is it
>> just me being noob and not enabling something, or is it bit more
>> coplicated than so?
>>
>> Sorry for the long writing, but basically what I ask is, can we get more
>> of usualy elisp stuff hanpening in babel src blocks?
>>
>
>
> Regards,
>
> Tim
>
> --
> *Tim Cross*
>
> /For gor sake stop laughing, this is serious!/


  reply	other threads:[~2021-07-25  8:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-24 19:50 Helo for defun/macro arguments list in minibuffer when in org-babel src blocks? Arthur Miller
2021-07-25  0:05 ` Tim Cross
2021-07-25  8:50   ` Arthur Miller [this message]
2021-07-25  9:03     ` Tim Cross
2021-07-25  9:48       ` Arthur Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DB9PR09MB49869671F514CE13214DEA1E96E79@DB9PR09MB4986.eurprd09.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=theophilusx@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).