emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Bernt Hansen <bernt@norang.ca>
Cc: emacs-orgmode@gnu.org
Subject: Re: BUG-#+ Fontification
Date: Fri, 29 May 2009 01:33:03 -0400	[thread overview]
Message-ID: <10323.1243575183@gamaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Nick Dokos <nicholas.dokos@hp.com> of "Thu, 28 May 2009 23:01:28 EDT." <8298.1243566088@gamaville.dokosmarshall.org>

Nick Dokos <nicholas.dokos@hp.com> wrote:

> Bernt Hansen <bernt@norang.ca> wrote:
> 
> > Nick Dokos <nicholas.dokos@hp.com> writes:
> > 
> > > Bernt Hansen <bernt@norang.ca> wrote:
> > >
> ...
> > >> 
> > >> So to 'fix' this issue I customized the face and set Foreground to
> > >> 'Firebrick' (red) which I think is what it used to look like.  Should
> > >> this face not have some default colouring defined? or are we supposed to
> > >> customize it.  That just jumped out at me as different from the default
> > >> behaviour we used to have -- and is what prompted this thread.
> > >> 
> > >
> > > It *is* initialized:
> > >
> > > ,----
> > > | (defface org-meta-line
> > > |   (org-compatible-face 'font-lock-comment-face nil)   <--------
> > > |   "Face for meta lines startin with \"#+\"."
> > > |   :group 'org-faces
> > > |   :version "22.1")
> > > `----
> > >
> > > It should look like a comment - but you may have defined the face
> > > somehow and the macrology might be incapable of redefining it. Have you
> > > tried restarting emacs?
> > 
> > Yes - I started a minimal emacs session to isolate the commit where it
> > turns black.
> 
> There seems to be an initialization problem of some sort: in my
> currently running session I evaluate the following two forms and get the
> results shown:
> 
> ,----
> | (get 'org-meta-line 'face-defface-spec)
> | ((t :inherit font-lock-comment-face))
> | 
> | (symbol-plist 'org-meta-line)
> | (face 102 face-defface-spec ((t :inherit font-lock-comment-face))
> |           face-documentation "Face for meta lines startin with \"#+\"." custom-version "22.1")
> `----
> 
> This instance of emacs was created by the Gnome session manager. If I
> start another instance by clicking on the Emacs icon/menu item/etc. I
> get the same behavior.
> 
> But if I open an xterm (or start a shell in emacs) and start another
> instance from the command line, I get the following:
> 
> ,----
> | (get 'org-meta-line 'face-defface-spec)
> | nil
> | 
> | (symbol-plist 'org-meta-line)
> | (face 101 face-defface-spec nil 
> |           face-documentation "Face for meta lines startin with \"#+\"." custom-version "22.1")
> `----
> 
> I don't know what causes this difference in behavior.
> 

Well, duh: because of my PATH, I was getting emacs 22 from the command line,
but  emacs 23 from the panel/menu - no wonder there is a difference.

OTOH, this was stupidity with a purpose :-) The upshot is that
org-compatible-face does not deal with emacs 22 gracefully, since the
first two clauses of the cond fail there and so it takes the default
branch; but since specs is nil in the call, the function returns
nil.

Bernt, you are on emacs 22, correct?

One of the emacs-major-version vs. 22 comparisons should probably
include equality (from the description, I suspect the first one):

,----
| (defun org-compatible-face (inherits specs)
|   "Make a compatible face specification.
| If INHERITS is an existing face and if the Emacs version supports it,
| just inherit the face.  If not, use SPECS to define the face.
| XEmacs and Emacs 21 do not know about the `min-colors' attribute.
| For them we convert a (min-colors 8) entry to a `tty' entry and move it
| to the top of the list.  The `min-colors' attribute will be removed from
| any other entries, and any resulting duplicates will be removed entirely."
|   (cond
|    ((and inherits (facep inherits)
| 	 (not (featurep 'xemacs)) (> emacs-major-version 22))    
|                                ; ^
|                                ; ^--- this should probably be >=                        
|
|     ;; In Emacs 23, we use inheritance where possible.
|     ;; We only do this in Emacs 23, because only there the outline
|     ;; faces have been changed to the original org-mode-level-faces.
|     (list (list t :inherit inherits)))
|    ((or (featurep 'xemacs) (< emacs-major-version 22))
|     ;; These do not understand the `min-colors' attribute.
|     (let (r e a)
|       (while (setq e (pop specs))
| 	(cond
| 	 ((memq (car e) '(t default)) (push e r))
| 	 ((setq a (member '(min-colors 8) (car e)))
| 	  (nconc r (list (cons (cons '(type tty) (delq (car a) (car e)))
| 			       (cdr e)))))
| 	 ((setq a (assq 'min-colors (car e)))
| 	  (setq e (cons (delq a (car e)) (cdr e)))
| 	  (or (assoc (car e) r) (push e r)))
| 	 (t (or (assoc (car e) r) (push e r)))))
|       (nreverse r)))
|    (t specs)))
`----

Thanks,
Nick

  parent reply	other threads:[~2009-05-29  5:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-28 20:28 BUG-#+ Fontification Bernt Hansen
2009-05-28 21:43 ` Carsten Dominik
2009-05-28 21:47   ` Bernt Hansen
2009-05-28 21:48     ` Bernt Hansen
2009-05-28 22:10       ` Bernt Hansen
2009-05-28 22:34         ` Nick Dokos
2009-05-28 22:59           ` Bernt Hansen
     [not found]             ` <8298.1243566088@gamaville.dokosmarshall.org>
2009-05-29  5:33               ` Nick Dokos [this message]
2009-05-29  7:40                 ` Carsten Dominik
2009-05-29 11:35                   ` Bernt Hansen
2009-05-29 14:20                   ` Nick Dokos
2009-05-29 11:14                 ` Bernt Hansen
2009-05-28 23:01           ` Bernt Hansen

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.orgmode.org/

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

  git send-email \
    --in-reply-to=10323.1243575183@gamaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=bernt@norang.ca \
    --cc=emacs-orgmode@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/org-mode.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).