mirror of
https://github.com/correl/melpa.git
synced 2025-04-14 09:09:39 -09:00
Add "foo.el ends here" trailing lines to single-file pkgs if missing
See #625
This commit is contained in:
parent
a63de796e7
commit
52de0cde23
1 changed files with 14 additions and 3 deletions
|
@ -500,6 +500,18 @@ The file is written to `package-build-working-dir'."
|
||||||
(insert (format ";; Version: %s" version))
|
(insert (format ";; Version: %s" version))
|
||||||
(newline))
|
(newline))
|
||||||
|
|
||||||
|
(defun pb/ensure-ends-here-line (file-path)
|
||||||
|
"Add a 'FILE-PATH ends here' trailing line if missing."
|
||||||
|
(save-excursion
|
||||||
|
(goto-char (point-min))
|
||||||
|
(let* ((fname (file-name-nondirectory file-path))
|
||||||
|
(trailer (concat ";;; " fname " ends here")))
|
||||||
|
(unless (search-forward trailer nil t)
|
||||||
|
(goto-char (point-max))
|
||||||
|
(newline)
|
||||||
|
(insert trailer)
|
||||||
|
(newline)))))
|
||||||
|
|
||||||
(defun pb/get-package-info (file-path)
|
(defun pb/get-package-info (file-path)
|
||||||
"Get a vector of package info from the docstrings in FILE-PATH."
|
"Get a vector of package info from the docstrings in FILE-PATH."
|
||||||
(when (file-exists-p file-path)
|
(when (file-exists-p file-path)
|
||||||
|
@ -509,9 +521,7 @@ The file is written to `package-build-working-dir'."
|
||||||
;; next few lines are a hack for some packages that aren't
|
;; next few lines are a hack for some packages that aren't
|
||||||
;; commented properly.
|
;; commented properly.
|
||||||
(pb/update-or-insert-version "0")
|
(pb/update-or-insert-version "0")
|
||||||
(goto-char (point-max))
|
(pb/ensure-ends-here-line file-path)
|
||||||
(newline)
|
|
||||||
(insert ";;; " (file-name-nondirectory file-path) " ends here")
|
|
||||||
(flet ((package-strip-rcs-id (str) "0"))
|
(flet ((package-strip-rcs-id (str) "0"))
|
||||||
(package-buffer-info))))))
|
(package-buffer-info))))))
|
||||||
|
|
||||||
|
@ -718,6 +728,7 @@ FILES is a list of (SOURCE . DEST) relative filepath pairs."
|
||||||
(let ((enable-local-variables :safe))
|
(let ((enable-local-variables :safe))
|
||||||
(with-current-buffer (find-file pkg-target)
|
(with-current-buffer (find-file pkg-target)
|
||||||
(pb/update-or-insert-version version)
|
(pb/update-or-insert-version version)
|
||||||
|
(pb/ensure-ends-here-line pkg-source)
|
||||||
(write-file pkg-target nil)
|
(write-file pkg-target nil)
|
||||||
(let ((valid-package))
|
(let ((valid-package))
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
|
|
Loading…
Add table
Reference in a new issue