Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar tables get confused by inline images (display text properties) #1

Open
tsdh opened this issue Jul 5, 2011 · 2 comments
Open

Comments

@tsdh
Copy link
Contributor

tsdh commented Jul 5, 2011

I've just discovered calfw and it's awesome! I use it together with org-mode.

One minor glitch is that the tables get confused by images. For example, in
one of my org files I have this entry:

* Wetter                                                            :weather:
** Montabaur
   :PROPERTIES:
   :CATEGORY: Montabaur 
   :LOCATION: Montabaur, Germany
   :END:
%%(org-google-weather "Montabaur" "de")

This uses the org-google-weather package to insert a short weather forecast
including an icon (sunny, cloudy, etc.) into the org agenda buffer.

Screenshot Org Agenda: http://dl.dropbox.com/u/30611246/img/org-agenda.png

When that is converted to a calfw calendar table, then the borders of the cells
are wrong.

Screenshot Calfw: http://dl.dropbox.com/u/30611246/img/org-calfw.png

Clearly, the table code relies on monospaced fonts and images don't fit well
here. So I think you should just strip images, that is, the display text
property.

This is a very simply patch that fixes the issue for me:

diff --git a/calfw-org.el b/calfw-org.el
index 99fe18e..5dcdc17 100644
--- a/calfw-org.el
+++ b/calfw-org.el
@@ -69,7 +69,10 @@
          (buffer (marker-buffer marker)))
     (propertize
      (concat item " " (buffer-name buffer))
-     'keymap cfw:org-text-keymap)))
+     'keymap cfw:org-text-keymap
+     ;; Delete the display property, since displaying images will break our
+     ;; table layout.
+     'display nil)))

 (defvar cfw:org-schedule-summary-transformer 'cfw:org-summary-format
   "Transformation function which transforms the org item string to calendar title.

However, I'm not convinced that it is a good idea to only fix the org mode
stuff. Most probably the filtering (or better, a nifty implementation of how
to correctly handle display specs) of display text properties should be in
calfw.el, but I can't spot the right location at a first glance.

@kiwanami
Copy link
Owner

kiwanami commented Jul 5, 2011

Thank you for your comment and bug report.

Yes, I also think that calfw should display images in the grids.
So, I will try org-google-weather to research using images in org files.
Please give me a time to research.

If it takes much time for me to implement the function, I would merge your patch to the master branch to avoid the problem.

@tsdh
Copy link
Contributor Author

tsdh commented Jul 5, 2011

Hi!

Yes, I also think that calfw should display images in the grids. So,
I will try org-google-weather to research using images in org files.
Please give me a time to research.

Sure. By the way, I just noticed that besides images also unicode
characters skrew the table layout. Again as an example,
org-google-weather inserts a ℃ character which is slightly wider than
normal ascii chars, at least with the font emacs chooses to display it.
(I use DeJaVu Sans Mono by default, but that doesn't contain this
character, and so emacs falls back to xft:-unknown-AntPoltSemiCond.)

If it takes much time for me to implement the function, I would merge
your patch to the master branch to avoid the problem.

Feel free to do so. But as I've said, I think a proper handling of
display text properties (even if it's simply removing them) belongs into
calfw.el instead of only the org mode backend.

Bye,
Tassilo

localauthor pushed a commit to localauthor/emacs-calfw that referenced this issue May 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants