From c200c243b43e59632119d1616ee67ed3110b4c3c Mon Sep 17 00:00:00 2001 From: Eric Ludlam Date: Sat, 23 Nov 2019 21:10:40 -0500 Subject: [PATCH] matlab-shell.el: (matlab-find-other-window-file-line-column): If input file fails to translate into a file name, issue a descriptive error instead of passing nil to find-file-other-window. --- matlab-shell.el | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/matlab-shell.el b/matlab-shell.el index b802307..610bd28 100644 --- a/matlab-shell.el +++ b/matlab-shell.el @@ -1651,15 +1651,17 @@ something Emacs can load." (defun matlab-find-other-window-file-line-column (ef el ec &optional debug) "Find file EF in other window and to go line EL and 1-basec column EC. If DEBUG is non-nil, then setup GUD debugging features." - (setq ef (matlab-shell-mref-to-filename ef)) - (find-file-other-window ef) - (with-no-warnings - (goto-line (string-to-number el))) - (when debug - (setq gud-last-frame (cons (buffer-file-name) (string-to-number el))) - (gud-display-frame)) - (setq ec (string-to-number ec)) - (if (> ec 0) (forward-char (1- ec)))) + (let ((ef-converted (matlab-shell-mref-to-filename ef))) + (when (not ef-converted) + (error "Failed to translate %s into a filename." ef)) + (find-file-other-window ef-converted) + (with-no-warnings + (goto-line (string-to-number el))) + (when debug + (setq gud-last-frame (cons (buffer-file-name) (string-to-number el))) + (gud-display-frame)) + (setq ec (string-to-number ec)) + (if (> ec 0) (forward-char (1- ec))))) (defun matlab-find-other-window-via-url (url &optional debug) "Find other window using matlab URL and optionally set DEBUG cursor."