emacsrequire

Emacs error when loading a created file into .emacs


GNU Emacs 28.2

I have created a file print2Buff.el, when starting to learn writing an emacs extension in the directory

~/.emacs.d/extensions/

In the init file, I write:

(add-to-list 'load-path "~/.emacs.d/extensions/")
(require 'print2Buff)

Nevertheless, when the init file is opened again, it announces that, in --debug-init mode:

Debugger entered--Lisp error: (error "Loading file /home/***/.emacs.d/extensions/print2Buff.el failed to provide feature ‘print2Buff’")

How could I solve this problem?

I have striven to google many emacs file loading error but I still get stuck.

I wish I would solve the problem to start writing my own emacs extensions.


Solution

  • Does print2Buff.el do (provide 'print2Buff)? If not, add that.

    (If it already does that, then provide more info, as the question isn't clear in that case. Provide a recipe, starting from emacs -Q.)