unofficial mirror of emacs-orgmode@gnu.org
 help / color / Atom feed
* Anyone doing any fancy customizations of source blocks?
@ 2020-06-02 18:54 William Denton
  2020-06-02 19:23 ` John Kitchin
  0 siblings, 1 reply; 11+ messages in thread
From: William Denton @ 2020-06-02 18:54 UTC (permalink / raw)
  To: emacs-orgmode

Is anyone doing any fancy formatting of source blocks, such as putting a line
in the left fringe, or a box around them, or having some interesting background?

I ask because I recently changed the theme I use to get the dark Solarized look 
I like,[1] and all of a sudden my #+begin_src lines were underlined and 
#+end_src had a line above it.  These come from org-block-begin-line and 
org-block-end-line, and are shown here, but I'd never noticed them in 
documentation or had them on my screen before:

https://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html

Aside from fontifying the source blocks I've never done anything special about 
them (except wonder how I ever did anything without them), but seeing this made 
me wonder if anyone here has really customized them so they look like medieval 
manuscripts or something from a futuristic video game.  (If any of that is 
possible---but in Emacs, anything is possible ...)

Bill

[1] Now I'm using https://github.com/bbatsov/solarized-emacs, with variable 
pitch turned off and Org headline resizing turned off.

--
William Denton :: Toronto, Canada   ---   Listening to Art: https://listeningtoart.org/
https://www.miskatonic.org/         ---   GHG.EARTH: https://ghg.earth/
Caveat lector.                      ---   STAPLR: https://staplr.org/


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

* Re: Anyone doing any fancy customizations of source blocks?
  2020-06-02 18:54 Anyone doing any fancy customizations of source blocks? William Denton
@ 2020-06-02 19:23 ` John Kitchin
  2020-06-03 18:23   ` Diego Zamboni
  2020-06-08 14:29   ` Rasmus
  0 siblings, 2 replies; 11+ messages in thread
From: John Kitchin @ 2020-06-02 19:23 UTC (permalink / raw)
  To: William Denton; +Cc: org-mode-email

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

Here is one approach:

https://pank.eu/blog/pretty-babel-src-blocks.html

I feel like I have seen some work that used ruby and python icons as
displays over #+begin_src, but I can't find it now.

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 Tue, Jun 2, 2020 at 2:54 PM William Denton <wtd@pobox.com> wrote:

> Is anyone doing any fancy formatting of source blocks, such as putting a
> line
> in the left fringe, or a box around them, or having some interesting
> background?
>
> I ask because I recently changed the theme I use to get the dark Solarized
> look
> I like,[1] and all of a sudden my #+begin_src lines were underlined and
> #+end_src had a line above it.  These come from org-block-begin-line and
> org-block-end-line, and are shown here, but I'd never noticed them in
> documentation or had them on my screen before:
>
>
> https://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html
>
> Aside from fontifying the source blocks I've never done anything special
> about
> them (except wonder how I ever did anything without them), but seeing this
> made
> me wonder if anyone here has really customized them so they look like
> medieval
> manuscripts or something from a futuristic video game.  (If any of that is
> possible---but in Emacs, anything is possible ...)
>
> Bill
>
> [1] Now I'm using https://github.com/bbatsov/solarized-emacs, with
> variable
> pitch turned off and Org headline resizing turned off.
>
> --
> William Denton :: Toronto, Canada   ---   Listening to Art:
> https://listeningtoart.org/
> https://www.miskatonic.org/         ---   GHG.EARTH: https://ghg.earth/
> Caveat lector.                      ---   STAPLR: https://staplr.org/
>
>

