diff options
| author | Dan Nicolaescu | 2008-01-27 19:48:44 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2008-01-27 19:48:44 +0000 |
| commit | a28ed9e54738bf5a52d2c03f887e74ebf2c1c7c2 (patch) | |
| tree | f1b3570628eee9a397409769799918d3cd7c0bff | |
| parent | 2aea825c389aada237f810582edbaa337435ea82 (diff) | |
| download | emacs-a28ed9e54738bf5a52d2c03f887e74ebf2c1c7c2.tar.gz emacs-a28ed9e54738bf5a52d2c03f887e74ebf2c1c7c2.zip | |
* add-log.el (change-log-search-file-name, change-log-find-file):
New function.
(change-log-font-lock-keywords): Move file name matching ...
(change-log-file-names-re): ... here. New defconst.
(change-log-mode-map): New binding C-c C-f to change-log-find-file.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/add-log.el | 23 |
2 files changed, 29 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 48c5455ea3b..c2aeff86f93 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2007-01-27 Jan Nieuwenhuizen <janneke@gnu.org> | ||
| 2 | |||
| 3 | * add-log.el (change-log-search-file-name, change-log-find-file): | ||
| 4 | New function. | ||
| 5 | (change-log-font-lock-keywords): Move file name matching ... | ||
| 6 | (change-log-file-names-re): ... here. New defconst. | ||
| 7 | (change-log-mode-map): New binding C-c C-f to change-log-find-file. | ||
| 8 | |||
| 1 | 2008-01-27 Alan Mackenzie <acm@muc.de> | 9 | 2008-01-27 Alan Mackenzie <acm@muc.de> |
| 2 | 10 | ||
| 3 | * progmodes/cc-awk.el, progmodes/cc-engine.el: Correct typos, | 11 | * progmodes/cc-awk.el, progmodes/cc-engine.el: Correct typos, |
diff --git a/lisp/add-log.el b/lisp/add-log.el index a52aa519819..534dbd0746d 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el | |||
| @@ -240,8 +240,10 @@ Note: The search is conducted only within 10%, at the beginning of the file." | |||
| 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 | |||
| 243 | (defvar change-log-font-lock-keywords | 245 | (defvar change-log-font-lock-keywords |
| 244 | '(;; | 246 | `(;; |
| 245 | ;; Date lines, new (2000-01-01) and old (Sat Jan 1 00:00:00 2000) styles. | 247 | ;; 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 | 248 | ;; Fixme: this regepx is just an approximate one and may match |
| 247 | ;; wrongly with a non-date line existing as a random note. In | 249 | ;; wrongly with a non-date line existing as a random note. In |
| @@ -255,7 +257,7 @@ Note: The search is conducted only within 10%, at the beginning of the file." | |||
| 255 | (2 'change-log-email))) | 257 | (2 'change-log-email))) |
| 256 | ;; | 258 | ;; |
| 257 | ;; File names. | 259 | ;; File names. |
| 258 | ("^\\( +\\|\t\\)\\* \\([^ ,:([\n]+\\)" | 260 | (,change-log-file-names-re |
| 259 | (2 'change-log-file) | 261 | (2 'change-log-file) |
| 260 | ;; Possibly further names in a list: | 262 | ;; Possibly further names in a list: |
| 261 | ("\\=, \\([^ ,:([\n]+\\)" nil nil (1 'change-log-file)) | 263 | ("\\=, \\([^ ,:([\n]+\\)" nil nil (1 'change-log-file)) |
| @@ -287,10 +289,27 @@ Note: The search is conducted only within 10%, at the beginning of the file." | |||
| 287 | 3 'change-log-acknowledgement)) | 289 | 3 'change-log-acknowledgement)) |
| 288 | "Additional expressions to highlight in Change Log mode.") | 290 | "Additional expressions to highlight in Change Log mode.") |
| 289 | 291 | ||
| 292 | (defun change-log-search-file-name (where) | ||
| 293 | "Return the file-name for the change under point." | ||
| 294 | (save-excursion | ||
| 295 | (goto-char where) | ||
| 296 | (beginning-of-line 1) | ||
| 297 | (re-search-forward change-log-file-names-re) | ||
| 298 | (match-string 2))) | ||
| 299 | |||
| 300 | (defun change-log-find-file () | ||
| 301 | "Visit the file for the change under point." | ||
| 302 | (interactive) | ||
| 303 | (let ((file (change-log-search-file-name (point)))) | ||
| 304 | (if (and file (file-exists-p file)) | ||
| 305 | (find-file file) | ||
| 306 | (message "No such file or directory: ~s" file)))) | ||
| 307 | |||
| 290 | (defvar change-log-mode-map | 308 | (defvar change-log-mode-map |
| 291 | (let ((map (make-sparse-keymap))) | 309 | (let ((map (make-sparse-keymap))) |
| 292 | (define-key map [?\C-c ?\C-p] 'add-log-edit-prev-comment) | 310 | (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) | 311 | (define-key map [?\C-c ?\C-n] 'add-log-edit-next-comment) |
| 312 | (define-key map [?\C-c ?\C-f] 'change-log-find-file) | ||
| 294 | map) | 313 | map) |
| 295 | "Keymap for Change Log major mode.") | 314 | "Keymap for Change Log major mode.") |
| 296 | 315 | ||