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

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

[elpa] externals/code-cells 30c0359c36 03/36: Simplify motion code


From: ELPA Syncer
Subject: [elpa] externals/code-cells 30c0359c36 03/36: Simplify motion code
Date: Mon, 28 Feb 2022 15:57:41 -0500 (EST)

branch: externals/code-cells
commit 30c0359c36f022990c88c8f585089c2e90e00c54
Author: Augusto Stoffel <astoff@users.noreply.github.com>
Commit: Augusto Stoffel <astoff@users.noreply.github.com>

    Simplify motion code
---
 cells.el | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/cells.el b/cells.el
index 6ab06639ee..23c3fa273b 100644
--- a/cells.el
+++ b/cells.el
@@ -61,7 +61,7 @@ Each of regexp should match the content of a comment line 
which
 introduces a cell break."
   :type '(repeat sexp))
 
-(defface cells-header-line '((t :inherit header-line))
+(defface cells-header-line '((t :extend t :inherit header-line))
   "Face used by `cells-mode' to highlight cell boundaries.")
 
 (defun cells-boundary-regexp ()
@@ -76,15 +76,9 @@ introduces a cell break."
 With ARG, repeat this that many times.  If ARG is negative, move
 backward."
   (interactive "p")
-  (or arg (setq arg 1))
-  (when (and (> arg 0) (not (eobp)))
-    (forward-char))
-  (save-match-data
-    (or
-     (when (re-search-forward (cells-boundary-regexp) nil t arg)
-       (goto-char (match-beginning 0)))
-     (when (< arg 0) (goto-char (point-min)))
-     (when (> arg 0) (goto-char (point-max))))))
+  (let ((page-delimiter (cells-boundary-regexp)))
+    (forward-page arg)
+    (move-beginning-of-line 1)))
 
 (defun cells-backward-cell (&optional arg)
   "Move to the previous cell boundary, or beginning of buffer.
@@ -92,7 +86,7 @@ With ARG, repeat this that many times.  If ARG is negative, 
move
 forward."
   (interactive "p")
   (cells-forward-cell (- (or arg 1))))
-  
+
 (defmacro cells-do (&rest body)
   "Find current cell bounds and evaluate BODY.
 Inside BODY, the variables `beg' and `end' are bound to the
@@ -144,12 +138,13 @@ via `pulse-momentary-highlight-region'."
                        '(pulse-momentary-highlight-region beg end))
                     (funcall ',fun beg end)))))
 
+;;;###autoload
 (define-minor-mode cells-mode
   "Minor mode for cell-oriented code."
   ;; TODO: integrate with outline-mode?
   :keymap (make-sparse-keymap)
   (let ((spec `((,(concat "\\(" (cells-boundary-regexp) "\\).*\n")
-                 0 'cells-header-line prepend))))
+                 0 'cells-header-line append))))
     (if cells-mode
         (progn
           (font-lock-add-keywords nil spec))



reply via email to

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