Commit graph

322 commits

Author SHA1 Message Date
Henrik Lissner
4bf49785fd
feat(lib): backport ensure-list from 28+
And deprecate doom-enlist, which it replaces.
2022-06-18 16:57:17 +02:00
Henrik Lissner
a48cd27d79
tweak(lib): always suppress doom-log output
It will still be logged to *Messages*, but won't spam the echo area.
2022-03-31 19:25:50 +02:00
Henrik Lissner
b92c644ad8
docs(lib): clarify setq!'s docstring
Emacs 29+ introduced the setopt macro for setting defcustom variables in
a way that takes setters and type-constraints into account, but it
eagerly pulls in a symbol's dependencies before doing so. To side-step
this silliness, use Doom's setq! macro instead. I'm tempted to alias
setopt to it...
2022-03-21 03:57:03 +01:00
Henrik Lissner
3333eee466
refactor(lib): sharp-quote & minor refactors 2022-03-21 03:57:03 +01:00
Henrik Lissner
0a151f4f13
refactor!(lib): remove obsolete lambda! macros
BREAKING CHANGE: These macros have been deprecated for years. Use
cmd!/cmd!! instead.
2022-03-21 03:57:02 +01:00
Henrik Lissner
17f457edf7
feat(lib): add fn!! macro
With implicit positional arguments. Adapted from
https://git.sr.ht/~tarsius/llama, minus the font-locking, outer function
call, and plus a few minor optimizations.

Ref: https://git.sr.ht/~tarsius/llama
2022-03-21 03:56:59 +01:00
Lele Gaifax
e5213f20e5 nit: fix several documentation typos 2022-01-10 02:21:49 +01:00
Henrik Lissner
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
Henrik Lissner
3a669d8daa fix(lib): add-hook! fails when passed a quoted list
Fix: #5779
2021-11-20 00:55:24 +01:00
Henrik Lissner
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
Henrik Lissner
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
Henrik Lissner
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
Henrik Lissner
ade96ed515 docs(lib): clarify type of add-hook!'s first arg 2021-10-11 20:25:18 +02:00
Henrik Lissner
f5c1332a31 refactor: minor refactors & nit picks across core 2021-10-10 18:36:46 +02:00
Henrik Lissner
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
Henrik Lissner
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
Henrik Lissner
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
Henrik Lissner
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
Henrik Lissner
f2588b0e90 feat(lib): imply &allow-other-keys in fn! macro 2021-09-16 20:20:08 +02:00
Henrik Lissner
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
Henrik Lissner
060636966f Document :depth in add-hook! docstring 2021-05-16 21:19:30 -04:00
Henrik Lissner
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
Henrik Lissner
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
Henrik Lissner
b8b51cee7b Simplify after!
The featurep check is redundant. eval-after-load does it too.
2021-02-24 18:28:23 -05:00
Henrik Lissner
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
Henrik Lissner
16a495c97d Fix #4548: global TAB overwritten by evil keybind 2021-02-06 06:54:18 -05:00
Henrik Lissner
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
Henrik Lissner
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
Henrik Lissner
f5a9dc11ee Update deprecated notices on back (+forward) ports 2021-01-31 04:30:48 -05:00
Henrik Lissner
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
Henrik Lissner
20e74206a8
Merge pull request #4531 from jbampton/fix-spelling
Fix spelling
2021-01-27 02:36:44 -05:00
Henrik Lissner
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
John Bampton
583f854298 Fix spelling 2021-01-18 02:16:45 +10:00
Henrik Lissner
da177d58c4
Fix #4457: wrong-type-arg keymapp on C-i keybinds 2021-01-05 01:55:53 -05:00
Henrik Lissner
a567834ff8
Fix #4457: broken key sequences ending with C-i 2021-01-03 22:40:06 -05:00
Henrik Lissner
c987794884
Fix #4478: backport exec-path function from 27.1 2021-01-03 17:40:33 -05:00
Henrik Lissner
4281a772b1
Revise core lib docstrings for clarity 2020-12-11 17:38:59 -05:00
Henrik Lissner
8edabbecfa
Add kbd! alias for general-simulate-key macro 2020-12-11 16:59:47 -05:00
Henrik Lissner
b5e948054c
Refactor & reformat core.el
Backport a bit of core.el from our CLI rewrite.
2020-12-02 17:58:09 -05:00
Henrik Lissner
affd076d53
Minor refactors & reformatting 2020-12-01 13:53:46 -05:00
Akira Baruah
c3001f77aa core-lib: Add docstring for add-hook-trigger! 2020-11-19 00:31:13 -08:00
Henrik Lissner
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
Henrik Lissner
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
Henrik Lissner
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
Henrik Lissner
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
Janfel
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
Henrik Lissner
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
Henrik Lissner
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
Henrik Lissner
2441d28ad1
Fix wrong-number-of-args error from cmd!! macro 2020-07-24 18:17:43 -04:00
Henrik Lissner
9073a5d402
Fix #3610: revert changes to cmd!! macro
Half-reverts e6c88e4384
2020-07-22 17:09:38 -04:00