* bug#3628: Python-Mode Ignores Global Font Lock
@ 2009-06-20 15:46 Sean B. Palmer
2009-06-22 9:10 ` Lawrence Mitchell
0 siblings, 1 reply; 3+ messages in thread
From: Sean B. Palmer @ 2009-06-20 15:46 UTC (permalink / raw
To: emacs-pretest-bug
In my .emacs file I turn off global font lock:
(global-font-lock-mode 0)
The effect is to turn syntax highlighting OFF in modes where there
would normally be syntax highlighting by default. The result in emacs
22.1.1 was to remove syntax highlighting from Perl, C, and Python
files.
In emacs 23.0.95.1 (build details below), this no longer works for
Python files. That is to say, various *.py files that I've tested have
syntax highlighting ON when I edit them in emacs with a normal
command:
$ emacs example.py
$ emacs api.py
Perl and C files have syntax highlighting OFF, on the other hand. When
editing one of the Python files, syntax highlighting can be turned OFF
by using the following procedure:
M-x eval-expression <RET>
(global-font-lock-mode 0) <RET>
In other words, by evaluating the expression from my .emacs file
manually. On repeating the expression, syntax highlighting remains
OFF, so it is apparently not acting as a toggle.
When I use emacs -q, syntax highlighting is ON by default when editing
any Perl, C, or Python file as expected. I've tried using different
positions for the global font lock line in my .emacs file, moving it
to the top, to the middle, and to the bottom, and that has no effect:
syntax highlighting is always ON in Python-Mode.
My full .emacs file is available here:
http://inamidst.com/config/emacs
I'm using the following version of emacs from CVS:
GNU Emacs 23.0.95.1 (i386-apple-darwin8.11.1, X toolkit) of 2009-06-20
Compiled with:
$ ./configure --prefix=$PACKAGES/emacs \
--with-jpeg=no --with-png=no --with-gif=no --with-tiff=no
And there doesn't appear to be any mention of this bug in
etc/PROBLEMS; I also asked in #emacs on freenode about this bug before
they advised me to file this bug by email.
Thanks,
--
Sean B. Palmer, http://inamidst.com/sbp/
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#3628: Python-Mode Ignores Global Font Lock
2009-06-20 15:46 bug#3628: Python-Mode Ignores Global Font Lock Sean B. Palmer
@ 2009-06-22 9:10 ` Lawrence Mitchell
2009-06-22 10:00 ` Sean B. Palmer
0 siblings, 1 reply; 3+ messages in thread
From: Lawrence Mitchell @ 2009-06-22 9:10 UTC (permalink / raw
To: Sean B. Palmer; +Cc: 3628
Sean B. Palmer wrote:
> In my .emacs file I turn off global font lock:
> (global-font-lock-mode 0)
[...]
> In emacs 23.0.95.1 (build details below), this no longer works for
> Python files. That is to say, various *.py files that I've tested have
> syntax highlighting ON when I edit them in emacs with a normal
> command:
> $ emacs example.py
> $ emacs api.py
> Perl and C files have syntax highlighting OFF, on the other hand. When
> editing one of the Python files, syntax highlighting can be turned OFF
> by using the following procedure:
> M-x eval-expression <RET>
> (global-font-lock-mode 0) <RET>
> In other words, by evaluating the expression from my .emacs file
> manually. On repeating the expression, syntax highlighting remains
> OFF, so it is apparently not acting as a toggle.
(global-font-lock-mode 0) only turns /off/ font lock
| With prefix arg, turn Global-Font-Lock mode on if and only if
| arg is positive.
I.e., it's not acting as a toggle, but this is intended.
[...]
The overriding of user preference regarding font lock appears to
be a deliberate change. A commit on Feb 21 2008 merges changes
from Dave Love's python.el.
| Author: Chong Yidong <cyd@stupidchicken.com>
| Date: Thu Feb 21 17:03:47 2008 +0000
| Merge from Dave Love's 2008-01-20 version.
These include:
| (python-mode): Add python-pea-hook to pre-abbrev-expand-hook. Use
| symbol-completion-try-complete for hippie expansion. Turn on font
| lock unconditionally.
Font-lock is used unconditionally in python buffers, I think, so
that text properties marking strings and comments can be
maintained with greater ease than otherwise. It appears to be a
design decision.
Cheers,
Lawrence
--
Lawrence Mitchell <wence@gmx.li>
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#3628: Python-Mode Ignores Global Font Lock
2009-06-22 9:10 ` Lawrence Mitchell
@ 2009-06-22 10:00 ` Sean B. Palmer
0 siblings, 0 replies; 3+ messages in thread
From: Sean B. Palmer @ 2009-06-22 10:00 UTC (permalink / raw
To: Lawrence Mitchell; +Cc: 3628
On Mon, Jun 22, 2009 at 10:10 AM, Lawrence Mitchell wrote:
> (global-font-lock-mode 0) only turns /off/ font lock
Yeah, but I was asked on #emacs whether it was acting as a toggle,
perhaps just to confirm that there was no bug introducing toggle
behaviour where it wasn't expected.
> Font-lock is used unconditionally in python buffers, I think,
> so that text properties marking strings and comments can
> be maintained with greater ease than otherwise.
Not honouring explicit instructions to turn off highlighting globally
in emacs sounds like a poor design decision to me. I consider this an
important bug.
Meanwhile, it's possible to use this workaround:
(add-hook 'python-mode-hook
'(lambda () (global-font-lock-mode 0)))
Thanks,
--
Sean B. Palmer, http://inamidst.com/sbp/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-22 10:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-20 15:46 bug#3628: Python-Mode Ignores Global Font Lock Sean B. Palmer
2009-06-22 9:10 ` Lawrence Mitchell
2009-06-22 10:00 ` Sean B. Palmer
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.