unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* calwf
@ 2016-01-11 16:51 Uwe Brauer
  2016-01-12 14:29 ` calwf Stefan Monnier
  0 siblings, 1 reply; 16+ messages in thread
From: Uwe Brauer @ 2016-01-11 16:51 UTC (permalink / raw)
  To: help-gnu-emacs


Hello

I recently learned about the calwf package which seems to me a very nice
alternative to weekly-view.el I used in the last years, but which
unfortunately does not work anymore correctly in GNU emacs. 

In case somebody also uses the package, I have two questions concerning
the customization of calwf

    -  is it possible to have the weekend *excluded* in the weekly view.

    -  is it possible to have a the left side a column with the hours. I
       attach an example (generated by weekly-view under Xemacs 21.5.34)


Regards

Uwe Brauer 



[-]
|       | Monday       | Tuesday      | Wednesday   | Thursday    | Friday      |
|-------+--------------+--------------+-------------+-------------+-------------|
|  8:00 |              |              |             |             |             |
|  8:30 |              | Group C ...  |             |             | Group C ... |
|  9:00 |              | ...........  |             | BioQ .....  | ........... |
|  9:30 |              |              |             | ........... |             |
| 10:00 |              |              |             | ........... |             |
| 10:30 |              | BioQ .....   | Group C ... |             |             |
| 11:00 |              | ..........   | ........... |             |             |
| 11:30 | Group E .... |              | Group E ... |             | Group E ... |
| 12:00 | ............ |              | ........... |             | ........... |
| 12:30 |              |              |             |             |             |
| 13:00 |              |              |             |             |             |
| 13:30 |              |              |             |             |             |
| 14:00 |              |              |             |             |             |
| 14:30 |              | Group D .... |             | Group D ..  |             |
| 15:00 |              | ..........   |             | ........... |             |
| 15:30 |              |              |             |             | Group D ... |
| 16:00 |              |              |             |             | ........... |
| 16:30 |              |              |             |             |             |
| 17:00 |              |              |             |             |             |
| 17:30 | Group B ...  |              | Group B ... |             | Group B ... |
| 18:00 | ............ |              | ........... |             | ........... |
| 18:30 |              |              |             |             |             |
| 19:00 |              |              |             |             |             |
| 19:30 |              |              |             |             |             |
| 20:00 |              |              |             |             |             |
| 20:30 |              |              |             |             |             |
---------------------------------------------------------------------------------------------------------------




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

* Re: calwf
  2016-01-11 16:51 calwf Uwe Brauer
@ 2016-01-12 14:29 ` Stefan Monnier
  2016-01-13 17:42   ` calwf Uwe Brauer
  2016-01-14  8:54   ` calwf Uwe Brauer
  0 siblings, 2 replies; 16+ messages in thread
From: Stefan Monnier @ 2016-01-12 14:29 UTC (permalink / raw)
  To: help-gnu-emacs

In both cases (calwf and weekly-view), I expect that the issue is
a simple question of renaming of a few functions/variables, or some such.

