emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Bug on calendar (was: The copyright issue)


From: MON KEY
Subject: [PATCH] Bug on calendar (was: The copyright issue)
Date: Mon, 9 Aug 2010 02:16:50 -0400

>> This will achieve results faster than waiting till the end of the
>> world which is by the way coming very soon according to many
>> calenders.
>
> emacs -Q
>
> M-x calendar ENTER
>
> Under the "Goto" menu I see "End of week", "End of month", "End of
> year" but not "End of the world"
>
> This is a serious omission that makes Emacs calendar look bad compared
> to many other calendars.
>
> Is anyone working on a patch? Also please don't accept diary entries
> for dates after the end of the world.

Here you go.
New function proposed for calendar `calendar-goto-doomsday'

;;; ==============================
;;; :CREATED <Timestamp: #{2010-08-08T18:59:25-04:00Z}#{10317} - by MON>
(defun calendar-goto-doomsday ()
  "Reposition the calendar window to next known doomsday and warn of
pending doom."
  (interactive)
  (let* ((cnt-dwn (format-seconds "%Y %D %H %M and %S"
                                  (1- most-positive-fixnum)))
         (cnt-from (format-time-string
                    "%B %d, day %j \(a %A\) in week %U of %Y"))
         (w-buffer "*Warning-Doomsday-Pending*")
         (tm-left  (format-seconds "%y" (1- most-positive-fixnum)))
         (w-type '(Husserlian-Temporal-Disconnect . alarm))
         (warning-minimum-level (cdr (assq (cdr w-type) warning-level-aliases)))
         (warning-prefix-function
          #'(lambda (lvl lvl-inf)
              (list lvl "DOOMSDAY-ALERT!%s:"
                    #'(lambda ()
                        (font-lock-fontify-buffer)
                        (save-excursion
                          (goto-char (buffer-end 0))
                          (when
                              (add-text-properties
                               (point)
                               (or (and (search-forward-regexp
                                         "DOOMSDAY-ALERT!"
(line-end-position) t)
                                        (point))
                                   (point))
                               '(face font-lock-warning-face fontified t))
                            (add-text-properties
                             (progn (forward-char 2) (point))
                             (or (and (> (skip-chars-forward "^:")
0)(1- (point)))
                                 (point))
                             '(face font-lock-preprocessor-face
fontified t))))))))
         (warning-fill-prefix (concat "\n" (make-string 17 32)))
         (w-msg (concat warning-fill-prefix
                        "By Emacs' best calculations (all 29 bits worth),"
                        warning-fill-prefix
                        "passage of time will cease in approximately:"
                        warning-fill-prefix cnt-dwn " from now."
                        warning-fill-prefix "Today is " cnt-from "..."
                        warning-fill-prefix
                        "Pragmatists should now take a moment to update their "
                        tm-left " year plan."))
         warning-suppress-types
         warning-suppress-log-types
         warning-series)
    (with-current-buffer (get-buffer-create w-buffer)
      (erase-buffer)
      (display-warning (car w-type) w-msg (cdr w-type) w-buffer))
    "Danger! Danger!"))
;;
;; (calendar-goto-doomsday)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]