2

I'm trying to use a fixed width font when in org-mode's column view (I use variable width font otherwise). Customizing the org-column face attribute doesn't seem to do it. How can I get this to work?

There's some related discussion out there (referenced in Org-mode FAQs), but it doesn't seem to help my situation. I'm thinking this excerpt from the documentation is the key, but I'm not sure how.

Face: org-column (sample) (customize this face)

Documentation: Face for column display of entry properties. This is actually only part of the face definition for the text in column view. The following faces apply, with this priority.

  1. The color of the reference face. This is normally the level fact that is used in the outline. In agenda-mode, it will be the face of the first character in the line. The color is explicitly retained to make sure that the column line still looks a bit like the structure line it is masking.

  2. The `org-column' face.

  3. The remaining properties of the reference face.

Since column view works by putting overlays with a display property over individual characters in the buffer, the face of the underlining character (this might for example be the a TODO keyword) might still shine through in some properties. So when your column view looks funny, with "random" colors, weight, strike-through, try to explicitly set the properties in the `org-column' face. For example, set :underline to nil, or the :slant to `normal'.

Under XEmacs, the rules are simpler, because the XEmacs version of column view defines special faces for each outline level. See the file `org-colview-xemacs.el' in Org's contrib/ directory for details.

Defined in `org-faces.el'.

           Family: Lucida Console
          Foundry: unspecified
            Width: unspecified
           Height: 120
           Weight: normal
            Slant: normal
       Foreground: unspecified
DistantForeground: unspecified
       Background: grey90
        Underline: nil
         Overline: unspecified
   Strike-through: nil
              Box: unspecified
          Inverse: unspecified
          Stipple: unspecified
             Font: unspecified
          Fontset: unspecified
          Inherit: unspecified

If it helps, I'm running Emacs 24.5 windows version on Mac OS X.


EDIT When I call the function that has the default keybinding C-u C-x = (I don't know the function's name) with my point in the org-column view region I get the following (excerpt):

There is an overlay here:

From 24 to 25

display [Show] face ((:foreground unspecified) (:height 120 :family >"Helvetica") org-agenda-column-dateline org-agenda-date-today) keymap [Show] line-prefix "" org-columns-format "%-70.70s | " org-columns-key "ITEM" org-columns-pom nil org-columns-value "Saturday 6 June 2015" org-columns-value-modified "Saturday 6 June 2015" wrap-prefix ""

Where does emacs invoke this overlay? It looks like it's calling the Helvetica font family in the face--this is precisely what I'm trying to prevent. I believe this is what is overruling the Lucida Console family that I defined for the org-column face (above).

  • In general, if you set a face, it is set globally for every buffer in an Emacs session. I would suggest that you look into using the org-agenda-mode-hook with face-remap-add-relative: emacs.stackexchange.com/a/7283/2287 And, you'll need to add some conditions if you only want it to apply to certain org-agenda buffers (but not all). Here is another example using a hook for an unrelated mode: stackoverflow.com/a/28008006/2112489 – lawlist Jun 6 '15 at 20:14
  • That's a really good point. I'll go back and revise how I request face modifications. For specific modes I generally use a hook (e.g., (add-hook 'org-agenda-mode-hook ...)) to call an interactive function to edit the buffer-face-mode-face variable. For specific characteristics of a mode (e.g., 'org-table), I use (set-face-attribute 'org-table nil :foreground ...). For the issue at hand, I edited my original post to help clarify my question. I think the 'overlay' emacs adds is my problem and I'd like to find out how to edit that. – kgo Jun 7 '15 at 1:03
  • Perhaps you could try placing your cursor at the location of the text you want to change the appearance of and type C-u C-x = -- that will to you what faces, text properties and overlays are present. You can then proceed to alter those characteristics as you desire. The aforementioned keyboard shortcut is running the function what-cursor-position -- the prefix argument causes additional details to be displayed. You may also want to consider looking at the 'default face for the entire buffer. – lawlist Jun 7 '15 at 1:08
  • Thanks, @lawlist. I just finished editing my original question that I referenced prematurely in my first comment. How might I go about preventing that face overlay (i.e., "Helvetica" font family)? I think that's what is messing up my font. – kgo Jun 7 '15 at 1:25
  • 1
    If I had to take a semi-researched guess, I would guess that your 'default face is being used here and the function responsible for that behavior is org-columns-display-here. If you decide that this is the case, then consider creating a new function with the exact same name and modifying it to suit your needs -- you will want to precede your new function with the same name by a require statement so that you can redefine it -- i.e., (require 'org-colview) (defun org-columns-display-here (&optional props dateline) . . . :) – lawlist Jun 7 '15 at 2:32
2

The primary function responsible for the behavior described by the original poster is located within the org-colview.el library, and is called org-columns-display-here. The function at issue can be found in the source code by typing M-x find-function RET org-columns-display-here RET after first having loaded the org-colview.el library -- e.g., M-x eval-expression RET (require 'org-colview) RET. The faces and individual attributes at issue are hard coded.

If the original poster decides to modify the function directly, the function can be copied and pasted to the .emacs file with a preceding require statement for the library where the original function is located. Although the internal workings of the function may be modified by the original poster, the original function will maintain its original name -- e.g., (require 'org-colview) (defun org-columns-display-here (prefix-descriptions) . . . ).

Options include, but are not limited to, hard-coding different faces and/or individual attributes defined by the original poster, changing the global settings for the existing faces used by the function (e.g., 'default), or including code to use the existing faces (e.g., 'default) on a buffer-local basis (with different attributes) with something like face-remap-add-relative, the documentation for which is at the following link: http://www.gnu.org/software/emacs/manual/html_node/elisp/Face-Remapping.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.