From 157b4a3eac5aae6400c90ab2701a9e6aceadb558 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Fri, 26 Aug 2022 19:24:56 -0400 Subject: [PATCH] Fix documentation strings and error output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rebased from: https://github.com/hexmode/rpm-spec-mode/commit/a56f4d41af5157b072779e2ca10348d464e77bc2and - Commit message updated. Signed-off-by: Björn Bidar --- rpm-spec-mode.el | 54 ++++++++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/rpm-spec-mode.el b/rpm-spec-mode.el index 299eb68..a41a336 100644 --- a/rpm-spec-mode.el +++ b/rpm-spec-mode.el @@ -87,7 +87,7 @@ (defcustom rpm-spec-short-circuit nil "Skip straight to specified stage. -(ie, skip all stages leading up to the specified stage). Only valid +\(ie, skip all stages leading up to the specified stage). Only valid in \"%build\" and \"%install\" stage." :type 'boolean :group 'rpm-spec) @@ -716,7 +716,7 @@ with no args, if that value is non-nil." (run-hooks 'rpm-spec-mode-hook)) (defun rpm-command-filter (process string) - "Filter to process normal output." + "Filter to PROCESS normal output. Add STRING as starting boundary." (with-current-buffer (process-buffer process) (save-excursion (goto-char (process-mark process)) @@ -737,7 +737,7 @@ 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-goto-add-change-log-header () - "Find change log and add header (if needed) for today" + "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))) @@ -751,7 +751,8 @@ If `rpm-change-log-uses-utc' is nil, \"today\" means the local time zone." (forward-line 2)))) (defun rpm-add-change-log-entry (&optional change-log-entry) - "Find change log and add an entry for today." + "Find change log and add an entry for today. +CHANGE-LOG-ENTRY will be used if provided." (interactive "sChange log entry: ") (save-excursion (rpm-goto-add-change-log-header) @@ -771,7 +772,9 @@ If `rpm-change-log-uses-utc' is nil, \"today\" means the local time zone." ;;------------------------------------------------------------ (defun rpm-insert-f (&optional filetype filename) - "Insert new \"%files\" entry." + "Insert new \"%files\" entry. +If FILENAME is 1 or is not provided, it will be prompted for +using FILETYPE to prompt the user." (save-excursion (and (rpm-goto-section "files") (rpm-end-of-section)) (if (or (eq filename 1) (not filename)) @@ -786,32 +789,38 @@ If `rpm-change-log-uses-utc' is nil, \"today\" means the local time zone." (insert filetype))) (defun rpm-insert-file (&optional filename) - "Insert regular file." + "Insert regular file. +Use FILENAME or, if interactive, prompt." (interactive "p") (rpm-insert-f "" filename)) (defun rpm-insert-config (&optional filename) - "Insert config file." + "Insert config file. +FILENAME is the config file." (interactive "p") (rpm-insert-f "%config " filename)) (defun rpm-insert-doc (&optional filename) - "Insert doc file." + "Insert doc file. +FILENAME is the doc file." (interactive "p") (rpm-insert-f "%doc " filename)) (defun rpm-insert-ghost (&optional filename) - "Insert ghost file." + "Insert ghost file. +FILENAME is the ghost file." (interactive "p") (rpm-insert-f "%ghost " filename)) (defun rpm-insert-dir (&optional dirname) - "Insert directory." + "Insert directory. +DIRNAME is the directory." (interactive "p") (rpm-insert-f "%dir " dirname)) (defun rpm-insert-docdir (&optional dirname) - "Insert doc directory." + "Insert doc directory. +DIRNAME is the directory." (interactive "p") (rpm-insert-f "%docdir " dirname)) @@ -824,7 +833,8 @@ controls whether case is significant." (completing-read prompt table pred require init hist))) (defun rpm-insert (&optional what file-completion) - "Insert given tag. Use file-completion if argument is t." + "Insert given tag. Use FILE-COMPLETION if argument is t. +WHAT is the tag used." (beginning-of-line) (if (not what) (setq what (rpm-completing-read "Tag: " rpm-tags-list))) @@ -847,6 +857,7 @@ controls whether case is significant." (insert insert-text (read-from-minibuffer (concat read-text)) "\n")))))) (defun rpm-topdir () + "Use environment to get the topdir for RPMs." (or (getenv "RPM") (getenv "rpm") @@ -856,7 +867,7 @@ controls whether case is significant." "/usr/src/RPM")) (defun rpm-insert-n (what &optional arg) - "Insert given tag with possible number." + "Insert given tag (WHAT) with possible number." (save-excursion (goto-char (point-max)) (if (search-backward-regexp (concat "^" what "\\([0-9]*\\):") nil t) @@ -870,7 +881,7 @@ controls whether case is significant." (insert what ": " (read-from-minibuffer (concat what "file: ")) "\n")))) (defun rpm-change (&optional what arg) - "Update given tag." + "Update given tag (WHAT)." (save-excursion (if (not what) (setq what (rpm-completing-read "Tag: " rpm-tags-list))) @@ -904,7 +915,7 @@ controls whether case is significant." (message "%s number \"%s\" not found..." what number))))) (defun rpm-insert-group (group) - "Insert Group tag." + "Insert GROUP tag." (interactive (list (rpm-completing-read "Group: " rpm-group-tags-list))) (beginning-of-line) (insert "Group: " group "\n")) @@ -948,6 +959,7 @@ controls whether case is significant." ;;------------------------------------------------------------ (defun rpm-current-section nil + "Get the current section." (interactive) (save-excursion (rpm-forward-section) @@ -992,7 +1004,7 @@ Go to beginning of current section." (point)) (defun rpm-goto-section (section) - "Move point to the beginning of the specified section; + "Move point to the beginning of the specified SECTION. leave point at previous location." (interactive (list (rpm-completing-read "Section: " rpm-section-list))) (push-mark) @@ -1009,6 +1021,7 @@ leave point at previous location." (insert "\n%" section "\n")))) (defun rpm-mouse-goto-section (&optional section) + "Go to SECTION." (interactive (x-popup-menu nil @@ -1026,13 +1039,14 @@ leave point at previous location." (goto-char (point-max)))))) (defun rpm-insert-true-prefix () + "Insert %{prefix}" (interactive) (insert "%{prefix}")) ;;------------------------------------------------------------ (defun rpm-build (buildoptions) - "Build this RPM package." + "Build this RPM package with BUILDOPTIONS." (if (and (buffer-modified-p) (y-or-n-p (format "Buffer %s modified, save it? " (buffer-name)))) (save-buffer)) @@ -1077,7 +1091,7 @@ leave point at previous location." (let ((topdir (expand-file-name default-directory))) (setq buildoptions (cons - (concat "--define \"_topdir " + (concat "--define \"_topdir " (replace-regexp-in-string "/SPECS/$" "" topdir) "\"") buildoptions))))) @@ -1088,7 +1102,7 @@ leave point at previous location." (concat (car lst) " " (list->string (cdr lst))) (car lst))) (compilation-start (list->string (cons rpm-spec-build-command buildoptions)) 'rpmbuild-mode)) - + (if (and rpm-spec-sign-gpg (not rpm-no-gpg)) (let ((build-proc (get-buffer-process (get-buffer @@ -1162,7 +1176,7 @@ command." (if (yes-or-no-p (concat "Process `" (process-name process) "' running. Kill it? ")) (delete-process process) - (error "Cannot run two simultaneous processes ..."))))) + (error "Cannot run two simultaneous processes"))))) ;;------------------------------------------------------------