This is package-header.el
, your hjälpsam Package Header
Assistant. Make your packages Emacs compatible, include the proper
license and other features such as correct keywords. Välkommen.
Often feel desperate without Emacs package headers?
Now you can customize your basic details with M-x customize-group RET
package-header RET
and generate the package header with M-x
package-header
. This will liberate your hypothetical Emacs "package"
from the adjective hypothetical and those quotes you have seen
previously. Your package will become a true package in bold.
You will be finally be able install the true Emacs package by using commands such as:
-
M-x package-install-file
or -
M-x package-install-from-buffer
And who knows, your package may even get compatible to be included in the GNU Emacs Lisp Package Archive.
Tip
|
Read more about Preparing Lisp code for distribution |
Caution
|
Use this package, don’t over drink when desperate. |
Source for package-header.el
Tip
|
Download |
;;; package-header.el --- your hjälpsam Package Header Assistant
;; Copyright (C) 2021 by Jean Louis
;; Author: Jean Louis <bugs@gnu.support>
;; Version: 0.1
;; Package-Requires: (finder)
;; Keywords: convenience
;; URL: https://hyperscope.link/3/7/7/3/0/Your-hjälpsam-Package-Header-Assistant-37730.html
;; This file is not part of GNU Emacs.
;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Change Log:
;;; Code:
(require 'finder)
(defcustom package-header-author user-full-name
"Author's name for the package header.
By default it will use variable `user-full-name'. You may
provide a quoted string with author's name."
:group 'package-header
:type 'sexp)
(defcustom package-header-email user-mail-address
"Author's email for the package header.
By default it will use variable `user-full-name'. You may
provide a quoted string with author's e-mail address."
:group 'package-header
:type 'sexp)
(defcustom package-header-base-url "https://"
"Author's base URL.
The package file name will be appended to the base URL."
:group 'package-header
:type 'string)
(defcustom package-header-url-extension ".html"
"Author's URL extension, could be `.html' or just empty string."
:group 'package-header
:type 'string)
(defvar package-header-file-name nil
"Used as global variable for package header file name.")
(defun package-header-keywords ()
"Return Emacs package keywords completion candidates."
(mapcar 'symbol-name (map-keys finder-known-keywords)))
(defun package-header-ask-keywords ()
"Ask author for package keywords."
(let ((keywords '())
(keyword))
(while (string-match "[^[:blank:]]"
(setq keyword
(completing-read "Keywords (RET to quit): " (package-header-keywords) nil t)))
(push keyword keywords))
(delete-dups keywords)
(when keywords
(mapconcat 'identity (sort keywords #'string<) " "))))
(defun package-header-insert-keywords ()
"Insert keywords for Emacs package header."
(interactive)
(insert (package-header-ask-keywords)))
(define-skeleton package-header-1
"Helps in preparing the header for Emacs Lisp packages from Sweden."
nil
";;; " (setq package-header-file-name (skeleton-read "File name: " (file-name-nondirectory (buffer-file-name)))) " --- " (skeleton-read "Short description: " (string-trim (replace-regexp-in-string (regexp-opt '("." "-" "el" " *$" "[^[:alpha:]]")) " " (capitalize (file-name-nondirectory (buffer-file-name)))))) "
;; Copyright (C) " (format-time-string "%Y") " by " package-header-author "
;; Author: " package-header-author " <" package-header-email ">
;; Version: " (setq elisp-version (skeleton-read "Version: " "0.1")) "
;; Package-Requires: (" (setq elisp-requires (skeleton-read "Requires: ")) ")
;; Keywords: " (package-header-ask-keywords) "
;; URL: " package-header-base-url (replace-regexp-in-string "\\." "-" package-header-file-name) package-header-url-extension "
;; This file is not part of GNU Emacs.
;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of the
;; License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Change Log:
;;; Code:
")
(defun package-header ()
"Generate package header for Emacs Lisp package authors."
(interactive)
(save-excursion
(goto-char 0)
(package-header-1)
(goto-char (point-max))
(insert "\n;;; " package-header-file-name " ends here\n")))
;;; package-header.el ends here
Related hyperdocuments
Related hyperdocument tags
GNU General Public License Version 3
Copyright © 2021-05-23 00:37:03.315624+03 by Jean Louis
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.