emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Using org-entities to escape symbols


From: drymer
Subject: Re: [O] Using org-entities to escape symbols
Date: Wed, 11 May 2016 05:14:13 +0000

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 <address@hidden> 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: 0x5DDFDAAD.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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