Commit 885c5126 authored by Eli Zaretskii's avatar Eli Zaretskii
Browse files

Fix a bug in 'generate-new-buffer-name'

* src/buffer.c (Fgenerate_new_buffer_name): Test IGNORE for being
nil before calling string-equal, since the latter will compare
"nil and 'nil' as equal.  (Bug#27966)

* test/src/buffer-tests.el
(test-generate-new-buffer-name-bug27966): New test.
parent 2cb98057
......@@ -1077,7 +1077,8 @@ is first appended to NAME, to speed up finding a non-existent buffer. */)
if (!NILP (Fstring_equal (name, ignore)) || NILP (Fget_buffer (name)))
if ((!NILP (ignore) && !NILP (Fstring_equal (name, ignore)))
|| NILP (Fget_buffer (name)))
return name;
if (SREF (name, 0) != ' ') /* See bug#1229. */
......@@ -45,4 +45,9 @@ with parameters from the *Messages* buffer modification."
(should (eq buf (current-buffer))))
(when msg-ov (delete-overlay msg-ov))))))
(ert-deftest test-generate-new-buffer-name-bug27966 ()
(should-not (string-equal "nil"
(progn (get-buffer-create "nil")
(generate-new-buffer-name "nil")))))
;;; buffer-tests.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment