;; Free Software Foundation, Inc.
;; Maintainer: FSF
-;; Keywords: tools
+;; Keywords: vc tools
;; This file is part of GNU Emacs.
;;; Code:
-(eval-when-compile
- (require 'timezone))
-
(defgroup change-log nil
"Change log maintenance."
:group 'tools
;; wrongly with a non-date line existing as a random note. In
;; addition, using any kind of fixed setting like this doesn't
;; work if a user customizes add-log-time-format.
- ("^[0-9-]+ +\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-z][a-z][a-z] [0-9:+ ]+"
+ ("^[0-9-]+ +\\|^ \\{11,\\}\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-z][a-z][a-z] [0-9:+ ]+"
(0 'change-log-date-face)
;; Name and e-mail; some people put e-mail in parens, not angles.
("\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" nil nil
(if add-log-file-name-function
(funcall add-log-file-name-function buffer-file)
(setq buffer-file
- (file-relative-name buffer-file (file-name-directory log-file)))
+ (let* ((dir (file-name-directory log-file))
+ (rel (file-relative-name buffer-file dir)))
+ ;; Sometimes with symlinks, the two buffers may have names that
+ ;; appear to belong to different directory trees. So check the
+ ;; file-truenames, to see if we get a better result.
+ (if (not (string-match "\\`\\.\\./" rel))
+ rel
+ (let ((new (file-relative-name (file-truename buffer-file)
+ (file-truename dir))))
+ (if (< (length new) (length rel))
+ new rel)))))
;; If we have a backup file, it's presumably because we're
;; comparing old and new versions (e.g. for deleted
;; functions) and we'll want to use the original name.
(change-log-get-method-definition-1 ""))
(concat change-log-get-method-definition-md "]"))))))
\f
+(autoload 'timezone-make-date-sortable "timezone")
+
(defun change-log-sortable-date-at ()
"Return date of log entry in a consistent form for sorting.
Point is assumed to be at the start of the entry."
- (require 'timezone)
(if (looking-at change-log-start-entry-re)
(let ((date (match-string-no-properties 0)))
(if date
(if (string-match "\\(....\\)-\\(..\\)-\\(..\\)\\s-+" date)
(concat (match-string 1 date) (match-string 2 date)
(match-string 3 date))
- (condition-case nil
- (timezone-make-date-sortable date)
- (error nil)))))
+ (ignore-errors (timezone-make-date-sortable date)))))
(error "Bad date")))
(defun change-log-resolve-conflict ()