From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mauro Aranda Newsgroups: gmane.emacs.bugs Subject: bug#43265: 28.0.50; Inconsistent fontifying in elisp-mode Date: Fri, 22 Jan 2021 17:11:22 -0300 Message-ID: <600b316d.1c69fb81.4b69e.5dba@mx.google.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26585"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 43265@debbugs.gnu.org, monnier@iro.umontreal.ca To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 22 21:17:20 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l32rw-0006nX-DJ for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 22 Jan 2021 21:17:20 +0100 Original-Received: from localhost ([::1]:33606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l32rv-0004GV-9N for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 22 Jan 2021 15:17:19 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l32mp-0005SG-G0 for bug-gnu-emacs@gnu.org; Fri, 22 Jan 2021 15:12:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49870) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l32mo-0004yw-71 for bug-gnu-emacs@gnu.org; Fri, 22 Jan 2021 15:12:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l32mo-0006PB-2U for bug-gnu-emacs@gnu.org; Fri, 22 Jan 2021 15:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 22 Jan 2021 20:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43265 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 43265-submit@debbugs.gnu.org id=B43265.161134629524588 (code B ref 43265); Fri, 22 Jan 2021 20:12:02 +0000 Original-Received: (at 43265) by debbugs.gnu.org; 22 Jan 2021 20:11:35 +0000 Original-Received: from localhost ([127.0.0.1]:33183 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l32mM-0006OW-UZ for submit@debbugs.gnu.org; Fri, 22 Jan 2021 15:11:35 -0500 Original-Received: from mail-qv1-f42.google.com ([209.85.219.42]:43287) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l32mK-0006OI-LH for 43265@debbugs.gnu.org; Fri, 22 Jan 2021 15:11:33 -0500 Original-Received: by mail-qv1-f42.google.com with SMTP id et9so3258709qvb.10 for <43265@debbugs.gnu.org>; Fri, 22 Jan 2021 12:11:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:from:to:cc:subject:in-reply-to:date:mime-version; bh=2oBnVpLHOE2/8Nf8Dl5FMDtCmHLPEuZW/GPhgz+HKfg=; b=i1LTAPqHj+yDhs9aicMkRCeh+kQLAm1VFAeWj3WaNKGmPoiyik141vNnfmblkdr4TQ qC+l+WKBI2AIeI0VOYS6UnWDjRgx+sKfO8URgySyhQkp7B1tFf/3EFbb9PlrUzNom5qb UN3bHBCNjGWZQw8As74DIrzBjj7ynQ/YoU+ndtRY9OII4XRbeMZzKJVBBLwBw+8HNT1O Fs9gyTTImMZSsYUUKGhWvTgFxX+ISygqercu4sfX50aSxNgpJeoWsBuduJM5hud/6x1w 1Nq5BMNYfQBQY/BpWj+pSKKASgphxWyvccrYgZMhV/NL+IbNjcSQbzujOwipiEnRQtps nSfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:from:to:cc:subject:in-reply-to:date :mime-version; bh=2oBnVpLHOE2/8Nf8Dl5FMDtCmHLPEuZW/GPhgz+HKfg=; b=WmfWz5aSXsMpKPaluROauCwJwP4H6HeC1oCDc0CMbv+CeDUyZoJV/uSmzUKVvVrGy2 U2A4WgUjfVwHMLuzQhXSYDyT5PtmjWrVZ0zGTle1UH9VvkioxYdacNN4Yts/4/QpL97k oSN5Edb6UmWga0LJPlDjOFWpZnH3ZaDDVl3K+oAziqF1Z84GNdAL3UKhYppiBwfE3heb xD6FiSG2mEwjJcvKepv/0JF+j83eOOAEhV2Nb1x69lUdcoD0pkpFg35Sr8X/DkngOiOf af556F0vCvV/yF4RY7ipQLCjEJfXg1No9W1FfyFXn5ooKHIZC+LorazCTjveQrGwsdxz NLFw== X-Gm-Message-State: AOAM533K6qzI+khaZMhjZj250OQBOtN4JUVUtumNVGECw7ltWYxLneeg zYyU8JcWm+8aKneFuUY58ek= X-Google-Smtp-Source: ABdhPJzxniwMWpZD7cfc7fPmX2vdJL+ZcLmPP871IKbEj20aHvmTNpQYR7ELMKQ7UlzonyQC0tfoUg== X-Received: by 2002:a0c:c211:: with SMTP id l17mr6118621qvh.53.1611346286173; Fri, 22 Jan 2021 12:11:26 -0800 (PST) Original-Received: from tbb-desktop ([201.213.132.172]) by smtp.gmail.com with ESMTPSA id s15sm6440845qtn.35.2021.01.22.12.11.24 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Jan 2021 12:11:25 -0800 (PST) X-Google-Original-Message-ID: <87y2gkratx.fsf@maurooaranda@gmail.com> In-Reply-To: <87mtx0ydgp.fsf@gnus.org> (message from Lars Ingebrigtsen on Fri, 22 Jan 2021 20:32:38 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:198403 Archived-At: Lars Ingebrigtsen writes: > Mauro Aranda writes: > >> To reproduce: >> >> emacs -Q >> In the scratch buffer type: >> >> (condition-case nil >> (fail-badly) >> (error (when foo t))) >> >> I don't see WHEN with font-lock-keyword-face. However: >> >> (condition-case nil >> (fail-badly) >> (error (if foo t))) >> >> IF has font-lock-keyword-face. > > This is the bit that determines whether to give something a keyword-face: > > (defun lisp--el-match-keyword (limit) > ;; FIXME: Move to elisp-mode.el. > (catch 'found > (while (re-search-forward > (eval-when-compile > (concat "(\\(" lisp-mode-symbol-regexp "\\)\\_>")) > limit t) > (let ((sym (intern-soft (match-string 1)))) > (when (or (special-form-p sym) > (and (macrop sym) > (not (get sym 'no-font-lock-keyword)) > (not (lisp--el-non-funcall-position-p > (match-beginning 0))))) > (throw 'found t)))))) > > All special forms get it (`if' is a special form), but macros (like > `when') only gets it if we're in a funcall position: > > (defun lisp--el-non-funcall-position-p (pos) > "Heuristically determine whether POS is an evaluated position." > > [...] > > (and (eq parent 'condition-case) > (progn > (forward-sexp 2) > (< (point) pos)))))))))) > > > And this doesn't count any of the error clauses as being in a funcall > position, so no macros in those get a keyword-face. > > I think. I've added Stefan M to the CCs. > > If that's the correct analysis, then fixing this shouldn't be too hard, > I think? Just add some extra code in the `condition-case' bit to catch > this case? Thanks for taking a look at this report, I hope it's easy to fix.