Commit Graph

316 Commits

Author SHA1 Message Date
e5213f20e5 nit: fix several documentation typos 2022-01-10 02:21:49 +01:00
9dad26961a fix: envvar file loader processing TZ incorrectly
setenv treats the TZ (and only TZ) envvar especially, so we have to too,
since I'm intentionally avoiding iteratively setenv'ing envvars to avoid
the unnecessary extra work it does.

Fix: #5760
2021-11-24 21:18:39 +01:00
3a669d8daa fix(lib): add-hook! fails when passed a quoted list
Fix: #5779
2021-11-20 00:55:24 +01:00
b35b32273a fix(lib): doom-enlist not wrapping cons cells
While lists are technically cons cells, cons cells don't have all the
properties of lists, so doom-enlist shouldn't treat it as one.

Before:

  (doom-enlist '(a . b))   #=> (a . b)

After:

  (doom-enlist '(a . b))   #=> ((a . b))
2021-10-20 20:18:39 +02:00
8f040b79be fix(lib): fn! error when arglist is a cons cell
Throws a wrong-type-argument error when fn! is given a cons cell in its
arguments, e.g.

  (fn! ((x . y)) ...)
2021-10-19 22:29:08 +02:00
0112319c04 fix(lib): add &allow-other-keys in fn! sub-arglists
Before this fix:

  (fn! (x &key y z))
  ;; implies
  (fn! (&key x &allow-other-keys)).

But

  (fn! (x (&key y) &key z))
  ;; would not imply
  (fn! (x (&key y &allow-other-keys) &key z &allow-other-keys)).
2021-10-18 01:15:54 +02:00
ade96ed515 docs(lib): clarify type of add-hook!'s first arg 2021-10-11 20:25:18 +02:00
f5c1332a31 refactor: minor refactors & nit picks across core 2021-10-10 18:36:46 +02:00
094b4c1023 refactor: move init helpers to core-lib
The functions have more general use-cases and should be considered part
of Doom's stdlib.
2021-10-10 18:36:46 +02:00
91770b66e5 feat(lib): add :depth support to add-hook!
The semantics of add-hook's APPEND argument changed in 27.1: it was
replaced with DEPTH, which controls its exact order of the hook (and is
respected every time a function is added to a hook, throughout its
lifetime).

Includes a general refactor for add-hook! too.
2021-10-10 18:36:46 +02:00
d13816ce3e feat(lib): extend function deftypes in letf! macro
This adds support for two new definition types to the left! convenience
macro: defun* and defadvice.

First, defun* is for defining recursive, local functions (uses
cl-labels under the hood). e.g.

  (letf! (defun* triangle (number)
           (cond ((<= number 0) 0)
                 ((= number 1) 1)
                 ((> number 1)
                  (+ number (triangle (1- number))))))
    ...)

Second, defadvice is for defining temporary advice (which has a global
effect; it can later be improved to limit scope by redefining things
with cl-letf). e.g.

  (letf! (defadvice my-fixed-triangle (fn number)
           :around #'triangle
           (funcall fn (1+ number)))
    ...)
2021-10-01 19:30:56 +02:00
2c5cc752ff fix(lib): preserve package order in after! macro
Prior to this, (after! (a b) ...) would expand to

  (after! b
    (after! a
      ...))

After this, it expands to

  (after! a
    (after! b
      ...))

This fixes load order issues with packages whose deferred configs are
nested, such as org and ob-ditaa.

Ref https://www.reddit.com/r/emacs/comments/pp3sye/hd311nz
2021-09-16 20:20:18 +02:00
f2588b0e90 feat(lib): imply &allow-other-keys in fn! macro 2021-09-16 20:20:08 +02:00
044a1a5f2b Drop Emacs 26.x support
Emacs 27.x has been the stable version of Emacs for nearly a year, and
introduces a litany of bugfixes, performance, and quality-of-life
improvements that significantly reduce Doom's maintenance burden (like
XDG support, early-init.el, image manipulation without imagemagick, a
native JSON library, harfbuzz support, pdumper, and others).

With so many big changes on Doom's horizon, I like having one less (big)
thing to worry about.

Also reverts bb677cf7a (#5232) as it is no longer needed.
2021-07-06 02:31:52 -04:00
060636966f Document :depth in add-hook! docstring 2021-05-16 21:19:30 -04:00
dee20c7585 Remove define-obsolete-*-alias fix
Packages have had enough time to catch up. Also, with 9d3742c0d these
fixes are no longer effective for packages.

Closes #4534
2021-05-15 14:09:08 -04:00
d44c57f01a Add :defer support to add-hook! macro
See add-hook's DEPTH argument (replaces APPEND in Emacs 27+).
2021-05-09 13:06:24 -04:00
b8b51cee7b Simplify after!
The featurep check is redundant. eval-after-load does it too.
2021-02-24 18:28:23 -05:00
76636d4a98 Refactor cmds!!
+ No longer depends on general.el
+ Each branch is now anaphoric (binds `it` to the return value of the
  predicate)
2021-02-11 17:35:48 -05:00
16a495c97d Fix #4548: global TAB overwritten by evil keybind 2021-02-06 06:54:18 -05:00
9446a8f411 Move byte-compile fix to core-packages
So it targets more than just 28.x+ users.
2021-02-06 04:49:28 -05:00
628f0a930f Force straight to byte-compile packages in same session
Straight (on its develop branch) byte compiles packages in a child
process, isolated from the current session. This is a sensible approach
and I applaud it, but there's a problem:

Some packages don't load their compile-time dependencies at
compile-time, causing errors *at* compile-time. They unwittingly rely on
the fact that package.el compiles them in the same session as their
dependencies, which indirectly loads their macros for them. I can't
depend on package authors to do the right thing, but I can force
straight to revert to the old approach.
2021-02-05 22:48:31 -05:00
f5a9dc11ee Update deprecated notices on back (+forward) ports 2021-01-31 04:30:48 -05:00
b91f1607d8 Fix #4532: wrong-number-of-args errors on emacs HEAD
This is a temporary fix. These should be removed once packages have
updated to accommodate the changes to the
define-obsolete-{variable,function,face}-alias macros.
2021-01-31 04:30:48 -05:00
20e74206a8 Merge pull request #4531 from jbampton/fix-spelling
Fix spelling
2021-01-27 02:36:44 -05:00
63929a240c Fix doom-lookup-key
+ Scanning wrong variable for minor mode keymaps (minor-mode-alist ->
  minor-mode-map-alist).
+ Accommodate possibility that emulation-mode-map-alists may contain
  nested alists (#4538).

Closes #4538
2021-01-18 17:45:29 -05:00
583f854298 Fix spelling 2021-01-18 02:16:45 +10:00
da177d58c4 Fix #4457: wrong-type-arg keymapp on C-i keybinds 2021-01-05 01:55:53 -05:00
a567834ff8 Fix #4457: broken key sequences ending with C-i 2021-01-03 22:40:06 -05:00
c987794884 Fix #4478: backport exec-path function from 27.1 2021-01-03 17:40:33 -05:00
4281a772b1 Revise core lib docstrings for clarity 2020-12-11 17:38:59 -05:00
8edabbecfa Add kbd! alias for general-simulate-key macro 2020-12-11 16:59:47 -05:00
b5e948054c Refactor & reformat core.el
Backport a bit of core.el from our CLI rewrite.
2020-12-02 17:58:09 -05:00
affd076d53 Minor refactors & reformatting 2020-12-01 13:53:46 -05:00
c3001f77aa core-lib: Add docstring for add-hook-trigger! 2020-11-19 00:31:13 -08:00
65be6923e7 Fix wrong-number-of-args on 'doom install'
Only affects Emacs 26.x users, because `file-name-quote`s signature
changed in 27.1.
2020-11-02 17:02:10 -05:00
7ec623593e Fix magit in remote repos
And backport executable-find from Emacs 27.1 so we don't have to do
these version checks every time we use it.
2020-11-02 14:43:12 -05:00
b461f76b0d Fix *-local-vars-hook & doom-first-*-hook not triggering
When starting Emacs with a file path argument these hooks aren't set up
in time for the file to be processed.

Fixes #3891, #4082, #4104
2020-10-16 23:08:56 -04:00
518c97a2ac Rename {if,when}! -> eval-{if,when}!
To better represent its purpose, as extensions to Emacs' eval-when*
API (for control flow at compile time).
2020-08-27 01:10:08 -04:00
3760ceb048 Fix deduplication in add-load-path!
Currently, `add-load-path!` doesn’t check for duplicates in `load-path`, because `cl-pushnew` tests for equality with `eql`. This changes the predicate to `string=`, fixing the bug.
2020-08-07 18:28:36 +02:00
a9bd4965bf Improve error handling in doom-first-*-hook
This should at least report what function invoked the error.
doom-first-input-hook was especially problematic because it runs on
pre-command-hook, which Emacs is very protective of. It will smother
errors that arise from it and auto-remove the offending hook. This
self-correction is nice for avoiding a broken Emacs, but it makes it
tough to debug those issues.
2020-08-02 18:41:21 -04:00
6ca9e0e2f1 Fix #3632: wrong-number-of-args on setq-local
Emacs 27.0.90 made setq-local variadic. I've backported this in core-lib
for Emacs <27 users. However, there are users who install Emacs
27.0.50...
2020-07-26 14:12:07 -04:00
2441d28ad1 Fix wrong-number-of-args error from cmd!! macro 2020-07-24 18:17:43 -04:00
9073a5d402 Fix #3610: revert changes to cmd!! macro
Half-reverts e6c88e4384
2020-07-22 17:09:38 -04:00
002bf84f45 doom-load-envvars-file: only affect default state
Some plugins (like envrc-mode) make process-environment, exec-path and
shell-file-name buffer-local. Running `M-x doom/reload` or
`doom-load-envvars-file` should affect their global values, and not
their buffer local ones.
2020-06-13 17:01:34 -04:00
5b8b04f0c8 Properly lazy load flyspell
Package was eagerly loaded at startup, so we must pretend it hasn't to
defer it and future configuration.

And generalize defer-feature! macro.
2020-06-05 01:41:49 -04:00
8bf902d5f4 General refactors & reformatting across the board 2020-06-04 20:13:28 -04:00
a9bf0b8985 Add cmd!, cmd!!, cmds! convenience macros
It's kind of silly that our command lambda macros (λ! and λ!!) need a
snippet, special key sequence or copy-paste to insert, so in the spirit
of fn! -- and to make sure they take up less space than `lambda!` --
I've added `cmd!` and `cmd!!` aliases. `lambda!` and `lambda!!` are now
deprecated. λ! and λ!! will remain.

I've also added `cmds!` as a convenience wrapper around
general-predicate-dispatch.
2020-05-27 18:29:35 -04:00
e6c88e4384 Refactor autoloads generator & reduce to one generated file
We no longer need two separate autoloads files, so I merged them and
optimized its generation logic.

Other changes
- Doom will refuse to start up (with a helpful error) if it's in an
  incomplete state. This should hopefully reduce the number of bug
  reports from folks that have done something weird, e.g.
  1. You've changed Emacs versions without running 'doom sync -b'.
  2. You've updated Doom outside of `doom upgrade` and didn't run `doom
     sync -u`.
  3. You've forgotten to run 'doom sync' in the first place!
  4. If a previous 'doom ...' command was aborted midway without running
     'doom sync' afterwards.
- 'doom sync' will emit reminders that you need to reload/restart Emacs
- Autoloads API now uses the `doom-autoloads-` prefix, intead of
  'doom-cli-autoloads-', as will be the new convention in the coming
  rewrite.
- Errors from within the package autoloads should be easier to invoke
  the debugger on.
- `doom-modules` is now stored in your autoloads file. Your module list
  will soon be frozen between calls to 'doom sync' to allow for our new,
  atomic CLI I'm working on. This will also means the `doom!` block
  won't cost anything in interactive sessions.
2020-05-25 15:55:29 -04:00
3a38fc633c Change doom-{interactive,debug}-mode suffix to -p
Because these are not really modes.

Also makes `doom-debug-mode` an actual (global) minor mode.
2020-05-25 03:43:40 -04:00