I installed darkroom via the package manager in my GNU Emacs 25.3.1 (x86_64-w64-mingw32). M-x package-list shows the package as installed and in fact are the files in the respective folder, the command, however, M-x darkroom-mode does not work, i.e. response with [no match].

The relevant parts of my .emacs looks like this:

(package-initialize)

(custom-set-variables
'(package-selected-packages (quote (darkroom auctex))))

Is there something missing? Is it maybe still running? I'm grateful for any suggestions,

  • 1
    Please don't show your whole init file here, and ask that we find the problem. Instead, bisect it to find out where the problem lies. What package is supposed to define the command you want? Perhaps that package is not getting loaded. Are you sure that the function is a command (so you can use it with M-x)? These are things to check. – Drew Oct 10 at 14:45
  • @Drew I wasn't aware of that, other helpdesks always ask for ALL the information, so I wanted to provide the right away. I narrowed it down to the parts that seem relevant to me. – Nils Oct 11 at 7:53
  • @Nils Note, that this site is community driven even if it is commercially hosted. So this is not a helpdesk. – Tobias Oct 11 at 8:02
  • No problem. Thanks for narrowing it down. That makes a big difference and makes the Q & A more helpful for others who might have a similar question. – Drew Oct 11 at 13:42
up vote 2 down vote accepted

The elpa-version darkroom-0.1.el of darkroom does not have an ;;;###autoload before (define-minor-mode darkroom-mode ...) as the github version has.

That means that you can either install the the github version or put

(autoload 'darkroom-mode "darkroom" nil t)

into your init file.

  • Thanks for your response, sadly, none of this solutions worked. Maybe I was something missing. However, I got it running with the elpa-version, see my answer. – Nils Oct 11 at 7:41
  • @Nils I've corrected the autoload variant. You need to mark the function as interactive. – Tobias Oct 11 at 7:48
  • Your changes worked. Since this solution has a better performance than mine, I think this is the way to go. Thanks for your help. – Nils Oct 11 at 7:57
  • @Nils Sorry about the hick-up I caused by forgetting the optional interactive argument of autoload. – Tobias Oct 11 at 8:00

The solution for me was the following:

install the package via the package manager

M-x package-install RET darkroom RET

add the following lines to the init file:

(add-to-list 'load-path "PATH/TO/DARKROOM_EXTENSION_FOLDER")
;; something like c:/emacs/.emacs.d/elpa/darkroom-0.1/
(require 'darkroom)

the required package has to be the same name as the .el file. So if your extension has the name darkroom_foo.el you need to require:

(require 'darkroom_foo)
  • The package directory is added to load-path by package-install/ package-initialize. You don't need to do that. I tried to avoid the require with autoload in my answer. require increases the startup time by loading the packages. Contrary to that the packages are loaded on demand by autoload. My corrected answer should do the job. – Tobias Oct 11 at 7:51

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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