summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2024-04-04 09:31:44 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2024-04-04 09:31:44 -0400
commita56142cb82d3390faa3dbd0658d65fe06822206d (patch)
tree1ef5a0f9df4f7f6d01480183d5342dd4de6d0850
parent7c5229895c2cd47b37c7b8cf51548386f24176fb (diff)
(sm-c-mode): Add `c-mode` as extra parentexternals/sm-c-mode
-rw-r--r--sm-c-mode.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/sm-c-mode.el b/sm-c-mode.el
index 339dcbc..e5ab1d7 100644
--- a/sm-c-mode.el
+++ b/sm-c-mode.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2015-2024 Free Software Foundation, Inc.
;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
-;; Version: 1.1
+;; Version: 1.2
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
@@ -91,6 +91,12 @@
;; All this says, is that sm-c-mode's indentation might actually be usable if
;; you use it on C code that is sufficiently similar to Emacs's.
+;;; News:
+
+;; Since 1.1:
+;;
+;; - Declare it as a kind of `c-mode' for the benefit of Eglot/YASnippet/...
+
;;; Code:
(require 'cl-lib)
@@ -956,6 +962,9 @@ Past this column, we do not try to align the backslashes."
(setq-local add-log-current-defun-header-regexp sm-c--def-regexp)
(setq-local imenu-generic-expression `((nil ,sm-c--def-regexp 1))))
+(when (fboundp 'derived-mode-add-parents)
+ (derived-mode-add-parents 'sm-c-mode '(c-mode)))
+
(defun sm-c--cpp-is-not-really-a-comment (&rest args)
;; Without this, placing the region around a CPP directive and hitting
;; M-; would just strip the leading "#" instead of commenting things out.