]> git.eshelyaron.com Git - emacs.git/commitdiff
Make sgml-validate not bug out from buffers not visiting a file
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 15 Sep 2020 16:11:28 +0000 (18:11 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 15 Sep 2020 16:13:14 +0000 (18:13 +0200)
* lisp/textmodes/sgml-mode.el (sgml-validate): Don't bug out when
running from a buffer that's not visiting a file (bug#22906).

lisp/textmodes/sgml-mode.el

index e0ef786953e7e5d39817d1ed525674b7c434580f..f3d8695e24800212e2c96ed4027190203ad57f75 100644 (file)
@@ -1188,10 +1188,9 @@ and move to the line in the SGML document that caused it."
                      (or sgml-saved-validate-command
                          (concat sgml-validate-command
                                  " "
-                                 (shell-quote-argument
-                                  (let ((name (buffer-file-name)))
-                                    (and name
-                                         (file-name-nondirectory name)))))))))
+                                  (when-let ((name (buffer-file-name)))
+                                   (shell-quote-argument
+                                    (file-name-nondirectory name))))))))
   (setq sgml-saved-validate-command command)
   (save-some-buffers (not compilation-ask-about-save) nil)
   (compilation-start command))