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

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

[elpa] externals/code-cells 1ca02d489d 23/36: Add code-cells-comment-or-


From: ELPA Syncer
Subject: [elpa] externals/code-cells 1ca02d489d 23/36: Add code-cells-comment-or-uncomment
Date: Mon, 28 Feb 2022 15:57:43 -0500 (EST)

branch: externals/code-cells
commit 1ca02d489d991e5ef7502cef9b8e59556a437224
Author: Augusto Stoffel <arstoffel@gmail.com>
Commit: Augusto Stoffel <arstoffel@gmail.com>

    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

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