[-- Attachment #2: Type: text/html, Size: 3180 bytes --]

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

* Re: Anyone doing any fancy customizations of source blocks?
  2020-06-02 19:23 ` John Kitchin
@ 2020-06-03 18:23   ` Diego Zamboni
  2020-06-03 20:09     ` briangpowell .
  2020-06-19  4:04     ` William Denton
  2020-06-08 14:29   ` Rasmus
  1 sibling, 2 replies; 11+ messages in thread
From: Diego Zamboni @ 2020-06-03 18:23 UTC (permalink / raw)
  To: William Denton; +Cc: org-mode-email

I use the config John mentioned and I like it - though I use different
symbols. Here's my config if you want an example:
https://github.com/zzamboni/dot-emacs/blob/master/init.org#source-code-blocks

--Diego

On Tue, Jun 2, 2020 at 9:24 PM John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>
> Here is one approach:
>
> https://pank.eu/blog/pretty-babel-src-blocks.html
>
> I feel like I have seen some work that used ruby and python icons as displays over #+begin_src, but I can't find it now.
>
> 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 Tue, Jun 2, 2020 at 2:54 PM William Denton <wtd@pobox.com> wrote:
>>
>> Is anyone doing any fancy formatting of source blocks, such as putting a line
>> in the left fringe, or a box around them, or having some interesting background?
>>
>> I ask because I recently changed the theme I use to get the dark Solarized look
>> I like,[1] and all of a sudden my #+begin_src lines were underlined and
>> #+end_src had a line above it.  These come from org-block-begin-line and
>> org-block-end-line, and are shown here, but I'd never noticed them in
>> documentation or had them on my screen before:
>>
>> https://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html
>>
>> Aside from fontifying the source blocks I've never done anything special about
>> them (except wonder how I ever did anything without them), but seeing this made
>> me wonder if anyone here has really customized them so they look like medieval
>> manuscripts or something from a futuristic video game.  (If any of that is
>> possible---but in Emacs, anything is possible ...)
>>
>> Bill
>>
>> [1] Now I'm using https://github.com/bbatsov/solarized-emacs, with variable
>> pitch turned off and Org headline resizing turned off.
>>
>> --
>> William Denton :: Toronto, Canada   ---   Listening to Art: https://listeningtoart.org/
>> https://www.miskatonic.org/         ---   GHG.EARTH: https://ghg.earth/
>> Caveat lector.                      ---   STAPLR: https://staplr.org/
>>


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

* Re: Anyone doing any fancy customizations of source blocks?
  2020-06-03 18:23   ` Diego Zamboni
@ 2020-06-03 20:09     ` briangpowell .
  2020-06-04  6:29       ` Diego Zamboni
  2020-06-19  4:04     ` William Denton
  1 sibling, 1 reply; 11+ messages in thread
From: briangpowell . @ 2020-06-03 20:09 UTC (permalink / raw)
  To: Diego Zamboni; +Cc: William Denton, org-mode-email

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

If you haven't already, you probably know all about it; but, for any
newcomers on the subject of Literate Programming & source code blocks, etc.

Highly recommend Knuth's CWEB book & of course NOWEB software {which is
CWEB generalized for ALL programming languages}:

https://www-cs-faculty.stanford.edu/~knuth/cweb.html

Thanks Diego, its a very interesting config example

On Wed, Jun 3, 2020 at 2:24 PM Diego Zamboni <diego@zzamboni.org> wrote:

> I use the config John mentioned and I like it - though I use different
> symbols. Here's my config if you want an example:
>
> https://github.com/zzamboni/dot-emacs/blob/master/init.org#source-code-blocks
>
> --Diego
>
> On Tue, Jun 2, 2020 at 9:24 PM John Kitchin <jkitchin@andrew.cmu.edu>
> wrote:
> >
> > Here is one approach:
> >
> > https://pank.eu/blog/pretty-babel-src-blocks.html
> >
> > I feel like I have seen some work that used ruby and python icons as
> displays over #+begin_src, but I can't find it now.
> >
> > 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 Tue, Jun 2, 2020 at 2:54 PM William Denton <wtd@pobox.com> wrote:
> >>
> >> Is anyone doing any fancy formatting of source blocks, such as putting
> a line
> >> in the left fringe, or a box around them, or having some interesting
> background?
> >>
> >> I ask because I recently changed the theme I use to get the dark
> Solarized look
> >> I like,[1] and all of a sudden my #+begin_src lines were underlined and
> >> #+end_src had a line above it.  These come from org-block-begin-line and
> >> org-block-end-line, and are shown here, but I'd never noticed them in
> >> documentation or had them on my screen before:
> >>
> >>
> https://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html
> >>
> >> Aside from fontifying the source blocks I've never done anything
> special about
> >> them (except wonder how I ever did anything without them), but seeing
> this made
> >> me wonder if anyone here has really customized them so they look like
> medieval
> >> manuscripts or something from a futuristic video game.  (If any of that
> is
> >> possible---but in Emacs, anything is possible ...)
> >>
> >> Bill
> >>
> >> [1] Now I'm using https://github.com/bbatsov/solarized-emacs, with
> variable
> >> pitch turned off and Org headline resizing turned off.
> >>
> >> --
> >> William Denton :: Toronto, Canada   ---   Listening to Art:
> https://listeningtoart.org/
> >> https://www.miskatonic.org/         ---   GHG.EARTH: https://ghg.earth/
> >> Caveat lector.                      ---   STAPLR: https://staplr.org/
> >>
>
>

[-- Attachment #2: Type: text/html, Size: 4601 bytes --]

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

* Re: Anyone doing any fancy customizations of source blocks?
  2020-06-03 20:09     ` briangpowell .
@ 2020-06-04  6:29       ` Diego Zamboni
  0 siblings, 0 replies; 11+ messages in thread
From: Diego Zamboni @ 2020-06-04  6:29 UTC (permalink / raw)
  To: briangpowell .; +Cc: William Denton, org-mode-email

Hi Brian,

Thanks for the kind words! I wrote a booklet about my setup including
other "literate config" examples, if you are interested:
https://leanpub.com/lit-config/read

I have been fascinated by the idea of literate programming since I got
a copy of The Stanford GraphBase while I was in college. I never used
CWEB directly, but I have tried noweb and other literate programming
tools over the years. However, Emacs + Org-mode + Babel is the first
toolset that I have actually been able to stick with on sustained use
:)

Best,
--Diego

On Wed, Jun 3, 2020 at 10:09 PM briangpowell . <briangpowellms@gmail.com> wrote:
>
> If you haven't already, you probably know all about it; but, for any newcomers on the subject of Literate Programming & source code blocks, etc.
>
> Highly recommend Knuth's CWEB book & of course NOWEB software {which is CWEB generalized for ALL programming languages}:
>
> https://www-cs-faculty.stanford.edu/~knuth/cweb.html
>
> Thanks Diego, its a very interesting config example
>
> On Wed, Jun 3, 2020 at 2:24 PM Diego Zamboni <diego@zzamboni.org> wrote:
>>
>> I use the config John mentioned and I like it - though I use different
>> symbols. Here's my config if you want an example:
>> https://github.com/zzamboni/dot-emacs/blob/master/init.org#source-code-blocks
>>
>> --Diego
>>
>> On Tue, Jun 2, 2020 at 9:24 PM John Kitchin <jkitchin@andrew.cmu.edu> wrote:
>> >
>> > Here is one approach:
>> >
>> > https://pank.eu/blog/pretty-babel-src-blocks.html
>> >
>> > I feel like I have seen some work that used ruby and python icons as displays over #+begin_src, but I can't find it now.
>> >
>> > 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 Tue, Jun 2, 2020 at 2:54 PM William Denton <wtd@pobox.com> wrote:
>> >>
>> >> Is anyone doing any fancy formatting of source blocks, such as putting a line
>> >> in the left fringe, or a box around them, or having some interesting background?
>> >>
>> >> I ask because I recently changed the theme I use to get the dark Solarized look
>> >> I like,[1] and all of a sudden my #+begin_src lines were underlined and
>> >> #+end_src had a line above it.  These come from org-block-begin-line and
>> >> org-block-end-line, and are shown here, but I'd never noticed them in
>> >> documentation or had them on my screen before:
>> >>
>> >> https://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html
>> >>
>> >> Aside from fontifying the source blocks I've never done anything special about
>> >> them (except wonder how I ever did anything without them), but seeing this made
>> >> me wonder if anyone here has really customized them so they look like medieval
>> >> manuscripts or something from a futuristic video game.  (If any of that is
>> >> possible---but in Emacs, anything is possible ...)
>> >>
>> >> Bill
>> >>
>> >> [1] Now I'm using https://github.com/bbatsov/solarized-emacs, with variable
>> >> pitch turned off and Org headline resizing turned off.
>> >>
>> >> --
>> >> William Denton :: Toronto, Canada   ---   Listening to Art: https://listeningtoart.org/
>> >> https://www.miskatonic.org/         ---   GHG.EARTH: https://ghg.earth/
>> >> Caveat lector.                      ---   STAPLR: https://staplr.org/
>> >>
>>


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

* Re: Anyone doing any fancy customizations of source blocks?
  2020-06-02 19:23 ` John Kitchin
  2020-06-03 18:23   ` Diego Zamboni
@ 2020-06-08 14:29   ` Rasmus
  1 sibling, 0 replies; 11+ messages in thread
From: Rasmus @ 2020-06-08 14:29 UTC (permalink / raw)
  To: emacs-orgmode

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> Here is one approach:
>
> https://pank.eu/blog/pretty-babel-src-blocks.html

There’s some work to generalize this here:

    https://github.com/integral-dw/org-menu-mode

I have not had a chance to try it myself yet.

That being said, the above approach still lives in my setup and doesn’t
bother me too much even if it is hack :)

Stay safe,
Rasmus

-- 
However beautiful the theory, one should occasionally look at the evidence



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

* Re: Anyone doing any fancy customizations of source blocks?
  2020-06-03 18:23   ` Diego Zamboni
  2020-06-03 20:09     ` briangpowell .
@ 2020-06-19  4:04     ` William Denton
  2020-06-19  7:19       ` Diego Zamboni via General discussions about Org-mode.
  2020-06-19 12:53       ` Norman Tovey-Walsh
  1 sibling, 2 replies; 11+ messages in thread
From: William Denton @ 2020-06-19  4:04 UTC (permalink / raw)
  To: Diego Zamboni; +Cc: org-mode-email

[-- Attachment #1: Type: TEXT/PLAIN, Size: 957 bytes --]

On 3 June 2020, Diego Zamboni wrote:

> I use the config John mentioned and I like it - though I use different
> symbols. Here's my config if you want an example:
> https://github.com/zzamboni/dot-emacs/blob/master/init.org#source-code-blocks

Thanks for this.  I used it for a while, and it looks great, but I decided I 
want to see the details on the begin_src line all the time.  I do like using the 
⎡and ⎣ character nr prettify-symbols-ali stto replace #+begin_src and 
#+end_src and will keep those.

(My apologies for weirdness in that line---the Unicode threw things off and 
I can't get it back to normal.)

I'll refer to your configuration file when I move my init files into Org.  It's 
a great example.

Bill
--
William Denton :: Toronto, Canada   ---   Listening to Art: https://listeningtoart.org/
https://www.miskatonic.org/         ---   GHG.EARTH: https://ghg.earth/
Caveat lector.                      ---   STAPLR: https://staplr.org/

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

* Re: Anyone doing any fancy customizations of source blocks?
  2020-06-19  4:04     ` William Denton
