branch: externals/code-cells
commit 1ca02d489d991e5ef7502cef9b8e59556a437224
Author: Augusto Stoffel <[email protected]>
Commit: Augusto Stoffel <[email protected]>

    Add code-cells-comment-or-uncomment
---
 code-cells.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/code-cells.el b/code-cells.el
index 01d1a672d5..f6961edf5b 100644
--- a/code-cells.el
+++ b/code-cells.el
@@ -132,6 +132,19 @@ region is active, use its bounds instead.  In this case,
     (goto-char start)
     (push-mark end nil t)))
 
+;;;###autoload
+(defun code-cells-comment-or-uncomment (&optional arg)
+  "Comment or uncomment the current code cell.
+
+ARG, if provided, is the number of comment characters to add or
+remove."
+  (interactive "P")
+  (pcase-let* ((`(,header ,end) (code-cells--bounds arg))
+               (start (save-excursion
+                        (goto-char header)
+                        (forward-line)
+                        (point))))
+    (comment-or-uncomment-region start end)))
 
 ;;;###autoload
 (defun code-cells-command (fun &rest options)

Reply via email to