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

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

[elpa] externals/sxhkdrc-mode 95b2c324f8 4/4: Refine sxhkdrc-mode-indent


From: ELPA Syncer
Subject: [elpa] externals/sxhkdrc-mode 95b2c324f8 4/4: Refine sxhkdrc-mode-indent-line
Date: Wed, 14 Dec 2022 05:58:09 -0500 (EST)

branch: externals/sxhkdrc-mode
commit 95b2c324f8ab66f1ca9eaee89fda54a535e06d6a
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Refine sxhkdrc-mode-indent-line
---
 sxhkdrc-mode.el | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/sxhkdrc-mode.el b/sxhkdrc-mode.el
index 2e2a3fe658..eca1c84cc2 100644
--- a/sxhkdrc-mode.el
+++ b/sxhkdrc-mode.el
@@ -6,7 +6,7 @@
 ;; Maintainer: Protesilaos Stavrou General Issues 
<~protesilaos/general-issues@lists.sr.ht>
 ;; URL: https://git.sr.ht/~protesilaos/sxhkdrc-mode
 ;; Mailing-List: https://lists.sr.ht/~protesilaos/general-issues
-;; Version: 0.1.3
+;; Version: 0.1.4
 ;; Package-Requires: ((emacs "27.1"))
 
 ;; This file is NOT part of GNU Emacs.
@@ -104,13 +104,16 @@ key chord chain (demarcated by a colon or semicolon)."
   (let ((syntax sxhkdrc-mode-syntax))
     (save-excursion
       (beginning-of-line)
-      (when (or (not (looking-at (alist-get 'key-generic syntax)))
-                (save-excursion
-                  (forward-line -1)
-                  (beginning-of-line)
-                  (looking-at (alist-get 'key-generic syntax))))
-        (delete-horizontal-space)
-        (indent-to (alist-get 'indent-command syntax))))))
+      (delete-horizontal-space)
+      (cond
+       ((looking-at (alist-get 'comment syntax))
+        (indent-to (alist-get 'indent-other syntax)))
+       ((or (not (looking-at (alist-get 'key-generic syntax)))
+            (save-excursion
+              (forward-line -1)
+              (beginning-of-line)
+              (looking-at (alist-get 'key-generic syntax))))
+        (indent-to (alist-get 'indent-command syntax)))))))
 
 ;;;###autoload
 (define-derived-mode sxhkdrc-mode prog-mode "SXHKDRC"



reply via email to

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