emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] BUG-#+ Fontification


From: Nick Dokos
Subject: Re: [Orgmode] BUG-#+ Fontification
Date: Fri, 29 May 2009 01:33:03 -0400

Nick Dokos <address@hidden> wrote:

> Bernt Hansen <address@hidden> wrote:
> 
> > Nick Dokos <address@hidden> writes:
> > 
> > > Bernt Hansen <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]