فهرست منبع

Add faces customization to quote and verse blocks

Patch by Julien Barnier, with modifications by Carsten.
Carsten Dominik 15 سال پیش
والد
کامیت
8f3c4096a0
3فایلهای تغییر یافته به همراه21 افزوده شده و 4 حذف شده
  1. 6 0
      lisp/ChangeLog
  2. 6 0
      lisp/org-faces.el
  3. 9 4
      lisp/org.el

+ 6 - 0
lisp/ChangeLog

@@ -1,5 +1,11 @@
 2009-11-18  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org.el (org-fontify-meta-lines-and-blocks): Apply special faces
+	for special blocks.
+
+	* org-faces.el (org-copy-face): Set lisp indentation.
+	(org-quote, org-verse): New faces.
+
 	* org-agenda.el (org-agenda-remove-date): Remove variable.
 
 2009-11-17  Carsten Dominik  <carsten.dominik@gmail.com>

+ 6 - 0
lisp/org-faces.el

@@ -44,6 +44,7 @@
       (copy-face old-face new-face)
       (if (fboundp 'set-face-doc-string)
 	  (set-face-doc-string new-face docstring)))))
+(put 'org-copy-face 'lisp-indent-function 2)
 
 (defgroup org-faces nil
   "Faces in Org-mode."
@@ -468,6 +469,11 @@ changes."
   :group 'org-faces
   :version "22.1")
 
+(org-copy-face 'org-block 'org-quote
+   "Face for #+BEGIN_QUOTE ... #+END_QUOTE blocks.")
+(org-copy-face 'org-block 'org-verse
+   "Face for #+BEGIN_VERSE ... #+END_VERSE blocks.")
+
 (defface org-clock-overlay ;; copied from secondary-selection
   (org-compatible-face nil
     '((((class color) (min-colors 88) (background light))

+ 9 - 4
lisp/org.el

@@ -4540,7 +4540,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)
 	  (cond
 	   ((member dc1 '("html:" "ascii:" "latex:" "docbook:"))
 	    ;; a single line of backend-specific content
@@ -4554,8 +4554,8 @@ 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))
 	    (when (re-search-forward
 		   (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*")
 		   nil t)  ;; on purpose, we look further than LIMIT
@@ -4568,8 +4568,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)))
+	       ((string= block-type "quote")
+		(add-text-properties beg1 end1 '(face org-quote)))
+	       ((string= block-type "verse")
+		(add-text-properties beg1 end1 '(face org-verse))))
 	      t))
 	   ((not (member (char-after beg) '(?\  ?\t)))
 	    ;; just any other in-buffer setting, but not indented