From: Alan Mackenzie <acm@muc.de>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: Eli Zaretskii <eliz@gnu.org>,
emacs-devel@gnu.org, aidalgol@no8wireless.co.nz,
Tassilo Horn <tsdh@gnu.org>
Subject: Re: Fontless Info
Date: Sun, 24 Feb 2013 18:08:38 +0000 [thread overview]
Message-ID: <20130224180838.GA2982@acm.acm> (raw)
In-Reply-To: <87k3pz4odx.fsf@yandex.ru>
Hello, Dmitry.
On Sat, Feb 23, 2013 at 08:58:50AM +0400, Dmitry Gutov wrote:
> Hey Alan,
> Alan Mackenzie <acm@muc.de> writes:
> > This might well do the trick:
> I've applied the patch, bootstrapped, and it [still] has problems with
> whitespace-mode. To reproduce:
> 1. Run emacs -Q
> 2. Eval (add-hook 'prog-mode 'whitespace-mode)
> 3. Open any .el file, for example => no syntax highligting
OK, thanks. whitespace-mode disables then re-enables font lock mode.
The code in define-globalized-minor-mode was recording the disable, but
not the re-enable, so it thought the major mode hook had disabled font
lock mode.
I've amended it so that it now takes account of the re-enabling too. I
think this solves the immediate problem.
Here's the patch (based off the trunk of a few days ago). As always,
please do a complete rebuild after applying the patch. Let me know how
it goes, please.
=== modified file 'lisp/emacs-lisp/easy-mmode.el'
*** lisp/emacs-lisp/easy-mmode.el 2013-02-15 20:01:51 +0000
--- lisp/emacs-lisp/easy-mmode.el 2013-02-24 17:53:33 +0000
***************
*** 359,366 ****
(MODE-check-buffers
(intern (concat global-mode-name "-check-buffers")))
(MODE-cmhh (intern (concat global-mode-name "-cmhh")))
! (MODE-disable-in-buffer
! (intern (concat global-mode-name "-disable-in-buffer")))
(minor-MODE-hook (intern (concat mode-name "-hook")))
(disable-MODE (intern (concat "disable-" mode-name)))
(MODE-major-mode (intern (concat (symbol-name mode) "-major-mode")))
--- 359,366 ----
(MODE-check-buffers
(intern (concat global-mode-name "-check-buffers")))
(MODE-cmhh (intern (concat global-mode-name "-cmhh")))
! (set-disable-MODE-in-buffer
! (intern (concat "set-disable-" global-mode-name "-in-buffer")))
(minor-MODE-hook (intern (concat mode-name "-hook")))
(disable-MODE (intern (concat "disable-" mode-name)))
(MODE-major-mode (intern (concat (symbol-name mode) "-major-mode")))
***************
*** 409,431 ****
(add-hook 'find-file-hook ',MODE-check-buffers)
(add-hook 'change-major-mode-hook ',MODE-cmhh))
(remove-hook 'after-change-major-mode-hook ',MODE-enable-in-buffers)
- (remove-hook 'change-major-mode-after-body-hook
- ',MODE-enable-in-buffers)
(remove-hook 'find-file-hook ',MODE-check-buffers)
(remove-hook 'change-major-mode-hook ',MODE-cmhh))
;; Go through existing buffers.
(dolist (buf (buffer-list))
(with-current-buffer buf
! (if ,global-mode (,turn-on) (when ,mode (,mode -1))))))
;; Autoloading define-globalized-minor-mode autoloads everything
;; up-to-here.
:autoload-end
! ;; A function which checks whether MODE has been disabled in the major
! ;; mode hook which has just been run.
! (add-hook ',minor-MODE-hook ',MODE-disable-in-buffer)
;; List of buffers left to process.
(defvar ,MODE-buffers nil)
--- 409,431 ----
(add-hook 'find-file-hook ',MODE-check-buffers)
(add-hook 'change-major-mode-hook ',MODE-cmhh))
(remove-hook 'after-change-major-mode-hook ',MODE-enable-in-buffers)
(remove-hook 'find-file-hook ',MODE-check-buffers)
(remove-hook 'change-major-mode-hook ',MODE-cmhh))
;; Go through existing buffers.
(dolist (buf (buffer-list))
(with-current-buffer buf
! (if ,global-mode
! (,turn-on)
! (when ,mode (let (,disable-MODE) (,mode -1)))))))
;; Autoloading define-globalized-minor-mode autoloads everything
;; up-to-here.
:autoload-end
! ;; A function which checks whether MODE has been left disabled
! ;; in the major mode hook which has just been run.
! (add-hook ',minor-MODE-hook ',set-disable-MODE-in-buffer)
;; List of buffers left to process.
(defvar ,MODE-buffers nil)
***************
*** 439,445 ****
(if ,mode (,mode -1))
(unless (eq ,MODE-major-mode major-mode)
(if ,mode
! (progn
(,mode -1)
(,turn-on))
(,turn-on))))
--- 439,445 ----
(if ,mode (,mode -1))
(unless (eq ,MODE-major-mode major-mode)
(if ,mode
! (let (,disable-MODE)
(,mode -1)
(,turn-on))
(,turn-on))))
***************
*** 457,469 ****
(add-to-list ',MODE-buffers (current-buffer))
(add-hook 'post-command-hook ',MODE-check-buffers))
(put ',MODE-cmhh 'definition-name ',global-mode)
! ;; disable-MODE is set in MODE-disable-in-buffer and cleared by
! ;; kill-all-local-variables.
(defvar-local ,disable-MODE nil)
! (defun ,MODE-disable-in-buffer ()
! (unless ,mode
! (setq ,disable-MODE t)))
! (put ',MODE-disable-in-buffer 'definition-name ',global-mode))))
;;;
;;; easy-mmode-defmap
--- 457,468 ----
(add-to-list ',MODE-buffers (current-buffer))
(add-hook 'post-command-hook ',MODE-check-buffers))
(put ',MODE-cmhh 'definition-name ',global-mode)
! ;; disable-MODE is set/cleared in set-disable-MODE-in-buffer
! ;; and cleared by kill-all-local-variables.
(defvar-local ,disable-MODE nil)
! (defun ,set-disable-MODE-in-buffer ()
! (setq ,disable-MODE (not ,mode)))
! (put ',set-disable-MODE-in-buffer 'definition-name ',global-mode))))
;;;
;;; easy-mmode-defmap
--
Alan Mackenzie (Nuremberg, Germany).
next prev parent reply other threads:[~2013-02-24 18:08 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-19 8:01 Fontless Info Aidan Gauland
2013-02-19 10:16 ` Tassilo Horn
2013-02-19 15:00 ` Drew Adams
2013-02-19 16:33 ` Eli Zaretskii
2013-02-19 16:20 ` Eli Zaretskii
2013-02-19 17:58 ` Drew Adams
2013-02-19 18:48 ` Drew Adams
2013-02-19 20:53 ` Eli Zaretskii
2013-02-19 21:05 ` Drew Adams
2013-02-19 21:21 ` Eli Zaretskii
2013-02-19 21:25 ` Drew Adams
2013-02-20 11:08 ` Michael Heerdegen
2013-02-19 21:14 ` Drew Adams
2013-02-19 23:23 ` Alan Mackenzie
2013-02-20 4:02 ` Drew Adams
2013-02-19 23:10 ` Alan Mackenzie
2013-02-20 10:58 ` Alan Mackenzie
2013-02-23 4:58 ` Dmitry Gutov
2013-02-24 18:08 ` Alan Mackenzie [this message]
2013-02-26 5:43 ` Dmitry Gutov
2013-02-19 16:58 ` Glenn Morris
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=20130224180838.GA2982@acm.acm \
--to=acm@muc.de \
--cc=aidalgol@no8wireless.co.nz \
--cc=dgutov@yandex.ru \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=tsdh@gnu.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).