emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Fontification of blocks
@ 2010-12-10  9:02 Sébastien Vauban
  2010-12-10 11:12 ` David O'Toole
  2010-12-13 19:50 ` Eric Schulte
  0 siblings, 2 replies; 28+ messages in thread
From: Sébastien Vauban @ 2010-12-10  9:02 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

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

Hi,

In order to make the blocks stand out more clearly in the mix of prose, code
and table results of many Babel Org files, I've added 2 new faces:

- org-block-begin-line
- org-block-end-line

These apply to the line just before and after the block's body:

#+srcname: top-10-dossiers-with-many-prestations
#+begin_src sql                                     <<< org-block-begin-line
SELECT TOP 10 prsPfiID_fk, COUNT(*) AS '# Prestations'
FROM prestations
GROUP BY prsPfiID_fk
ORDER BY COUNT(*) DESC
#+end_src                                             <<< org-block-end-line

Not only for =src=, but also for =verse=, =quote=, etc.

This patch takes care of the correct fontification, both in native style, and
in the "no native fontification" style:


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

diff --git a/lisp/org.el b/lisp/org.el
index e03e9ca..f57c09b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5137,8 +5137,8 @@ will be prompted for."
 	      (add-text-properties
 	       beg end
 	       '(font-lock-fontified t font-lock-multiline t))
-	      (add-text-properties beg beg1 '(face org-meta-line))
-	      (add-text-properties end1 (+ end 1) '(face org-meta-line))
+	      (add-text-properties beg beg1 '(face org-block-begin-line))
+	      (add-text-properties end1 (+ end 1) '(face org-block-end-line))
 					; for end_src
 	      (cond
 	       ((and lang org-src-fontify-natively)
@@ -5149,9 +5149,9 @@ will be prompted for."
 					; end of source block
 	       ((not org-fontify-quote-and-verse-blocks))
 	       ((string= block-type "quote")
-		(add-text-properties beg1 end1 '(face org-quote)))
+		(add-text-properties beg1 (1+ end1) '(face org-quote)))
 	       ((string= block-type "verse")
-		(add-text-properties beg1 end1 '(face org-verse))))
+		(add-text-properties beg1 (1+ end1) '(face org-verse))))
 	      t))
 	   ((member dc1 '("title:" "author:" "email:" "date:"))
 	    (add-text-properties
@@ -5167,7 +5167,7 @@ will be prompted for."
 	   ((not (member (char-after beg) '(?\  ?\t)))
 	    ;; just any other in-buffer setting, but not indented
 	    (add-text-properties
-	     beg (match-end 0)
+	     beg (1+ (match-end 0))
 	     '(font-lock-fontified t face org-meta-line))
 	    t)
 	   ((or (member dc1 '("begin:" "end:" "caption:" "label:"

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


Best regards,
  Seb

-- 
Sébastien Vauban


[-- Attachment #4: 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] 28+ messages in thread
* Fontification of blocks
@ 2010-12-10  9:01 Sébastien Vauban
  0 siblings, 0 replies; 28+ messages in thread
From: Sébastien Vauban @ 2010-12-10  9:01 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

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

Hi,

In order to make the blocks stand out more clearly in the mix of prose, code
and table results of many Babel Org files, I've added 2 new faces:

- org-block-begin-line
- org-block-end-line

These apply to the line just before and after the block's body:

#+srcname: top-10-dossiers-with-many-prestations
#+begin_src sql                                     <<< org-block-begin-line
SELECT TOP 10 prsPfiID_fk, COUNT(*) AS '# Prestations'
FROM prestations
GROUP BY prsPfiID_fk
ORDER BY COUNT(*) DESC
#+end_src                                             <<< org-block-end-line

Not only for =src=, but also for =verse=, =quote=, etc.

This patch takes care of the correct fontification, both in native style, and
in the "no native fontification" style:


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

diff --git a/lisp/org.el b/lisp/org.el
index e03e9ca..f57c09b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5137,8 +5137,8 @@ will be prompted for."
 	      (add-text-properties
 	       beg end
 	       '(font-lock-fontified t font-lock-multiline t))
-	      (add-text-properties beg beg1 '(face org-meta-line))
-	      (add-text-properties end1 (+ end 1) '(face org-meta-line))
+	      (add-text-properties beg beg1 '(face org-block-begin-line))
+	      (add-text-properties end1 (+ end 1) '(face org-block-end-line))
 					; for end_src
 	      (cond
 	       ((and lang org-src-fontify-natively)
@@ -5149,9 +5149,9 @@ will be prompted for."
 					; end of source block
 	       ((not org-fontify-quote-and-verse-blocks))
 	       ((string= block-type "quote")
-		(add-text-properties beg1 end1 '(face org-quote)))
+		(add-text-properties beg1 (1+ end1) '(face org-quote)))
 	       ((string= block-type "verse")
-		(add-text-properties beg1 end1 '(face org-verse))))
+		(add-text-properties beg1 (1+ end1) '(face org-verse))))
 	      t))
 	   ((member dc1 '("title:" "author:" "email:" "date:"))
 	    (add-text-properties
@@ -5167,7 +5167,7 @@ will be prompted for."
 	   ((not (member (char-after beg) '(?\  ?\t)))
 	    ;; just any other in-buffer setting, but not indented
 	    (add-text-properties
-	     beg (match-end 0)
+	     beg (1+ (match-end 0))
 	     '(font-lock-fontified t face org-meta-line))
 	    t)
 	   ((or (member dc1 '("begin:" "end:" "caption:" "label:"

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


Best regards,
  Seb

-- 
Sébastien Vauban


[-- Attachment #4: 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] 28+ messages in thread

end of thread, other threads:[~2011-02-09  8:40 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-10  9:02 Fontification of blocks Sébastien Vauban
2010-12-10 11:12 ` David O'Toole
2010-12-13 21:25   ` Sébastien Vauban
2010-12-22 13:36     ` Dan Davison
2010-12-22 14:46       ` Sébastien Vauban
2010-12-13 19:50 ` Eric Schulte
2010-12-13 20:46   ` Sébastien Vauban
2010-12-15 17:22     ` Eric Schulte
2011-02-01 21:04       ` Sébastien Vauban
2011-02-02  7:25         ` Eric S Fraga
2011-02-02 14:34         ` Dan Davison
2011-02-02 20:19           ` Sébastien Vauban
2011-02-07 12:54             ` Dan Davison
2011-02-07 19:55               ` Sébastien Vauban
2011-02-08 19:00                 ` Dan Davison
2011-02-08 20:14                   ` Sébastien Vauban
2011-02-09  8:40                     ` Dan Davison
2011-02-02 22:24         ` Sébastien Vauban
2011-02-02 22:46           ` Eric S Fraga
2011-02-03 15:02           ` Eric Schulte
2011-02-03 19:57             ` Sébastien Vauban
2011-02-03 20:05             ` Eric S Fraga
2011-02-03 20:44               ` Sébastien Vauban
2011-02-04  9:21                 ` Sébastien Vauban
2011-02-04 16:18                   ` Eric S Fraga
2011-02-04 20:50                   ` Eric Schulte
2011-02-06  8:52                     ` Sébastien Vauban
  -- strict thread matches above, loose matches on Subject: below --
2010-12-10  9:01 Sébastien Vauban

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