branch: elpa/rpm-spec-mode
commit 8603ea1d45c4430f73a733db7b3973ef353298e0
Author: Björn Bidar <[email protected]>
Commit: Björn Bidar <[email protected]>
Fix interactive functions
Functions that don't make use of the prefix argument (C-u)
simply should not have the "p" arg in (interactive),
instead of always passing an unused optional arg.
Incidentally, removing the "p" also fixes
rpm-insert-{file,config,doc,ghost,dir,docdir}
which were wrongly passing the prefix arg as the filename/dirname.
E.g. C-u 5 M-x rpm-insert-file was wrongly inserting "5" as the filename.
Th commit message is the same since purpose of the commit is still the
same however I complete replaced the original commit by using
interactive prompts for the mandatory arguments.
(cherry picked from commit 9de017d728e459a19124bd6a4a365ec96c228849)
---
rpm-spec-mode.el | 61 +++++++++++++++++++++++++++-----------------------------
1 file changed, 29 insertions(+), 32 deletions(-)
diff --git a/rpm-spec-mode.el b/rpm-spec-mode.el
index 8618982798..b4a71ffe8c 100644
--- a/rpm-spec-mode.el
+++ b/rpm-spec-mode.el
@@ -881,40 +881,34 @@ using FILETYPE to prompt the user."
rpm-default-group ") ")))
(insert filetype)))
-(defun rpm-insert-file (&optional filename)
- "Insert regular file.
-Use FILENAME or, if interactive, prompt."
- (interactive "p")
+(defun rpm-insert-file (filename)
+ "Insert file FILENAME."
+ (interactive "FFilename: ")
(rpm-insert-f "" filename))
-(defun rpm-insert-config (&optional filename)
- "Insert config file.
-FILENAME is the config file."
- (interactive "p")
+(defun rpm-insert-config (filename)
+ "Insert config file FILENAME."
+ (interactive "FFilename: ")
(rpm-insert-f "%config " filename))
-(defun rpm-insert-doc (&optional filename)
- "Insert doc file.
-FILENAME is the doc file."
- (interactive "p")
+(defun rpm-insert-doc (filename)
+ "Insert doc file FILENAME."
+ (interactive "FFilename: ")
(rpm-insert-f "%doc " filename))
-(defun rpm-insert-ghost (&optional filename)
- "Insert ghost file.
-FILENAME is the ghost file."
- (interactive "p")
+(defun rpm-insert-ghost (filename)
+ "Insert ghost file FILENAME."
+ (interactive "FFilename: ")
(rpm-insert-f "%ghost " filename))
-(defun rpm-insert-dir (&optional dirname)
- "Insert directory.
-DIRNAME is the directory."
- (interactive "p")
+(defun rpm-insert-dir (dirname)
+ "Insert directory DIRNAME."
+ (interactive "GDirectory: ")
(rpm-insert-f "%dir " dirname))
-(defun rpm-insert-docdir (&optional dirname)
- "Insert doc directory.
-DIRNAME is the directory."
- (interactive "p")
+(defun rpm-insert-docdir (dirname)
+ "Insert doc directory DIRNAME."
+ (interactive "GDirectory: ")
(rpm-insert-f "%docdir " dirname))
;;------------------------------------------------------------
@@ -978,6 +972,7 @@ WHAT is the tag used."
"Update given tag (WHAT)."
(save-excursion
(if (not what)
+ ;; interactive
(setq what (rpm-completing-read "Tag: " rpm-tags-list)))
(cond
((string-equal what "Group")
@@ -995,7 +990,7 @@ WHAT is the tag used."
(message "%s tag not found..." what))))))
(defun rpm-change-n (tag)
- "Change given TAG with possible number."
+ "Change given tag TAG with possible number."
(save-excursion
(goto-char (point-min))
(let ((number (read-from-minibuffer (concat tag " number: "))))
@@ -1026,20 +1021,22 @@ WHAT is the tag used."
nil nil (match-string 1)))))
(message "Group tag not found..."))))
-(defun rpm-insert-tag (&optional tag)
- "Insert or change a TAG."
- (interactive "p")
+(defun rpm-insert-tag (tag)
+ "Insert or change a TAG.
+With a prefix argument, change an existing tag."
+ (interactive (list (completing-read "Tag: " rpm-tags-list)))
(if current-prefix-arg
(rpm-change tag)
- (rpm-insert)))
+ (rpm-insert tag)))
-(defun rpm-change-tag (&optional tag)
- "Change a TAG."
- (interactive "p")
+(defun rpm-change-tag (tag)
+ "Change an existing tag."
+ (interactive (list (completing-read "Tag: " rpm-tags-list)))
(rpm-change tag))
(defun rpm-insert-packager ()
"Insert Packager tag."
+ (interactive)
(beginning-of-line)
(insert (format "Packager: %s <%s>\n"
(if (functionp rpm-spec-user-full-name)