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

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

[elpa] externals/csharp-mode 239527c 263/459: Protect dmode from ccmode


From: ELPA Syncer
Subject: [elpa] externals/csharp-mode 239527c 263/459: Protect dmode from ccmode monkeypatch (#134)
Date: Sun, 22 Aug 2021 13:59:40 -0400 (EDT)

branch: externals/csharp-mode
commit 239527c1f27cf5246505f1faf23269487fdbfdd2
Author: Nathan Moreau <nathan.moreau@m4x.org>
Commit: Jostein Kjønigsen <jostein@kjonigsen.net>

    Protect dmode from ccmode monkeypatch (#134)
    
    * Try not to patch cc-mode functions globally.
    
    Fix #133.
---
 csharp-mode.el | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/csharp-mode.el b/csharp-mode.el
index 9583878..06b62d8 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -2508,7 +2508,17 @@ are the string substitutions (see `format')."
             t)
           (c-put-font-lock-face start (1+ start) 'font-lock-warning-face)))))
 
-(defun c-looking-at-inexpr-block (lim containing-sexp &optional check-at-end)
+(advice-add 'c-looking-at-inexpr-block
+            :around 'csharp--c-looking-at-inexpr-block-hack)
+
+(defun csharp--c-looking-at-inexpr-block-hack (orig-fun &rest args)
+  (apply
+   (if (eq major-mode 'csharp-mode)
+       #'csharp--c-looking-at-inexpr-block
+     orig-fun)
+   args))
+
+(defun csharp--c-looking-at-inexpr-block (lim containing-sexp &optional 
check-at-end)
   ;; Return non-nil if we're looking at the beginning of a block
   ;; inside an expression.  The value returned is actually a cons of
   ;; either 'inlambda, 'inexpr-statement or 'inexpr-class and the
@@ -3067,10 +3077,10 @@ Key bindings:
 
   ;; The paragraph-separate variable was getting stomped by
   ;; other hooks, so it must reside here.
-  (setq paragraph-separate
-        "[ \t]*\\(//+\\|\\**\\)\\([ \t]+\\|[ \t]+<.+?>\\)$\\|^\f")
+  (setq-local paragraph-separate
+              "[ \t]*\\(//+\\|\\**\\)\\([ \t]+\\|[ \t]+<.+?>\\)$\\|^\f")
 
-  (setq beginning-of-defun-function 'csharp-move-back-to-beginning-of-defun)
+  (setq-local beginning-of-defun-function 
'csharp-move-back-to-beginning-of-defun)
   ;; `end-of-defun-function' can remain forward-sexp !!
 
   (set (make-local-variable 'comment-auto-fill-only-comments) t)
@@ -3098,4 +3108,3 @@ Key bindings:
 (provide 'csharp-mode)
 
 ;;; csharp-mode.el ends here
-



reply via email to

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