all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Daily Diary Display in Emacs emacs24 24.4+1-5
@ 2015-10-23 16:24 Charles Curley
  2015-10-23 20:44 ` Emanuel Berg
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Charles Curley @ 2015-10-23 16:24 UTC (permalink / raw)
  To: help-gnu-emacs

I have emacs24, 24.4+1-5 on Debian 8.2 jessie. In the past (e.g. emacs
23.4+1-4 on debian 7.x, wheezy), I have had emacs re-display my diary
every day automatically. This capability does not seem to work on this
version of emacs.

Relevant portions of my .emacs (watch for wrapping):

--------------------------------------------------
;; Calendar stuff:
(if (system-is-desktop)
    (progn

      ;; ---great bit of code from Jeff Miller to highlight appointments in red on modeline---

      ;; per http://www.emacswiki.org/emacs/AppointmentMode
      (defface appt-face
        '((t (:foreground "red" :background "white")))
        "Face to indicate a current appointment."
        :group 'appt)

      (defadvice appt-disp-window (before appt-hilite-more activate)
        (when appt-mode-string
          (put-text-property 1 (- (length appt-mode-string) 1)
                             'face 'appt-face appt-mode-string)))

      (defadvice appt-check (after appt-hilite activate)
        (when appt-mode-string
          (put-text-property 1 (- (length appt-mode-string) 1)
                             'face 'appt-face appt-mode-string)
          (force-mode-line-update)))

      ;; ---------------------------------
      ;; (seq appt-display-mode-line t)    ; explicitly enable it.


      ;; set my home co-ordinates for sunrise/sunset calculations
      (setq calendar-latitude xx.x)
      (setq calendar-longitude xxx.x)
      (setq calendar-location-name "obfuscated")
      (calendar)                       ; fire up the calendar display.
      (setq show-trailing-whitespace nil)
      ;; (setq cal-tex-diary t)
      ;; (setq cal-tex-rules t)

      (progn
        (calendar-mark-holidays)
        (diary-mark-entries)
        (other-window 1) ; Now switch to the main window on this frame.
        ;; Set a vector for the number of days in advance to show
        ;; appointments. Then turn the diary mode on.
        (setq diary-number-of-entries [2 3 3 3 3 5 2])
        ;; Add the appointment generator to the diary hook.

        (if ( < emacs-major-version 24) ; emacs 23 or less
            (add-hook 'diary-hook 'appt-make-list)
          )

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

      ;; If this is non-nil, Emacs rings the terminal bell for appointment
      ;; reminders. The default is t.
      ;; (setq appt-audible nil)

      (setq appt-activate 1 ; http://www.emacswiki.org/emacs/AppointmentMode
            appt-display-duration 59)

      ;; Also from http://www.emacswiki.org/emacs/AppointmentMode
      (defun diary-save-hook ()
        "Stuff to do when saving the diary files."
        (appt-initialize))
      (defun add-diary-save-hook ()
        "find-file-hooks hook to add the diary-save-hook when appropriate"
        (if (string-match "diary" (buffer-name))
            (add-hook 'after-save-hook 'diary-save-hook)))
      (add-hook 'find-file-hooks 'add-diary-save-hook)

      (diary)
      
      )
  )
;; end calendar/diary stuff
--------------------------------------------------


-- 

The right of the people to be secure in their persons, houses, papers,
and effects, against unreasonable searches and seizures, shall not be
violated, and no Warrants shall issue, but upon probable cause,
supported by Oath or affirmation, and particularly describing the
place to be searched, and the persons or things to be seized.
-- U.S. Const. Amendment IV

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB



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

* Re: Daily Diary Display in Emacs emacs24 24.4+1-5
  2015-10-23 16:24 Daily Diary Display in Emacs emacs24 24.4+1-5 Charles Curley
@ 2015-10-23 20:44 ` Emanuel Berg
  2015-10-23 22:11   ` Charles Curley
  2015-10-24  0:28 ` John Mastro
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Emanuel Berg @ 2015-10-23 20:44 UTC (permalink / raw)
  To: help-gnu-emacs

Charles Curley <charlescurley@charlescurley.com>
writes:

> I have emacs24, 24.4+1-5 on Debian 8.2 jessie.
> In the past (e.g. emacs 23.4+1-4 on debian 7.x,
> wheezy), I have had emacs re-display my diary every
> day automatically. This capability does not seem to
> work on this version of emacs.
>
> Relevant portions of my .emacs ...

