emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 521c534: org-src: Refactor inline src block fontify


From: ELPA Syncer
Subject: [elpa] externals/org 521c534: org-src: Refactor inline src block fontify lines
Date: Thu, 2 Dec 2021 06:57:31 -0500 (EST)

branch: externals/org
commit 521c534101cf5d49cda70e3e9ffd494cc72fe594
Author: TEC <tec@tecosaur.com>
Commit: TEC <tec@tecosaur.com>

    org-src: Refactor inline src block fontify lines
    
    * lisp/org-src.el (org-fontify-inline-src-blocks-1): Refactor
    `org-fontify-inline-src-blocks-1' to bring down the maximum line
    length.  While we're at it, get rid of the debugging `message' call that
    somehow made its way in, and an unused variable in the `let' statement.
---
 lisp/org-src.el | 35 ++++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 13 deletions(-)

diff --git a/lisp/org-src.el b/lisp/org-src.el
index 639a447..46fed05 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -664,37 +664,46 @@ as `org-src-fontify-natively' is non-nil."
 
 (defun org-fontify-inline-src-blocks-1 (limit)
   "Fontify inline src_LANG blocks, from `point' up to LIMIT."
-  (let ((case-fold-search t)
-        (initial-point (point)))
-    (while (re-search-forward "\\_<src_\\([^ \t\n[{]+\\)[{[]?" limit t) ; 
copied from `org-element-inline-src-block-parser'
+  (let ((case-fold-search t))
+    ;; The regexp below is copied from `org-element-inline-src-block-parser'.
+    (while (re-search-forward "\\_<src_\\([^ \t\n[{]+\\)[{[]?" limit t)
       (let ((beg (match-beginning 0))
             (lang-beg (match-beginning 1))
             (lang-end (match-end 1))
             pt)
-        (font-lock-append-text-property lang-beg lang-end 'face 'org-meta-line)
-        (font-lock-append-text-property beg lang-beg 'face 'shadow)
-        (font-lock-append-text-property beg lang-end 'face 
'org-inline-src-block)
+        (font-lock-append-text-property
+         lang-beg lang-end 'face 'org-meta-line)
+        (font-lock-append-text-property
+         beg lang-beg 'face 'shadow)
+        (font-lock-append-text-property
+         beg lang-end 'face 'org-inline-src-block)
         (setq pt (goto-char lang-end))
         ;; `org-element--parse-paired-brackets' doesn't take a limit, so to
         ;; prevent it searching the entire rest of the buffer we temporarily
         ;; narrow the active region.
         (save-restriction
-          (narrow-to-region beg (min limit (or (save-excursion (and 
(search-forward "\n" limit t 2) (point)))
-                                               (point-max))))
-          (message "buf: %S" (substring-no-properties (buffer-string)))
+          (narrow-to-region beg
+                            (min limit (or (save-excursion
+                                             (and (search-forward"\n" limit t 
2)
+                                                  (point)))
+                                           (point-max))))
           (when (ignore-errors (org-element--parse-paired-brackets ?\[))
-            (font-lock-append-text-property pt (point) 'face 
'org-inline-src-block)
+            (font-lock-append-text-property
+             pt (point) 'face 'org-inline-src-block)
             (setq pt (point)))
           (when (ignore-errors (org-element--parse-paired-brackets ?\{))
             (remove-text-properties pt (point) '(face nil))
-            (font-lock-append-text-property pt (1+ pt) 'face 
'(org-inline-src-block shadow))
+            (font-lock-append-text-property
+             pt (1+ pt) 'face '(org-inline-src-block shadow))
             (unless (= (1+ pt) (1- (point)))
               (if org-src-fontify-natively
                   (org-src-font-lock-fontify-block
                    (buffer-substring-no-properties lang-beg lang-end)
                    (1+ pt) (1- (point)))
-                (font-lock-append-text-property (1+ pt) (1- (point)) 'face 
'org-inline-src-block)))
-            (font-lock-append-text-property (1- (point)) (point)'face 
'(org-inline-src-block shadow))
+                (font-lock-append-text-property
+                 (1+ pt) (1- (point)) 'face 'org-inline-src-block)))
+            (font-lock-append-text-property
+             (1- (point)) (point) 'face '(org-inline-src-block shadow))
             (setq pt (point)))))
       t)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]