unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
Cc: monnier+gnu/emacs@rum.cs.yale.edu, y@mit.edu,
	mh-e-devel@lists.sourceforge.net, emacs-devel@gnu.org
Subject: Re: problem with mh-e and 2002-08-20 change to font-core.el
Date: Fri, 30 Aug 2002 09:42:49 -0400	[thread overview]
Message-ID: <200208301342.g7UDgng18121@rum.cs.yale.edu> (raw)
In-Reply-To: E17key9-00086U-00@fencepost.gnu.org

>     > font-lock-face properties go in mode-specific places.
> 
>     But do the properties belong to the text or to the mode.
> 
> I am not sure that question makes real sense, but the
> font-lock-face property is not specific to any one mode.
> The right font-lock-face properties for one mode are wrong
> for some others.
> 
>     I have the impression that most of those font-lock-face properties
>     are added together with the corresponding text and that they can't
>     be recovered just from the text.  I.e. erasing them might not
>     be the right thing to do since it loses information.
> 
> For Occur mode, this is correct.  Info mode automatically applies
> the properties to the text.
> 
> With the current code, changing from Occur mode to Fundamental mode
> and back to Occur mode would lose the font-lock-face properties.
> That is a bug.
> 
> With the change you propose, changing from Occur mode to Fundamental
> mode and then to Info mode would leave you with font-lock-face
> properties left over from Occur mode.  That would be a bug.

I'm not sure how important this is, really.

> Is there any way to make both cases work right?

I think we can't make it work "automatically", but instead we need
to change `info.el' such that (font-lock-mode 1) or (font-lock-mode 0)
in info-mode begins by clearing the font-lock-face property.

We can maybe do it with something like

  (add-hook 'font-lock-mode
            (lambda ()
              (remove-face-properties (point-min) (point-max)
                                      '(font-lock-face))))

but that might be run too late.  So maybe we should add some
support in font-core.el to make it easier for a mode to tell
"erase font-lock-face property when font-lock-mode is changed".

Of course, another alternative is to make info.el use font-lock-keywords
(and the `face' property) rather than do all the looping&matching by hand.
That seems much better.

>     The "erase the font-lock-face property when changing-mode" hook you
>     added is only added when you turn on font-lock-mode, so the
>     font-lock-face property will stay if you don't turn on font-lock-mode
>     before changing major-mode.
> 
> Now I understand.  Is there a method that fixes this too?

First, I think that the change-major-mode-hook should
run (font-lock-mode -1) and that if it doesn't do the right thing,
then we should fix (font-lock-mode -1) rather than change
the change-major-mode-hook.


	Stefan

  reply	other threads:[~2002-08-30 13:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-26  7:38 problem with mh-e and 2002-08-20 change to font-core.el y
2002-08-26 21:18 ` Luc Teirlinck
2002-08-26 23:23   ` Luc Teirlinck
2002-08-26 23:57     ` Luc Teirlinck
2002-08-27 19:05   ` Richard Stallman
2002-08-28  5:51     ` chad
2002-08-28 23:32       ` Richard Stallman
2002-09-27 17:35         ` Bill Wohler
2002-08-26 21:51 ` Richard Stallman
2002-08-26 22:09   ` Stefan Monnier
2002-08-28  6:53     ` Richard Stallman
2002-08-28 13:55       ` Stefan Monnier
2002-08-28 23:33         ` Richard Stallman
2002-08-29 15:25           ` Stefan Monnier
2002-08-30  6:09             ` Richard Stallman
2002-08-30 13:42               ` Stefan Monnier [this message]
2002-09-01 13:15                 ` Richard Stallman
2002-09-02 17:05                   ` Stefan Monnier

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=200208301342.g7UDgng18121@rum.cs.yale.edu \
    --to=monnier+gnu/emacs@rum.cs.yale.edu \
    --cc=emacs-devel@gnu.org \
    --cc=mh-e-devel@lists.sourceforge.net \
    --cc=y@mit.edu \
    /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).