emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Make ,* show up as * in babel blocks
@ 2013-12-23 21:12 Oleh
  2014-01-03 15:52 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: Oleh @ 2013-12-23 21:12 UTC (permalink / raw)
  To: org mode

Hi all,

When a line of babel source code starts with leading star
(also some other characters, see `org-unescape-code-in-string')
org-mode auto-escapes it with a comma.
I assume that there's no easy way not to add the comma.
But I think it should be possible to fontify it as if it's not there.

This comma is auto-removed for purposes of evaluation
or when switching to native mode to edit a source block.

The issue is that it's not removed when viewing the org-file.

Small example to illustrate: J souce "*/ 2 2" displays as

#+begin_src J
,*/ 2 2
#+end_src

I've found a work around:

(defvar keyword-comma-star
  '(("^\\(,\\*\\)" (1 (prog1 ()
                    (compose-region (match-beginning 1)
                                    (match-end 1)
                                    ?*))))))
(font-lock-add-keywords 'org-mode keyword-comma-star)

Is this good enough to add to org-babel core?
Maybe someone has a different option to fix the issue?

regards
Oleh

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Make ,* show up as * in babel blocks
  2013-12-23 21:12 Make ,* show up as * in babel blocks Oleh
@ 2014-01-03 15:52 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2014-01-03 15:52 UTC (permalink / raw)
  To: Oleh; +Cc: org mode

Hi Oleh,

Oleh <ohwoeowho@gmail.com> writes:

> When a line of babel source code starts with leading star
> (also some other characters, see `org-unescape-code-in-string')
> org-mode auto-escapes it with a comma.
> I assume that there's no easy way not to add the comma.
> But I think it should be possible to fontify it as if it's not there.
>
> This comma is auto-removed for purposes of evaluation
> or when switching to native mode to edit a source block.
>
> The issue is that it's not removed when viewing the org-file.
>
> Small example to illustrate: J souce "*/ 2 2" displays as
>
> #+begin_src J
> ,*/ 2 2
> #+end_src
>
> I've found a work around:
>
> (defvar keyword-comma-star
>   '(("^\\(,\\*\\)" (1 (prog1 ()
>                     (compose-region (match-beginning 1)
>                                     (match-end 1)
>                                     ?*))))))
> (font-lock-add-keywords 'org-mode keyword-comma-star)

I think it's a good candidate for
http://orgmode.org/worg/org-hacks.html 
but the default should be to display the comma so that users
know it's here.

2 cents,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-03 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-23 21:12 Make ,* show up as * in babel blocks Oleh
2014-01-03 15:52 ` Bastien

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).