commit c2943fd872103395fe36cc10c54bf7e185ab3c7d
parent 91799fb78de688fcf7aff91ce7f6d63ed2304d07
Author: Iqbal Ansari <iqbal.ansari@ignitesol.com>
Date: Thu, 29 Oct 2015 16:59:36 +0530
Do not try to emojify inside org-src blocks
Since our checks for programming mode constructs would not work inside
the src blocks
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/emojify.el b/emojify.el
@@ -137,6 +137,12 @@ buffer where emojis are going to be displayed selected."
(and (nth pos syntax-beg)
(nth pos syntax-end)))))
+(defun emojify-inside-org-src-p (point)
+ (when (eq major-mode 'org-mode)
+ (save-excursion
+ (goto-char point)
+ (eq (org-element-type (org-element-at-point)) 'src-block))))
+
(defun emojify-valid-text-context-p (beg end)
(and (or (not (char-before beg))
;; 32 space since ? (? followed by a space) is not readable
@@ -214,6 +220,8 @@ BEG and END are the beginning and end of the region respectively"
;; The text is at the beginning of the buffer
(emojify-valid-text-context-p match-beginning match-end)
+ (not (emojify-inside-org-src-p match-beginning))
+
;; Inhibit possibly inside a list
;; 41 is ?) but packages get confused by the extra closing paren
;; TODO Report bugs to such packages