emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Custom keymaps on org blocks
Date: Sat, 10 Jun 2017 15:31:48 -0400	[thread overview]
Message-ID: <CAJ51ETq12knC1BOcwe+N2XJaqOPv_89HaSy0_FTdTLcjFYZ-4A@mail.gmail.com> (raw)
In-Reply-To: <m2a85gkkq1.fsf@andrew.cmu.edu>

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

In case anyone would like to try this themselves, I documented what I tried
here:
http://kitchingroup.cheme.cmu.edu/blog/2017/06/10/Adding-keymaps-to-src-blocks-via-org-font-lock-hook/

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


On Sat, Jun 10, 2017 at 9:58 AM, John Kitchin <jkitchin@andrew.cmu.edu>
wrote:

>
> Nicolas Goaziou writes:
>
> > Hello,
> >
> > John Kitchin <jkitchin@andrew.cmu.edu> writes:
> >
> >> On the other hand, there are times when I am working on a document that
> has
> >> a lot of short code blocks, e.g. for lecture notes or blog posts, where
> it
> >> is sufficiently tedious to me to switch in and out of the special edit
> mode
> >> that I wanted to try this solution out, and it became clear you can't
> >> really try it out without modifying the core org code that does the
> >> font-locking on a block.
> >
> > Are you sure about it? There are two hooks related to fontification:
> > `org-font-lock-set-keywords-hook' and `org-font-lock-hook'. I'm
> > surprised none can help you in this case.
>
> You are totally right on this. I can use org-font-lock-hook to take care
> of this. Thanks for the pointer.
>
> >
> >> I don't think we have to go so far as to say we make multiple major mode
> >> keybindings available, so much as context specific keybindings available
> >> where there is value in it. We already have this in org-speed keys for
> >> example, and even these can be context specific to do different things
> on
> >> headings (even different things on headings with specific properties)
> and
> >> blocks (
> >> http://kitchingroup.cheme.cmu.edu/blog/2016/12/22/Context-
> specific-org-mode-speed-keys/
> >> ).
> >
> > Neat hack.
>
> Thanks!
>
> >
> >> If there was a change to org to enable this, I wouldn't expect the core
> to
> >> change behavior for anyone, it would just make it possible for users to
> >> change this if they wanted to. The same way they can customize the face
> of
> >> a code block for different languages.
> >
> > Fair enough. Would you want to provide a proper patch?
>
> With the hook I don't think it is necessary. Thanks for all the
> discussion though (everyone) it was helpful to think it through.
> >
> > Thank you.
> >
> >
> > Regards,
>
>
> --
> 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: 4116 bytes --]

  reply	other threads:[~2017-06-10 19:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-05 21:53 Custom keymaps on org blocks John Kitchin
2017-06-06 18:16 ` Nicolas Goaziou
2017-06-07 12:58   ` John Kitchin
2017-06-07 13:21     ` Nicolas Goaziou
2017-06-07 13:50       ` John Kitchin
2017-06-08  0:22         ` Grant Rettke
2017-06-10  9:03         ` Nicolas Goaziou
2017-06-10 13:58           ` John Kitchin
2017-06-10 19:31             ` John Kitchin [this message]
2018-09-05 15:52               ` Matt Price
2017-06-07  1:22 ` Grant Rettke
2017-06-07 12:49   ` John Kitchin
2017-06-07 23:52     ` Grant Rettke

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=CAJ51ETq12knC1BOcwe+N2XJaqOPv_89HaSy0_FTdTLcjFYZ-4A@mail.gmail.com \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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).