Usually issues of compatibility between emacsen are fairly simple to solve.
E.g. the "nice display" in weekly-view in XEmacs might be due simply to
the fact that when the code was written it used features not available
in Emacs, so the author put a (featurep 'xemacs) test in it.  In that
case, removing the test might actually be sufficient to get the feature
working, tho in most cases, this will bump into some further
compatibility issues.

IOW, these should all be fairly easy to debug by single-stepping
through the code and comparing where the execution diverges between the
two different emacsen.


        Stefan




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

* Re: calwf
  2016-01-12 14:29 ` calwf Stefan Monnier
@ 2016-01-13 17:42   ` Uwe Brauer
  2016-01-13 19:55     ` calwf tomas
  2016-01-14 14:09     ` calwf Stefan Monnier
  2016-01-14  8:54   ` calwf Uwe Brauer
  1 sibling, 2 replies; 16+ messages in thread
From: Uwe Brauer @ 2016-01-13 17:42 UTC (permalink / raw)
  To: help-gnu-emacs

>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

   > In both cases (calwf and weekly-view), I expect that the issue is a
   > simple question of renaming of a few functions/variables, or some
   > such.

Yes.
I had to introduce the following alias:

(defalias 'view-diary-entries 'diary-view-entries) ;which was even
obsolete in the diary-lib version of xemacs

But also 

(defalias 'general-holidays 'holiday-general-holidays)
(defalias 'oriental-holidays 'holiday oriental-holidays)
(defalias 'local-holidays 'holiday-local-holidays)
(defalias 'other-holidays  'holiday-other-holidays)
(defalias 'hebrew-holidays 'holiday-oriental-holidays)
(defalias 'christian-holidays 'holiday-christian-holidays)
(defalias 'islamic-holidays 'holiday-iclamic-holidays)

Because of the  the following ChangeLog entry

,----
| commit 3f65970414538063e38ada2a47cb4ef4f35b630e
| Author: Glenn Morris <rgm@gnu.org>
| Date:   Sun Oct 5 19:02:04 2014 -0700
| 
|     Remove calendar code obsolete since at least version 23.1
|     
| * lisp/calendar/holidays.el (general-holidays, oriental-holidays)
|     (local-holidays, other-holidays, hebrew-holidays)
`----

Frankly the rationale of renaming functions is beyond me, since it
breaks backwards compatibility.



   > Usually issues of compatibility between emacsen are fairly simple
   > to solve. E.g. the "nice display" in weekly-view in XEmacs might be
   > due simply to the fact that when the code was written it used
   > features not available in Emacs, so the author put a (featurep
   > 'xemacs) test in it. In that

He did not!


   > case, removing the test might actually be sufficient to get the
   > feature working, tho in most cases, this will bump into some
   > further compatibility issues.

   > IOW, these should all be fairly easy to debug by single-stepping
   > through the code and comparing where the execution diverges between
   > the two different emacsen.

Right. I will try that. My favorite debugging tool is edebug. Is there
anything better around now you could recommend?





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

* Re: calwf
  2016-01-13 17:42   ` calwf Uwe Brauer
@ 2016-01-13 19:55     ` tomas
  2016-01-14 14:09     ` calwf Stefan Monnier
  1 sibling, 0 replies; 16+ messages in thread
From: tomas @ 2016-01-13 19:55 UTC (permalink / raw)
  To: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, Jan 13, 2016 at 05:42:51PM +0000, Uwe Brauer wrote:
> >>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:
> 
>    > In both cases (calwf and weekly-view), I expect that the issue is a
>    > simple question of renaming of a few functions/variables, or some
>    > such.
> 
> Yes.
> I had to introduce the following alias:
> 
> (defalias 'view-diary-entries 'diary-view-entries) ;which was even
> obsolete in the diary-lib version of xemacs
> 
> But also 
> 
> (defalias 'general-holidays 'holiday-general-holidays)
> (defalias 'oriental-holidays 'holiday oriental-holidays)
> (defalias 'local-holidays 'holiday-local-holidays)
> (defalias 'other-holidays  'holiday-other-holidays)
> (defalias 'hebrew-holidays 'holiday-oriental-holidays)
> (defalias 'christian-holidays 'holiday-christian-holidays)
> (defalias 'islamic-holidays 'holiday-iclamic-holidays)

[...]

> Frankly the rationale of renaming functions is beyond me, since it
> breaks backwards compatibility.

In this case (putting everything under a "name space") the change has
something running for it: less name collissions.

The change i, of course, always nasty.

reegards
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlaWq6kACgkQBcgs9XrR2kYYIACeKY3FRJ2FK1qzd9TZFPpjw0vb
stkAmwRTQ2zKR29Y0FkZdXKOspO3IeGc
=j8pa
-----END PGP SIGNATURE-----



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

* Re: calwf
  2016-01-12 14:29 ` calwf Stefan Monnier
  2016-01-13 17:42   ` calwf Uwe Brauer
@ 2016-01-14  8:54   ` Uwe Brauer
  2016-01-14 14:13     ` calwf Stefan Monnier
  2016-01-14 14:15     ` calwf Stefan Monnier
  1 sibling, 2 replies; 16+ messages in thread
From: Uwe Brauer @ 2016-01-14  8:54 UTC (permalink / raw)
  To: help-gnu-emacs

>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

   > In both cases (calwf and weekly-view), I expect that the issue is
   > IOW, these should all be fairly easy to debug by single-stepping
   > through the code and comparing where the execution diverges between the
   > two different emacsen.

The function is question is this one:

(defun week-graph-view-diary-entries ()
  "Prepare and display a buffer with diary entries of the current week.
See `view-diary-entries' for more."
  (interactive)
  (save-excursion
    (calendar-cursor-to-nearest-date)
    (let ((diary-display-hook 'fancy-diary-display-week-graph)
	  (day (calendar-day-of-week (calendar-cursor-to-date))))
      (unless (= day calendar-week-start-day)
	(calendar-beginning-of-week 1))
      (view-diary-entries 7))))

I edebugged it and GNU emacs and Xemacs behave exactly the same, till 

      (view-diary-entries 7))))
                            ^(same)

      (view-diary-entries 7))))
                              ^(different)

Most of the work is done by the function
fancy-diary-display-week-graph
which is in the diary-display-hook.

However I cannot debug fancy-diary-display-week-graph, in the sense that
the debugger never starts for this function (most likely because it is
in that hook)





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

* Re: calwf
  2016-01-13 17:42   ` calwf Uwe Brauer
  2016-01-13 19:55     ` calwf tomas
@ 2016-01-14 14:09     ` Stefan Monnier
  1 sibling, 0 replies; 16+ messages in thread
From: Stefan Monnier @ 2016-01-14 14:09 UTC (permalink / raw)
  To: help-gnu-emacs

> (defalias 'view-diary-entries 'diary-view-entries) ;which was even
> obsolete in the diary-lib version of xemacs
>
> But also 
>
> (defalias 'general-holidays 'holiday-general-holidays)
> (defalias 'oriental-holidays 'holiday oriental-holidays)
> (defalias 'local-holidays 'holiday-local-holidays)
> (defalias 'other-holidays  'holiday-other-holidays)
> (defalias 'hebrew-holidays 'holiday-oriental-holidays)
> (defalias 'christian-holidays 'holiday-christian-holidays)
> (defalias 'islamic-holidays 'holiday-iclamic-holidays)
>
> Because of the  the following ChangeLog entry

Rather than add aliases which re-dirty the name space, you'll be better
off changing the source code to use the new names.

>> Usually issues of compatibility between emacsen are fairly simple
>> to solve. E.g. the "nice display" in weekly-view in XEmacs might be
>> due simply to the fact that when the code was written it used
>> features not available in Emacs, so the author put a (featurep
>> 'xemacs) test in it. In that
> He did not!

Good.

> My favorite debugging tool is edebug.

Same here.


        Stefan




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

* Re: calwf
  2016-01-14  8:54   ` calwf Uwe Brauer
@ 2016-01-14 14:13     ` Stefan Monnier
  2016-01-14 17:00       ` calwf Uwe Brauer
  2016-01-14 14:15     ` calwf Stefan Monnier
  1 sibling, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2016-01-14 14:13 UTC (permalink / raw)
  To: help-gnu-emacs

>     (let ((diary-display-hook 'fancy-diary-display-week-graph)
[...]
>       (view-diary-entries 7))))

There's no such hook run by Emacs's view-diary-entries, hence the difference.
I think you want to use `diary-display-function' instead.


        Stefan




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

* Re: calwf
  2016-01-14  8:54   ` calwf Uwe Brauer
  2016-01-14 14:13     ` calwf Stefan Monnier
@ 2016-01-14 14:15     ` Stefan Monnier
  1 sibling, 0 replies; 16+ messages in thread
From: Stefan Monnier @ 2016-01-14 14:15 UTC (permalink / raw)
  To: help-gnu-emacs

>     (let ((diary-display-hook 'fancy-diary-display-week-graph)

BTW, in this case, marking the code as `lexical-binding' and then
byte-compiling it would have pointed out that diary-display-hook
is unused.

I find the byte-compiler's warnings are even better than Edebug (tho
very often the byte-compiler has no warning to give me, in which case
Edebug is still my favorite tool).


        Stefan




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

* Re: calwf
  2016-01-14 14:13     ` calwf Stefan Monnier
@ 2016-01-14 17:00       ` Uwe Brauer
  2016-01-14 19:34         ` calwf Stefan Monnier
  0 siblings, 1 reply; 16+ messages in thread
From: Uwe Brauer @ 2016-01-14 17:00 UTC (permalink / raw)
  To: help-gnu-emacs

>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

   >> (let ((diary-display-hook 'fancy-diary-display-week-graph)
   > [...]
   >> (view-diary-entries 7))))

   > There's no such hook run by Emacs's view-diary-entries, hence the difference.
   > I think you want to use `diary-display-function' instead.


Ok thanks I got it to work: changes; old values have a comment.

;(add-hook 'diary-display-hook 'fancy-diary-display-week-graph)
(setq diary-display-function 'fancy-diary-display-week-graph);

;(let ((diary-display-hook 'fancy-diary-display-week-graph);
    (let ((diary-display-hook 'fancy-diary-display-week-graph)

;(set-buffer (get-buffer-create fancy-diary-buffer))
    (set-buffer (get-buffer-create diary-fancy-buffer))
;    (display-buffer fancy-diary-buffer)
        (display-buffer diary-fancy-buffer)

I could make a change in emacswiki.

I am not sure what is the best solution


wrap the old code with a
 (if (featurep    'xemacs)?

Thanks

Uwe 




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

* Re: calwf
  2016-01-14 17:00       ` calwf Uwe Brauer
@ 2016-01-14 19:34         ` Stefan Monnier
  2016-01-15  9:05           ` [missing diary-display-hook] (was: calwf) Uwe Brauer
  2016-01-15  9:06           ` calwf Uwe Brauer
  0 siblings, 2 replies; 16+ messages in thread
From: Stefan Monnier @ 2016-01-14 19:34 UTC (permalink / raw)
  To: help-gnu-emacs

> I could make a change in emacswiki.

Better is to distribute the new version in some Git repository.
[ I personally favor the elpa.git one, when possible.  ]

> wrap the old code with a
>  (if (featurep    'xemacs)?

For example, yes.


        Stefan




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

* [missing diary-display-hook] (was: calwf)
  2016-01-14 19:34         ` calwf Stefan Monnier
@ 2016-01-15  9:05           ` Uwe Brauer
  2016-01-15 13:56             ` [missing diary-display-hook] Stefan Monnier
  2016-01-15 16:52             ` Glenn Morris
  2016-01-15  9:06           ` calwf Uwe Brauer
  1 sibling, 2 replies; 16+ messages in thread
From: Uwe Brauer @ 2016-01-15  9:05 UTC (permalink / raw)
  To: help-gnu-emacs

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

>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

   >> I could make a change in emacswiki.
   > Better is to distribute the new version in some Git repository.
   > [ I personally favor the elpa.git one, when possible.  ]

   >> wrap the old code with a
   >> (if (featurep    'xemacs)?

   > For example, yes.

I encountered a related problem. In the old calendar code there was a
hook

diary-display-hook

This hook has been removed by
commit 3f65970414538063e38ada2a47cb4ef4f35b630e
Author: Glenn Morris <rgm@gnu.org>
Date:   Sun Oct 5 19:02:04 2014 -0700

However that hook allowed be the following setting.

(add-hook 'diary-display-hook 'sort-diary-entries)
(add-hook 'diary-display-hook 'fancy-schedule-display-desk-calendar t)
(add-hook 'diary-display-hook 'fancy-diary-display-week-graph)

Now there seems only a variable
diary-display-function
but I don't see how to add various values. I frankly still don't see the
benefit from removing working code. I will write Glenn as well.

Uwe 


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 3677 bytes --]

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

* Re: calwf
  2016-01-14 19:34         ` calwf Stefan Monnier
  2016-01-15  9:05           ` [missing diary-display-hook] (was: calwf) Uwe Brauer
@ 2016-01-15  9:06           ` Uwe Brauer
  1 sibling, 0 replies; 16+ messages in thread
From: Uwe Brauer @ 2016-01-15  9:06 UTC (permalink / raw)
  To: help-gnu-emacs

>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

   >> I could make a change in emacswiki.
   > Better is to distribute the new version in some Git repository.
   > [ I personally favor the elpa.git one, when possible.  ]

   >> wrap the old code with a
   >> (if (featurep    'xemacs)?

   > For example, yes.

I encountered a related problem. In the old calendar code there was a
hook

diary-display-hook

This hook has been removed by
commit 3f65970414538063e38ada2a47cb4ef4f35b630e
Author: Glenn Morris <rgm@gnu.org>
Date:   Sun Oct 5 19:02:04 2014 -0700

However that hook allowed be the following setting.

(add-hook 'diary-display-hook 'sort-diary-entries)
(add-hook 'diary-display-hook 'fancy-schedule-display-desk-calendar t)
(add-hook 'diary-display-hook 'fancy-diary-display-week-graph)

Now there seems only a variable
diary-display-function
but I don't see how to add various values. I frankly still don't see the
benefit from removing working code. I will write Glenn as well.

Uwe 





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

* Re: [missing diary-display-hook]
  2016-01-15  9:05           ` [missing diary-display-hook] (was: calwf) Uwe Brauer
@ 2016-01-15 13:56             ` Stefan Monnier
  2016-01-15 17:38               ` Uwe Brauer
  2016-01-15 16:52             ` Glenn Morris
  1 sibling, 1 reply; 16+ messages in thread
From: Stefan Monnier @ 2016-01-15 13:56 UTC (permalink / raw)
  To: help-gnu-emacs

> (add-hook 'diary-display-hook 'sort-diary-entries)

IIUC there's another hook, more appropriate for sorting.

> (add-hook 'diary-display-hook 'fancy-schedule-display-desk-calendar t)
> (add-hook 'diary-display-hook 'fancy-diary-display-week-graph)

Don't know what these do nor how they work, so not sure what needs to be
done here.

In the worst case, you can do something along the lines of

   (add-function :before diary-display-function
                 #'fancy-schedule-display-desk-calendar)
   (add-function :before diary-display-function
                 #'fancy-diary-display-week-graph)


-- Stefan




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

* Re: [missing diary-display-hook]
  2016-01-15  9:05           ` [missing diary-display-hook] (was: calwf) Uwe Brauer
  2016-01-15 13:56             ` [missing diary-display-hook] Stefan Monnier
@ 2016-01-15 16:52             ` Glenn Morris
  2016-01-15 17:42               ` Uwe Brauer
  1 sibling, 1 reply; 16+ messages in thread
From: Glenn Morris @ 2016-01-15 16:52 UTC (permalink / raw)
  To: help-gnu-emacs

Uwe Brauer wrote:

> (add-hook 'diary-display-hook 'sort-diary-entries)

Please read the fine manual; eg.

http://www.gnu.org/software/emacs/manual/html_node/emacs/Fancy-Diary-Display.html



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

* Re: [missing diary-display-hook]
  2016-01-15 13:56             ` [missing diary-display-hook] Stefan Monnier
@ 2016-01-15 17:38               ` Uwe Brauer
  0 siblings, 0 replies; 16+ messages in thread
From: Uwe Brauer @ 2016-01-15 17:38 UTC (permalink / raw)
  To: help-gnu-emacs

>>> "Stefan" == Stefan Monnier <monnier@iro.umontreal.ca> writes:

    >> (add-hook 'diary-display-hook 'sort-diary-entries)
    > IIUC there's another hook, more appropriate for sorting.

    >> (add-hook 'diary-display-hook 'fancy-schedule-display-desk-calendar t)
    >> (add-hook 'diary-display-hook 'fancy-diary-display-week-graph)

    > Don't know what these do nor how they work, so not sure what needs to be
    > done here.

    > In the worst case, you can do something along the lines of

    >    (add-function :before diary-display-function
    >                  #'fancy-schedule-display-desk-calendar)
    >    (add-function :before diary-display-function
    >                  #'fancy-diary-display-week-graph)

Thanks that worked nicely.




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

* Re: [missing diary-display-hook]
  2016-01-15 16:52             ` Glenn Morris
@ 2016-01-15 17:42               ` Uwe Brauer
  0 siblings, 0 replies; 16+ messages in thread
From: Uwe Brauer @ 2016-01-15 17:42 UTC (permalink / raw)
  To: help-gnu-emacs

>>> "GM" == Glenn Morris <rgm@gnu.org> writes:

   > Uwe Brauer wrote:
   >> (add-hook 'diary-display-hook 'sort-diary-entries)

   > Please read the fine manual; eg.

   > http://www.gnu.org/software/emacs/manual/html_node/emacs/Fancy-Diary-Display.html


Thanks!

You made a mayor surgery renaming variables and function in 2014. May I
ask, perhaps, for the future, that the ChangeLog suggests the new names?
It took me quite some time to figure out that the code in question
weekly-view and cal-desk-calendar work with the following simple
aliasing

; cal-desk-calendar
(defalias 'check-calendar-holidays 'calendar-check-holidays)
(defalias 'calendar-extract-year 'extract-calendar-year)
(defalias 'calendar-increment-month 'increment-calendar-month)

; variables
(defvaralias 'holidays-in-diary-buffer 'diary-show-holidays-flag)
(defvaralias 'fancy-diary-buffer  'diary-fancy-buffer)
(defvaralias 'hebrew-holidays 'holiday-hebrew-holidays)

; the same for weekly-view.el

(defvaralias 'diary-display-hook 'diary-display-function)





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

end of thread, other threads:[~2016-01-15 17:42 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-11 16:51 calwf Uwe Brauer
2016-01-12 14:29 ` calwf Stefan Monnier
2016-01-13 17:42   ` calwf Uwe Brauer
2016-01-13 19:55     ` calwf tomas
2016-01-14 14:09     ` calwf Stefan Monnier
2016-01-14  8:54   ` calwf Uwe Brauer
2016-01-14 14:13     ` calwf Stefan Monnier
2016-01-14 17:00       ` calwf Uwe Brauer
2016-01-14 19:34         ` calwf Stefan Monnier
2016-01-15  9:05           ` [missing diary-display-hook] (was: calwf) Uwe Brauer
2016-01-15 13:56             ` [missing diary-display-hook] Stefan Monnier
2016-01-15 17:38               ` Uwe Brauer
2016-01-15 16:52             ` Glenn Morris
2016-01-15 17:42               ` Uwe Brauer
2016-01-15  9:06           ` calwf Uwe Brauer
2016-01-14 14:15     ` calwf Stefan Monnier

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