diff options
| author | Roland McGrath | 1992-06-03 06:44:38 +0000 |
|---|---|---|
| committer | Roland McGrath | 1992-06-03 06:44:38 +0000 |
| commit | dd3092241c54298a12840b7b3633a62542d590f2 (patch) | |
| tree | 349f6c0cf7fe9fe2739fd64830a6b9a08568262f | |
| parent | 328561fc91a2802b47ae9669110b8071e1696d4e (diff) | |
| download | emacs-dd3092241c54298a12840b7b3633a62542d590f2.tar.gz emacs-dd3092241c54298a12840b7b3633a62542d590f2.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/add-log.el | 125 |
1 files changed, 70 insertions, 55 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el index 8d935ae23a7..ad2e1d73ad9 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | ;;; add-log.el --- change log maintenance commands for Emacs | 1 | ;;; add-log.el --- change log maintenance commands for Emacs |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1985-1991 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1985, 86, 87, 88, 89, 90, 91, 1992 |
| 4 | ;; Free Software Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | ;; This file is part of GNU Emacs. | 6 | ;; This file is part of GNU Emacs. |
| 6 | 7 | ||
| @@ -42,10 +43,7 @@ Second arg is file name of change log. If nil, uses `change-log-default-name'. | |||
| 42 | Third arg OTHER-WINDOW non-nil means visit in other window." | 43 | Third arg OTHER-WINDOW non-nil means visit in other window." |
| 43 | (interactive (list current-prefix-arg | 44 | (interactive (list current-prefix-arg |
| 44 | (prompt-for-change-log-name))) | 45 | (prompt-for-change-log-name))) |
| 45 | (let* ((default (if (eq system-type 'vax-vms) | 46 | (let* ((full-name (if whoami |
| 46 | "$CHANGE_LOG$.TXT" | ||
| 47 | "ChangeLog")) | ||
| 48 | (full-name (if whoami | ||
| 49 | (read-input "Full name: " (user-full-name)) | 47 | (read-input "Full name: " (user-full-name)) |
| 50 | (user-full-name))) | 48 | (user-full-name))) |
| 51 | ;; Note that some sites have room and phone number fields in | 49 | ;; Note that some sites have room and phone number fields in |
| @@ -59,21 +57,25 @@ Third arg OTHER-WINDOW non-nil means visit in other window." | |||
| 59 | (read-input "Site name: " (system-name)) | 57 | (read-input "Site name: " (system-name)) |
| 60 | (system-name))) | 58 | (system-name))) |
| 61 | (defun (add-log-current-defun)) | 59 | (defun (add-log-current-defun)) |
| 62 | (entry (and buffer-file-name | 60 | entry entry-position empty-entry) |
| 63 | (file-name-nondirectory buffer-file-name))) | ||
| 64 | entry-position entry-boundary empty-entry) | ||
| 65 | ;; Never want to add a change log entry for the ChangeLog buffer itself: | ||
| 66 | (if (equal default entry) | ||
| 67 | (setq entry nil | ||
| 68 | formatted-revision nil | ||
| 69 | defun nil)) | ||
| 70 | (or file-name | 61 | (or file-name |
| 71 | (setq file-name (or change-log-default-name | 62 | (setq file-name (or change-log-default-name |
| 72 | default-directory))) | 63 | default-directory))) |
| 73 | (if (file-directory-p file-name) | 64 | (setq file-name (if (file-directory-p file-name) |
| 74 | (setq file-name (concat (file-name-as-directory file-name) | 65 | (expand-file-name (change-log-name) file-name) |
| 75 | (change-log-name)))) | 66 | (expand-file-name file-name))) |
| 76 | (set (make-local-variable 'change-log-default-name) file-name) | 67 | (set (make-local-variable 'change-log-default-name) file-name) |
| 68 | (if buffer-file-name | ||
| 69 | (setq entry (if (string-match | ||
| 70 | (concat "^" (regexp-quote (file-name-directory | ||
| 71 | file-name))) | ||
| 72 | buffer-file-name) | ||
| 73 | (substring buffer-file-name (match-end 0)) | ||
| 74 | (file-name-nondirectory buffer-file-name)))) | ||
| 75 | ;; Never want to add a change log entry for the ChangeLog buffer itself. | ||
| 76 | (if (equal file-name entry) | ||
| 77 | (setq entry nil | ||
| 78 | defun nil)) | ||
| 77 | (if (and other-window (not (equal file-name buffer-file-name))) | 79 | (if (and other-window (not (equal file-name buffer-file-name))) |
| 78 | (find-file-other-window file-name) | 80 | (find-file-other-window file-name) |
| 79 | (find-file file-name)) | 81 | (find-file file-name)) |
| @@ -91,54 +93,65 @@ Third arg OTHER-WINDOW non-nil means visit in other window." | |||
| 91 | (1- (point)))) | 93 | (1- (point)))) |
| 92 | (if (and entry | 94 | (if (and entry |
| 93 | (not empty-entry)) | 95 | (not empty-entry)) |
| 94 | ;; Look for today's entry for same file | 96 | ;; Look for today's entry for the same file. |
| 95 | ;; If there is an empty entry (just a `*'), take the hint and | 97 | ;; If there is an empty entry (just a `*'), take the hint and |
| 96 | ;; use it. This is so that C-x a from the ChangeLog buffer | 98 | ;; use it. This is so that C-x a from the ChangeLog buffer |
| 97 | ;; itself can be used to force the next entry to be added at | 99 | ;; itself can be used to force the next entry to be added at |
| 98 | ;; the beginning, even if there are today's entries for the | 100 | ;; the beginning, even if there are today's entries for the |
| 99 | ;; same file (but perhaps different revisions). | 101 | ;; same file (but perhaps different revisions). |
| 100 | (setq entry-boundary (save-excursion | 102 | (let ((entry-boundary (save-excursion |
| 101 | (and (re-search-forward "\n[A-Z]" nil t) | 103 | (and (re-search-forward "\n[A-Z]" nil t) |
| 102 | (point))) | 104 | (point))))) |
| 103 | entry-position (save-excursion | 105 | (setq entry-position (save-excursion |
| 104 | (and (re-search-forward | 106 | (and (re-search-forward |
| 105 | (concat | 107 | (concat |
| 106 | (regexp-quote (concat "* " entry)) | 108 | (regexp-quote (concat "* " entry)) |
| 107 | ;; don't accept `foo.bar' when | 109 | ;; don't accept `foo.bar' when |
| 108 | ;; looking for `foo': | 110 | ;; looking for `foo': |
| 109 | "[ \n\t,]") | 111 | "[ \n\t,:]") |
| 110 | entry-boundary | 112 | entry-boundary |
| 111 | t) | 113 | t) |
| 112 | (1- (match-end 0)))))) | 114 | (1- (match-end 0))))))) |
| 113 | (cond (entry-position | 115 | (cond (entry-position |
| 114 | ;; Move to existing entry for same file. | 116 | ;; Move to the existing entry for the same file. |
| 115 | (goto-char entry-position) | 117 | (goto-char entry-position) |
| 116 | (search-forward "\n\n") | 118 | (re-search-forward "^\\s *$") |
| 117 | (forward-line -1)) | 119 | (open-line 1) |
| 120 | (indent-relative-maybe)) | ||
| 118 | (empty-entry | 121 | (empty-entry |
| 119 | ;; Put this file name into existing empty entry. | 122 | ;; Put this file name into the existing empty entry. |
| 120 | (goto-char empty-entry) | 123 | (goto-char empty-entry) |
| 121 | (insert (or entry ""))) | 124 | (if entry |
| 125 | (insert entry))) | ||
| 122 | (t | 126 | (t |
| 123 | ;; Make a new entry | 127 | ;; Make a new entry. |
| 124 | (forward-line 1) | 128 | (forward-line 1) |
| 125 | (while (looking-at "\\sW") | 129 | (while (looking-at "\\sW") |
| 126 | (forward-line 1)) | 130 | (forward-line 1)) |
| 127 | (delete-region (point) | 131 | (delete-region (point) |
| 128 | (progn | 132 | (progn |
| 129 | (skip-chars-backward "\n") | 133 | (skip-chars-backward "\n") |
| 130 | (point))) | 134 | (point))) |
| 131 | (open-line 3) | 135 | (open-line 3) |
| 132 | (forward-line 2) | 136 | (forward-line 2) |
| 133 | (indent-to left-margin) | 137 | (indent-to left-margin) |
| 134 | (insert "* " (or entry "")))) | 138 | (insert "* " (or entry "")))) |
| 135 | ;; Point is at the entry for this file, | 139 | ;; Point is at the entry for this file, |
| 136 | ;; either at the end of the line or at the first blank line. | 140 | ;; either at the end of the line or at the first blank line. |
| 137 | (if defun | 141 | (if defun |
| 138 | (progn | 142 | (progn |
| 139 | ;; Make it easy to get rid of the defun name. | 143 | ;; Make it easy to get rid of the function name. |
| 140 | (undo-boundary) | 144 | (undo-boundary) |
| 141 | (insert "(" defun "): "))))) | 145 | (insert (if (save-excursion |
| 146 | (beginning-of-line 1) | ||
| 147 | (looking-at "\\s *$")) | ||
| 148 | "" | ||
| 149 | " ") | ||
| 150 | "(" defun "): ")) | ||
| 151 | (if (not (save-excursion | ||
| 152 | (beginning-of-line 1) | ||
| 153 | (looking-at "\\s *\\(\\*\\s *\\)?$"))) | ||
| 154 | (insert ":"))))) | ||
| 142 | 155 | ||
| 143 | ;;;###autoload | 156 | ;;;###autoload |
| 144 | (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window) | 157 | (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window) |
| @@ -155,14 +168,16 @@ Interactively, with a prefix argument, the file name is prompted for." | |||
| 155 | (add-change-log-entry whoami file-name t)) | 168 | (add-change-log-entry whoami file-name t)) |
| 156 | 169 | ||
| 157 | (defun change-log-mode () | 170 | (defun change-log-mode () |
| 171 | "Major mode for editting change logs; like Indented Text Mode. | ||
| 172 | New log entries are usually made with \\[add-change-log-entry]." | ||
| 158 | (interactive) | 173 | (interactive) |
| 159 | (kill-all-local-variables) | 174 | (kill-all-local-variables) |
| 160 | (indented-text-mode) | 175 | (indented-text-mode) |
| 161 | (setq major-mode 'change-log-mode) | 176 | (setq major-mode 'change-log-mode) |
| 162 | (setq mode-name "Change Log") | 177 | (setq mode-name "Change Log") |
| 163 | ;; Let each entry behave as one paragraph: | 178 | ;; Let each entry behave as one paragraph: |
| 164 | (set (make-local-variable 'paragraph-start) "^$\\|^^L") | 179 | (set (make-local-variable 'paragraph-start) "^\\s *$\\|^^L") |
| 165 | (set (make-local-variable 'paragraph-separate) "^$\\|^^L") | 180 | (set (make-local-variable 'paragraph-separate) "^\\s *$\\|^^L\\|^\\sw") |
| 166 | ;; Let all entries for one day behave as one page. | 181 | ;; Let all entries for one day behave as one page. |
| 167 | ;; Note that a page boundary is also a paragraph boundary. | 182 | ;; Note that a page boundary is also a paragraph boundary. |
| 168 | ;; Unfortunately the date line of a page actually belongs to | 183 | ;; Unfortunately the date line of a page actually belongs to |
| @@ -170,6 +185,8 @@ Interactively, with a prefix argument, the file name is prompted for." | |||
| 170 | ;; page moving cmds go to the end of the match, and Emacs | 185 | ;; page moving cmds go to the end of the match, and Emacs |
| 171 | ;; regexps don't have a context feature. | 186 | ;; regexps don't have a context feature. |
| 172 | (set (make-local-variable 'page-delimiter) "^[A-Z][a-z][a-z] .*\n\\|^") | 187 | (set (make-local-variable 'page-delimiter) "^[A-Z][a-z][a-z] .*\n\\|^") |
| 188 | (set (make-local-variable 'version-control) 'never) | ||
| 189 | (set (make-local-variable 'adaptive-fill-regexp) "\\s *") | ||
| 173 | (run-hooks 'change-log-mode-hook)) | 190 | (run-hooks 'change-log-mode-hook)) |
| 174 | 191 | ||
| 175 | (defvar add-log-current-defun-header-regexp | 192 | (defvar add-log-current-defun-header-regexp |
| @@ -231,5 +248,3 @@ Has a preference of looking backwards." | |||
| 231 | t) | 248 | t) |
| 232 | (buffer-substring (match-beginning 1) | 249 | (buffer-substring (match-beginning 1) |
| 233 | (match-end 1)))))))) | 250 | (match-end 1)))))))) |
| 234 | |||
| 235 | ;;; add-log.el ends here | ||