From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#25841: 25.2; Highlighting not being updated in some modes. Date: Wed, 21 Aug 2019 04:09:38 +0200 Message-ID: References: <231f3b41-7ba1-58d9-a1d4-2e0af37d0ac7@drisq.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="64807"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Paul Whittaker , 25841-done@debbugs.gnu.org To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 21 04:10:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i0G4g-000Ggy-KI for geb-bug-gnu-emacs@m.gmane.org; Wed, 21 Aug 2019 04:10:10 +0200 Original-Received: from localhost ([::1]:43342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0G4f-000556-Hd for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Aug 2019 22:10:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35429) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i0G4Z-00054x-W0 for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2019 22:10:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i0G4Y-0001qU-RS for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2019 22:10:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53736) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i0G4Y-0001qK-NH for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2019 22:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i0G4Y-0000dx-FE for bug-gnu-emacs@gnu.org; Tue, 20 Aug 2019 22:10:02 -0400 In-Reply-To: <231f3b41-7ba1-58d9-a1d4-2e0af37d0ac7@drisq.com> Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Wed, 21 Aug 2019 02:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 25841 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Mail-Followup-To: 25841@debbugs.gnu.org, stefan@marxist.se, emacs@pdw.org.uk Original-Received: via spool by 25841-done@debbugs.gnu.org id=D25841.15663533992453 (code D ref 25841); Wed, 21 Aug 2019 02:10:02 +0000 Original-Received: (at 25841-done) by debbugs.gnu.org; 21 Aug 2019 02:09:59 +0000 Original-Received: from localhost ([127.0.0.1]:34322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0G4U-0000dU-A1 for submit@debbugs.gnu.org; Tue, 20 Aug 2019 22:09:59 -0400 Original-Received: from mail-pg1-f172.google.com ([209.85.215.172]:40308) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i0G4R-0000dF-Qg for 25841-done@debbugs.gnu.org; Tue, 20 Aug 2019 22:09:56 -0400 Original-Received: by mail-pg1-f172.google.com with SMTP id w10so371887pgj.7 for <25841-done@debbugs.gnu.org>; Tue, 20 Aug 2019 19:09:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=J1+hSaFaZJYsCerVB8rphgBMqO2QkBrRpKx4IGbswyg=; b=ktqSpv91ocA+s96WpIdWTok9AiDvetUTfZKGTySumBi95b7Z8GJsNsDSc81BwcQWE8 NHc0MK2b3GSi4esxSeyrggvzdRrJn9Z483PooquKpaKsEnvQRb0LCQ9G0yiXKgPhA3vn 3YpYfO8OKG3x5LxFShs2ozHogt5dWG10RPNf0Q5OU5iEor1NcFJRtBb08IR52f1mcS72 l+qGujP1yJUmjdFva2WOVf6deCkCLQxkp6RlKdQ3QIL3k5LokTLPfj0n7JsIt6WR+i3X S2GVT3zZp6/bD8+60E+qebcbs0Qq3DQnRisA5YT0rNoptwaQf2/CpRZE0PHaIpWqoolz 704A== X-Gm-Message-State: APjAAAUckjGJ4QUDLQwaFVtg2bJGlcCKBiB2ZJQE+aSFP0fRggu44KAV 7r8ZqfEVM+a3fCnHD72V4ilKm2065rFldw7EcXw= X-Google-Smtp-Source: APXvYqxt3JqufYnOeEbA0joXBEFnQ7nZ1U/N88hSI7HD50a1DWB5i2OhDSWG2Uu/wwuPCmkeIL5DkYXb1svYzIwuwIk= X-Received: by 2002:a17:90a:17ab:: with SMTP id q40mr3047240pja.106.1566353390100; Tue, 20 Aug 2019 19:09:50 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:165461 Archived-At: Stephen Berman writes: > On Thu, 23 Feb 2017 12:21:38 +0000 Paul Whittaker wrote: > >> On 22/02/17 22:02, Glenn Morris wrote: >>> This is the documented way highlight-regexp behaves: >>> >>> Use Font lock mode, if enabled, to highlight REGEXP. Otherwise, >>> use overlays for highlighting. If overlays are used, the >>> highlighting will not update as you type. >> >> Thanks, I'd missed that. >> >> I'm trying to get dynamic (non-overlay) highlighting working in a plain >> text mode. That documentation makes me think that I just need to enable >> font-lock mode, but doing that doesn't appear to make any difference. >> >> emacs -Q >> M-x fundamental-mode RET >> M-1 M-x font-lock-mode RET >> M-x highlight-regexp RET foo RET hi-yellow RET >> >> f o o SPC b a r ;; Not highlighted, as before. >> >> Would you expect that to work, or is there something else that I'm >> missing here? Apologies if this is a stupid question: I suspect I'm not >> seeing all of the picture. > > I can't explain how font-lock works, but by experimenting it appears you > have to set font-lock-defaults to a non-nil value in the buffer (it > seems before enabling font-lock-mode, though there's an interaction I > don't understand). Here's a recipe: > > 0. emacs -Q > 1. C-x b a RET ; Switch to new buffer "a". > 2. Enter some text, e.g. "foo". > 3. M-x font-lock-mode RET ; Disable font-lock-mode in the buffer -- > ; by default it's enabled globally . > 4. M-: (setq-local font-lock-defaults (list 'bla)) RET > 5. M-x font-lock-mode RET ; Re-enable font-lock-mode. On one test I > ; thought this was sufficient, but on > ; subsequent repetition I've consistently > ; gotten a void variable error and had to > ; disable and then re-enable font-lock-mode > ; again. > 6. M-x highlight-regexp (or M-s h r) RET foo RET hi-yellow RET > => Now "foo" is highlighted, and deleting a letter from it unhighlights > it. This seems to be the documented behaviour for highlight-regexp. Since there's nothing more to do here, and it was already tagged notabug, I'm closing this bug report. If anyone disagrees, feel free to re-open. Thanks, Stefan Kangas