That code is very disorganized. Try to clean it up.
Consider moving it all to file of its own, e.g.,
my-calendar.el and then `load' it from .emacs.

You don't mention which part of the code doesn't work
- as for me, I don't even have a "system-is-desktop"
function, which is the first line of your code - I'm
on

    GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+
    Version 3.14.5) of 2015-03-07 on trouble, modified
    by Debian

but it might be a package thing rather.

Anyway, what is it that you want to happen? You write
"I have had emacs re-display my diary every day
automatically." Literally, that sounds like you have
Emacs on 24/7 and you want it to automatically update
the diary every 24 hours. But more likely (since you
mention "desktop") you want Emacs to bring up the
diary on startup. Or? Which is it?

In general, instead relying on such wild-west code, do
what you want interactively, with M-x (and shortcuts),
then, when you get it to work, replicate what you just
did in code. It shouldn't be like several pages!
Keep configuration (settings, usually `setq') and
behavior (functions, i.e. `defun's) apart.

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: Daily Diary Display in Emacs emacs24 24.4+1-5
  2015-10-23 20:44 ` Emanuel Berg
@ 2015-10-23 22:11   ` Charles Curley
  2015-10-24  0:20     ` Emanuel Berg
  0 siblings, 1 reply; 9+ messages in thread
From: Charles Curley @ 2015-10-23 22:11 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, 23 Oct 2015 22:44:11 +0200
Emanuel Berg <embe8573@student.uu.se> wrote:

> Charles Curley <charlescurley@charlescurley.com>
> writes:
> 
> > I have emacs24, 24.4+1-5 on Debian 8.2 jessie.
> > In the past (e.g. emacs 23.4+1-4 on debian 7.x,
> > wheezy), I have had emacs re-display my diary every
> > day automatically. This capability does not seem to
> > work on this version of emacs.
> >
> > Relevant portions of my .emacs ...
> 
> That code is very disorganized. Try to clean it up.
> Consider moving it all to file of its own, e.g.,
> my-calendar.el and then `load' it from .emacs.

Yeah, I know it's disorganized. I've been using emacs since version
19.x, and across that many version, it just metastasizes.

> 
> You don't mention which part of the code doesn't work
> - as for me, I don't even have a "system-is-desktop"
> function, which is the first line of your code - I'm
> on

Sorry about that. "system-is-desktop" is a function local to my network
which looks at the host name, and returns t or nil depending on whether
I consider the computer a desktop machine or a server.

I don't think it's a matter of the current code not working (as far as I
know). It's a matter what used to work no longer does so. Since I have
not changed my code going from 23 to 24, that suggests the problem is
somewhere in emacs.




> 
>     GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+
>     Version 3.14.5) of 2015-03-07 on trouble, modified
>     by Debian
> 
> but it might be a package thing rather.
> 
> Anyway, what is it that you want to happen? You write
> "I have had emacs re-display my diary every day
> automatically." Literally, that sounds like you have
> Emacs on 24/7 and you want it to automatically update
> the diary every 24 hours.

Exactly. I leave my desktops on 24/7 whenever I can.

> But more likely (since you
> mention "desktop") you want Emacs to bring up the
> diary on startup. Or? Which is it?
> 
> In general, instead relying on such wild-west code, do
> what you want interactively, with M-x (and shortcuts),
> then, when you get it to work, replicate what you just
> did in code. It shouldn't be like several pages!

I can get it to do what I want manually. M-x diary does it. I suspect
there's a hook in there somewhere to which I should be adding some code
which ultimately calls diary.

What I don't know is, what used to tell emacs to run diary every night?
That is what is no longer working.



-- 

The right of the people to be secure in their persons, houses, papers,
and effects, against unreasonable searches and seizures, shall not be
violated, and no Warrants shall issue, but upon probable cause,
supported by Oath or affirmation, and particularly describing the
place to be searched, and the persons or things to be seized.
-- U.S. Const. Amendment IV

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB



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

* Re: Daily Diary Display in Emacs emacs24 24.4+1-5
  2015-10-23 22:11   ` Charles Curley
@ 2015-10-24  0:20     ` Emanuel Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2015-10-24  0:20 UTC (permalink / raw)
  To: help-gnu-emacs

Charles Curley <charlescurley@charlescurley.com>
writes:

> Yeah, I know it's disorganized. I've been using
> emacs since version 19.x, and across that many
> version, it just metastasizes.

At least your code did ;)

> I don't think it's a matter of the current code not
> working (as far as I know). It's a matter what used
> to work no longer does so. Since I have not changed
> my code going from 23 to 24, that suggests the
> problem is somewhere in emacs.

As you know, it has been known to happen, that code
that worked in one version doesn't work in the next.
And, if it "works" in the sense it doesn't produce an
error message but seizes to produce the desired
behavior, then it sort of doesn't work, does it?
Always, the cleaner the code, the more easy to
troubleshoot whatever the scenario...

> Exactly. I leave my desktops on 24/7 whenever I can.
>
> I can get it to do what I want manually. M-x diary
> does it. I suspect there's a hook in there somewhere
> to which I should be adding some code which
> ultimately calls diary.
>
> What I don't know is, what used to tell emacs to run
> diary every night? That is what is no
> longer working.

Examine the calendar and/or diary variables,
documentation, and so on.

You can schedule it manually ~like this:

(require 'cl-lib)

(defvar my-timer)
(setq my-timer (timer-create))

(defvar *its* 0)
(setq *its* 0)

;; replace this with a diary updating function
(defun every-five ()
  (message "Five! %s"(make-string (cl-incf *its*) ?\.)))

(timer-set-function my-timer 'every-five)
(timer-set-time my-timer (current-time) 5) ; once a day = every 86400 second!
(timer-activate my-timer)
;; (cancel-timer my-timer)

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

* Re: Daily Diary Display in Emacs emacs24 24.4+1-5
  2015-10-23 16:24 Daily Diary Display in Emacs emacs24 24.4+1-5 Charles Curley
  2015-10-23 20:44 ` Emanuel Berg
@ 2015-10-24  0:28 ` John Mastro
  2015-10-24 15:44 ` Stephen Berman
  2015-10-24 17:48 ` Charles Curley
  3 siblings, 0 replies; 9+ messages in thread
From: John Mastro @ 2015-10-24  0:28 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org; +Cc: Charles Curley

Charles Curley <charlescurley@charlescurley.com> wrote:
> I have emacs24, 24.4+1-5 on Debian 8.2 jessie. In the past (e.g. emacs
> 23.4+1-4 on debian 7.x, wheezy), I have had emacs re-display my diary
> every day automatically. This capability does not seem to work on this
> version of emacs.

As an example, this will call the `diary' function every night at
midnight. Is this the functionality you have in mind or do you need
something more sophisticated? I didn't see anything in the code you
posted that seems to do anything on a schedule. (But note that I don't
use `diary' myself).

    (defvar my-diary-update-timer
      (run-at-time "12am" (* 60 60 24) #'diary)
      "Timer to call `diary' ever night at midnight.")
    ;; To cancel:
    ;; (cancel-timer my-diary-update-timer)

-- 
john



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

* Re: Daily Diary Display in Emacs emacs24 24.4+1-5
  2015-10-23 16:24 Daily Diary Display in Emacs emacs24 24.4+1-5 Charles Curley
  2015-10-23 20:44 ` Emanuel Berg
  2015-10-24  0:28 ` John Mastro
@ 2015-10-24 15:44 ` Stephen Berman
  2015-10-24 17:48 ` Charles Curley
  3 siblings, 0 replies; 9+ messages in thread
From: Stephen Berman @ 2015-10-24 15:44 UTC (permalink / raw)
  To: Charles Curley; +Cc: help-gnu-emacs

On Fri, 23 Oct 2015 10:24:09 -0600 Charles Curley <charlescurley@charlescurley.com> wrote:

> I have emacs24, 24.4+1-5 on Debian 8.2 jessie. In the past (e.g. emacs
> 23.4+1-4 on debian 7.x, wheezy), I have had emacs re-display my diary
> every day automatically. This capability does not seem to work on this
> version of emacs.
>
> Relevant portions of my .emacs (watch for wrapping):
[...]
>       (setq appt-activate 1 ; http://www.emacswiki.org/emacs/AppointmentMode

`appt-activate' is a function, not a variable, and the above line should
be (appt-activate 1) (which is also what that Emacswiki page shows).

>       ;; Also from http://www.emacswiki.org/emacs/AppointmentMode
>       (defun diary-save-hook ()
>         "Stuff to do when saving the diary files."
>         (appt-initialize))

There is no function (or variable) `appt-initialize' in GNU Emacs;
according to the above Emacswiki page, there is such a function in
XEmacs.

Perhaps these issues are causing your problem (though I don't see how
the above code could ever have worked in GNU Emacs).

Steve Berman



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

* Re: Daily Diary Display in Emacs emacs24 24.4+1-5
  2015-10-23 16:24 Daily Diary Display in Emacs emacs24 24.4+1-5 Charles Curley
                   ` (2 preceding siblings ...)
  2015-10-24 15:44 ` Stephen Berman
@ 2015-10-24 17:48 ` Charles Curley
  2015-10-26 22:44   ` Charles Curley
  3 siblings, 1 reply; 9+ messages in thread
From: Charles Curley @ 2015-10-24 17:48 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, 23 Oct 2015 10:24:09 -0600
Charles Curley <charlescurley@charlescurley.com> wrote:

> I have emacs24, 24.4+1-5 on Debian 8.2 jessie. In the past (e.g. emacs
> 23.4+1-4 on debian 7.x, wheezy), I have had emacs re-display my diary
> every day automatically. This capability does not seem to work on this
> version of emacs.

I *may* have a solution.

Bob Proulx <bob@proulx.com>'s email "Undesirable sh-mode indent"
reminded me to read the news file. Searching on appropriate keywords
produced the following:


    *** The obsolete (since Emacs 22.1) method of enabling the appt
    package by adding `appt-make-list' to `diary-hook' has been removed.
    Use `appt-activate' instead.

So the culprit in my code is here:

        (if ( < emacs-major-version 24) ; emacs 23 or less
            (add-hook 'diary-hook 'appt-make-list)
          )

I don't need the version test any more, and the proper code is:

        (add-hook 'diary-hook 'appt-activate)

I made that change yesterday and evaluated it. It appears this morning
to have worked. If it continues to work correctly, I will call it good.

There are lots of good suggestions in the replies, and I will follow
those up with changes and appropriate testing.



-- 

The right of the people to be secure in their persons, houses, papers,
and effects, against unreasonable searches and seizures, shall not be
violated, and no Warrants shall issue, but upon probable cause,
supported by Oath or affirmation, and particularly describing the
place to be searched, and the persons or things to be seized.
-- U.S. Const. Amendment IV

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB



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

* Re: Daily Diary Display in Emacs emacs24 24.4+1-5
  2015-10-24 17:48 ` Charles Curley
@ 2015-10-26 22:44   ` Charles Curley
  2015-10-27  0:11     ` Emanuel Berg
  0 siblings, 1 reply; 9+ messages in thread
From: Charles Curley @ 2015-10-26 22:44 UTC (permalink / raw)
  To: help-gnu-emacs

On Sat, 24 Oct 2015 11:48:28 -0600
Charles Curley <charlescurley@charlescurley.com> wrote:

> On Fri, 23 Oct 2015 10:24:09 -0600
> Charles Curley <charlescurley@charlescurley.com> wrote:
> 
> > I have emacs24, 24.4+1-5 on Debian 8.2 jessie. In the past (e.g.
> > emacs 23.4+1-4 on debian 7.x, wheezy), I have had emacs re-display
> > my diary every day automatically. This capability does not seem to
> > work on this version of emacs.
> 
> I *may* have a solution.

...

>         (add-hook 'diary-hook 'appt-activate)
> 
> I made that change yesterday and evaluated it. It appears this morning
> to have worked. If it continues to work correctly, I will call it
> good.

No, that is not the solution. For one thing, it toggles appt-activate
every time diary-hook is called, i.e. every time the diary is
displayed. Not what I want.

Also, it appears to do something else. You should be able to move
point in the calendar to a day other than today's date, and hit d, and
get a display in the diary starting with the date where point
is. Somehow, that code shuts that off, and every time you hit d, emacs
display a diary beginning with today's date. Also not what I want.

I now have

      (appt-activate 1) ; http://www.emacswiki.org/emacs/AppointmentMode

in my .emacs. We will see what that does.

-- 

The right of the people to be secure in their persons, houses, papers,
and effects, against unreasonable searches and seizures, shall not be
violated, and no Warrants shall issue, but upon probable cause,
supported by Oath or affirmation, and particularly describing the
place to be searched, and the persons or things to be seized.
-- U.S. Const. Amendment IV

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB



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

* Re: Daily Diary Display in Emacs emacs24 24.4+1-5
  2015-10-26 22:44   ` Charles Curley
@ 2015-10-27  0:11     ` Emanuel Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2015-10-27  0:11 UTC (permalink / raw)
  To: help-gnu-emacs

Charles Curley <charlescurley@charlescurley.com>
writes:

> I now have
>
>       (appt-activate 1) ;
> http://www.emacswiki.org/emacs/AppointmentMode
>
> in my .emacs. We will see what that does.

Make it work, by outworking the opposition...

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

end of thread, other threads:[~2015-10-27  0:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-23 16:24 Daily Diary Display in Emacs emacs24 24.4+1-5 Charles Curley
2015-10-23 20:44 ` Emanuel Berg
2015-10-23 22:11   ` Charles Curley
2015-10-24  0:20     ` Emanuel Berg
2015-10-24  0:28 ` John Mastro
2015-10-24 15:44 ` Stephen Berman
2015-10-24 17:48 ` Charles Curley
2015-10-26 22:44   ` Charles Curley
2015-10-27  0:11     ` Emanuel Berg

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.