Mercurial > emacs
comparison lisp/add-log.el @ 91367:c70e45a7acfd
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-324
author | Miles Bader <miles@gnu.org> |
---|---|
date | Wed, 30 Jan 2008 07:57:28 +0000 |
parents | 606f2d163a64 f58e88e8d9cb |
children |
comparison
equal
deleted
inserted
replaced
91366:86f3a8f0a3a6 | 91367:c70e45a7acfd |
---|---|
238 :version "21.1" | 238 :version "21.1" |
239 :group 'change-log) | 239 :group 'change-log) |
240 ;; backward-compatibility alias | 240 ;; backward-compatibility alias |
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]+\\)") | |
244 (defconst change-log-start-entry-re "^\\sw.........[0-9:+ ]*") | |
245 | |
243 (defvar change-log-font-lock-keywords | 246 (defvar change-log-font-lock-keywords |
244 '(;; | 247 `(;; |
245 ;; Date lines, new (2000-01-01) and old (Sat Jan 1 00:00:00 2000) styles. | 248 ;; Date lines, new (2000-01-01) and old (Sat Jan 1 00:00:00 2000) styles. |
246 ;; Fixme: this regepx is just an approximate one and may match | 249 ;; Fixme: this regepx is just an approximate one and may match |
247 ;; wrongly with a non-date line existing as a random note. In | 250 ;; wrongly with a non-date line existing as a random note. In |
248 ;; addition, using any kind of fixed setting like this doesn't | 251 ;; addition, using any kind of fixed setting like this doesn't |
249 ;; work if a user customizes add-log-time-format. | 252 ;; work if a user customizes add-log-time-format. |
253 ("\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" nil nil | 256 ("\\([^<(]+?\\)[ \t]*[(<]\\([A-Za-z0-9_.+-]+@[A-Za-z0-9_.-]+\\)[>)]" nil nil |
254 (1 'change-log-name) | 257 (1 'change-log-name) |
255 (2 'change-log-email))) | 258 (2 'change-log-email))) |
256 ;; | 259 ;; |
257 ;; File names. | 260 ;; File names. |
258 ("^\\( +\\|\t\\)\\* \\([^ ,:([\n]+\\)" | 261 (,change-log-file-names-re |
259 (2 'change-log-file) | 262 (2 'change-log-file) |
260 ;; Possibly further names in a list: | 263 ;; Possibly further names in a list: |
261 ("\\=, \\([^ ,:([\n]+\\)" nil nil (1 'change-log-file)) | 264 ("\\=, \\([^ ,:([\n]+\\)" nil nil (1 'change-log-file)) |
262 ;; Possibly a parenthesized list of names: | 265 ;; Possibly a parenthesized list of names: |
263 ("\\= (\\([^(),\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)" | 266 ("\\= (\\([^(),\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)" |
285 ;; of the change log entry. | 288 ;; of the change log entry. |
286 ("\\(^\\( +\\|\t\\)\\| \\)\\(Patch\\(es\\)? by\\|Report\\(ed by\\| from\\)\\|Suggest\\(ed by\\|ion from\\)\\)" | 289 ("\\(^\\( +\\|\t\\)\\| \\)\\(Patch\\(es\\)? by\\|Report\\(ed by\\| from\\)\\|Suggest\\(ed by\\|ion from\\)\\)" |
287 3 'change-log-acknowledgement)) | 290 3 'change-log-acknowledgement)) |
288 "Additional expressions to highlight in Change Log mode.") | 291 "Additional expressions to highlight in Change Log mode.") |
289 | 292 |
293 (defun change-log-search-file-name (where) | |
294 "Return the file-name for the change under point." | |
295 (save-excursion | |
296 (goto-char where) | |
297 (beginning-of-line 1) | |
298 (if (looking-at change-log-start-entry-re) | |
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)))))) | |
322 | |
323 (defun change-log-find-file () | |
324 "Visit the file for the change under point." | |
325 (interactive) | |
326 (let ((file (change-log-search-file-name (point)))) | |
327 (if (and file (file-exists-p file)) | |
328 (find-file file) | |
329 (message "No such file or directory: %s" file)))) | |
330 | |
290 (defvar change-log-mode-map | 331 (defvar change-log-mode-map |
291 (let ((map (make-sparse-keymap))) | 332 (let ((map (make-sparse-keymap))) |
292 (define-key map [?\C-c ?\C-p] 'add-log-edit-prev-comment) | 333 (define-key map [?\C-c ?\C-p] 'add-log-edit-prev-comment) |
293 (define-key map [?\C-c ?\C-n] 'add-log-edit-next-comment) | 334 (define-key map [?\C-c ?\C-n] 'add-log-edit-next-comment) |
335 (define-key map [?\C-c ?\C-f] 'change-log-find-file) | |
294 map) | 336 map) |
295 "Keymap for Change Log major mode.") | 337 "Keymap for Change Log major mode.") |
296 | 338 |
297 ;; It used to be called change-log-time-zone-rule but really should be | 339 ;; It used to be called change-log-time-zone-rule but really should be |
298 ;; called add-log-time-zone-rule since it's only used from add-log-* code. | 340 ;; called add-log-time-zone-rule since it's only used from add-log-* code. |
1099 (looking-at | 1141 (looking-at |
1100 "\\([A-Za-z_]*:?\\)\\s-*\\(([^)]*)\\)?[A-Za-z_]*[ \t\n\f\r]*") | 1142 "\\([A-Za-z_]*:?\\)\\s-*\\(([^)]*)\\)?[A-Za-z_]*[ \t\n\f\r]*") |
1101 (change-log-get-method-definition-1 "")) | 1143 (change-log-get-method-definition-1 "")) |
1102 (concat change-log-get-method-definition-md "]")))))) | 1144 (concat change-log-get-method-definition-md "]")))))) |
1103 | 1145 |
1104 (defconst change-log-start-entry-re "^\\sw.........[0-9:+ ]*") | |
1105 | |
1106 (defun change-log-sortable-date-at () | 1146 (defun change-log-sortable-date-at () |
1107 "Return date of log entry in a consistent form for sorting. | 1147 "Return date of log entry in a consistent form for sorting. |
1108 Point is assumed to be at the start of the entry." | 1148 Point is assumed to be at the start of the entry." |
1109 (require 'timezone) | 1149 (require 'timezone) |
1110 (if (looking-at change-log-start-entry-re) | 1150 (if (looking-at change-log-start-entry-re) |