From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.devel Subject: Tests involving post-command-hook Date: Wed, 01 Aug 2018 00:10:27 +0200 Message-ID: <87bmangip8.fsf@gmx.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1533074916 1568 195.159.176.226 (31 Jul 2018 22:08:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 31 Jul 2018 22:08:36 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 01 00:08:32 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fkcoh-0000Iq-CU for ged-emacs-devel@m.gmane.org; Wed, 01 Aug 2018 00:08:31 +0200 Original-Received: from localhost ([::1]:60829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkcqo-0007Ln-1X for ged-emacs-devel@m.gmane.org; Tue, 31 Jul 2018 18:10:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkcqh-0007LX-Ch for emacs-devel@gnu.org; Tue, 31 Jul 2018 18:10:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fkcqe-0002YJ-85 for emacs-devel@gnu.org; Tue, 31 Jul 2018 18:10:35 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:33447) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fkcqd-0002WB-U1 for emacs-devel@gnu.org; Tue, 31 Jul 2018 18:10:32 -0400 Original-Received: from rosalinde ([188.101.20.252]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MaIw0-1fV9Ia3I0O-00Jnk3 for ; Wed, 01 Aug 2018 00:10:28 +0200 X-Provags-ID: V03:K1:pwqzn0iA5+C5G2Gr1peeLiXjfYm9T4ZZXay+5H3sUSNjSr0Ausz 84KeMvsHbrdtwX/YwzR+OZ7TTWfnwlOAYCqkftqBALlBYKbMBHbYMP44krJbHg/a8WlouDD v20SSg3sMYNURo69AdtnlH+ytuHpmSCkEgeh3paREaxDjlQpyU8HY/HlV1EB3cgCq0p/QFZ H11dNDkItQFHyr5/7f+tQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:GJIY36Z2/RI=:h6cHV0u3b5z6Bub1SRuZE7 cXxf6IS95W1J6SPTYri0xcxosvEfYxJGQmklAZ0TdY5vAyzBzuiDDiQEQQNFTpeNsOMrA1B2/ /gYrZhdy5Xk6PVdqHl4iVv6gXju4cZ4+e+K55psSeOgLh9wpI5bFp3KlDEawqEkm0GwsWxVPU L6UN9jqDQsAUeKi0HXB37A/JiH/NFkvFP2aJN9fkD1mj9dcxLxv2R40hkfWwql9IlXsJC6wOW kOzHF5Hs6cyohRcUz9aYzrJECM2rkQHU8gj/A0iFpa7lLYnx7l5oQusnk8CguKnR9+tyLHW4U YwSTvCB19aLidaiMavuS1sCMlHkSuiy78gLxnE88sroZdGhOwyiF5W3web+LPCq/qKPjRuHEA 4frNtTliQ7oAdE55ZEk/cgi7RFfEGkMQ+YOdtD13JkMkuPE4cB4xa5Jq2rrrpAhMAZlEauvbx HWMg79YsEZPXUFES3cKYth01VOdxjfBOp8hfmwizoETG/z0rbFQWP24f8H9G9NhPMoRIQrcvb 4nHxJOY1zGald36yg/Fyw/bjuJd8aUkx50Xzu0MbkX6ATB+Wo1mPp8gW3D5YWRju5rJVIiTPE eDOD+ZhSKSw4/2SWPMz6oW6waDPkOZwmt2rXS9jcJeW0fhuoHY7JnWQXJUMVLaRrNap3VeY/P fKfERo6ulLFx/AAIXMHqN62IdJeFWYGtATm8WMTUYmWPJxeten3PNzvRKGrOFm7DMWaig3y1C 1ZrJTQhBDwmYWVK/U0XIb44rlhwU5tc7dWUD56VE/mbzexnKbWEvD502LMTqNOgzHigu0Gd1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:228065 Archived-At: I'm using ERT to test for the hl-line face property and it appears that in the test environment, the function hl-line-highlight is not automatically run from post-command-hook as it should be, although I use call-interactively to mimic a command invocation. It works only if I explicitly call run-hooks. I also see this without ERT: (let ((buf (get-buffer-create "*hl-line-test*"))) (with-current-buffer buf (erase-buffer) (insert "This is a test.\n") (hl-line-mode) (call-interactively (lambda () (interactive) (forward-line -1))) ;; (run-hooks 'post-command-hook) (if (eq 'hl-line (get-char-property (point) 'face)) (message "test1 passed") (message "test1 failed")) (hl-line-mode -1) (erase-buffer) (insert "This is a test.\n") (call-interactively (lambda () (interactive) (forward-line -1))) (hl-line-mode) (if (eq 'hl-line (get-char-property (point) 'face)) (message "test2 passed") (message "test2 failed")) (hl-line-mode -1) (erase-buffer) (insert "This is line 1.\nThis is line 2.\n") (call-interactively (lambda () (interactive) (forward-line -1))) (hl-line-mode) (if (eq 'hl-line (get-char-property (point) 'face)) (message "test3.1 passed") (message "test3.1 failed")) (call-interactively (lambda () (interactive) (forward-line -1))) ;; (run-hooks 'post-command-hook) (if (eq 'hl-line (get-char-property (point) 'face)) (message "test3.2 passed") (message "test3.2 failed"))) (hl-line-mode -1)) Evaluating this in emacs -Q or loading it with emacs --batch yields this: test1 failed test2 passed test3.1 passed test3.2 failed The two successful tests are because hl-line-mode calls hl-line-highlight before adding it to post-command-hook. Uncommenting the two (run-hooks 'post-command-hook) lines yields this, which is what I expected without run-hooks (and what I see when testing without them interactively): test1 passed test2 passed test3.1 passed test3.2 passed Is this behavior of post-command-hook expected and if so, is using run-hooks in ERT valid, i.e. is it still really testing hl-line-mode behavior? Steve Berman