comparison lisp/packages/add-log.el @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 0293115a14e9
comparison
equal deleted inserted replaced
1:c0c6a60d29db 2:ac2d302a0011
18 18
19 ;; You should have received a copy of the GNU General Public License 19 ;; You should have received a copy of the GNU General Public License
20 ;; along with XEmacs; see the file COPYING. If not, write to the Free 20 ;; along with XEmacs; see the file COPYING. If not, write to the Free
21 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 21 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 22
23 ;;; Synched up with: FSF 19.30. 23 ;;; Synched up with: FSF 19.34.
24 24
25 ;;; Commentary: 25 ;;; Commentary:
26 26
27 ;; This facility is documented in the Emacs Manual. 27 ;; This facility is documented in the Emacs Manual.
28 28
57 (setq add-log-mailing-address user-mail-address)) 57 (setq add-log-mailing-address user-mail-address))
58 58
59 (defvar change-log-font-lock-keywords 59 (defvar change-log-font-lock-keywords
60 '(("^[SMTWF].+" . font-lock-function-name-face) ; Date line. 60 '(("^[SMTWF].+" . font-lock-function-name-face) ; Date line.
61 ("^\t\\* \\([^ :\n]+\\)" 1 font-lock-comment-face) ; File name. 61 ("^\t\\* \\([^ :\n]+\\)" 1 font-lock-comment-face) ; File name.
62 ("\(\\([^)\n]+\\)\)" 1 font-lock-keyword-face)) ; Function name. 62 ("(\\([^)\n]+\\)):" 1 font-lock-keyword-face)) ; Function name.
63 "Additional expressions to highlight in Change Log mode.") 63 "Additional expressions to highlight in Change Log mode.")
64 (put 'change-log-mode 'font-lock-defaults 64 (put 'change-log-mode 'font-lock-defaults
65 '(change-log-font-lock-keywords t)) 65 '(change-log-font-lock-keywords t))
66 66
67 (defvar change-log-mode-map nil 67 (defvar change-log-mode-map nil
98 name)))) 98 name))))
99 99
100 ;;;###autoload 100 ;;;###autoload
101 (defun find-change-log (&optional file-name) 101 (defun find-change-log (&optional file-name)
102 "Find a change log file for \\[add-change-log-entry] and return the name. 102 "Find a change log file for \\[add-change-log-entry] and return the name.
103
103 Optional arg FILE-NAME specifies the file to use. 104 Optional arg FILE-NAME specifies the file to use.
104 If FILE-NAME is nil, use the value of `change-log-default-name'. 105 If FILE-NAME is nil, use the value of `change-log-default-name'.
105 If 'change-log-default-name' is nil, behave as though it were 'ChangeLog' 106 If 'change-log-default-name' is nil, behave as though it were 'ChangeLog'
106 \(or whatever we use on this operating system). 107 \(or whatever we use on this operating system).
107 108
194 (file-name-nondirectory buffer-file-name)))) 195 (file-name-nondirectory buffer-file-name))))
195 196
196 (if (and other-window (not (equal file-name buffer-file-name))) 197 (if (and other-window (not (equal file-name buffer-file-name)))
197 (find-file-other-window file-name) 198 (find-file-other-window file-name)
198 (find-file file-name)) 199 (find-file file-name))
200 (or (eq major-mode 'change-log-mode)
201 (change-log-mode))
199 (undo-boundary) 202 (undo-boundary)
200 (goto-char (point-min)) 203 (goto-char (point-min))
201 (if (looking-at (concat (regexp-quote (substring (current-time-string) 204 (if (looking-at (concat (regexp-quote (substring (current-time-string)
202 0 10)) 205 0 10))
203 ".* " (regexp-quote add-log-full-name) 206 ".* " (regexp-quote add-log-full-name)
297 (kill-all-local-variables) 300 (kill-all-local-variables)
298 (indented-text-mode) 301 (indented-text-mode)
299 (setq major-mode 'change-log-mode 302 (setq major-mode 'change-log-mode
300 mode-name "Change Log" 303 mode-name "Change Log"
301 left-margin 8 304 left-margin 8
302 fill-column 74) 305 fill-column 74
306 indent-tabs-mode t
307 tab-width 8)
303 (use-local-map change-log-mode-map) 308 (use-local-map change-log-mode-map)
304 ;; Let each entry behave as one paragraph: 309 ;; Let each entry behave as one paragraph:
305 ;; We really do want "^" in paragraph-start below: it is only the lines that 310 ;; We really do want "^" in paragraph-start below: it is only the lines that
306 ;; begin at column 0 (despite the left-margin of 8) that we are looking for. 311 ;; begin at column 0 (despite the left-margin of 8) that we are looking for.
307 (set (make-local-variable 'paragraph-start) "\\s *$\\|\f\\|^\\sw") 312 (set (make-local-variable 'paragraph-start) "\\s *$\\|\f\\|^\\sw")
353 ;; make sure beginning-of-defun finds that one 358 ;; make sure beginning-of-defun finds that one
354 ;; rather than the previous one. 359 ;; rather than the previous one.
355 (or (eobp) (forward-char 1)) 360 (or (eobp) (forward-char 1))
356 (beginning-of-defun) 361 (beginning-of-defun)
357 ;; Make sure we are really inside the defun found, not after it. 362 ;; Make sure we are really inside the defun found, not after it.
358 (if (and (progn (end-of-defun) 363 (if (and (looking-at "\\s(")
364 (progn (end-of-defun)
359 (< location (point))) 365 (< location (point)))
360 (progn (forward-sexp -1) 366 (progn (forward-sexp -1)
361 (>= location (point)))) 367 (>= location (point))))
362 (progn 368 (progn
363 (if (looking-at "\\s(") 369 (if (looking-at "\\s(")