branch: externals/code-cells commit 9b8a10188cf45d58cf0ae8aedd8a168be318f9f2 Author: Augusto Stoffel <arstof...@gmail.com> Commit: Augusto Stoffel <arstof...@gmail.com>
Remove deprecated variable code-cells-boundary-markers --- code-cells.el | 51 ++++++++++++++++----------------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/code-cells.el b/code-cells.el index 44756bc196..92abd238d7 100644 --- a/code-cells.el +++ b/code-cells.el @@ -66,36 +66,17 @@ ;;; Cell navigation -(defcustom code-cells-boundary-markers nil - "List of regular expressions specifying cell boundaries. -They should match immediately after a comment start at the -beginning of a line. The length of the first capture determines -the outline level." - :type '(repeat regexp)) -(make-obsolete-variable 'code-cells-boundary-markers - 'code-cells-boundary-regexp - "0.3") - (defcustom code-cells-boundary-regexp - (rx (+ (syntax comment-start)) + (rx line-start + (+ (syntax comment-start)) (or (seq (* (syntax whitespace)) "%" (group-n 1 (+ "%"))) (group-n 1 (+ "*")) (seq " In[" (* (any space digit)) "]:"))) "Regular expression specifying cell boundaries. It should match at the beginning of a line. The length of the first capture determines the outline level." - :type 'regexp) - -(defun code-cells-boundary-regexp () - "Return a regexp matching comment lines that serve as cell boundary." - (if code-cells-boundary-markers - (concat (rx line-start) - (or comment-start-skip - (rx (+ (syntax comment-start)) (* (syntax whitespace)))) - "\\(?:" - (string-join code-cells-boundary-markers "\\|") - "\\)") - (rx line-start (regexp code-cells-boundary-regexp)))) + :type 'regexp + :safe #'stringp) ;;;###autoload (defun code-cells-forward-cell (&optional arg) @@ -103,7 +84,7 @@ first capture determines the outline level." With ARG, repeat this that many times. If ARG is negative, move backward." (interactive "p") - (let ((page-delimiter (code-cells-boundary-regexp))) + (let ((page-delimiter code-cells-boundary-regexp)) (when (and (< 0 arg) (looking-at page-delimiter)) (forward-char)) (forward-page arg) @@ -139,7 +120,7 @@ from the current one." (when (/= 0 distance) ;; Except when at the boundary, `(code-cells-forward-cell -1)' doesn't ;; move out of current cell - (unless (looking-at-p (code-cells-boundary-regexp)) + (unless (looking-at-p code-cells-boundary-regexp) (code-cells-backward-cell)) (code-cells-forward-cell distance)) (code-cells--bounds))) @@ -153,9 +134,9 @@ Move up when ARG is negative and move down otherwise." (unless (save-excursion (and (/= current-beg next-beg) (goto-char current-beg) - (looking-at-p (code-cells-boundary-regexp)) + (looking-at-p code-cells-boundary-regexp) (goto-char next-beg) - (looking-at-p (code-cells-boundary-regexp)))) + (looking-at-p code-cells-boundary-regexp))) (user-error "Can't move cell")) (transpose-regions current-beg current-end next-beg next-end))) @@ -217,7 +198,7 @@ COMMAND." (list 'menu-item nil command :filter (lambda (d) (when (and (bolp) - (looking-at (code-cells-boundary-regexp))) + (looking-at code-cells-boundary-regexp)) d)))) ;;; Code evaluation @@ -273,17 +254,17 @@ Called from Lisp, evaluate region between START and END." To be used as the value of the variable `outline-level'. At a cell boundary, returns the cell outline level, as determined by -`code-cells-boundary-markers'. Otherwise, returns the sum of the +`code-cells-boundary-regexp'. Otherwise, returns the sum of the outline level as determined by the major mode and the current cell level." - (let* ((at-boundary (looking-at-p (code-cells-boundary-regexp))) + (let* ((at-boundary (looking-at-p code-cells-boundary-regexp)) (mm-level (if at-boundary 0 (funcall (car code-cells--saved-vars)))) (cell-level (if (or at-boundary (save-excursion (re-search-backward - (code-cells-boundary-regexp) nil t))) + code-cells-boundary-regexp nil t))) (if (match-string 1) (- (match-end 1) (match-beginning 1)) 1) @@ -295,7 +276,7 @@ level." (defun code-cells--font-lock-keywords () "Font lock keywords to highlight cell boundaries." - `((,(rx (regexp (code-cells-boundary-regexp)) (* any) "\n") + `((,(rx (regexp code-cells-boundary-regexp) (* any) "\n") 0 'code-cells-header-line append))) ;;;###autoload @@ -310,11 +291,11 @@ level." outline-heading-end-regexp paragraph-start) outline-level 'code-cells--outline-level - outline-regexp (rx (or (regexp (code-cells-boundary-regexp)) + outline-regexp (rx (or (regexp code-cells-boundary-regexp) (regexp outline-regexp))) outline-heading-end-regexp "\n" paragraph-separate (rx (or (regexp paragraph-separate) - (regexp (code-cells-boundary-regexp))))) + (regexp code-cells-boundary-regexp)))) (font-lock-add-keywords nil (code-cells--font-lock-keywords))) (setq-local outline-level (pop code-cells--saved-vars) outline-regexp (pop code-cells--saved-vars) @@ -329,7 +310,7 @@ level." This function is useful when added to a major mode hook." (when (save-excursion (goto-char (point-min)) - (re-search-forward (code-cells-boundary-regexp) 5000 t)) + (re-search-forward code-cells-boundary-regexp 5000 t)) (code-cells-mode))) (let ((map (make-sparse-keymap)))