aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authordickmao2021-07-19 18:12:17 +0200
committerLars Ingebrigtsen2021-07-19 18:23:11 +0200
commit95e31a1a328a7548efa76befa74d430925ca7f6d (patch)
tree4d2aaf18122907285d8ae8ea3ada398e21980fcb /test/src
parentdd70012dca136d1218987b602ce22330e406cb26 (diff)
downloademacs-95e31a1a328a7548efa76befa74d430925ca7f6d.tar.gz
emacs-95e31a1a328a7548efa76befa74d430925ca7f6d.zip
Make make-indirect-buffer inherit inhibit-buffer-hook from base buffer
* src/buffer.c (Fmake_indirect_buffer): Match base buffer's inhibit-buffer-hooks. * test/src/buffer-tests.el (buffer-tests-inhibit-buffer-hooks-indirect): Add a test (bug#49160).
Diffstat (limited to 'test/src')
-rw-r--r--test/src/buffer-tests.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el
index 123f2e8eabb..0161927419c 100644
--- a/test/src/buffer-tests.el
+++ b/test/src/buffer-tests.el
@@ -1361,4 +1361,28 @@ with parameters from the *Messages* buffer modification."
1361 (should run-kbqf)) 1361 (should run-kbqf))
1362 (remove-hook 'buffer-list-update-hook bluh)))) 1362 (remove-hook 'buffer-list-update-hook bluh))))
1363 1363
1364(ert-deftest buffer-tests-inhibit-buffer-hooks-indirect ()
1365 "Indirect buffers do not call `get-buffer-create'."
1366 (dolist (inhibit '(nil t))
1367 (let ((base (get-buffer-create "foo" inhibit)))
1368 (unwind-protect
1369 (dotimes (_i 11)
1370 (let* (flag*
1371 (flag (lambda () (prog1 t (setq flag* t))))
1372 (indirect (make-indirect-buffer base "foo[indirect]")))
1373 (unwind-protect
1374 (progn
1375 (with-current-buffer indirect
1376 (add-hook 'kill-buffer-query-functions flag nil t))
1377 (kill-buffer indirect)
1378 (if inhibit
1379 (should-not flag*)
1380 (should flag*)))
1381 (let (kill-buffer-query-functions)
1382 (when (buffer-live-p indirect)
1383 (kill-buffer indirect))))))
1384 (let (kill-buffer-query-functions)
1385 (when (buffer-live-p base)
1386 (kill-buffer base)))))))
1387
1364;;; buffer-tests.el ends here 1388;;; buffer-tests.el ends here