kiwanami / emacs-calfw

A calendar framework for Emacs
1.17k stars 100 forks source link

org multi-date events #111

Open bobberb opened 6 years ago

bobberb commented 6 years ago

Dear calfw community,

When I create an agenda item such as:

* Nihon
  :PROPERTIES:
  :END:

<2018-02-19>

the event is normally processed by calfw as seen here calfw_working

However, providing a range such as:

* Nihon
  :PROPERTIES:
  :END:

<2018-02-19>--<2018-02-20>

Show up and range across days before and after they are supposed to as seen here calfw_broken

I see similar issues posted here. What am I doing wrong?

titibandit commented 4 years ago

I have the same issue. Multi day org events appear just like they do on your setup

ghost commented 4 years ago

I also had the same issue, but (temporarily) solved it. I found that the issue occurred when the version of org was 9.3.6. I changed the version to 9.1.9 (built-in of emacs26), then the calfw calendar worked correctly. Maybe due to incompatible changes of org-mode.

titibandit commented 4 years ago

Yes you're right. I have another computer on which everything was fine. After updating it (I'm not sure which was the org version), the problem appeared.

acsala commented 4 years ago

I have the same issue with multi-date events. I think the calfw package is no longer maintined.

zemaye commented 4 years ago

I pushed a fix to my fork. Only tested on my machine but maybe it'll help

https://github.com/kiwanami/emacs-calfw/issues/124#issuecomment-627079563

acsala commented 4 years ago

@zemaye your fix seems to have solved this issue.

ghost commented 2 years ago

Using emacs 27.2 on Win10. I had the same issue and can confirm that @zemaye's solution works. Instead of changing calfw.org, I override the behavior in my init.el:

(use-package calfw-org
  :ensure t
  :bind
  ("M-<f3>" . cfw:open-org-calendar)
  :config
  ;; hotfix: incorrect time range display
  ;; source: https://github.com/zemaye/emacs-calfw/commit/3d17649c545423d919fd3bb9de2efe6dfff210fe
  (defun cfw:org-get-timerange (text)
  "Return a range object (begin end text).
If TEXT does not have a range, return nil."
  (let* ((dotime (cfw:org-tp text 'dotime)))
    (and (stringp dotime) (string-match org-ts-regexp dotime)
     (let* ((matches  (s-match-strings-all org-ts-regexp dotime))
           (start-date (nth 1 (car matches)))
           (end-date (nth 1 (nth 1 matches)))
           (extra (cfw:org-tp text 'extra)))
       (if (string-match "(\\([0-9]+\\)/\\([0-9]+\\)): " extra)
       ( list( calendar-gregorian-from-absolute
       (time-to-days
       (org-read-date nil t start-date))
       )
       (calendar-gregorian-from-absolute
       (time-to-days
       (org-read-date nil t end-date))) text)))))))

Thanks, zemaye, for the fix.