@ 2020-06-19  7:19       ` Diego Zamboni via General discussions about Org-mode.
  2020-06-19 12:53       ` Norman Tovey-Walsh
  1 sibling, 0 replies; 11+ messages in thread
From: Diego Zamboni via General discussions about Org-mode. @ 2020-06-19  7:19 UTC (permalink / raw)
  To: William Denton; +Cc: Org-mode mailing list

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

Hi Bill,\r
\r
I'm glad you found the example useful. I've been thinking myself of also un-hiding the header arguments, which I do find useful to have visible.\r
\r
Best,\r
--Diego\r
On Fri, Jun 19, 2020 at 4:04 AM William Denton <wtd@pobox.com> wrote:\r
“On 3 June 2020, Diego Zamboni wrote:\r
\r
> I use the config John mentioned and I like it - though I use different\r
> symbols. Here's my config if you want an example:\r
> https://github.com/zzamboni/dot-emacs/blob/master/init.org#source-code-blocks\r
\r
Thanks for this. I used it for a while, and it looks great, but I decided I \r
want to see the details on the begin_src line all the time. I do like using the \r
⎡and ⎣ character nr prettify-symbols-ali stto replace #+begin_src and \r
#+end_src and will keep those.\r
\r
(My apologies for weirdness in that line---the Unicode threw things off and \r
I can't get it back to normal.)\r
\r
I'll refer to your configuration file when I move my init files into Org. It's \r
a great example.\r
\r
Bill\r
--\r
William Denton :: Toronto, Canada --- Listening to Art: https://listeningtoart.org/\r
https://www.miskatonic.org/ --- GHG.EARTH: https://ghg.earth/\r
Caveat lector. --- STAPLR: https://staplr.org/”\r

[-- Attachment #2: Type: text/html, Size: 2955 bytes --]

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

* Re: Anyone doing any fancy customizations of source blocks?
  2020-06-19  4:04     ` William Denton
  2020-06-19  7:19       ` Diego Zamboni via General discussions about Org-mode.
@ 2020-06-19 12:53       ` Norman Tovey-Walsh
  2020-06-19 13:12         ` Joost Kremers
  1 sibling, 1 reply; 11+ messages in thread
From: Norman Tovey-Walsh @ 2020-06-19 12:53 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 922 bytes --]

> On 3 June 2020, Diego Zamboni wrote:
>> I use the config John mentioned and I like it - though I use different
>> symbols. Here's my config if you want an example:
>> https://github.com/zzamboni/dot-emacs/blob/master/init.org#source-code-blocks

This example reminded me of something that’s been puzzling me. In the
screenshot, the background color of lines that begin and end a source
block extend all the way across the screen.

When I change the faces for org block begin/end to something with a
background color, the color only extends to the end of the characters on
that line. The same is true if I change the background color of the
content of the block.

This is quite distracting. I thought “this must be the consequence of
some other mode I’m using or something” and I decided to test that. I
fired up “emacs -q” and loaded the code pointed to by the post above.
What I get is:


[-- Attachment #1.2: Screen Shot 2020-06-19 at 1.49.40 PM.png --]
[-- Type: image/png, Size: 18243 bytes --]

[-- Attachment #1.3: Type: text/plain, Size: 450 bytes --]


What’s the trick to get the background color to extend across the entire line?
<
                                        Be seeing you,
                                          norm

--
Norman Tovey-Walsh <ndw@nwalsh.com>
https://nwalsh.com/

> ...it is significant that we are called the 'information society'—not
> the thinking society, not the deliberative society, not the society of
> reason and rationality.--Lloyd Morrisett

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: Anyone doing any fancy customizations of source blocks?
  2020-06-19 12:53       ` Norman Tovey-Walsh
@ 2020-06-19 13:12         ` Joost Kremers
  2020-06-19 14:21           ` Norman Tovey-Walsh
  0 siblings, 1 reply; 11+ messages in thread
From: Joost Kremers @ 2020-06-19 13:12 UTC (permalink / raw)
  To: emacs-orgmode


On Fri, Jun 19 2020, Norman Tovey-Walsh wrote:
> What’s the trick to get the background color to extend across 
> the entire line?

In Emacs 27, add an `:extend t` property to the face. In Emacs 26 
and earlier, IIRC, you need to make sure that the newline at the 
end of the line is also fontified. (That may actually be necessary 
in Emacs 27 as well, in addition to the `:extend` property...)

-- 
Joost Kremers
Life has its moments


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

* Re: Anyone doing any fancy customizations of source blocks?
  2020-06-19 13:12         ` Joost Kremers
@ 2020-06-19 14:21           ` Norman Tovey-Walsh
  0 siblings, 0 replies; 11+ messages in thread
From: Norman Tovey-Walsh @ 2020-06-19 14:21 UTC (permalink / raw)
  To: emacs-orgmode

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

Joost Kremers <joostkremers@fastmail.fm> writes:
> In Emacs 27, add an `:extend t` property to the face.

Thank you! I somehow failed to connect that with my move to Emacs 27 a
while back.

                                        Be seeing you,
                                          norm

--
Norman Tovey-Walsh <ndw@nwalsh.com>
https://nwalsh.com/

> Sometimes in life situations develop that only the half-crazy can get
> out of.--La Rochefoucauld

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

end of thread, back to index

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 18:54 Anyone doing any fancy customizations of source blocks? William Denton
2020-06-02 19:23 ` John Kitchin
2020-06-03 18:23   ` Diego Zamboni
2020-06-03 20:09     ` briangpowell .
2020-06-04  6:29       ` Diego Zamboni
2020-06-19  4:04     ` William Denton
2020-06-19  7:19       ` Diego Zamboni via General discussions about Org-mode.
2020-06-19 12:53       ` Norman Tovey-Walsh
2020-06-19 13:12         ` Joost Kremers
2020-06-19 14:21           ` Norman Tovey-Walsh
2020-06-08 14:29   ` Rasmus

unofficial mirror of emacs-orgmode@gnu.org

Archives are clonable:
	git clone --mirror https://yhetil.org/orgmode/0 orgmode/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 orgmode orgmode/ https://yhetil.org/orgmode \
		emacs-orgmode@gnu.org
	public-inbox-index orgmode

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git