diff options
| author | Richard M. Stallman | 1992-08-03 17:03:00 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1992-08-03 17:03:00 +0000 |
| commit | 09b389d02520eb50745d9b4f88cde35f42c7f0fe (patch) | |
| tree | b67e8baad592082049d38db6236a2de87f6735d3 | |
| parent | 06deef52bcecc54d593eb36c5498ad5c19f3430b (diff) | |
| download | emacs-09b389d02520eb50745d9b4f88cde35f42c7f0fe.tar.gz emacs-09b389d02520eb50745d9b4f88cde35f42c7f0fe.zip | |
*** empty log message ***
| -rw-r--r-- | lisp/add-log.el | 95 |
1 files changed, 77 insertions, 18 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el index 6930495d838..d3679f6c9ee 100644 --- a/lisp/add-log.el +++ b/lisp/add-log.el | |||
| @@ -65,6 +65,10 @@ Third arg OTHER-WINDOW non-nil means visit in other window." | |||
| 65 | (setq file-name (if (file-directory-p file-name) | 65 | (setq file-name (if (file-directory-p file-name) |
| 66 | (expand-file-name (change-log-name) file-name) | 66 | (expand-file-name (change-log-name) file-name) |
| 67 | (expand-file-name file-name))) | 67 | (expand-file-name file-name))) |
| 68 | ;; Chase links before visiting the file. | ||
| 69 | ;; This makes it easier to use a single change log file | ||
| 70 | ;; for several related directories. | ||
| 71 | (setq file-name (or (file-symlink-p file-name) file-name)) | ||
| 68 | (set (make-local-variable 'change-log-default-name) file-name) | 72 | (set (make-local-variable 'change-log-default-name) file-name) |
| 69 | (if buffer-file-name | 73 | (if buffer-file-name |
| 70 | (setq entry (if (string-match | 74 | (setq entry (if (string-match |
| @@ -119,7 +123,7 @@ Third arg OTHER-WINDOW non-nil means visit in other window." | |||
| 119 | (goto-char entry-position) | 123 | (goto-char entry-position) |
| 120 | (re-search-forward "^\\s *$") | 124 | (re-search-forward "^\\s *$") |
| 121 | (beginning-of-line) | 125 | (beginning-of-line) |
| 122 | (while (looking-at "^\\s *$") | 126 | (while (and (not (eobp)) (looking-at "^\\s *$")) |
| 123 | (delete-region (point) (save-excursion (forward-line 1) (point)))) | 127 | (delete-region (point) (save-excursion (forward-line 1) (point)))) |
| 124 | (insert "\n\n") | 128 | (insert "\n\n") |
| 125 | (forward-line -2) | 129 | (forward-line -2) |
| @@ -134,7 +138,7 @@ Third arg OTHER-WINDOW non-nil means visit in other window." | |||
| 134 | (forward-line 1) | 138 | (forward-line 1) |
| 135 | (while (looking-at "\\sW") | 139 | (while (looking-at "\\sW") |
| 136 | (forward-line 1)) | 140 | (forward-line 1)) |
| 137 | (while (looking-at "^\\s *$") | 141 | (while (and (not (eobp)) (looking-at "^\\s *$")) |
| 138 | (delete-region (point) (save-excursion (forward-line 1) (point)))) | 142 | (delete-region (point) (save-excursion (forward-line 1) (point)))) |
| 139 | (insert "\n\n\n") | 143 | (insert "\n\n\n") |
| 140 | (forward-line -2) | 144 | (forward-line -2) |
| @@ -175,7 +179,7 @@ Interactively, with a prefix argument, the file name is prompted for." | |||
| 175 | 179 | ||
| 176 | (defun change-log-mode () | 180 | (defun change-log-mode () |
| 177 | "Major mode for editting change logs; like Indented Text Mode. | 181 | "Major mode for editting change logs; like Indented Text Mode. |
| 178 | Prevents numeric backups and sets `left-margin' to 8 and `fill-column'to 74. | 182 | Prevents numeric backups and sets `left-margin' to 8 and `fill-column' to 74. |
| 179 | New log entries are usually made with \\[add-change-log-entry]." | 183 | New log entries are usually made with \\[add-change-log-entry]." |
| 180 | (interactive) | 184 | (interactive) |
| 181 | (kill-all-local-variables) | 185 | (kill-all-local-variables) |
| @@ -220,16 +224,32 @@ Has a preference of looking backwards." | |||
| 220 | ;; If we are now precisely a the beginning of a defun, | 224 | ;; If we are now precisely a the beginning of a defun, |
| 221 | ;; make sure beginning-of-defun finds that one | 225 | ;; make sure beginning-of-defun finds that one |
| 222 | ;; rather than the previous one. | 226 | ;; rather than the previous one. |
| 223 | (forward-char 1) | 227 | (or (eobp) (forward-char 1)) |
| 224 | (beginning-of-defun) | 228 | (beginning-of-defun) |
| 225 | ;; Make sure we are really inside the defun found, not after it. | 229 | ;; Make sure we are really inside the defun found, not after it. |
| 226 | (if (save-excursion (end-of-defun) | 230 | (if (and (progn (end-of-defun) |
| 227 | (< location (point))) | 231 | (< location (point))) |
| 232 | (progn (forward-sexp -1) | ||
| 233 | (>= location (point)))) | ||
| 228 | (progn | 234 | (progn |
| 229 | (forward-word 1) | 235 | (forward-word 1) |
| 230 | (skip-chars-forward " ") | 236 | (skip-chars-forward " ") |
| 231 | (buffer-substring (point) | 237 | (buffer-substring (point) |
| 232 | (progn (forward-sexp 1) (point)))))) | 238 | (progn (forward-sexp 1) (point)))))) |
| 239 | ((and (or (eq major-mode 'c-mode) | ||
| 240 | (eq major-mode 'c++-mode)) | ||
| 241 | (save-excursion (beginning-of-line) | ||
| 242 | (while (= (char-after (- (point) 2)) ?\\) | ||
| 243 | (forward-line -1)) | ||
| 244 | (looking-at "[ \t]*#[ \t]*define[ \t]"))) | ||
| 245 | ;; Handle a C macro definition. | ||
| 246 | (beginning-of-line) | ||
| 247 | (while (= (char-after (- (point) 2)) ?\\) | ||
| 248 | (forward-line -1)) | ||
| 249 | (search-forward "define") | ||
| 250 | (skip-chars-forward " \t") | ||
| 251 | (buffer-substring (point) | ||
| 252 | (progn (forward-sexp 1) (point)))) | ||
| 233 | ((or (eq major-mode 'c-mode) | 253 | ((or (eq major-mode 'c-mode) |
| 234 | (eq major-mode 'c++-mode)) | 254 | (eq major-mode 'c++-mode)) |
| 235 | ;; See if we are in the beginning part of a function, | 255 | ;; See if we are in the beginning part of a function, |
| @@ -237,20 +257,59 @@ Has a preference of looking backwards." | |||
| 237 | (while (not (or (looking-at "{") | 257 | (while (not (or (looking-at "{") |
| 238 | (looking-at "\\s *$"))) | 258 | (looking-at "\\s *$"))) |
| 239 | (forward-line 1)) | 259 | (forward-line 1)) |
| 240 | (forward-char 1) | 260 | (or (eobp) (forward-char 1)) |
| 241 | (beginning-of-defun) | 261 | (beginning-of-defun) |
| 242 | (if (save-excursion (end-of-defun) | 262 | (if (progn (end-of-defun) |
| 243 | (< location (point))) | 263 | (< location (point))) |
| 244 | (progn | 264 | (progn |
| 245 | (forward-line -1) | 265 | (backward-sexp 1) |
| 246 | (while (looking-at "[ \t\n]") ; skip typedefs of arglist | 266 | (let (beg tem) |
| 247 | (forward-line -1)) | 267 | |
| 248 | (down-list 1) ; into arglist | 268 | (forward-line -1) |
| 249 | (backward-up-list 1) | 269 | ;; Skip back over typedefs of arglist. |
| 250 | (skip-chars-backward " \t") | 270 | (while (and (not (bobp)) |
| 251 | (buffer-substring (point) | 271 | (looking-at "[ \t\n]")) |
| 252 | (progn (backward-sexp 1) | 272 | (forward-line -1)) |
| 253 | (point)))))) | 273 | ;; See if this is using the DEFUN macro used in Emacs. |
| 274 | (if (save-excursion | ||
| 275 | (while (and (not (bobp)) | ||
| 276 | (looking-at "[^\n\f]") | ||
| 277 | (not (looking-at ".*\\*/"))) | ||
| 278 | (forward-line -1)) | ||
| 279 | (forward-line 1) | ||
| 280 | (setq tem (point)) | ||
| 281 | (and (looking-at "DEFUN ") | ||
| 282 | (>= location (point)))) | ||
| 283 | (progn | ||
| 284 | (goto-char tem) | ||
| 285 | (down-list 1) | ||
| 286 | (forward-sexp 1) | ||
| 287 | (skip-chars-forward " ,") | ||
| 288 | (buffer-substring (point) | ||
| 289 | (progn (forward-sexp 1) (point)))) | ||
| 290 | ;; Ordinary C function syntax. | ||
| 291 | (setq beg (point)) | ||
| 292 | (down-list 1) ; into arglist | ||
| 293 | (backward-up-list 1) | ||
| 294 | (skip-chars-backward " \t") | ||
| 295 | ;; Verify initial pos was after real start of function. | ||
| 296 | (if (and (save-excursion | ||
| 297 | (goto-char beg) | ||
| 298 | ;; For this purpose, include the line | ||
| 299 | ;; that has the decl keywords. | ||
| 300 | ;; This may also include some of the comments | ||
| 301 | ;; before the function. | ||
| 302 | (while (and (not (bobp)) | ||
| 303 | (save-excursion (forward-line -1) | ||
| 304 | (looking-at "[^\n\f]"))) | ||
| 305 | (forward-line -1)) | ||
| 306 | (>= location (point))) | ||
| 307 | ;; Consistency check: going down and up | ||
| 308 | ;; shouldn't take us back before BEG. | ||
| 309 | (> (point) beg)) | ||
| 310 | (buffer-substring (point) | ||
| 311 | (progn (backward-sexp 1) | ||
| 312 | (point))))))))) | ||
| 254 | ((memq major-mode | 313 | ((memq major-mode |
| 255 | '(TeX-mode plain-TeX-mode LaTeX-mode;; tex-mode.el | 314 | '(TeX-mode plain-TeX-mode LaTeX-mode;; tex-mode.el |
| 256 | plain-tex-mode latex-mode;; cmutex.el | 315 | plain-tex-mode latex-mode;; cmutex.el |