From 37d2a2d1cfa58c5334eec4f7fbabc4a2f313ab33 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 26 Feb 2015 00:21:53 +0100 Subject: [PATCH] Prevent invisible characters in keywords * lisp/org.el (org-fontify-meta-lines-and-blocks-1): Forbid invisible characters (e.g. bracket links) in all keywords but TITLE, DATE, AUTHOR, CAPTION and EMAIL. Also remove back-end specific keywords, which are treated just like any other regular keyword. Reported-by: Rasmus --- lisp/org.el | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index fdf349a42..17871a527 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -5881,17 +5881,6 @@ by a #." (dc3 (downcase (match-string 3))) end end1 quoting block-type ovl) (cond - ((member dc1 '("+html:" "+ascii:" "+latex:")) - ;; a single line of backend-specific content - (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) - (remove-text-properties (match-beginning 0) (match-end 0) - '(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) 1) - '(font-lock-fontified t face org-block)) - ; for backend-specific code - t) ((and (match-end 4) (equal dc3 "+begin")) ;; Truly a block (setq block-type (downcase (match-string 5)) @@ -5943,18 +5932,14 @@ by a #." (if (string-equal dc1 "+title:") '(font-lock-fontified t face org-document-title) '(font-lock-fontified t face org-document-info)))) - ((or (equal dc1 "+results") - (member dc1 '("+begin:" "+end:" "+caption:" "+label:" - "+orgtbl:" "+tblfm:" "+tblname:" "+results:" - "+call:" "+header:" "+headers:" "+name:")) - (and (match-end 4) (equal dc3 "+attr"))) - (org-remove-flyspell-overlays-in - (match-beginning 0) - (if (equal "+caption:" dc1) (match-end 2) (match-end 0))) - (add-text-properties - beg (match-end 0) - '(font-lock-fontified t face org-meta-line)) - t) + ((equal dc1 "+caption:") + (org-remove-flyspell-overlays-in (match-end 2) (match-end 0)) + (remove-text-properties (match-beginning 0) (match-end 0) + '(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) 1) + '(font-lock-fontified t face org-block))) ((member dc3 '(" " "")) (org-remove-flyspell-overlays-in beg (match-end 0)) (add-text-properties @@ -5962,9 +5947,10 @@ by a #." '(font-lock-fontified t face font-lock-comment-face))) (t ;; just any other in-buffer setting, but not indented (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) - (add-text-properties - beg (match-end 0) - '(font-lock-fontified t face org-meta-line)) + (remove-text-properties (match-beginning 0) (match-end 0) + '(display t invisible t intangible t)) + (add-text-properties beg (match-end 0) + '(font-lock-fontified t face org-meta-line)) t)))))) (defun org-fontify-drawers (limit) -- 2.11.4.GIT