Skip to content

Commit a4112eb

Browse files
authored
Merge pull request #35173 from gottesmm/pr-bda612d38a584f3f9ba7f8e2b5479873d3cdb6fa
2 parents e328fb3 + 694c198 commit a4112eb

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

utils/sil-mode.el

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -275,16 +275,20 @@
275275

276276
(defun sil-mode-display-function-cfg()
277277
(interactive)
278-
;; First we need to find the previous '{' and then the next '}'
278+
;; First we need to find the previous '{' and then the next '}'.
279279
(save-mark-and-excursion
280-
(let ((brace-start (search-backward "{"))
281-
(brace-end (search-forward "}"))
282-
(process-connection-type nil))
283-
(let ((p (start-process sil-mode-viewcfg-program-name
284-
sil-mode-viewcfg-buffer-name
285-
sil-mode-viewcfg-command
286-
(concat "--renderer=" sil-mode-viewcfg-renderer))))
287-
(process-send-region p brace-start brace-end)
280+
(let ((brace-start (re-search-backward "{\s*$"))
281+
(brace-end (re-search-forward "^} // end sil function '" nil t))
282+
(process-connection-type nil))
283+
;; See if we failed to find } // end sil function. If we did, search again
284+
;; for ^} itself and see if we find anything.
285+
(if (null brace-end)
286+
(setq brace-end (re-search-forward "^}")))
287+
(let ((p (start-process sil-mode-viewcfg-program-name
288+
sil-mode-viewcfg-buffer-name
289+
sil-mode-viewcfg-command
290+
(concat "--renderer=" sil-mode-viewcfg-renderer))))
291+
(process-send-region p brace-start brace-end)
288292
(process-send-eof p)))))
289293

290294
;;; Top Level Entry point

0 commit comments

Comments
 (0)