From 305132b25eb60da67dbc27223d63d5a4588b63e0 Mon Sep 17 00:00:00 2001 From: rekado Date: Fri, 15 Jul 2016 10:02:51 +0200 Subject: Move regexp for begin of org src block to variable. --- init.org | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/init.org b/init.org index ee53fc7..5cd315c 100644 --- a/init.org +++ b/init.org @@ -290,13 +290,15 @@ from [[https://pank.eu/blog/pretty-babel-src-blocks.html][the blog of Rasmus Pan #+BEGIN_SRC elisp (defvar-local rasmus/org-at-src-begin -1 "Variable that holds whether last position was a ") +(defvar-local my/org-src-begin-regexp + "^[ \t]*#\\+begin_src[ \t]+[^ \f\t\n\r\v]+[ \t]*") (defvar rasmus/ob-header-symbol ?☰ "Symbol used for babel headers") (defun rasmus/org-prettify-src--update () (let ((case-fold-search t) - (re "^[ \t]*#\\+begin_src[ \t]+[^ \f\t\n\r\v]+[ \t]*") + (re my/org-src-begin-regexp) found) (save-excursion (goto-char (point-min)) @@ -332,7 +334,7 @@ may not be efficient." (let* ((case-fold-search t) (at-src-block (save-excursion (beginning-of-line) - (looking-at "^[ \t]*#\\+begin_src[ \t]+[^ \f\t\n\r\v]+[ \t]*")))) + (looking-at my/org-src-begin-regexp)))) ;; Test if we moved out of a block. (when (or (and rasmus/org-at-src-begin (not at-src-block)) -- cgit v1.2.3