Skip to content

Commit fe3ca7e

Browse files
committed
Inline square-parenthesis detection.
This was only used one place. Fixes byte-compilation regression introduced in: 0a2a3b0 Partially adresses: #79
1 parent 49a957b commit fe3ca7e

File tree

1 file changed

+10
-33
lines changed

1 file changed

+10
-33
lines changed

csharp-mode.el

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -558,38 +558,6 @@ to work properly with code that includes attributes.
558558
)))
559559

560560

561-
;; essentially the same as (progn), but this this is required to avoid
562-
;; byte-compilation warnings due to some forms referencing this
563-
;; getting expanded during compilation.
564-
(eval-when-compile
565-
(defun csharp-is-square-parentasis-block-p ()
566-
"Attempts to safely assess if the current point is at the opening of
567-
a square parentasis block [ ... ]."
568-
(let* ((start (point)) ;; variables used to hold our position, so that we know that
569-
(end)) ;; our code isn't stuck trying to look for a non-existant sexp.
570-
(and (eq (char-after) 91) ;; open square
571-
(while (and (eq (char-after) 91)
572-
(not (eq start end)))
573-
(c-safe (c-forward-sexp 1))
574-
(setq end (point)))
575-
(eq (char-before) 93))) ;; close square
576-
))
577-
578-
;; nasty hack to silence compile-time warnings and runtime-warnings.
579-
;; exact copy of defun above.
580-
(defun csharp-is-square-parentasis-block-p ()
581-
"Attempts to safely assess if the current point is at the opening of
582-
a square parentasis block [ ... ]."
583-
(let* ((start (point)) ;; variables used to hold our position, so that we know that
584-
(end)) ;; our code isn't stuck trying to look for a non-existant sexp.
585-
(and (eq (char-after) 91) ;; open square
586-
(while (and (eq (char-after) 91)
587-
(not (eq start end)))
588-
(c-safe (c-forward-sexp 1))
589-
(setq end (point)))
590-
(eq (char-before) 93))) ;; close square
591-
)
592-
593561
;; ==================================================================
594562
;; end of csharp-mode utility and feature defuns
595563
;; ==================================================================
@@ -913,7 +881,16 @@ a square parentasis block [ ... ]."
913881

914882
(if (or
915883
(eq (char-after) ?{) ;; open curly
916-
(csharp-is-square-parentasis-block-p)
884+
;; is square parenthesis block? - start
885+
(let* ((start (point)) ;; used to hold our position, so that we know that
886+
(end)) ;; our code isn't stuck trying to look for a non-existant sexp.
887+
(and (eq (char-after) 91) ;; open square
888+
(while (and (eq (char-after) 91)
889+
(not (eq start end)))
890+
(c-safe (c-forward-sexp 1))
891+
(setq end (point)))
892+
(eq (char-before) 93)))
893+
;; is square parenthesis block? - end
917894
(and (eq (char-after) 40) ;; open paren
918895
(c-safe (c-forward-sexp 1) t)))
919896

0 commit comments

Comments
 (0)