emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* default face org-column
@ 2013-05-30  2:43 Xiao-Yong Jin
  2013-06-01  6:17 ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Xiao-Yong Jin @ 2013-05-30  2:43 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1481 bytes --]

Hi,

In org-faces.el,

(when (fboundp 'set-face-attribute)
  ;; Make sure that a fixed-width face is used when we have a column table.
  (set-face-attribute 'org-column nil
		      :height (face-attribute 'default :height)
		      :family (face-attribute 'default :family)))

I understand why you did this, but it is not quite logical, and somewhat invasive.  First, you certainly do not do this with org-table.  Then why org-column specifically?  Second, it overwrites the the value I set in the emacs theme or custom-set-faces.  Third, the end result is quite bizarre and odd-looking.  The "default" height and "default" family is some how not what I set for the frame, because the font family and size is set when emacs starts up and loaded the org-mode.  When I use set-frame-font or text-scale-adjust, org-column will stick with the old font family and size.  In fact, because the font family for org-column and org-column-title are different, the result is just bad.

I don't think it is only my problem, but I'll describe my setup for themes/font.  I use default-frame-alist to set the font family and size—The above code will not pick up this setup.  I use load-theme and enable-theme to load the theme I want.  Sometimes I use set-frame-font or text-scale-adjust to get a pleasantly looking texts temporary.  I usually use fixed-width font, so the above code is not doing any good.

For the time being, I commented out the above code.

Best,
Xiao-Yong


[-- Attachment #2: Type: text/html, Size: 2143 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: default face org-column
  2013-05-30  2:43 default face org-column Xiao-Yong Jin
@ 2013-06-01  6:17 ` Carsten Dominik
  2013-06-28  4:55   ` Xiao-Yong Jin
  0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2013-06-01  6:17 UTC (permalink / raw)
  To: Xiao-Yong Jin; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1937 bytes --]


On 30.5.2013, at 04:43, Xiao-Yong Jin <jinxiaoyong@gmail.com> wrote:

> Hi,
> 
> In org-faces.el,
> 
> (when (fboundp 'set-face-attribute)
>   ;; Make sure that a fixed-width face is used when we have a column table.
>   (set-face-attribute 'org-column nil
> 		      :height (face-attribute 'default :height)
> 		      :family (face-attribute 'default :family)))

Hi Xiao,

I remember that I struggled with the problem that I had to make sure that column view used a fixed-width face - and this was the solution that worked - not a particular pretty one, admittedly.

Do you have an idea on how to change this code that it will always work?  I'd be very happy to accept a good patch.

- Carsten

> 
> I understand why you did this, but it is not quite logical, and somewhat invasive.  First, you certainly do not do this with org-table.  Then why org-column specifically?  Second, it overwrites the the value I set in the emacs theme or custom-set-faces.  Third, the end result is quite bizarre and odd-looking.  The "default" height and "default" family is some how not what I set for the frame, because the font family and size is set when emacs starts up and loaded the org-mode.  When I use set-frame-font or text-scale-adjust, org-column will stick with the old font family and size.  In fact, because the font family for org-column and org-column-title are different, the result is just bad.
> 
> I don't think it is only my problem, but I'll describe my setup for themes/font.  I use default-frame-alist to set the font family and size—The above code will not pick up this setup.  I use load-theme and enable-theme to load the theme I want.  Sometimes I use set-frame-font or text-scale-adjust to get a pleasantly looking texts temporary.  I usually use fixed-width font, so the above code is not doing any good.
> 
> For the time being, I commented out the above code.
> 
> Best,
> Xiao-Yong
> 


[-- Attachment #2: Type: text/html, Size: 3128 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: default face org-column
  2013-06-01  6:17 ` Carsten Dominik
@ 2013-06-28  4:55   ` Xiao-Yong Jin
  2013-06-28 11:05     ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Xiao-Yong Jin @ 2013-06-28  4:55 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 3043 bytes --]

On Jun 1, 2013, at 3:17 PM, Carsten Dominik <carsten.dominik@gmail.com> wrote:

> Hi Xiao,
> 
> I remember that I struggled with the problem that I had to make sure that column view used a fixed-width face - and this was the solution that worked - not a particular pretty one, admittedly.
> 
> Do you have an idea on how to change this code that it will always work?  I'd be very happy to accept a good patch.
> 
> - Carsten

Hi Carsten,

I wasn't sure what you were talking about until I tried out the theme, leuven... and that was really fanciful and totally screwed the column-view without your fixed-width face fix.

In order to make it more flexible, instead of just set it once when org-faces.el is loaded, I think enforcing it every time when column-view is called is a better choice.  Thus came the following little patch.

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index a98deec..f3b8e42 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -169,8 +169,10 @@ This is the compiled version of the format.")
                            (get-text-property (point-at-bol) 'face))
                       'default))
         (color (list :foreground (face-attribute ref-face :foreground)))
-        (face (list color 'org-column ref-face))
-        (face1 (list color 'org-agenda-column-dateline ref-face))
+        (font (list :height (face-attribute 'default :height)
+                    :family (face-attribute 'default :family)))
+        (face (list color font 'org-column ref-face))
+        (face1 (list color font 'org-agenda-column-dateline ref-face))
         (cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp))
         pom property ass width f string ov column val modval s2 title calc)
     ;; Check if the entry is in another buffer.
diff --git a/lisp/org-faces.el b/lisp/org-faces.el
index 5472964..e968657 100644
--- a/lisp/org-faces.el
+++ b/lisp/org-faces.el
@@ -217,12 +217,6 @@ column view defines special faces for each outline level.  See the file
   "Face for column display of entry properties."
   :group 'org-faces)
 
-(when (fboundp 'set-face-attribute)
-  ;; Make sure that a fixed-width face is used when we have a column table.
-  (set-face-attribute 'org-column nil
-                     :height (face-attribute 'default :height)
-                     :family (face-attribute 'default :family)))
-
 (defface org-agenda-column-dateline
   (org-compatible-face 'org-column
     '((t nil)))

In this way, the column-view face will not be bound only to the font family and size at the time of loading org-faces.el, but anytime column-view is called.  I'm not sure if I covered all the cases, but it seems to work well for me.  I hope the patch is not broken by the mail app, but I guess it is simple enough to read it in one sip of coffee, though I tracked the issue and wrote the patch with one cup.

Best,
Xiao-Yong

PS. I realized it was almost a month-old email.  Org-mode is really good at remembering it for me.

[-- Attachment #2: Type: text/html, Size: 5630 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: default face org-column
  2013-06-28  4:55   ` Xiao-Yong Jin
@ 2013-06-28 11:05     ` Carsten Dominik
  0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2013-06-28 11:05 UTC (permalink / raw)
  To: Xiao-Yong Jin; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 3297 bytes --]

Hi Xiao-Yong,

I have applied this patch, thank you.

- Carsten

On 28.6.2013, at 06:55, Xiao-Yong Jin <jinxiaoyong@gmail.com> wrote:

> On Jun 1, 2013, at 3:17 PM, Carsten Dominik <carsten.dominik@gmail.com> wrote:
> 
>> Hi Xiao,
>> 
>> I remember that I struggled with the problem that I had to make sure that column view used a fixed-width face - and this was the solution that worked - not a particular pretty one, admittedly.
>> 
>> Do you have an idea on how to change this code that it will always work?  I'd be very happy to accept a good patch.
>> 
>> - Carsten
> 
> Hi Carsten,
> 
> I wasn't sure what you were talking about until I tried out the theme, leuven... and that was really fanciful and totally screwed the column-view without your fixed-width face fix.
> 
> In order to make it more flexible, instead of just set it once when org-faces.el is loaded, I think enforcing it every time when column-view is called is a better choice.  Thus came the following little patch.
> 
> diff --git a/lisp/org-colview.el b/lisp/org-colview.el
> index a98deec..f3b8e42 100644
> --- a/lisp/org-colview.el
> +++ b/lisp/org-colview.el
> @@ -169,8 +169,10 @@ This is the compiled version of the format.")
>                             (get-text-property (point-at-bol) 'face))
>                        'default))
>          (color (list :foreground (face-attribute ref-face :foreground)))
> -        (face (list color 'org-column ref-face))
> -        (face1 (list color 'org-agenda-column-dateline ref-face))
> +        (font (list :height (face-attribute 'default :height)
> +                    :family (face-attribute 'default :family)))
> +        (face (list color font 'org-column ref-face))
> +        (face1 (list color font 'org-agenda-column-dateline ref-face))
>          (cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp))
>          pom property ass width f string ov column val modval s2 title calc)
>      ;; Check if the entry is in another buffer.
> diff --git a/lisp/org-faces.el b/lisp/org-faces.el
> index 5472964..e968657 100644
> --- a/lisp/org-faces.el
> +++ b/lisp/org-faces.el
> @@ -217,12 +217,6 @@ column view defines special faces for each outline level.  See the file
>    "Face for column display of entry properties."
>    :group 'org-faces)
>  
> -(when (fboundp 'set-face-attribute)
> -  ;; Make sure that a fixed-width face is used when we have a column table.
> -  (set-face-attribute 'org-column nil
> -                     :height (face-attribute 'default :height)
> -                     :family (face-attribute 'default :family)))
> -
>  (defface org-agenda-column-dateline
>    (org-compatible-face 'org-column
>      '((t nil)))
> 
> In this way, the column-view face will not be bound only to the font family and size at the time of loading org-faces.el, but anytime column-view is called.  I'm not sure if I covered all the cases, but it seems to work well for me.  I hope the patch is not broken by the mail app, but I guess it is simple enough to read it in one sip of coffee, though I tracked the issue and wrote the patch with one cup.
> 
> Best,
> Xiao-Yong
> 
> PS. I realized it was almost a month-old email.  Org-mode is really good at remembering it for me.


[-- Attachment #2: Type: text/html, Size: 6144 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-28 11:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-30  2:43 default face org-column Xiao-Yong Jin
2013-06-01  6:17 ` Carsten Dominik
2013-06-28  4:55   ` Xiao-Yong Jin
2013-06-28 11:05     ` Carsten Dominik

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).