Delivered-To: kawamura@debian.org
Subject: Bug#58153: y2k and other minor fixes
Reply-To: Phil.Nitschke@caemrad.com.au, 58153@bugs.debian.org
Resent-From: Phil Nitschke <phil@caemrad.com.au>
Resent-To: debian-bugs-dist@lists.debian.org
Resent-CC: Takao KAWAMURA <kawamura@debian.org>
Resent-Date: Tue, 15 Feb 2000 15:03:00 GMT
Resent-Message-ID: <handler.58153.B.95062337120401@bugs.debian.org>
Resent-Sender: owner@bugs.debian.org
X-Debian-PR-Message: report 58153
X-Debian-PR-Package: edb
X-Debian-PR-Keywords: 
X-Loop: owner@bugs.debian.org
X-Authentication-Warning: stalag13.caemrad.com.au: mail set sender to <phil@caemrad.com.au> using -f
Date: Wed, 16 Feb 2000 00:30:28 +1030 (CST)
From: Phil Nitschke <phil@caemrad.com.au>
To: submit@bugs.debian.org
Content-Type: multipart/mixed; boundary="Multipart_Wed_Feb_16_00:30:28_2000-1"

Package: edb
Version: 1.21-8

Attached are the diffs between 3 of the Debian EDB files (in
/usr/share/emacs/...) and those that I use (in /usr/local/share...)  

The following table summarises their contents.

  File          Priority   Contents
  ~~~~~~~~~~~~  ~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  db-format.el  Low        Font/Face modification (see below)
  db-time.el    High       y2k and 29-days-in-February patch
  db-util.el    Medium     Use *Messages* buffer, not *Message*

I think I picked up the db-format.el patches off the edb mailing list
years ago when it was still active.  I have not tested these, and I
only submit them in case someone else finds them useful.

I wrote the db-time.el patches to stop EDB from displaying dates like
this: "5 Feb 100", and instead display them like this: "15 Feb 00".

The db-util.el patch makes EDB use the regular  "*Messages*" buffer,
like everyone else, instead of the (irregular!) "*Message*" buffer.

-- 
Phil


*** /usr/local/share/emacs/site-lisp/edb-1.21/db-format.el	Tue Feb 15 23:51:49 2000
--- /usr/share/emacs/site-lisp/edb/db-format.el	Sun Sep 19 12:19:07 1999
***************
*** 65,72 ****
  If the text already has a face, that takes precedence.
  This variable is examined only when a data display buffer is being set up.")
  
