aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2008-01-27 19:52:46 +0000
committerDan Nicolaescu2008-01-27 19:52:46 +0000
commit000605b34b4d18d73bbde8021124ca164d10fa1f (patch)
tree1663611ba49a47e312b1b06a30fc5402a9bc4767
parenta28ed9e54738bf5a52d2c03f887e74ebf2c1c7c2 (diff)
downloademacs-000605b34b4d18d73bbde8021124ca164d10fa1f.tar.gz
emacs-000605b34b4d18d73bbde8021124ca164d10fa1f.zip
(change-log-search-file-name): Work harder to find
the correct file name. (change-log-find-file): Fix typo. (change-log-start-entry-re): Move definition earlier.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/add-log.el31
2 files changed, 33 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c2aeff86f93..c84ffb934b3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12008-01-27 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * add-log.el (change-log-search-file-name): Work harder to find
4 the correct file name.
5 (change-log-find-file): Fix typo.
6 (change-log-start-entry-re): Move definition earlier.
7
12007-01-27 Jan Nieuwenhuizen <janneke@gnu.org> 82007-01-27 Jan Nieuwenhuizen <janneke@gnu.org>
2 9
3 * add-log.el (change-log-search-file-name, change-log-find-file): 10 * add-log.el (change-log-search-file-name, change-log-find-file):
diff --git a/lisp/add-log.el b/lisp/add-log.el
index 534dbd0746d..c9fdb34bc9a 100644
--- a/lisp/add-log.el
+++ b/lisp/add-log.el
@@ -241,6 +241,7 @@ Note: The search is conducted only within 10%, at the beginning of the file."
241(put 'change-log-acknowledgement-face 'face-alias 'change-log-acknowledgement) 241(put 'change-log-acknowledgement-face 'face-alias 'change-log-acknowledgement)
242 242
243(defconst change-log-file-names-re "^\\( +\\|\t\\)\\* \\([^ ,:([\n]+\\)") 243(defconst change-log-file-names-re "^\\( +\\|\t\\)\\* \\([^ ,:([\n]+\\)")
244(defconst change-log-start-entry-re "^\\sw.........[0-9:+ ]*")
244 245
245(defvar change-log-font-lock-keywords 246(defvar change-log-font-lock-keywords
246 `(;; 247 `(;;
@@ -294,8 +295,30 @@ Note: The search is conducted only within 10%, at the beginning of the file."
294 (save-excursion 295 (save-excursion
295 (goto-char where) 296 (goto-char where)
296 (beginning-of-line 1) 297 (beginning-of-line 1)
297 (re-search-forward change-log-file-names-re) 298 (if (looking-at change-log-start-entry-re)
298 (match-string 2))) 299 ;; We are at the start of an entry, search forward for a file
300 ;; name.
301 (progn
302 (re-search-forward change-log-file-names-re nil t)
303 (match-string 2))
304 (if (looking-at change-log-file-names-re)
305 ;; We found a file name.
306 (match-string 2)
307 ;; Look backwards for either a file name or the log entry start.
308 (if (re-search-backward
309 (concat "\\(" change-log-start-entry-re
310 "\\)\\|\\("
311 change-log-file-names-re "\\)") nil t)
312 (if (match-beginning 1)
313 ;; We got the start of the entry, look forward for a
314 ;; file name.
315 (progn
316 (re-search-forward change-log-file-names-re nil t)
317 (match-string 2))
318 (match-string 4))
319 ;; We must be before any file name, look forward.
320 (re-search-forward change-log-file-names-re nil t)
321 (match-string 2))))))
299 322
300(defun change-log-find-file () 323(defun change-log-find-file ()
301 "Visit the file for the change under point." 324 "Visit the file for the change under point."
@@ -303,7 +326,7 @@ Note: The search is conducted only within 10%, at the beginning of the file."
303 (let ((file (change-log-search-file-name (point)))) 326 (let ((file (change-log-search-file-name (point))))
304 (if (and file (file-exists-p file)) 327 (if (and file (file-exists-p file))
305 (find-file file) 328 (find-file file)
306 (message "No such file or directory: ~s" file)))) 329 (message "No such file or directory: %s" file))))
307 330
308(defvar change-log-mode-map 331(defvar change-log-mode-map
309 (let ((map (make-sparse-keymap))) 332 (let ((map (make-sparse-keymap)))
@@ -1120,8 +1143,6 @@ Has a preference of looking backwards."
1120 (change-log-get-method-definition-1 "")) 1143 (change-log-get-method-definition-1 ""))
1121 (concat change-log-get-method-definition-md "]")))))) 1144 (concat change-log-get-method-definition-md "]"))))))
1122 1145
1123(defconst change-log-start-entry-re "^\\sw.........[0-9:+ ]*")
1124
1125(defun change-log-sortable-date-at () 1146(defun change-log-sortable-date-at ()
1126 "Return date of log entry in a consistent form for sorting. 1147 "Return date of log entry in a consistent form for sorting.
1127Point is assumed to be at the start of the entry." 1148Point is assumed to be at the start of the entry."