emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Patch] Org-fontify
@ 2010-08-13 20:19 Sébastien Vauban
  2010-08-13 20:37 ` Erik Iverson
  0 siblings, 1 reply; 7+ messages in thread
From: Sébastien Vauban @ 2010-08-13 20:19 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

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

Hello,

Champagne!  My very first patch... Hopefully one that will be followed by many
more...

Goal: to *fontify whole lines* of code-block or meta-lines.

See the results on this minimal example:

--8<---------------cut here---------------start------------->8---
#+TITLE:     Better identification of source blocks and results
#+DATE:      2010-08-13
#+DESCRIPTION: 
#+KEYWORDS: 
#+LANGUAGE:  en_US

This is

#+BEGIN_SRC org
** Totals
*** Using a table formula
#+END_SRC

random text

#+LaTeX: \thisismycommand{}{param2}

inserted between

#+begin_src R :session woodland
names(woodland)
str(woodland)
summary(woodland)
#+end_src

code blocks

#+begin_src R :session woodland
woodland
#+end_src

copy from different

#+srcname:woodland
#+begin_src R :colnames t
read.table("/tmp/woodlands.txt",header=TRUE)
#+end_src

#+results: woodland
| "ID" | "wood"  | "A.reptans" | "E.amygdaloides" |
|------+---------+-------------+------------------|
| "a"  | "wood1" |           5 |               10 |
| "b"  | "wood2" |           1 |                0 |

postings on org-mode...
--8<---------------cut here---------------end--------------->8---

with *faces with background*, such as:

--8<---------------cut here---------------start------------->8---
     (org-block ((t (:foreground "blue1" :background "#EAFFEA"))))
     (org-code ((t (:foreground "blue1" :background "#EAFFEA"))))
     (org-meta-line ((t (:foreground "#008ED1" :background "#FFEAEA"))))
     (org-table ((t (:foreground "blue1" :background "#EAEAFF"))))
--8<---------------cut here---------------end--------------->8---

Only feature: I did not succeed highlighting full lines containing =srcname=
or =results=. Not a big deal. Though, if someone can do it, that would
definitely please me...

Best regards,
  Seb

-- 
Sébastien Vauban

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-fontify.patch --]
[-- Type: text/x-diff, Size: 1260 bytes --]

diff --git a/lisp/org.el b/lisp/org.el
index af4f793..64deb53 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5036,8 +5036,9 @@ will be prompted for."
 				    '(display t invisible t intangible t))
 	    (add-text-properties (match-beginning 1) (match-end 3)
 				 '(font-lock-fontified t face org-meta-line))
-	    (add-text-properties (match-beginning 6) (match-end 6)
+	    (add-text-properties (match-beginning 6) (+ (match-end 6) 1)
 				 '(font-lock-fontified t face org-block))
+					; for backend-specific code
 	    t)
 	   ((and (match-end 4) (equal dc3 "begin"))
 	    ;; Truly a block
@@ -5054,10 +5055,13 @@ will be prompted for."
 	       beg end
 	       '(font-lock-fontified t font-lock-multiline t))
 	      (add-text-properties beg beg1 '(face org-meta-line))
-	      (add-text-properties end1 end '(face org-meta-line))
+	      (add-text-properties end1 (+ end 1) '(face org-meta-line))
+					; for end_src
 	      (cond
 	       (quoting
-		(add-text-properties beg1 end1 '(face org-block)))
+		(add-text-properties beg1 (+ end1 1) '(face
+						       org-block)))
+					; end of source block
 	       ((not org-fontify-quote-and-verse-blocks))
 	       ((string= block-type "quote")
 		(add-text-properties beg1 end1 '(face org-quote)))

[-- Attachment #3: Type: text/plain, Size: 222 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [Patch] Org-fontify
  2010-08-13 20:19 [Patch] Org-fontify Sébastien Vauban
@ 2010-08-13 20:37 ` Erik Iverson
  2010-08-13 21:52   ` Sébastien Vauban
  0 siblings, 1 reply; 7+ messages in thread
From: Erik Iverson @ 2010-08-13 20:37 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

Hello!

Having not tried this out, are the aims different than David O'Toole's
mode-specific fontification of org-mode source blocks?

http://www.mail-archive.com/emacs-orgmode@gnu.org/msg28160.html

See a picture of what he's done here:

http://imagebin.ca/view/iRVK_as7.html



Sébastien Vauban wrote:
> Hello,
> 
> Champagne!  My very first patch... Hopefully one that will be followed by many
> more...
> 
> Goal: to *fontify whole lines* of code-block or meta-lines.
> 
> See the results on this minimal example:
> 
> --8<---------------cut here---------------start------------->8---
> #+TITLE:     Better identification of source blocks and results
> #+DATE:      2010-08-13
> #+DESCRIPTION: 
> #+KEYWORDS: 
> #+LANGUAGE:  en_US
> 
> This is
> 
> #+BEGIN_SRC org
> ** Totals
> *** Using a table formula
> #+END_SRC
> 
> random text
> 
> #+LaTeX: \thisismycommand{}{param2}
> 
> inserted between
> 
> #+begin_src R :session woodland
> names(woodland)
> str(woodland)
> summary(woodland)
> #+end_src
> 
> code blocks
> 
> #+begin_src R :session woodland
> woodland
> #+end_src
> 
> copy from different
> 
> #+srcname:woodland
> #+begin_src R :colnames t
> read.table("/tmp/woodlands.txt",header=TRUE)
> #+end_src
> 
> #+results: woodland
> | "ID" | "wood"  | "A.reptans" | "E.amygdaloides" |
> |------+---------+-------------+------------------|
> | "a"  | "wood1" |           5 |               10 |
> | "b"  | "wood2" |           1 |                0 |
> 
> postings on org-mode...
> --8<---------------cut here---------------end--------------->8---
> 
> with *faces with background*, such as:
> 
> --8<---------------cut here---------------start------------->8---
>      (org-block ((t (:foreground "blue1" :background "#EAFFEA"))))
>      (org-code ((t (:foreground "blue1" :background "#EAFFEA"))))
>      (org-meta-line ((t (:foreground "#008ED1" :background "#FFEAEA"))))
>      (org-table ((t (:foreground "blue1" :background "#EAEAFF"))))
> --8<---------------cut here---------------end--------------->8---
> 
> Only feature: I did not succeed highlighting full lines containing =srcname=
> or =results=. Not a big deal. Though, if someone can do it, that would
> definitely please me...
> 
> Best regards,
>   Seb
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [Patch] Org-fontify
  2010-08-13 20:37 ` Erik Iverson
