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