all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* diary display won't initialise correctly?
@ 2003-02-06 17:53 Kester Clegg
  2003-02-06 22:53 ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: Kester Clegg @ 2003-02-06 17:53 UTC (permalink / raw)



Having put the following hooks into my .emacs, I notice on pressing 'd',
just a single day is displayed, moving my cursor means 4 days are
displayed which is what I want. How can I get it to display 4 days to
begin with, or each time I press 'd'?  I've included seemingly
irrelevant lines just case someone knows of any conflicts.


;;------------------
(add-hook 'calendar-move-hook (lambda () (view-diary-entries 4)))
(add-hook 'list-diary-entries-hook 'sort-diary-entries t)
(add-hook 'diary-hook 'appt-make-list)
(add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
(add-hook 'diary-display-hook 'fancy-diary-display)

(setq number-of-diary-entries 7)

(setq-default save-place t)
(setq european-calendar-style 't)

(display-time)

(setq calendar-latitude 54.5)
(setq calendar-longitude 1)
(setq calendar-location-name "BelleVue Street, York")

-- 
************************************************************************
Kester Clegg				Dept. of Computer Science,
Research Assistant (UTC)		University of York, 
Tel (01904) 43 27 49			email: kester at cs.york.ac.uk
************************************************************************

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

* Re: diary display won't initialise correctly?
  2003-02-06 17:53 diary display won't initialise correctly? Kester Clegg
@ 2003-02-06 22:53 ` Kevin Rodgers
  2003-02-07 11:35   ` Kester Clegg
  0 siblings, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2003-02-06 22:53 UTC (permalink / raw)


Kester Clegg wrote:

> Having put the following hooks into my .emacs, I notice on pressing 'd',
> just a single day is displayed, moving my cursor means 4 days are
> displayed which is what I want. How can I get it to display 4 days to
> begin with, or each time I press 'd'?  I've included seemingly
> irrelevant lines just case someone knows of any conflicts.
> 
> 
> ;;------------------
> (add-hook 'calendar-move-hook (lambda () (view-diary-entries 4)))
> (add-hook 'list-diary-entries-hook 'sort-diary-entries t)
> (add-hook 'diary-hook 'appt-make-list)
> (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
> (add-hook 'diary-display-hook 'fancy-diary-display)
> 
> (setq number-of-diary-entries 7)


Why 7 instead of 4?


> (setq-default save-place t)
> (setq european-calendar-style 't)
> 
> (display-time)
> 
> (setq calendar-latitude 54.5)
> (setq calendar-longitude 1)
> (setq calendar-location-name "BelleVue Street, York")

Here's a hack to use `number-of-diary-entries' as the default instead of 1.  I'm

sure you can figure out how to change that to 4.  :-)


(defadvice view-diary-entries (before number-of-diary-entries activate)
   "If ARG is not specified, display `number-of-diary-entries' instead of 1."
   (if (and (interactive-p)
	   (null current-prefix-arg))
       (ad-set-arg 0 number-of-diary-entries)))

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

* Re: diary display won't initialise correctly?
  2003-02-06 22:53 ` Kevin Rodgers
@ 2003-02-07 11:35   ` Kester Clegg
  2003-02-11  0:29     ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: Kester Clegg @ 2003-02-07 11:35 UTC (permalink / raw)


Kevin Rodgers <kevin.rodgers@ihs.com> writes:

[...]

> > (add-hook 'calendar-move-hook (lambda () (view-diary-entries 4)))
> > (add-hook 'list-diary-entries-hook 'sort-diary-entries t)
> > (add-hook 'diary-hook 'appt-make-list)
> > (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
> > (add-hook 'diary-display-hook 'fancy-diary-display)
> > (setq number-of-diary-entries 7)
> 
> 
> Why 7 instead of 4?

I was playing around, of course!  :-)

[...]

> (defadvice view-diary-entries (before number-of-diary-entries activate)
>    "If ARG is not specified, display `number-of-diary-entries' instead of 1."
>    (if (and (interactive-p)
> 	   (null current-prefix-arg))
>        (ad-set-arg 0 number-of-diary-entries)))

Thanks for that, seems to work fine - so is defadvice the standard way
to get a hook into something before it runs?  What made you take that
route?

-- 
************************************************************************
Kester Clegg				Dept. of Computer Science,
Research Assistant (UTC)		University of York, 
Tel (01904) 43 27 49			email: kester at cs.york.ac.uk
************************************************************************

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

* Re: diary display won't initialise correctly?
  2003-02-07 11:35   ` Kester Clegg
@ 2003-02-11  0:29     ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2003-02-11  0:29 UTC (permalink / raw)


Kester Clegg wrote:

> Kevin Rodgers <kevin.rodgers@ihs.com> writes:
>>(defadvice view-diary-entries (before number-of-diary-entries activate)
>>   "If ARG is not specified, display `number-of-diary-entries' instead of 1."
>>   (if (and (interactive-p)
>>	   (null current-prefix-arg))
>>       (ad-set-arg 0 number-of-diary-entries)))
>>
> 
> Thanks for that, seems to work fine - so is defadvice the standard way
> to get a hook into something before it runs?  What made you take that
> route?

Since view-diary-entries isn't controlled by a variable, there's no
other way to do it without defining your own command that merely calls
view-diary-entries with an explicit argument -- and I would be loathe to
do that just to provide a more sensible interactive default.

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

end of thread, other threads:[~2003-02-11  0:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-06 17:53 diary display won't initialise correctly? Kester Clegg
2003-02-06 22:53 ` Kevin Rodgers
2003-02-07 11:35   ` Kester Clegg
2003-02-11  0:29     ` Kevin Rodgers

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.