emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: drymer <drymer@autistici.org>
To: Kaushal Modi <kaushal.modi@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Using org-entities to escape symbols
Date: Wed, 11 May 2016 05:14:13 +0000	[thread overview]
Message-ID: <7ebde954-9265-7c08-1d9e-662647616ec2@autistici.org> (raw)
In-Reply-To: <CAFyQvY1W4pE+OWLQ6hpdh3WzRHfbNqGYcNh1n8p1EFGPNtuCZA@mail.gmail.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 1591 bytes --]

It's working! Thank you very much for your time, this will be very useful.

Kaushal Modi:
> On Tue, May 10, 2016 at 6:51 PM Kaushal Modi <kaushal.modi@gmail.com> wrote:
> 
>> I will see if I can find a workaround for it on 24.5.
>>
> 
> Here's a final try ..
> 
> Please replace the advising function with this one:
> 
> (defun modi/org-insert-org-entity-maybe (orig-fun &rest args)
>   "When the universal prefix C-u is used before entering any character,
> insert the character's `org-entity' name if available."
>   (let ((pressed-key (char-to-string (elt (this-single-command-keys) 0)))
>         entity-name)
>     (when (and (listp args) (eq 4 (car args)))
>       (setq entity-name (modi/org-entity-get-name pressed-key))
>       (when entity-name
>         (setq entity-name (concat "\\" entity-name "{}"))
>         (insert entity-name)
>         (message (concat "Inserted `org-entity' "
>                          (propertize entity-name
>                                      'face 'font-lock-function-name-face)
>                          " for the symbol "
>                          (propertize pressed-key
>                                      'face 'font-lock-function-name-face)
>                          "."))))
>     (when (null entity-name)
>       (apply orig-fun args))))
> 
> The only change is in this line:
> 
>  (let ((pressed-key (char-to-string (elt (this-single-command-keys) 0)))
> 
> I have quickly verified it to work the same in  both emacs 24.5 and emacs
> 25.x.
> 
> Let me know. Thanks for testing the code.
> 

[-- Attachment #1.1.2: 0x5DDFDAAD.asc --]
[-- Type: application/pgp-keys, Size: 6235 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

      parent reply	other threads:[~2016-05-11  5:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-10 19:26 Using org-entities to escape symbols drymer
2016-05-10 19:38 ` Kaushal Modi
2016-05-10 19:53   ` Kaushal Modi
2016-05-10 20:25     ` drymer
2016-05-10 20:31       ` John Kitchin
2016-05-10 21:02         ` Thomas S. Dye
2016-05-10 20:33       ` Kaushal Modi
2016-05-10 21:24         ` drymer
2016-05-10 21:46           ` Kaushal Modi
2016-05-10 22:16             ` drymer
2016-05-10 22:51               ` Kaushal Modi
2016-05-10 23:00                 ` Kaushal Modi
2016-05-10 23:22                   ` Kaushal Modi
2016-05-11  5:14                   ` drymer [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=7ebde954-9265-7c08-1d9e-662647616ec2@autistici.org \
    --to=drymer@autistici.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=kaushal.modi@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).