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

This commit is contained in:
Karel Klic 2011-11-25 19:33:04 +01:00
parent a2302b156d
commit 4d08961b29
2 changed files with 56 additions and 2 deletions

View File

@ -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@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@redhat.com> - 1:23.3-16
- Initialize xgselect in function xg_select when
gfds_size == 0 (rhbz#751154)

View File

@ -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))
;;------------------------------------------------------------