3

I'm playing around with developing and publishing an Emacs package, very simple stuff, just trying things out before I commit to a bigger project. The problem that I'm having is that after I've made a MELPA package (as per this tutorial) and try the package-install-file command I'm greeted with the "Package lacks a file header" error message, even though as far as I can see my package contains all of the required header information (as you can see here). My source file looks like this:

;;; header-tracker.el --- Easy switching between header and source files.

;; Copyright (C) 2019 Nathan Campos

;; Author: Nathan Campos <nathan@innoveworkshop.com>
;; Homepage: http://github.com/nathanpc/header-tracker.el
;; Version: 1.0.0
;; Keywords: convenience, usability
;; Package-Requires: ((emacs "24.1"))

;; This file is NOT part of GNU Emacs.

;;; License:

;; 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:

;; Quickly and easily keep track and switch between header and source files
;; using this handy package.

;; This package exports a interactive function `header-tracker-toggle-header`
;; which can be binded to a key to seamlessly switch between source and header
;; files. This can be accomplished by adding the following lines to your
;; configuration file:

;; (add-hook 'c-mode-common-hook
;;           (lambda ()
;;             (local-set-key (kbd "C-c h") 'header-tracker-toggle-header)))

;; For more information about this package please consult the README file.

;;; Code:

;; Some code here...

(provide 'header-tracker)
;;; header-tracker.el ends here

Also, when I run (package-buffer-info) in the source buffer this is what I get in return, so apparently the header is valid:

(package-desc header-tracker (1 0 0) "Easy switching between header and source files." ((emacs (24 1))) single nil nil ((:authors ("Nathan Campos" . "nathan@innoveworkshop.com")) (:maintainer "Nathan Campos" . "nathan@innoveworkshop.com") (:url . "http://github.com/nathanpc/header-tracker.el")) nil)

Running checkdoc yields:

Buffer comments and tags:  Ok
Documentation style:       Ok
Message/Query text style:  Ok
Unwanted Spaces:           Ok

Another interesting thing that is happening is that if I run package-install-from-buffer in my package (not in the MELPA fork) it installs without any issues.

How can I debug this error since apparently it doesn't give any indication of what made it happen in the first place.

  • Try M-x toggle-debug-on-error, install again, and see if the backtrace gives more clues – npostavs Aug 14 '19 at 11:54
  • 1
    Try to kill the ;;; License: line together with the following newline. – Tobias Aug 14 '19 at 13:27
  • 1
    package-install-file runs fine with the code in your question using GNU Emacs 26.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-04-12. – Tobias Aug 14 '19 at 13:41
  • You could try running checkdoc on the offending file. – user12563 Aug 14 '19 at 14:21
  • @Tobias That's interesting because I'm running the exact same version. Now I'm starting to think I'm missing something. – Nathan Campos Aug 14 '19 at 20:00
0

Are you running on windows? I have seen a package work fine on Linux, but generate similar errors on windows. Could be due to GIT changing the CR to CRLF when checking out on Windows.

git config --global core.autocrlf false being set before cloning will prevent the change.

Information from here spacemacs issue

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.