[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Helo for defun/macro arguments list in minibuffer when in org-babel

From: Arthur Miller
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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

(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 via email to

[Prev in Thread] Current Thread [Next in Thread]