What I want to achieve
I want to use https://github.com/jeeger/ttl-mode in Doom Emacs
From my understanding in order to use a package in Doom Emacs that is not available via a module:
doom rein my packages.el:
...
(package! ttl-mode)
...
in my config.el:
(def-package! ttl-mode
:config
;; (autoload 'ttl-mode "ttl-mode" "Major mode for OWL or Turtle files" t)
;; (add-hook 'ttl-mode-hook ; Turn on font lock when in ttl mode
;; 'turn-on-font-lock)
(setq auto-mode-alist
(append
(list
'("\\.n3" . ttl-mode)
'("\\.ttl" . ttl-mode))
auto-mode-alist))
)
doom re clones the package and doom doc does not find a problem. But still I get:
Error in private config: config.el, (file-missing Cannot open load file No such file or directory ttl-mode)
System information
((emacs
(version . "26.2")
(features . "XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD LCMS2")
(build . "Apr 12, 2019")
(buildopts "--build=x86_64-linux-gnu --prefix=/usr '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib --program-suffix=26 --with-modules --with-file-notification=inotify --with-mailutils --with-x=yes --with-x-toolkit=gtk3 --with-xwidgets --with-lcms2 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs26-CYbeHB/emacs26-26.2~1.gitfd1b34b=. -fstack-protector-strong -Wformat -Werror=format-security -no-pie' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -no-pie'"))
(doom
(version . "2.0.9")
(build . "HEAD -> develop, origin/develop, origin/HEAD d866ee37 2019-09-10 15:01:00 -0400"))
(system
(type . gnu/linux)
(config . "x86_64-pc-linux-gnu")
(shell . "/bin/bash")
(uname . "Linux 4.15.0-60-generic #67-Ubuntu SMP Thu Aug 22 16:55:30 UTC 2019 x86_64")
(path "~/.cargo/bin" "~/bin" "~/.local/bin" "/usr/local/bin" "~/.cargo/bin" "~/.local/bin" "~/bin" "/usr/local/sbin" "/usr/local/bin" "/usr/sbin" "/usr/bin" "/sbin" "/bin" "/usr/games" "/usr/local/games" "/snap/bin" "~/.fzf/bin" "/usr/lib/x86_64-linux-gnu/emacs/26.2/x86_64-linux-gnu"))
(config
(envfile . envvar-file)
(elc-files . 0)
(modules :completion company ivy :ui doom doom-dashboard hl-todo modeline nav-flash ophints (popup +all +defaults) vc-gutter vi-tilde-fringe window-select workspaces :editor evil file-templates fold multiple-cursors rotate-text snippets :emacs dired electric vc :tools eval flycheck (lookup +docsets) magit :lang data emacs-lisp markdown (org +dragndrop +ipython +pandoc +present) python rest sh :config default)
(packages "org-caldav" "calfw" "calfw-org" "ttl-mode")
(elpa-packages "n/a")))
I think ttl-mode on MELPA (this is where you get your packages if you just do package! without options) is outdated (and jeeger/ttl-mode is forked from it).
I made it work like this:
;; .doom.d/packages.el
(package! ttl-mode :recipe
(:host github :repo "jeeger/ttl-mode"))
;; .doom.d/config.el
(def-package! ttl-mode
:config
(setq auto-mode-alist
(append
(list
'("\\.n3" . ttl-mode)
'("\\.ttl" . ttl-mode))
auto-mode-alist)))
Thanks for the hint! I totally overlooked the note that it is a fork :)
I removed the original entry from packages.el, ran doom re to let it purge the orphaned package and added the entry like you instructed. Then reran doom re, without errors, but still no luck, same error. Any further ideas how I can debug/fix this?
I was able to get it working with:
;; in ~/.doom.d/packages.el
(package! ttl-mode
:recipe (:host github :repo "jeeger/ttl-mode"))
;; in ~/.doom.d/config.el
(use-package! ttl-mode
:mode "\\.n3$"
:mode "\\.ttl$")
Before you run doom refresh, try deleting ~/.emacs.d/.local/straight/{repos,build}/ttl-mode manually.
@hlissner works, thanks a lot! In what cases is it recommended to use-package! vs def-package!? I understand the latter is a doom wrapper around the first.
For what it's worth, I deleted manually all the "ttl stuff" in emacs.d/.local that was still present after the purge that doom re did:
~/.emacs.d/.local develop* ⇣
❯ fd ttl
straight/repos/melpa/recipes/battle-haxe
straight/repos/melpa/recipes/ttl-mode
straight/repos/ttl-mode
straight/repos/ttl-mode/ttl-mode.el.in
Might that be the cause of the issue I had, that prior to trying to get the package from github, as hinted by @filalex77, I had the MELPA version and it did not get purged fully?
@benjaminbauer Both use-package! and def-package! are wrappers around use-package (note the missing !). And def-package! is deprecated in favor of use-package!.
@filalex77 OK, thanks for clarifying!
I am trying this after going through this discussion, but I am not able to load my mode:
;;In package.el:
(package! sclang-mode
:recipe (:host github :repo "supercollider/scel"))
;;In config.el:
(setenv "PATH" (concat (getenv "PATH") "/Applications/SuperCollider.app/Contents/MacOS"))
(setq exec-path (append exec-path '("/Applications/SuperCollider.app/Contents/MacOS")))
(use-package! sclang-mode
:mode "\\.sc$"
:mode "\\.scd$")
-> "Cannot open load file" "No such file or directory" "sclang"
Most helpful comment
I was able to get it working with: