[emacs] Add a new command rpm-goto-add-change-log-entry (C-c C-w) to rpm-spec mode (Jaroslav Skarvada)

Karel Klíč kklic at fedoraproject.org
Fri Nov 25 17:33:08 UTC 2011


commit 4d08961b2992339879f6c60412b751dfe628ced6
Author: Karel Klic <kklic at redhat.com>
Date:   Fri Nov 25 19:33:04 2011 +0100

    Add a new command rpm-goto-add-change-log-entry (C-c C-w) to rpm-spec mode (Jaroslav Skarvada)

 emacs.spec                    |   10 ++++++-
 rpm-spec-mode-changelog.patch |   48 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 2 deletions(-)
---
diff --git a/emacs.spec b/emacs.spec
index a0d6db6..29fe662 100644
--- a/emacs.spec
+++ b/emacs.spec
@@ -3,7 +3,7 @@ Summary: GNU Emacs text editor
 Name: emacs
 Epoch: 1
 Version: 23.3
-Release: 16%{?dist}
+Release: 17%{?dist}
 License: GPLv3+
 URL: http://www.gnu.org/software/emacs/
 Group: Applications/Editors
@@ -24,7 +24,8 @@ Source19: emacs-terminal.desktop
 Source20: emacs-terminal.sh
 Patch0: glibc-open-macro.patch
 Patch1: rpm-spec-mode.patch
-Patch3: rpm-spec-mode-utc.patch
+Patch2: rpm-spec-mode-utc.patch
+Patch3: rpm-spec-mode-changelog.patch
 # Upstream implemented the change in revno. 101105
 Patch4: emacs-23.1-xdg.patch
 # Fix rhbz#595546
@@ -167,6 +168,7 @@ packages that add functionality to Emacs.
 cp %SOURCE7 %SOURCE10 site-lisp
 pushd site-lisp
 %patch1 -p0
+%patch2 -p0
 %patch3 -p0
 popd
 
@@ -441,6 +443,10 @@ update-desktop-database &> /dev/null || :
 %dir %{_datadir}/emacs/site-lisp/site-start.d
 
 %changelog
+* Fri Nov 25 2011 Karel Klíč <kklic at redhat.com> - 1:23.3-17
+- Add a new command rpm-goto-add-change-log-entry (C-c C-w) to
+  rpm-spec mode (Jaroslav Skarvada)
+
 * Fri Nov 25 2011 Karel Klíč <kklic at redhat.com> - 1:23.3-16
 - Initialize xgselect in function xg_select when
   gfds_size == 0 (rhbz#751154)
diff --git a/rpm-spec-mode-changelog.patch b/rpm-spec-mode-changelog.patch
new file mode 100644
index 0000000..42edb48
--- /dev/null
+++ b/rpm-spec-mode-changelog.patch
@@ -0,0 +1,48 @@
+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))
+ 
+ ;;------------------------------------------------------------
+ 


More information about the scm-commits mailing list