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 11:48:46 +0200	[thread overview]
Message-ID: <AM9PR09MB4977A024336A9C72288F15DB96E79@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <874kciivu6.fsf@gmail.com> (Tim Cross's message of "Sun, 25 Jul 2021 19:03:55 +1000")

Tim Cross <theophilusx@gmail.com> writes:

> Arthur Miller <arthur.miller@live.com> writes:
>
>> 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.
>
> Note that org-edit-special isn't really narrowing. Rather, it opens a
> new buffer (there are options to control how it does this i.e. replace
> org buffer, split to open in new buffer, open in new frame etc) which puts the source block
> into the native mode for the language being edited.  For example, if
> your editing an emacs-lisp block, the edit special buffer will be in
> emacs-lisp-mode and will have all the facilities you would normally have
> when opening an emacs lisp file.
>
> What it sounds like you want to do is just have all the (for example)
> emacs-lisp mode and associated minor modes activated when your cursor is
> within a source block within the org buffer. This is extremely difficult
> to. Part of the problem is that modes like emacs-lisp-mode are designed
> to operate on buffers.

Yes indeed. I am quite aware of difficulties involved. I did myself a
small [[https://github.com/amno1/dired-auto-readme][hack to dired mode to "auto show" readme files]], and got into all
those problems there.

That one major mode per buffer is starting to be a limitation. What we
really would need is a major mode per region, or some other mean to be
able to combine modes. Maybe something like a "primary mode" which would
be what Emacs opens into when a file is loaded, i.e. 'org-mode' in this
example and secondary modes, which would be other major modes loaded,
and somehow activated per region or I don't know. But that is a
day-dreaming :). It would require rebuilding entire machinery.

>                        There are some 'special' packages, like mmm-mode
> which try to support this type of functionality, but to be honest, I've
> never found them very good and they often have significant performance
> problems.

Yes I know. I tried with mmm-mode, didn't really work well for me.

> Of course, this is emacs and you can probably get something mostly
> working, but it will take considerable effort and may well have
> performance hits as well as other unexpected side effects. I think your
> definitely 'swimming against the flow' and suspect that in the end, you

Haha, definitely :-). But that is the story of my entire life ;-).

Yes, in this case, that is correct. What I am doing here is bending
entire org-mode to do something it is not supposed to do. If you are
interested you can take a look at [[https://github.com/amno1/.emacs.d/blob/main/init.org][my little app on my github]]:

Look at "org hacks" under generator heading.

> will spend far more time trying to maintain your hacks rather than
> actually focusing on the work you want to get done. I originally went down a

That is what is hapening, but I started this as a hobby project as well
as a learning experience. I really suck at both Emacs internals and
elisp, so I need something like this as a learning project.

> Anyway, good luck.

Thanks, and thank you for the tips and feedback.


      reply	other threads:[~2021-07-25  9:49 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
2021-07-25  9:03     ` Tim Cross
2021-07-25  9:48       ` Arthur Miller [this message]

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=AM9PR09MB4977A024336A9C72288F15DB96E79@AM9PR09MB4977.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).