[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))
- [elpa] externals/code-cells c16c0aa0af 13/36: Use named groups in alternative regexp branches, (continued)
- [elpa] externals/code-cells c16c0aa0af 13/36: Use named groups in alternative regexp branches, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells 1661efd9ae 18/36: Add MELPA badge; mention EIN, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells d03621b103 19/36: Change screenshot, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells 374edc6be7 20/36: Change package description, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells 1bd650391a 25/36: Update README, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells 4e973e0122 26/36: Do not assume Emacs has native JSON parsing available, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells 185c33b8b6 27/36: Fix cell movement for files without newline at the end, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells 031f726941 30/36: code-cells-eval: Fix check for a possibly active minor mode, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells ea7799c447 35/36: Release on ELPA, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells 37dce1d908 02/36: Add existing code, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells 30c0359c36 03/36: Simplify motion code,
ELPA Syncer <=
- [elpa] externals/code-cells aeddd889c2 04/36: Add ipynb support via Jupytext, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells e02bda5b68 09/36: Assorted refinements, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells aefabc4abf 10/36: Comments about ipynb conversion settings, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells 7bad8f1cf6 11/36: Speed keys, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells 2dc51b44a3 12/36: Correct outline level before first cell header, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells 9500e07f83 15/36: Fix byte-compilation issue, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells adda62ec82 16/36: Address some packaging issues, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells 67e1479a75 28/36: Add code-cells-mode-maybe, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells f93db2d65c 29/36: Refinement in Commentary section, ELPA Syncer, 2022/02/28
- [elpa] externals/code-cells 47305f5439 31/36: Indicate that spaces are allowed before cell boundary marker, ELPA Syncer, 2022/02/28