! ;;; added `nil' to this (unused) variable decln to correct it
! (deflocalvar dbf-selected-field-face nil
    "If non-nil, the face for the field being currently edited.")
  
  
--- 65,71 ----
  If the text already has a face, that takes precedence.
  This variable is examined only when a data display buffer is being set up.")
  
! (deflocalvar dbf-selected-field-face
    "If non-nil, the face for the field being currently edited.")
  
  
***************
*** 2446,2455 ****
      (dbc-update-database-modified-p)
      (buffer-disable-undo (current-buffer))
      (if db-fontification
! 	(when (save-match-data 
! 		(string-match "\\(Lucid\\|Xemacs\\)" (emacs-version)))
! 	  (map-extents (function (lambda (x y) (delete-extent x)))
! 		       (current-buffer) (point-min) (point-max) nil)))
      (erase-buffer)
      (while (< field-index dbf-displayspecs-length)
        ;; (db-debug-message "display-record:  field %s" field-index)
--- 2445,2452 ----
      (dbc-update-database-modified-p)
      (buffer-disable-undo (current-buffer))
      (if db-fontification
! 	(map-extents (function (lambda (x y) (delete-extent x)))
! 		     (current-buffer) (point-min) (point-max) nil))
      (erase-buffer)
      (while (< field-index dbf-displayspecs-length)
        ;; (db-debug-message "display-record:  field %s" field-index)
***************
*** 2634,2657 ****
  
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
! ;;; Data display buffer fontification (GNU Emacs version)
! ;;; (See original Lucid versions below)
! 
! (defun db-inter-field-face-setup ()
!   "Initialise the properties of the variable `db-inter-field-face'.
! Really only a trivial example."
!   (interactive)
!   (copy-face 'default 'db-inter-field-face)
!   (set-face-foreground 'db-inter-field-face "magenta"))
  
  (if db-fontification
      ;; Allowing user to set his own preferences in ~/.Xdefaults
      (progn
!       (or (internal-find-face 'db-inter-field-face)
   	  (make-face 'db-inter-field-face))
        (or (face-differs-from-default-p 'db-inter-field-face)
  	  (copy-face 'bold 'db-inter-field-face))))
  
  (defun db-fontify (start end)
    "Fontify the region between START and END.  Leave out the leading and
    trailing white space."
--- 2631,2651 ----
  
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
! ;;; Data display buffer fontification
! ;;;
  
  (if db-fontification
      ;; Allowing user to set his own preferences in ~/.Xdefaults
      (progn
!       (or (find-face 'db-inter-field-face)
   	  (make-face 'db-inter-field-face))
        (or (face-differs-from-default-p 'db-inter-field-face)
  	  (copy-face 'bold 'db-inter-field-face))))
  
+ ;; This is a bit of a hack.  Leaving out the white space stops the field
+ ;; text from occassionally taking on the 'db-inter-field-face'.  If the
+ ;; user did not use white space the this would evidently not work.
+ 
  (defun db-fontify (start end)
    "Fontify the region between START and END.  Leave out the leading and
    trailing white space."
***************
*** 2663,2706 ****
        (goto-char end)
        (skip-chars-backward " \t\n")
        (if (< ext-start (point))
! 	  (let (overlay-extent)
! 	    (setq overlay-extent (make-overlay ext-start (point)))
! 	    (put-text-property (overlay-start overlay-extent)
! 			       (overlay-end overlay-extent)
! 			       'face 'db-inter-field-face
! 			       (overlay-buffer overlay-extent))
! 	    (overlay-put overlay-extent 'face 'db-inter-field-face))))))
! 
! ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
! ;;;; Data display buffer fontification (Lucid emacs only)
! ;;;;
! 
! ;(if db-fontification
! ;    ;; Allowing user to set his own preferences in ~/.Xdefaults
! ;    (progn
! ;      (or (find-face 'db-inter-field-face)
! ; 	  (make-face 'db-inter-field-face))
! ;      (or (face-differs-from-default-p 'db-inter-field-face)
! ;	  (copy-face 'bold 'db-inter-field-face))))
! 
! ;;; This is a bit of a hack.  Leaving out the white space stops the field
! ;;; text from occassionally taking on the 'db-inter-field-face'.  If the
! ;;; user did not use white space the this would evidently not work.
! 
! ;(defun db-fontify (start end)
! ;  "Fontify the region between START and END.  Leave out the leading and
! ;  trailing white space."
! ;  (let (ext-start)
! ;    (save-excursion
! ;      (goto-char start)
! ;      (skip-chars-forward " \t\n")
! ;      (setq ext-start (point))
! ;      (goto-char end)
! ;      (skip-chars-backward " \t\n")
! ;      (if (< ext-start (point))
! ;	  (set-extent-face
! ;	   (make-extent ext-start (point))
! ;	   'db-inter-field-face)))))
  
  ;;; Old version
  ;; (defun db-fontify (start end)
--- 2657,2665 ----
        (goto-char end)
        (skip-chars-backward " \t\n")
        (if (< ext-start (point))
! 	  (set-extent-face
! 	   (make-extent ext-start (point))
! 	   'db-inter-field-face)))))
  
  ;;; Old version
  ;; (defun db-fontify (start end)

*** /usr/local/share/emacs/site-lisp/edb-1.21/db-time.el	Tue Feb 15 23:48:52 2000
--- /usr/share/emacs/site-lisp/edb/db-time.el	Sun Sep 19 12:19:07 1999
***************
*** 54,63 ****
         (let ((day (date-day date))) (or (not day) (zerop day)))))
  
  (defsubst date-year-short (date)
!   "Extract the year and return it as a two digit value."
!   (let ((yy (date-year date)))
!     (cond ((> yy 1999) (% yy 2000))
!           (t (% yy 1900)))))
  
  (defun date-year-long (date)
    "Extract the year as a four digit value."
--- 54,61 ----
         (let ((day (date-day date))) (or (not day) (zerop day)))))
  
  (defsubst date-year-short (date)
!   "Extract the year and return it modulo 1900."
!   (% (date-year date) 1900))
  
  (defun date-year-long (date)
    "Extract the year as a four digit value."
***************
*** 143,149 ****
  ;;; Months
  
  (defconst monthlength-array
!   [0 31 29 31 30 31 30 31 31 30 31 30 31])
  
  ;; I could add a fancy leap year check.
  (defun date-month-day-compatible (date)
--- 141,147 ----
  ;;; Months
  
  (defconst monthlength-array
!   [0 31 28 31 30 31 30 31 31 30 31 30 31])
  
  ;; I could add a fancy leap year check.
  (defun date-month-day-compatible (date)

*** /tmp/db-util.el	Wed Feb 16 00:15:52 2000
--- /tmp/db-util.el433hVf	Wed Feb 16 00:15:52 2000
***************
*** 688,695 ****
  
  ;; Originally by Joe Wells <jbw@cs.bu.edu>
  (defun db-best-fit-message (text &optional buffer)
!   "Show TEXT in echo area if it fits or in optional BUFFER (default *Messages*)."
!   (or buffer (setq buffer "*Messages*"))
    (save-excursion
      (set-buffer (get-buffer-create " temp printing buffer"))
      (erase-buffer)
--- 688,695 ----
  
  ;; Originally by Joe Wells <jbw@cs.bu.edu>
  (defun db-best-fit-message (text &optional buffer)
!   "Show TEXT in echo area if it fits or in optional BUFFER (default *Message*)."
!   (or buffer (setq buffer "*Message*"))
    (save-excursion
      (set-buffer (get-buffer-create " temp printing buffer"))
      (erase-buffer)
