summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorProtesilaos Stavrou <info@protesilaos.com>2022-12-14 12:54:58 +0200
committerProtesilaos Stavrou <info@protesilaos.com>2022-12-14 12:54:58 +0200
commit95b2c324f8ab66f1ca9eaee89fda54a535e06d6a (patch)
tree6a9406ce94a2c2be4d9452264c3fbbfac22d92ae
parent19004b174aed88996ffadc47dce45f6dcd6cbbdb (diff)
Refine sxhkdrc-mode-indent-line
-rw-r--r--sxhkdrc-mode.el19
1 files changed, 11 insertions, 8 deletions
diff --git a/sxhkdrc-mode.el b/sxhkdrc-mode.el
index 2e2a3fe..eca1c84 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"