@ 2010-08-13 21:52   ` Sébastien Vauban
  2010-08-14 21:04     ` Sébastien Vauban
  0 siblings, 1 reply; 7+ messages in thread
From: Sébastien Vauban @ 2010-08-13 21:52 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Erik,

Erik Iverson wrote:
> Having not tried this out, are the aims different than David O'Toole's
> mode-specific fontification of org-mode source blocks?
>
> http://www.mail-archive.com/emacs-orgmode-mXXj517/zsQ@public.gmane.org/msg28160.html
>
> See a picture of what he's done here:
>
> http://imagebin.ca/view/iRVK_as7.html

Nothing to do, in fact. Complementary, I hope...

The fact is that, when you use faces with background, you see the whole line
fontified (up to the right fringe), or only up to the end of the line (last
character, =C-e=).

My patch cares for the first behavior.

Best regards,
  Seb

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [Patch] Org-fontify
  2010-08-13 21:52   ` Sébastien Vauban
@ 2010-08-14 21:04     ` Sébastien Vauban
  2010-08-15  7:30       ` Carsten Dominik
  0 siblings, 1 reply; 7+ messages in thread
From: Sébastien Vauban @ 2010-08-14 21:04 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Erik and all,

> Erik Iverson wrote:
>> Having not tried this out, are the aims different than David O'Toole's
>> mode-specific fontification of org-mode source blocks?
>>
>> http://www.mail-archive.com/emacs-orgmode-mXXj517/zsQ@public.gmane.org/msg28160.html
>>
>> See a picture of what he's done here:
>>
>> http://imagebin.ca/view/iRVK_as7.html
>
> Nothing to do, in fact. Complementary, I hope...
>
> The fact is that, when you use faces with background, you see the whole line
> fontified (up to the right fringe), or only up to the end of the line (last
> character, =C-e=).
>
> My patch cares for the first behavior.

See http://www.mygooglest.com/sva/highlight-whole-ines.png
for the results on my minimal example file.

Best regards,
  Seb

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Re: [Patch] Org-fontify
  2010-08-14 21:04     ` Sébastien Vauban
