GNU bug report logs - #11213
24.0.95; (Maybe/Wish): Should color-themes be buffer local?

Previous Next

Package: emacs;

Reported by: Jambunathan K <kjambunathan <at> gmail.com>

Date: Tue, 10 Apr 2012 20:10:02 UTC

Severity: wishlist

Found in version 24.0.95

Done: Jambunathan K <kjambunathan <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11213 in the body.
You can then email your comments to 11213 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11213; Package emacs. (Tue, 10 Apr 2012 20:10:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jambunathan K <kjambunathan <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 10 Apr 2012 20:10:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.95; (Maybe/Wish): Should color-themes be buffer local?
Date: Wed, 11 Apr 2012 01:37:38 +0530
24.0.95; (Maybe/Wish): Should color-themes be buffer local?

The impression I get is that color themes are session-specific and I am
wondering whether it is possible to load a theme just for a particular
buffer (or a mode). [1]

Context:

ODT exporter uses htmlfontify.el to export source blocks with some fancy
colors.[2] The implication is that an ODT file created out of an Org
file (with src blocks) will look and feel differently based on
individual user's font lock settings.  If there was/were a way to
activate a theme on per-buffer basis, then I would like to use it within
the ODT exporter.

Not a bug per-se.  Just a wish.

Footnotes: 
[1] http://lists.gnu.org/archive/html/help-gnu-emacs/2011-10/msg00329.html

Same request as this bug report.  But from an independent source.  It
went unanswered.

[2]  http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9914





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11213; Package emacs. (Tue, 10 Apr 2012 20:26:02 GMT) Full text and rfc822 format available.

Message #8 received at 11213 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Jambunathan K'" <kjambunathan <at> gmail.com>, <11213 <at> debbugs.gnu.org>
Subject: RE: bug#11213: 24.0.95;
	(Maybe/Wish): Should color-themes be buffer local?
Date: Tue, 10 Apr 2012 13:24:14 -0700
color-themes.el is not part of Emacs.
http://www.emacswiki.org/emacs/ColorTheme

Perhaps you mean custom themes instead?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11213; Package emacs. (Tue, 10 Apr 2012 20:34:01 GMT) Full text and rfc822 format available.

Message #11 received at 11213 <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 11213 <at> debbugs.gnu.org
Subject: Re: bug#11213: 24.0.95;
	(Maybe/Wish): Should color-themes be buffer local?
Date: Wed, 11 Apr 2012 02:02:21 +0530
> color-themes.el is not part of Emacs.
> http://www.emacswiki.org/emacs/ColorTheme
>
> Perhaps you mean custom themes instead?

Yes.  I meant custom themes - (info "(emacs) Custom Themes")





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11213; Package emacs. (Wed, 11 Apr 2012 07:00:02 GMT) Full text and rfc822 format available.

Message #14 received at 11213 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 11213 <at> debbugs.gnu.org
Subject: Re: bug#11213: 24.0.95;
	(Maybe/Wish): Should color-themes be buffer local?
Date: Wed, 11 Apr 2012 14:58:10 +0800
Jambunathan K <kjambunathan <at> gmail.com> writes:

> ODT exporter uses htmlfontify.el to export source blocks with some
> fancy colors.[2] The implication is that an ODT file created out of an
> Org file (with src blocks) will look and feel differently based on
> individual user's font lock settings.  If there was/were a way to
> activate a theme on per-buffer basis, then I would like to use it
> within the ODT exporter.

Your description is not too clear, but I guess what you're trying to say
is that you want the htmlfontified output to use some standard set of
faces, independent of the user's face settings.  Probably the best way
to do that is to set up face remappings in the to-be-exported buffer.
See the Face Remapping node in the Lisp manual for details.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11213; Package emacs. (Wed, 11 Apr 2012 10:34:02 GMT) Full text and rfc822 format available.

Message #17 received at 11213 <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Chong Yidong <cyd <at> gnu.org>
Cc: 11213 <at> debbugs.gnu.org
Subject: Re: bug#11213: 24.0.95;
	(Maybe/Wish): Should color-themes be buffer local?
Date: Wed, 11 Apr 2012 16:02:01 +0530
Hello Chong

> Jambunathan K <kjambunathan <at> gmail.com> writes:
>
>> ODT exporter uses htmlfontify.el to export source blocks with some
>> fancy colors.[2] The implication is that an ODT file created out of an
>> Org file (with src blocks) will look and feel differently based on
>> individual user's font lock settings.  If there was/were a way to
>> activate a theme on per-buffer basis, then I would like to use it
>> within the ODT exporter.
>
> Your description is not too clear, but I guess what you're trying to say
> is that you want the htmlfontified output to use some standard set of
> faces, independent of the user's face settings.  

You have understood me correctly.

> Probably the best way to do that is to set up face remappings in the
> to-be-exported buffer.  See the Face Remapping node in the Lisp manual
> for details.

Given a(ny) theme, let's say "adwaita-theme.el", can someone give me a
recipe which runs through all the face definitions defined in that theme
file and hand it off to `face-remapping-alist'.

I don't see any references to remap in cus-face.el and I think it will
take sometime for me to "massage" face definitions in a theme file in to
a form that is understood by `face-remapping-alist'.  I hope such a
massaging is possible.

Again, any ready to use recipe is most welcome.

Jambunathan K.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11213; Package emacs. (Sat, 21 Apr 2012 06:30:02 GMT) Full text and rfc822 format available.

Message #20 received at 11213 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Jambunathan K <kjambunathan <at> gmail.com>
Cc: 11213 <at> debbugs.gnu.org
Subject: Re: bug#11213: 24.0.95;
	(Maybe/Wish): Should color-themes be buffer local?
Date: Sat, 21 Apr 2012 14:28:21 +0800
Jambunathan K <kjambunathan <at> gmail.com> writes:

>> Probably the best way to do that is to set up face remappings in the
>> to-be-exported buffer.  See the Face Remapping node in the Lisp manual
>> for details.
>
> Given a(ny) theme, let's say "adwaita-theme.el", can someone give me a
> recipe which runs through all the face definitions defined in that theme
> file and hand it off to `face-remapping-alist'.

Do

   (get 'adwaita 'theme-settings)

and collect all the face settings in the resulting list.  Each list
element should have the form

   (theme-face FACE adwaita SPEC)

where FACE is a face which is customized by the theme, and SPEC is the
face spec specified.  Once you know FACE, you probably want to

  (face-spec-choose (face-default-spec FACE)

to get the face attributes for the face's default (uncustomized,
unthemed) face spec, on the selected frame.  Then you can put that
attribute in face-remapping-alist.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11213; Package emacs. (Sat, 21 Apr 2012 17:51:02 GMT) Full text and rfc822 format available.

Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Victor Borja <vic.borja <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#11213: 24.0.95;
	(Maybe/Wish): Should color-themes be buffer local?
Date: Sat, 21 Apr 2012 16:01:22 +0000 (UTC)
Hi, i just created a couple of el files (one for color-theme.el 
and other for emacs24 custom themes) for installing a theme
buffer-locally 

     https://github.com/vic/color-theme-buffer-local  

these rely on face remapping as some replys here say.






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11213; Package emacs. (Wed, 25 Apr 2012 19:09:01 GMT) Full text and rfc822 format available.

Message #26 received at 11213 <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: Chong Yidong <cyd <at> gnu.org>
Cc: 11213 <at> debbugs.gnu.org
Subject: Re: bug#11213: 24.0.95;
	(Maybe/Wish): Should color-themes be buffer local?
Date: Thu, 26 Apr 2012 00:37:24 +0530
[Message part 1 (text/plain, inline)]
Chong Yidong <cyd <at> gnu.org> writes:

> Jambunathan K <kjambunathan <at> gmail.com> writes:
>
>>> Probably the best way to do that is to set up face remappings in the
>>> to-be-exported buffer.  See the Face Remapping node in the Lisp manual
>>> for details.
>>
>> Given a(ny) theme, let's say "adwaita-theme.el", can someone give me a
>> recipe which runs through all the face definitions defined in that theme
>> file and hand it off to `face-remapping-alist'.
>
> Do
>
>    (get 'adwaita 'theme-settings)
>
> and collect all the face settings in the resulting list.  Each list
> element should have the form
>
>    (theme-face FACE adwaita SPEC)
>
> where FACE is a face which is customized by the theme, and SPEC is the
> face spec specified.  Once you know FACE, you probably want to
>
>   (face-spec-choose (face-default-spec FACE)
>
> to get the face attributes for the face's default (uncustomized,
> unthemed) face spec, on the selected frame.  Then you can put that
> attribute in face-remapping-alist.

Based on your suggestion this is what I have cooked up.  I am recording
what I see as problems and invite your comments.


1. Copy the attached form to color-theme.el
2. emacs -q, C-x C-f color-theme.el
3. M-x load-theme-buffer-local RET tango-dark RET
4. Look at the attached png image for a screenshot of the image.
5. Place your cursor on `load-theme-buffer-local' and C-u C-x =.  Follow
   the link to `font-lock-function-name-face'.
6. You will see that foreground color is reported as "Blue1" while /in
   fact/ the face is yellowish.
7. Now M-x htmlfontify-buffer.  I am attaching the .html file created
   by this command.  You will see that the buffer is colorized based on
   uncustomized face settings.

I believe the problems in 5-7 are related.  

I think C-u C-x = and whatever the underlying APIs that htmlfontify uses
for retrieving face properties should act on effective value and not
global values.

[color-theme.el (application/emacs-lisp, inline)]
[load-theme-buffer-local.PNG (image/png, attachment)]
[color-theme.el.html (text/html, inline)]

Reply sent to Jambunathan K <kjambunathan <at> gmail.com>:
You have taken responsibility. (Fri, 15 Nov 2013 05:07:02 GMT) Full text and rfc822 format available.

Notification sent to Jambunathan K <kjambunathan <at> gmail.com>:
bug acknowledged by developer. (Fri, 15 Nov 2013 05:07:02 GMT) Full text and rfc822 format available.

Message #31 received at 11213-done <at> debbugs.gnu.org (full text, mbox):

From: Jambunathan K <kjambunathan <at> gmail.com>
To: 11213-done <at> debbugs.gnu.org
Subject: Re: bug#11213: 24.0.95;
 (Maybe/Wish): Should color-themes be buffer local?
Date: Fri, 15 Nov 2013 10:35:39 +0530
OP here.  Closed.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 13 Dec 2013 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 187 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.