[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/paredit e121b92 024/224: Clarify `paredit-insert-comment'
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/paredit e121b92 024/224: Clarify `paredit-insert-comment' and change its criteria for code comments. |
Date: |
Sat, 7 Aug 2021 09:22:10 -0400 (EDT) |
branch: elpa/paredit
commit e121b9258746d4d947269cab840197c3bbf2391a
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>
Clarify `paredit-insert-comment' and change its criteria for code comments.
Formerly, this would choose code comments only when code follow the
point on the line. Now it will insert code comments also when no
code precede the point on the line. For example, the command will
choose a code comment rather than a margin comment in the following
fragment:
(foo bar
|baz
quux)
=>
(foo bar
;; |
baz
quux)
darcs-hash:20081025201840-00fcc-0435e69b7e5e42c43a763dad345c0f8a25925b89
---
paredit.el | 49 +++++++++++++++++++++----------------------------
1 file changed, 21 insertions(+), 28 deletions(-)
diff --git a/paredit.el b/paredit.el
index 6c705a0..73a9d51 100644
--- a/paredit.el
+++ b/paredit.el
@@ -1065,35 +1065,28 @@ This is expected to be called only in
`paredit-comment-dwim'; do not
(code-before-p
(save-excursion (paredit-skip-whitespace nil (point-at-bol))
(not (bolp)))))
- (if (and (bolp)
- ;; We have to use EQ 0 here and not ZEROP because ZEROP
- ;; signals an error if its argument is non-numeric, but
- ;; CALCULATE-LISP-INDENT may return nil.
- (eq (let ((indent (calculate-lisp-indent)))
- (if (consp indent)
- (car indent)
- indent))
- 0))
- ;; Top-level comment
- (progn (if code-after-p (save-excursion (newline)))
- (insert ";;; "))
- (if code-after-p
- ;; Code comment
- (progn (if code-before-p
- ;++ Why NEWLINE-AND-INDENT here and not just
- ;++ NEWLINE, or PAREDIT-NEWLINE?
- (newline-and-indent))
+ (cond ((and (bolp)
+ (let ((indent
+ (let ((indent (calculate-lisp-indent)))
+ (if (consp indent) (car indent) indent))))
+ (and indent (zerop indent))))
+ ;; Top-level comment
+ (if code-after-p (save-excursion (newline)))
+ (insert ";;; "))
+ ((or code-after-p (not code-before-p))
+ ;; Code comment
+ (if code-before-p (newline))
+ (lisp-indent-line)
+ (insert ";; ")
+ (if code-after-p
+ (save-excursion
+ (newline)
(lisp-indent-line)
- (insert ";; ")
- ;; Move the following code. (NEWLINE-AND-INDENT will
- ;; delete whitespace after the comment, though, so use
- ;; NEWLINE & LISP-INDENT-LINE manually here.)
- (save-excursion (newline)
- (lisp-indent-line)))
- ;; Margin comment
- (progn (indent-to comment-column
- 1) ; 1 -> force one leading space
- (insert ?\; ))))))
+ (indent-sexp))))
+ (t
+ ;; Margin comment
+ (indent-to comment-column 1) ; 1 -> force one leading space
+ (insert ?\; )))))
;;;; Character Deletion
- [nongnu] elpa/paredit ba0de55 120/224: Add brief docstring to `paredit-check-region-state'., (continued)
- [nongnu] elpa/paredit ba0de55 120/224: Add brief docstring to `paredit-check-region-state'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 951813a 131/224: Fix `paredit-move-past-close' within a character escape., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 901acb8 012/224: Changes for version 16., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 602e328 011/224: Changes for version 15., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 760ae70 004/224: Changes for version 8., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 004d257 013/224: Changes for version 17., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 7f89e54 014/224: Changes for version 18., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 17852a0 019/224: Call `comment-forward' as a symbol with `funcall'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 2f3db5f 021/224: Broaden `paredit-raise-sexp' to act sensibly on strings and characters., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 8ab1694 022/224: Change `paredit-comment-on-line-p' to use `comment-search-forward'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit e121b92 024/224: Clarify `paredit-insert-comment' and change its criteria for code comments.,
ELPA Syncer <=
- [nongnu] elpa/paredit 451ea5e 025/224: Add magic autoload comment for `paredit-mode'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit a386bdf 031/224: Call `end-of-defun' in `paredit-reindent-defun'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 0d7a39d 032/224: Un-deprecate `enable-paredit-mode' and `disable-paredit-mode'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit db3a581 037/224: Switch copying terms to GPLv3+., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit ab99e93 044/224: Simplify definition of `paredit-kill-line-in-string'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 5bfc873 047/224: Fix `paredit-copy-as-kill' within strings., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit d265584 045/224: Fix `paredit-kill' on whitespace character literal with margin comment., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 7b31864 046/224: Check `eolp' before using `char-after' in `paredit-kill'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 30f564d 051/224: Add utilities for `check-parens' restricted to a region., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit d3723a0 059/224: Tweak second page. Remove rants and IRC reference., ELPA Syncer, 2021/08/07