@ 2010-08-15  7:30       ` Carsten Dominik
  2010-08-17 14:07         ` Sébastien Vauban
  0 siblings, 1 reply; 7+ messages in thread
From: Carsten Dominik @ 2010-08-15  7:30 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

Hi,

I have applied this patch.

Thanks!

- Carsten

On Aug 14, 2010, at 11:04 PM, Sébastien Vauban wrote:

> Hi Erik and all,
>
>> Erik Iverson wrote:
>>> Having not tried this out, are the aims different than David  
>>> O'Toole's
>>> mode-specific fontification of org-mode source blocks?
>>>
>>> http://www.mail-archive.com/emacs-orgmode@gnu.org/msg28160.html
>>>
>>> See a picture of what he's done here:
>>>
>>> http://imagebin.ca/view/iRVK_as7.html
>>
>> Nothing to do, in fact. Complementary, I hope...
>>
>> The fact is that, when you use faces with background, you see the  
>> whole line
>> fontified (up to the right fringe), or only up to the end of the  
>> line (last
>> character, =C-e=).
>>
>> My patch cares for the first behavior.
>
> See http://www.mygooglest.com/sva/highlight-whole-ines.png
> for the results on my minimal example file.
>
> Best regards,
>  Seb
>
> -- 
> Sébastien Vauban
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

* Re: [Patch] Org-fontify
  2010-08-15  7:30       ` Carsten Dominik
@ 2010-08-17 14:07         ` Sébastien Vauban
  2010-08-17 14:23           ` Carsten Dominik
  0 siblings, 1 reply; 7+ messages in thread
From: Sébastien Vauban @ 2010-08-17 14:07 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Carsten,

Carsten Dominik wrote:
> On Aug 14, 2010, at 11:04 PM, Sébastien Vauban wrote:
>>
>> See http://www.mygooglest.com/sva/highlight-whole-ines.png
>> for the results on my minimal example file.
>
> I have applied this patch.

Thanks.

Thinking a bit more about it, I wondered if it wouldn't be good -- though I'm
not sure on this -- to link this behavior with
`org-fontify-whole-heading-line'.

What do you think?  Easy to do (and not to do)...


Best regards,
  Seb

-- 
Sébastien Vauban


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode-mXXj517/zsQ@public.gmane.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Re: [Patch] Org-fontify
  2010-08-17 14:07         ` Sébastien Vauban
@ 2010-08-17 14:23           ` Carsten Dominik
  0 siblings, 0 replies; 7+ messages in thread
From: Carsten Dominik @ 2010-08-17 14:23 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

No

HiSebastian,

no, I think these are separate issues.

Best wishes

- Carsten

On Aug 17, 2010, at 4:07 PM, Sébastien Vauban wrote:

> Hi Carsten,
>
> Carsten Dominik wrote:
>> On Aug 14, 2010, at 11:04 PM, Sébastien Vauban wrote:
>>>
>>> See http://www.mygooglest.com/sva/highlight-whole-ines.png
>>> for the results on my minimal example file.
>>
>> I have applied this patch.
>
> Thanks.
>
> Thinking a bit more about it, I wondered if it wouldn't be good --  
> though I'm
> not sure on this -- to link this behavior with
> `org-fontify-whole-heading-line'.
>
> What do you think?  Easy to do (and not to do)...
>
>
> Best regards,
>  Seb
>
> -- 
> Sébastien Vauban
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

end of thread, other threads:[~2010-08-17 14:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-13 20:19 [Patch] Org-fontify Sébastien Vauban
2010-08-13 20:37 ` Erik Iverson
2010-08-13 21:52   ` Sébastien Vauban
2010-08-14 21:04     ` Sébastien Vauban
2010-08-15  7:30       ` Carsten Dominik
2010-08-17 14:07         ` Sébastien Vauban
2010-08-17 14:23           ` Carsten Dominik

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