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

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

[nongnu] elpa/yasnippet-snippets d80b2ff60f 10/13: FIX: Single semicolon


From: ELPA Syncer
Subject: [nongnu] elpa/yasnippet-snippets d80b2ff60f 10/13: FIX: Single semicolon at beginning was indented. (#454)
Date: Fri, 5 Jan 2024 07:00:47 -0500 (EST)

branch: elpa/yasnippet-snippets
commit d80b2ff60ffd149caf36cea2759e4c432aa73efc
Author: quazgar <quazgar@users.noreply.github.com>
Commit: GitHub <noreply@github.com>

    FIX: Single semicolon at beginning was indented. (#454)
    
    The workaround here is to add a double semicolon, iff the start comment is a
    single semicolon.  This also required some fixing of the whitespace
    calculations.  This commit is for issue
    387 (https://github.com/AndreaCrotti/yasnippet-snippets/issues/387).
---
 snippets/prog-mode/commentblock | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/snippets/prog-mode/commentblock b/snippets/prog-mode/commentblock
index ba61f61a99..1636b7f6e0 100644
--- a/snippets/prog-mode/commentblock
+++ b/snippets/prog-mode/commentblock
@@ -15,15 +15,20 @@ ${1:$(let* ((col (current-column))
 ${1:$(let* ((col (current-column))
            (str "")
            (start (yas-trimmed-comment-start))
+           (start (if (string= start ";") ";;" start))
            (end (yas-trimmed-comment-end)))
          (while (< (length str) (ffloor (/ (- 78.0 (+ col (length start) 
(string-width yas-text) (length end))) 2.0)))
                 (setq str (concat str " ")))
-        (concat start str))} ${1:comment} ${1:$(let* ((col (current-column))
-                                                     (str "")
-                                                     (start 
(yas-trimmed-comment-start))
-                                                     (end 
(yas-trimmed-comment-end)))
-                                                   (while (< (length str) (- 
79.0 (if (eq (mod (string-width yas-text) 2) 1) (- col 1) col) (length end)))
-                                                          (setq str (concat 
str " ")))
+        (concat start str))} ${1:comment} ${1:$(
+        let* ((col (current-column))
+              (str "")
+              (start (yas-trimmed-comment-start))
+              (start (if (string= start ";") ";;" start))
+              (end (yas-trimmed-comment-end)))
+              (while (< (length str)
+                        (- 79 (length end)
+                           (if (eq (mod (+ (string-width yas-text) (length 
start) (length end)) 2) 1) (- col 1) col)))
+              (setq str (concat str " ")))
                                                  (concat str end))}
 ${1:$(let* ((col (current-column))
            (str "")



reply via email to

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