emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Add faces customization to quote and verse blocks
@ 2009-11-12 15:41 Julien Barnier
  2009-11-17 15:28 ` Julien Barnier
  2009-11-18 22:54 ` Carsten Dominik
  0 siblings, 2 replies; 5+ messages in thread
From: Julien Barnier @ 2009-11-12 15:41 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Here is a small patch that allows to add custom faces to QUOTE and VERSE
blocks. As I'm quite new to emacs lisp and as it is the first time I
submit a patch to a project, please feel free to correct or reject it if
its form or quality is not sufficient.

Thanks a lot for all your work on org-mode !

Julien

---
 lisp/org-faces.el |   28 ++++++++++++++++++++++++++++
 lisp/org.el       |   15 +++++++++++----
 2 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index 4543d38..fbac871 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
@@ -468,6 +468,34 @@ changes."
   :group 'org-faces
   :version "22.1")
 
+(defface org-quote
+  (org-compatible-face nil
+    '((((class color grayscale) (min-colors 88) (background light))
+       (:foreground "grey50" :slant italic))
+      (((class color grayscale) (min-colors 88) (background dark))
+       (:foreground "grey70" :slant italic))
+      (((class color) (min-colors 8) (background light))
+       (:foreground "green" :slant italic))
+      (((class color) (min-colors 8) (background dark))
+       (:foreground "yellow" :slant italic))))
+  "Face for #+BEGIN_QUOTE ... #+END_QUOTE blocks."
+  :group 'org-faces
+  :version "22.1")
+
+(defface org-verse
+  (org-compatible-face nil
+    '((((class color grayscale) (min-colors 88) (background light))
+       (:foreground "grey50" :slant italic))
+      (((class color grayscale) (min-colors 88) (background dark))
+       (:foreground "grey70" :slant italic))
+      (((class color) (min-colors 8) (background light))
+       (:foreground "green" :slant italic))
+      (((class color) (min-colors 8) (background dark))
+       (:foreground "yellow" :slant italic))))
+  "Face for #+BEGIN_VERSE ... #+END_VERSE blocks."
+  :group 'org-faces
+  :version "22.1")
+
 (defface org-clock-overlay ;; copied from secondary-selection
   (org-compatible-face nil
     '((((class color) (min-colors 88) (background light))
diff --git a/lisp/org.el b/lisp/org.el
index 5562d8d..adabfa8 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4518,7 +4518,7 @@ will be prompted for."
 	      (beg1 (line-beginning-position 2))
 	      (dc1 (downcase (match-string 2)))
 	      (dc3 (downcase (match-string 3)))
-	      end end1 quoting)
+	      end end1 quoting block-type quote-block verse-block)
 	  (cond
 	   ((member dc1 '("html:" "ascii:" "latex:" "docbook:"))
 	    ;; a single line of backend-specific content
@@ -4532,8 +4532,10 @@ will be prompted for."
 	    t)
 	   ((and (match-end 4) (equal dc3 "begin"))
 	    ;; Truely a block
-	    (setq quoting (member (downcase (match-string 5))
-				  org-protecting-blocks))
+	    (setq block-type (downcase (match-string 5))
+		  quoting (member block-type org-protecting-blocks)
+		  quote-block (equal block-type "quote")
+		  verse-block (equal block-type "verse"))
 	    (when (re-search-forward
 		   (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*")
 		   nil t)  ;; on purpose, we look further than LIMIT
@@ -4546,8 +4548,13 @@ will be prompted for."
 	       '(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))
-	      (when quoting
+	      (cond
+	       (quoting
 		(add-text-properties beg1 end1 '(face org-block)))
+	       (quote-block
+		(add-text-properties beg1 end1 '(face org-quote)))
+	       (verse-block
+		(add-text-properties beg1 end1 '(face org-verse))))
 	      t))
 	   ((not (member (char-after beg) '(?\  ?\t)))
 	    ;; just any other in-buffer setting, but not indented
-- 
1.6.5.2

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

* Re: [PATCH] Add faces customization to quote and verse blocks
  2009-11-12 15:41 [PATCH] Add faces customization to quote and verse blocks Julien Barnier
@ 2009-11-17 15:28 ` Julien Barnier
  2009-11-17 15:38   ` Carsten Dominik
  2009-11-17 15:43   ` Carsten Dominik
  2009-11-18 22:54 ` Carsten Dominik
  1 sibling, 2 replies; 5+ messages in thread
From: Julien Barnier @ 2009-11-17 15:28 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

> Here is a small patch that allows to add custom faces to QUOTE and VERSE
> blocks. As I'm quite new to emacs lisp and as it is the first time I
> submit a patch to a project, please feel free to correct or reject it if
> its form or quality is not sufficient.

Sorry to bother you with this, but I would be very interested to know
why this patch has been rejected ? Is it because the "feature" it
implements is not seen as useful ? Or because the code is of poor
quality ? Is there some rewrite I could do to make it acceptable ?

Thanks in advance,

-- 
Julien

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

* Re: Re: [PATCH] Add faces customization to quote and verse blocks
  2009-11-17 15:28 ` Julien Barnier
@ 2009-11-17 15:38   ` Carsten Dominik
  2009-11-17 15:43   ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2009-11-17 15:38 UTC (permalink / raw)
  To: Julien Barnier; +Cc: emacs-orgmode

Hi Julien,

the patch has not been rejected (yet), I have not yet had time to look  
at it.  It came in at a moment when I was occupied with other stuff,  
and at that moment was pushed back.  It is in my queue though.

Will get to it soon, hopefully.

- Carsten

On Nov 17, 2009, at 4:28 PM, Julien Barnier wrote:

> Hi,
>
>> Here is a small patch that allows to add custom faces to QUOTE and  
>> VERSE
>> blocks. As I'm quite new to emacs lisp and as it is the first time I
>> submit a patch to a project, please feel free to correct or reject  
>> it if
>> its form or quality is not sufficient.
>
> Sorry to bother you with this, but I would be very interested to know
> why this patch has been rejected ? Is it because the "feature" it
> implements is not seen as useful ? Or because the code is of poor
> quality ? Is there some rewrite I could do to make it acceptable ?
>
> Thanks in advance,
>
> -- 
> Julien
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: 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] 5+ messages in thread

* Re: Re: [PATCH] Add faces customization to quote and verse blocks
  2009-11-17 15:28 ` Julien Barnier
  2009-11-17 15:38   ` Carsten Dominik
@ 2009-11-17 15:43   ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2009-11-17 15:43 UTC (permalink / raw)
  To: Julien Barnier; +Cc: emacs-orgmode

Hi Julien,

the patch has not been rejected (yet), I have not yet had time to look  
at it.  It came in at a moment when I was occupied with other stuff,  
and at that moment was pushed back.  It is in my queue though.

Will get to it soon, hopefully.

- Carsten

On Nov 17, 2009, at 4:28 PM, Julien Barnier wrote:

> Hi,
>
>> Here is a small patch that allows to add custom faces to QUOTE and  
>> VERSE
>> blocks. As I'm quite new to emacs lisp and as it is the first time I
>> submit a patch to a project, please feel free to correct or reject  
>> it if
>> its form or quality is not sufficient.
>
> Sorry to bother you with this, but I would be very interested to know
> why this patch has been rejected ? Is it because the "feature" it
> implements is not seen as useful ? Or because the code is of poor
> quality ? Is there some rewrite I could do to make it acceptable ?
>
> Thanks in advance,
>
> -- 
> Julien
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: 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] 5+ messages in thread

* Re: [PATCH] Add faces customization to quote and verse blocks
  2009-11-12 15:41 [PATCH] Add faces customization to quote and verse blocks Julien Barnier
  2009-11-17 15:28 ` Julien Barnier
@ 2009-11-18 22:54 ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2009-11-18 22:54 UTC (permalink / raw)
  To: Julien Barnier; +Cc: emacs-orgmode

Hi Julien,

I have applied your patch but modified it, also to keep it under the  
"fsf copyright assignment needed" limit.  Would you consider to sign  
those papers for future patches?

Thanks.

- Carsten

On Nov 12, 2009, at 4:41 PM, Julien Barnier wrote:

> Hi,
>
> Here is a small patch that allows to add custom faces to QUOTE and  
> VERSE
> blocks. As I'm quite new to emacs lisp and as it is the first time I
> submit a patch to a project, please feel free to correct or reject  
> it if
> its form or quality is not sufficient.
>
> Thanks a lot for all your work on org-mode !
>
> Julien
>
> ---
> lisp/org-faces.el |   28 ++++++++++++++++++++++++++++
> lisp/org.el       |   15 +++++++++++----
> 2 files changed, 39 insertions(+), 4 deletions(-)
>
> diff --git a/lisp/org-faces.el b/lisp/org-faces.el
> index 4543d38..fbac871 100644
> --- a/lisp/org-faces.el
> +++ b/lisp/org-faces.el
> @@ -468,6 +468,34 @@ changes."
>   :group 'org-faces
>   :version "22.1")
>
> +(defface org-quote
> +  (org-compatible-face nil
> +    '((((class color grayscale) (min-colors 88) (background light))
> +       (:foreground "grey50" :slant italic))
> +      (((class color grayscale) (min-colors 88) (background dark))
> +       (:foreground "grey70" :slant italic))
> +      (((class color) (min-colors 8) (background light))
> +       (:foreground "green" :slant italic))
> +      (((class color) (min-colors 8) (background dark))
> +       (:foreground "yellow" :slant italic))))
> +  "Face for #+BEGIN_QUOTE ... #+END_QUOTE blocks."
> +  :group 'org-faces
> +  :version "22.1")
> +
> +(defface org-verse
> +  (org-compatible-face nil
> +    '((((class color grayscale) (min-colors 88) (background light))
> +       (:foreground "grey50" :slant italic))
> +      (((class color grayscale) (min-colors 88) (background dark))
> +       (:foreground "grey70" :slant italic))
> +      (((class color) (min-colors 8) (background light))
> +       (:foreground "green" :slant italic))
> +      (((class color) (min-colors 8) (background dark))
> +       (:foreground "yellow" :slant italic))))
> +  "Face for #+BEGIN_VERSE ... #+END_VERSE blocks."
> +  :group 'org-faces
> +  :version "22.1")
> +
> (defface org-clock-overlay ;; copied from secondary-selection
>   (org-compatible-face nil
>     '((((class color) (min-colors 88) (background light))
> diff --git a/lisp/org.el b/lisp/org.el
> index 5562d8d..adabfa8 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -4518,7 +4518,7 @@ will be prompted for."
> 	      (beg1 (line-beginning-position 2))
> 	      (dc1 (downcase (match-string 2)))
> 	      (dc3 (downcase (match-string 3)))
> -	      end end1 quoting)
> +	      end end1 quoting block-type quote-block verse-block)
> 	  (cond
> 	   ((member dc1 '("html:" "ascii:" "latex:" "docbook:"))
> 	    ;; a single line of backend-specific content
> @@ -4532,8 +4532,10 @@ will be prompted for."
> 	    t)
> 	   ((and (match-end 4) (equal dc3 "begin"))
> 	    ;; Truely a block
> -	    (setq quoting (member (downcase (match-string 5))
> -				  org-protecting-blocks))
> +	    (setq block-type (downcase (match-string 5))
> +		  quoting (member block-type org-protecting-blocks)
> +		  quote-block (equal block-type "quote")
> +		  verse-block (equal block-type "verse"))
> 	    (when (re-search-forward
> 		   (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*")
> 		   nil t)  ;; on purpose, we look further than LIMIT
> @@ -4546,8 +4548,13 @@ will be prompted for."
> 	       '(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))
> -	      (when quoting
> +	      (cond
> +	       (quoting
> 		(add-text-properties beg1 end1 '(face org-block)))
> +	       (quote-block
> +		(add-text-properties beg1 end1 '(face org-quote)))
> +	       (verse-block
> +		(add-text-properties beg1 end1 '(face org-verse))))
> 	      t))
> 	   ((not (member (char-after beg) '(?\  ?\t)))
> 	    ;; just any other in-buffer setting, but not indented
> -- 
> 1.6.5.2
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: 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] 5+ messages in thread

end of thread, other threads:[~2009-11-18 22:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-12 15:41 [PATCH] Add faces customization to quote and verse blocks Julien Barnier
2009-11-17 15:28 ` Julien Barnier
2009-11-17 15:38   ` Carsten Dominik
2009-11-17 15:43   ` Carsten Dominik
2009-11-18 22:54 ` 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).