Re: [O] Changing org-block background with org-src-fontify-natively
On 2016-06-13 19:12, Rasmuswrites: >> One thing I don't understand is how I reveal what is hidden by the >> burger symbol. I move my cursor around, including on top of the burger, >> and nothing changes. Should I run some command to reveal it? > > Indeed. That's the main selling point of prettify-symbols-mode. It might > be in Emacs-25; check if the variable prettify-symbols-unprettify-at-point > is defined. I use: > > (setq prettify-symbols-unprettify-at-point 'right-edge) It does not exist here (on emacs 24.5.1), so I guess I need to wait till emacs 25 ships. In the meantime it's fairly easy to temporarily turn off prettify-symbols-mode (as it really looks good when enabled, so I still want to use it). > If time allows, I will rewrite it as a separate mode as prettify-symbols > mode is not quite right for this purpose. That would be great! Thanks, Alan -- OpenPGP Key ID : 040D0A3B4ED2E5C7 Monthly Athmospheric CO₂, Mauna Loa Obs. 2015-05: 403.94, 2016-05: 407.70 signature.asc Description: PGP signature
Re: [O] Changing org-block background with org-src-fontify-natively
Hi Alan, Alan Schmittwrites: >>> How exactly do you get the pencil instead of the #+BEGIN_SRC and >>> #+END_SRC? >> >> Prettify-symbols-mode, I'm using the version that will be shipped with >> Emacs 25.1. Details here: >> >> https://pank.eu/blog/pretty-babel-src-blocks.html > > This is great, thanks a lot! > > One thing I don't understand is how I reveal what is hidden by the > burger symbol. I move my cursor around, including on top of the burger, > and nothing changes. Should I run some command to reveal it? Indeed. That's the main selling point of prettify-symbols-mode. It might be in Emacs-25; check if the variable prettify-symbols-unprettify-at-point is defined. I use: (setq prettify-symbols-unprettify-at-point 'right-edge) If time allows, I will rewrite it as a separate mode as prettify-symbols mode is not quite right for this purpose. Rasmus -- Human: An animal that complicates things more than strictly necessary
Re: [O] Changing org-block background with org-src-fontify-natively
On 2016-06-11 13:40, Rasmuswrites: > swfl...@flintfam.org (Samuel W. Flint) writes: > >> How exactly do you get the pencil instead of the #+BEGIN_SRC and >> #+END_SRC? > > Prettify-symbols-mode, I'm using the version that will be shipped with > Emacs 25.1. Details here: > > https://pank.eu/blog/pretty-babel-src-blocks.html This is great, thanks a lot! One thing I don't understand is how I reveal what is hidden by the burger symbol. I move my cursor around, including on top of the burger, and nothing changes. Should I run some command to reveal it? Best, Alan -- OpenPGP Key ID : 040D0A3B4ED2E5C7 Monthly Athmospheric CO₂, Mauna Loa Obs. 2015-05: 403.94, 2016-05: 407.70 signature.asc Description: PGP signature
Re: [O] Changing org-block background with org-src-fontify-natively
Ken Mankoffwrites: > On 2016-06-11 at 07:40, Rasmus wrote: >> Prettify-symbols-mode, I'm using the version that will be shipped with >> Emacs 25.1. Details here: >> >> https://pank.eu/blog/pretty-babel-src-blocks.html > > That post says, > >>> It might be nice to reveal the burger whenever the cursor is on the >>> same line as the burger. I tried to get this working, but I couldn’t >>> get it working property. > > Would this solve it? > > http://endlessparentheses.com/new-in-emacs-25-1-have-prettify-symbols-mode-reveal-the-symbol-at-point.html No, prettify-symbols-mode allow you to remove composition whenever point is within range of the composed symbol. It does not allow to remove composition for the whole range of the line. Rasmus -- Sådan en god dansk lagereddike kan man slet ikke bruge mere
Re: [O] Changing org-block background with org-src-fontify-natively
On 2016-06-11 at 07:40, Rasmuswrote: > Prettify-symbols-mode, I'm using the version that will be shipped with > Emacs 25.1. Details here: > > https://pank.eu/blog/pretty-babel-src-blocks.html That post says, >> It might be nice to reveal the burger whenever the cursor is on the >> same line as the burger. I tried to get this working, but I couldn’t >> get it working property. Would this solve it? http://endlessparentheses.com/new-in-emacs-25-1-have-prettify-symbols-mode-reveal-the-symbol-at-point.html -k.
Re: [O] Changing org-block background with org-src-fontify-natively
> Rasmus writes: R> swfl...@flintfam.org (Samuel W. Flint) writes: >> How exactly do you get the pencil instead of the #+BEGIN_SRC and >> #+END_SRC? R> Prettify-symbols-mode, I'm using the version that will be shipped R> with Emacs 25.1. Details here: R> https://pank.eu/blog/pretty-babel-src-blocks.html Thank you!! Sam -- Samuel W. Flint 4096R/266596F4 (9477 D23E 389E 40C5 2F10 DE19 68E5 318E 2665 96F4) (λs.s s) λs.s s signature.asc Description: PGP signature
Re: [O] Changing org-block background with org-src-fontify-natively
swfl...@flintfam.org (Samuel W. Flint) writes: > How exactly do you get the pencil instead of the #+BEGIN_SRC and > #+END_SRC? Prettify-symbols-mode, I'm using the version that will be shipped with Emacs 25.1. Details here: https://pank.eu/blog/pretty-babel-src-blocks.html Xebar Saramwrites: > and the different background colors per code block type (different > background for python. lisp etc :)) It's documented in this patch. http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=af463605f10459ae32cd2d8ee1f9ad0a7f333eff Let me know if something is unclear. > That is some rock-star stuff! Thanks! It's Emacs after all! Rasmus -- Bang bang
Re: [O] Changing org-block background with org-src-fontify-natively
That is some rock-star stuff! Thanks! Rasmus writes: > Andreas Lehawrites: > >> My Org mode experience would also benefit a lot from having source block >> backgrounds again and with per-language configurable background colour. > > That’s possible with the attache patch. An example of the horrors you can > subject yourself to is also attached. -- 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
Re: [O] Changing org-block background with org-src-fontify-natively
On Fri, Jun 10, 2016 at 8:24 AM, Samuel W. Flintwrote: > How exactly do you get the pencil instead of the #+BEGIN_SRC and > #+END_SRC? > and the different background colors per code block type (different background for python. lisp etc :)) thx Z
Re: [O] Changing org-block background with org-src-fontify-natively
> Rasmus writes: R> Andreas Lehawrites: >> My Org mode experience would also benefit a lot from having >> source block backgrounds again and with per-language configurable >> background colour. R> That’s possible with the attache patch. An example of the R> horrors you can subject yourself to is also attached. How exactly do you get the pencil instead of the #+BEGIN_SRC and #+END_SRC? Thanks, Sam -- Samuel W. Flint 4096R/266596F4 (9477 D23E 389E 40C5 2F10 DE19 68E5 318E 2665 96F4) (λs.s s) λs.s s
Re: [O] Changing org-block background with org-src-fontify-natively
Andreas Lehawrites: > My Org mode experience would also benefit a lot from having source block > backgrounds again and with per-language configurable background colour. That’s possible with the attache patch. An example of the horrors you can subject yourself to is also attached. -- Lasciate ogni speranza, voi che leggete questo. >From 5d39108d319dc321af95e22c6cb25164dd61e891 Mon Sep 17 00:00:00 2001 From: Rasmus Date: Thu, 9 Jun 2016 16:52:05 +0200 Subject: [PATCH] org-src: Allow per language block face * lisp/org-src.el (org-src-font-lock-fontify-block): * lisp/org.el (org-fontify-meta-lines-and-blocks-1): Allow per-block face. --- lisp/org-src.el | 9 ++--- lisp/org.el | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 2f96fdf..d8c0541 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -494,7 +494,10 @@ as `org-src-fontify-natively' is non-nil." (when (fboundp lang-mode) (let ((string (buffer-substring-no-properties start end)) (modified (buffer-modified-p)) - (org-buffer (current-buffer))) + (org-buffer (current-buffer)) + (block-faces (let ((face-name (intern (format "org-block-%s" lang + (append (and (facep face-name) (list face-name)) + '(org-block) (remove-text-properties start end '(face nil)) (with-current-buffer (get-buffer-create @@ -510,12 +513,12 @@ as `org-src-fontify-natively' is non-nil." (put-text-property (+ start (1- pos)) (1- (+ start next)) 'face (list :inherit (append (and new-face (list new-face)) - (list 'org-block))) + block-faces)) org-buffer)) (setq pos next)) ;; Add the face to the remaining part of the text. (put-text-property (1- (+ start pos)) end 'face - '(:inherit org-block) org-buffer))) + (list :inherit block-faces) org-buffer))) (add-text-properties start end '(font-lock-fontified t fontified t font-lock-multiline t)) diff --git a/lisp/org.el b/lisp/org.el index 206ebad..d00de1e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5976,7 +5976,9 @@ by a #." (add-text-properties beg1 block-end '(src-block t))) (quoting (add-text-properties beg1 (min (point-max) (1+ end1)) - '(face org-block))) ; end of source block + (let ((face-name (intern (format "org-block-%s" lang + (append (and (facep face-name) (list face-name)) + '(face org-block) ; end of source block ((not org-fontify-quote-and-verse-blocks)) ((string= block-type "quote") (add-text-properties beg1 (min (point-max) (1+ end1)) '(face org-quote))) -- 2.8.3 #+BEGIN_SRC emacs-lisp :eval never ;; setup (set-face-attribute 'org-block nil :background (color-darken-name (face-attribute 'default :background) 3)) (defface org-block-R `((t (:background ,(color-lighten-name "#455EB3" 50 "Face for R src blocks") (defface org-block-emacs-lisp `((t (:background ,(color-lighten-name "#7F5AB6" 30 "Face for elisp src blocks") (defface org-block-python `((t (:background ,(color-lighten-name "#00FF00" 30 "Face for python blocks") #+END_SRC #+BEGIN_SRC emacs-lisp :var x=1 (defun x () 1 ) #+END_SRC #+BEGIN_SRC R x <- function () 1 #+END_SRC #+BEGIN_SRC python def x: return(1) #+END_SRC #+BEGIN_SRC shell echo 1 #+END_SRC
Re: [O] Changing org-block background with org-src-fontify-natively
Hi, John Kitchinwrites: > It doesn't sounds like there is a way to do language specific colors. > Karl Voit writes: >> * Nick Dokos wrote: [ ... ] >> >> It would be fine to have both: org-src-fontify-natively *and* a >> background colour I can set. I'd like to 'back' this feature request. My Org mode experience would also benefit a lot from having source block backgrounds again and with per-language configurable background colour. Regards, Andreas
Re: [O] Changing org-block background with org-src-fontify-natively
* Nick Dokoswrote: > > M-x describe-face RET org-block RET With this, I see that "background" is set to the colour I want to have. However, what's the face-variable that defines the background of blocks with a specified language? Or does it interfere with my "(setq org-src-fontify-natively t)"? It would be fine to have both: org-src-fontify-natively *and* a background colour I can set. -- mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode: > get Memacs from https://github.com/novoid/Memacs < https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
Re: [O] Changing org-block background with org-src-fontify-natively
It doesn't sounds like there is a way to do language specific colors. Karl Voit writes: > * Nick Dokoswrote: >> >> M-x describe-face RET org-block RET > > With this, I see that "background" is set to the colour I want to > have. > > However, what's the face-variable that defines the background of > blocks with a specified language? > > Or does it interfere with my "(setq org-src-fontify-natively t)"? > > It would be fine to have both: org-src-fontify-natively *and* a > background colour I can set. -- 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
Re: [O] Changing org-block background with org-src-fontify-natively
I guess that gives away I am still using 8.2.10! I have never figured out how to get a higher version of that through elpa/melpa/http://orgmode.org/elpa/. Nick Dokos writes: > John Kitchinwrites: > >> That is pretty weird. It should be defined in org-faces.el. What org version >> are you using? >> > > It was deleted in this commit: > > commit f8b42e8ebeeecdef59a8a7cbc4324264a5162197 > Author: Bastien Guerry > Date: Mon Jul 28 18:54:00 2014 +0200 > > Don't use an overlay for src blocks backgrounds > > * org-faces.el (org-block-background): Delete. > > > and afaict, it does not appear in org-faces any longer. > >> On Tue, Jan 12, 2016 at 6:53 AM, Karl Voit wrote: >> >> * John Kitchin wrote: >> > I halso have no org-block-background in my setup: C-h v >> org-block-! >> > >> > Are faces supposed to show as variable? >> > > I don't think so - they are in a different name space - you need e.g. > > M-x describe-face RET org-block RET > > to see a face. -- 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
Re: [O] Changing org-block background with org-src-fontify-natively
John Kitchinwrites: > That is pretty weird. It should be defined in org-faces.el. What org version > are you using? > It was deleted in this commit: commit f8b42e8ebeeecdef59a8a7cbc4324264a5162197 Author: Bastien Guerry Date: Mon Jul 28 18:54:00 2014 +0200 Don't use an overlay for src blocks backgrounds * org-faces.el (org-block-background): Delete. and afaict, it does not appear in org-faces any longer. > On Tue, Jan 12, 2016 at 6:53 AM, Karl Voit wrote: > > * John Kitchin wrote: > > I halso have no org-block-background in my setup: C-h v org-block-! > > > > Are faces supposed to show as variable? > I don't think so - they are in a different name space - you need e.g. M-x describe-face RET org-block RET to see a face. -- Nick
Re: [O] Changing org-block background with org-src-fontify-natively
* John Kitchinwrote: > What do you have org-block-background set to? There is no org-block-background in my setup: C-h v org-block- only offers org-block-entry-blocking and org-block-regexp. Org-mode version 8.3.2 (release_8.3.2-200-gc2eeac) > I use the leuven theme, which gives this a light yellow background for > me. Thought so. I am using (load-theme 'wombat t) these days which I want to keep. This is why I tried to accomplish the background colour with separate commands and not by choosing a theme. -- mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode: > get Memacs from https://github.com/novoid/Memacs < https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
Re: [O] Changing org-block background with org-src-fontify-natively
That is pretty weird. It should be defined in org-faces.el. What org version are you using? 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, Jan 12, 2016 at 6:53 AM, Karl Voitwrote: > * John Kitchin wrote: > > I halso have no org-block-background in my setup: C-h v org-block-! > > > > Are faces supposed to show as variable? > > I have no clue. Unfortunately, my elisp knowledge is very small. > > > in my setup, this is defined in org-faces. > > > > Maybe you can do something as mundane as > > (set-face-background 'org-block-background "plum2") > > in your init file. > > This results in: "set-face-attribute: Invalid face: > org-block-background" > > -- > mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode: >> get Memacs from https://github.com/novoid/Memacs < > > https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on > github > > >
Re: [O] Changing org-block background with org-src-fontify-natively
* John Kitchinwrote: > I halso have no org-block-background in my setup: C-h v org-block-! > > Are faces supposed to show as variable? I have no clue. Unfortunately, my elisp knowledge is very small. > in my setup, this is defined in org-faces. > > Maybe you can do something as mundane as > (set-face-background 'org-block-background "plum2") > in your init file. This results in: "set-face-attribute: Invalid face: org-block-background" -- mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode: > get Memacs from https://github.com/novoid/Memacs < https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
Re: [O] Changing org-block background with org-src-fontify-natively
I halso have no org-block-background in my setup: C-h v org-block-! Are faces supposed to show as variable? in my setup, this is defined in org-faces. Maybe you can do something as mundane as (set-face-background 'org-block-background "plum2") in your init file. Maybe Karl Voit writes: > * John Kitchinwrote: >> What do you have org-block-background set to? > > There is no org-block-background in my setup: C-h v org-block- > only offers org-block-entry-blocking and org-block-regexp. > > Org-mode version 8.3.2 (release_8.3.2-200-gc2eeac) > >> I use the leuven theme, which gives this a light yellow background for >> me. > > Thought so. > > I am using (load-theme 'wombat t) these days which I want to keep. > This is why I tried to accomplish the background colour with > separate commands and not by choosing a theme. -- 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
Re: [O] Changing org-block background with org-src-fontify-natively
What do you have org-block-background set to? I use the leuven theme, which gives this a light yellow background for me. 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 Sun, Dec 27, 2015 at 4:42 AM, Karl Voitwrote: > * Xebar Saram wrote: > > > > Hi all > > Hi Xebar! > > > so i have zero technical skills or knowledge, but i have been looking > for a > > way to have a different background in org-src blocks so that bash > > backgrounds will have a black color, lisp a white color etc. > > from what i understand (but i may be totally off here) Karl, thats what > > your trying to achieve? > > Almost: I want to set the background colour of all source blocks to > the same colour so that I can clearly distinguish non-blocks to > source code. > > > did you succeed in that? > > Not yet. > > -- > mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode: >> get Memacs from https://github.com/novoid/Memacs < > > https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on > github > > >
Re: [O] Changing org-block background with org-src-fontify-natively
* Xebar Saramwrote: > > Hi all Hi Xebar! > so i have zero technical skills or knowledge, but i have been looking for a > way to have a different background in org-src blocks so that bash > backgrounds will have a black color, lisp a white color etc. > from what i understand (but i may be totally off here) Karl, thats what > your trying to achieve? Almost: I want to set the background colour of all source blocks to the same colour so that I can clearly distinguish non-blocks to source code. > did you succeed in that? Not yet. -- mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode: > get Memacs from https://github.com/novoid/Memacs < https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
[O] Changing org-block background with org-src-fontify-natively
Hi! ,[ my current settings for org-block ] | (defface org-block | ;; defface org-block-background was removed from org: | ;; http://emacs.stackexchange.com/questions/14824/org-block-background-font-not-having-effect | '((t (:background "#00"))) | "Face used for the source block background.") | | (setq org-src-fontify-natively t) ` With this, I get the #00 background for blocks like example, quote, and src. If I do specify a src type like "sh", I guess that org-src-fontify-natively overrides my setting. At least I get the effect that with a given src type, the background is not #00 but the pre-defined background of my theme (wombat). So, is there a way to modify (only) the background colour also for source blocks with a given type and active org-src-fontify-natively? Thanks! -- mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode: > get Memacs from https://github.com/novoid/Memacs < https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
Re: [O] Changing org-block background with org-src-fontify-natively
* Karl Voitwrote: > > So, is there a way to modify (only) the background colour also for > source blocks with a given type and active org-src-fontify-natively? Addendum: https://stackoverflow.com/a/30139612 shows my situation whereas the setup of John Kitchin https://www.youtube.com/watch?v=N7AaKHRd9uw seems to have solved my issue: org-src-fontify-natively combined with a different background colour. -- mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode: > get Memacs from https://github.com/novoid/Memacs < https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github
Re: [O] Changing org-block background with org-src-fontify-natively
Hi all so i have zero technical skills or knowledge, but i have been looking for a way to have a different background in org-src blocks so that bash backgrounds will have a black color, lisp a white color etc. from what i understand (but i may be totally off here) Karl, thats what your trying to achieve? did you succeed in that? does any one have this working in his config and willing to share? thx! Z On Sat, Dec 26, 2015 at 11:17 PM, Karl Voitwrote: > * Karl Voit wrote: > > > > So, is there a way to modify (only) the background colour also for > > source blocks with a given type and active org-src-fontify-natively? > > Addendum: > > https://stackoverflow.com/a/30139612 shows my situation whereas the > setup of John Kitchin https://www.youtube.com/watch?v=N7AaKHRd9uw > seems to have solved my issue: org-src-fontify-natively combined > with a different background colour. > > -- > mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode: >> get Memacs from https://github.com/novoid/Memacs < > > https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on > github > > >