emacs/rpm-spec-mode-changelog.patch

49 lines
2.1 KiB
Diff
Raw Normal View History

diff -up rpm-spec-mode.el.orig site-lisp/rpm-spec-mode.el
--- rpm-spec-mode.el.orig 2011-11-10 17:22:20.000000000 +0100
+++ rpm-spec-mode.el 2011-11-23 15:59:13.959987280 +0100
@@ -491,6 +491,7 @@ value returned by function `user-mail-ad
(set-keymap-name rpm-spec-mode-map 'rpm-spec-mode-map))
(define-key rpm-spec-mode-map "\C-c\C-c" 'rpm-change-tag)
(define-key rpm-spec-mode-map "\C-c\C-e" 'rpm-add-change-log-entry)
+ (define-key rpm-spec-mode-map "\C-c\C-w" 'rpm-goto-add-change-log-entry)
(define-key rpm-spec-mode-map "\C-c\C-i" 'rpm-insert-tag)
(define-key rpm-spec-mode-map "\C-c\C-n" 'rpm-forward-section)
(define-key rpm-spec-mode-map "\C-c\C-o" 'rpm-goto-section)
@@ -719,10 +720,8 @@ This variable is global by default, but
If `rpm-change-log-uses-utc' is nil, \"today\" means the local time zone."
(format-time-string "%a %b %e %Y" nil rpm-change-log-uses-utc))
-(defun rpm-add-change-log-entry (&optional change-log-entry)
- "Find change log and add an entry for today."
- (interactive "sChange log entry: ")
- (save-excursion
+(defun rpm-goto-add-change-log-header ()
+ "Find change log and add header (if needed) for today"
(rpm-goto-section "changelog")
(let* ((address (rpm-spec-user-mail-address))
(fullname (or rpm-spec-user-full-name (user-full-name)))
@@ -733,8 +732,21 @@ If `rpm-change-log-uses-utc' is nil, \"t
(concat " - " (rpm-find-spec-version t))))))
(if (not (search-forward string nil t))
(insert "\n" string "\n")
- (forward-line 2))
- (insert "- " change-log-entry "\n"))))
+ (forward-line 2))))
+
+(defun rpm-add-change-log-entry (&optional change-log-entry)
+ "Find change log and add an entry for today."
+ (interactive "sChange log entry: ")
+ (save-excursion
+ (rpm-goto-add-change-log-header)
+ (insert "- " change-log-entry "\n")))
+
+(defun rpm-goto-add-change-log-entry ()
+ "Goto change log and add an header for today (if needed)."
+ (interactive)
+ (rpm-goto-add-change-log-header)
+ (insert "- \n")
+ (end-of-line '0))
;;------------------------------------------------------------