unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Eli Zaretskii <eliz@gnu.org>, 55451@debbugs.gnu.org
Subject: bug#55451: 28.1.50; Executing (jit-lock-mode -1) does not disable jit-lock-mode
Date: Wed, 18 May 2022 19:46:35 +0800	[thread overview]
Message-ID: <871qwr2hd0.fsf@localhost> (raw)
In-Reply-To: <87bkvwjatb.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 661 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>> jit-lock-mode is not a minor mode, so the usual syntax doesn't work
>> with it, and isn't documented to work.  Set it to nil to disable.
>
> The doc string could do with some explicit text about this, so I've
> added that to Emacs 29.  But since this is working as intended, I'm
> closing this bug report.

Thanks! It certainly improves the situation.
However, I am confused why it is impossible to follow +1/-1 convention.
Looking through jit-lock.el I do not see any place where any value other
than non-nil/nil is considered.

A possible patch is attached.

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-jit-lock-mode-Treat-1-and-1-ARG-as-other-normal-mino.patch --]
[-- Type: text/x-patch, Size: 1011 bytes --]

From a9da60ba42f6745f4bbdb305e057639c40f8d34e Mon Sep 17 00:00:00 2001
Message-Id: <a9da60ba42f6745f4bbdb305e057639c40f8d34e.1652874345.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Wed, 18 May 2022 19:44:25 +0800
Subject: [PATCH] jit-lock-mode: Treat +1 and -1 ARG as other normal minor
 modes

* lisp/jit-lock.el (jit-lock-mode): Recognise +1/-1 arguments using
minor mode conventions.
---
 lisp/jit-lock.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index 20c1202474..224223fc7e 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -218,7 +218,12 @@ jit-lock-mode
 the variable `jit-lock-stealth-nice'.
 
 If you need to debug code run from jit-lock, see `jit-lock-debug-mode'."
-  (setq jit-lock-mode arg)
+  (setq jit-lock-mode
+        (pcase arg
+          (`+1 t)
+          (`-1 nil)
+          (`nil nil)
+          (val val)))
   (cond
    ((and (buffer-base-buffer)
          jit-lock-mode)
-- 
2.35.1


  reply	other threads:[~2022-05-18 11:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 14:00 bug#55451: 28.1.50; Executing (jit-lock-mode -1) does not disable jit-lock-mode Ihor Radchenko
2022-05-16 15:53 ` Eli Zaretskii
2022-05-17 18:03   ` Lars Ingebrigtsen
2022-05-18 11:46     ` Ihor Radchenko [this message]
2022-05-18 17:27       ` Lars Ingebrigtsen
2022-05-18 17:41         ` Eli Zaretskii
2022-05-19 13:49           ` Ihor Radchenko
2022-05-19 14:00             ` Eli Zaretskii
2022-05-20  8:13               ` Ihor Radchenko
2022-05-19 23:13           ` Richard Stallman
2022-05-20  6:55             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871qwr2hd0.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=55451@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).