Commit graph

33 commits

Author SHA1 Message Date
Henrik Lissner
a5c80fcb4b
refactor: deprecate doom-private-dir for doom-user-dir
- Deprecates the doom-private-dir variable in favor of doom-user-dir.
- Renames the pseudo category for the user's module: :private -> :user.
- Renames the doom-private-error error type to doom-user-error.

Emacs uses the term "user" to refer to the "things" in user space (e.g.
user-init-file, user-emacs-directory, user-mail-address, xdg-user-dirs,
package-user-dir, etc), and I'd like to be consistent with that. It also
has the nice side-effect of being slightly shorter. I also hope
'doom-user-error' will be less obtuse to beginners than
'doom-private-error'.
2022-08-14 20:43:35 +02:00
Henrik Lissner
924d78443a
tweak(snippets): yas-verbosity = 2 2022-07-24 13:16:02 +02:00
Henrik Lissner
14b2395424
refactor: remove unused core variables
doom-debug-p and doom-interactive-p have always been intentionally
redundant, because changing the variables they replaced had other
side-effects, which made writing tests for them difficult. Since our
new (yet unpublished) tests lean heavily toward integration testing more
than unit testing, this becomes an implementation detail.

And doom-init-p's only use was refactor out at some point in the past,
so it's no longer used.

Also done to reduce Doom's footprint, in general.
2022-06-29 18:14:20 +02:00
Henrik Lissner
06392a723f refactor: rename orig-fn arg in advice to fn
A minor tweak to our naming conventions for the first argument of an
:around advice.
2021-08-04 01:53:12 -04:00
Henrik Lissner
60b595321e Lazy-load yasnippet harder for faster first-file load time
+ Rather than waiting for the first "interactive" major mode to be
  visited to activate yas-minor-mode, we wait until the first time the
  user invokes a snippet command to activate yas-global-mode.
+ yas-reload-all is one of the bottlenecks when loading a file for the
  first time. Deferring it further should help with this.
+ yas-global-mode reaches more major modes than our former list of
  hooks (fixes #5140).

Closes #5140
2021-06-05 13:12:00 -04:00
Henrik Lissner
523ced6e9a
Fix #4127: arrayp error on some snippets via +snippets/edit 2020-11-14 14:16:01 -05:00
Sheng Yang
bb415adbe0 Load yas when yas-activate-extra-mode is called
Also load when yas-deactivate-extra-mode is called
2020-09-25 19:50:17 -05:00
Henrik Lissner
4e82ee4397
Refactor doom-debug-mode
+ Add explain-pause-mode
+ Now reloads itself if doom-debug-variables is changed or when one of
  its variables becomes available.
+ doom-debug-variables now supports a cons cell entry where its CAR is
  the name of the variable and CDR is the value it should be set to when
  doom-debug-mode is active.
2020-08-21 01:26:24 -04:00
Henrik Lissner
b2787a9426
Fix #3627: persist auto-yasnippet snippets
Needs to be persisted to a directory yasnippet can see.
2020-07-25 22:05:40 -04:00
Henrik Lissner
7a868b1537
Fix yasnippet+hippie-expand interop 2020-07-23 00:55:51 -04:00
Henrik Lissner
b2919ee5d6
Fix #2639: duplicate snippets in completion prompt 2020-06-05 02:52:18 -04:00
Henrik Lissner
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
Henrik Lissner
d8fda76c7d
yas-also-auto-indent-first-line = nil
Stop yasnippet from aggressively reindenting the whole snippet; assume
the user is expanding the snippet exactly where they want it.

Half-fixes #3211
2020-05-24 14:29:41 -04:00
Henrik Lissner
d12752324a
Introduce letf! convenience macro
A more succinct cl-letf, which allows for local functions and macros.
2020-04-29 23:48:21 -04:00
Henrik Lissner
f8693d0f8c
Load snippets *after* yasnippet config in daemon 2020-04-24 04:07:57 -04:00
Henrik Lissner
06d5d5e6c0
General refactors, reformatting & comment revision 2020-04-23 23:56:17 -04:00
Henrik Lissner
a7a5cbb7bf
editor/snippets: refactor & comment
And load snippets earlier in daemon sessions.
2020-04-17 21:58:55 -04:00
Henrik Lissner
5e65d0e063
Load yasnippet incrementally 2020-03-31 02:24:14 -04:00
Henrik Lissner
d0021461f7
Fix duplicate snippets
e.g. If you've cloned doom-snippets to $DOOMDIR/snippets.

Also refactors how yas-snippet-dirs is initialized.
2019-11-22 19:07:10 -05:00
Henrik Lissner
4657c9e9be
editor/snippets: fix error loading doom-snippets-lib 2019-10-29 01:10:25 -04:00
Henrik Lissner
3c6f48f9ec
Move evil & corrective keybinds to respective modules
Keybinds that correct behavior or provide or extend vim functionality
were moved to their respective modules, or to the :editor evil module.

Keybinds in the global space, that are particularly opinionated but
potentially harmful or imposing as a default, or likely for users to
change (like leader keys), are kept in config/default.
2019-10-26 23:44:28 -04:00
Henrik Lissner
a3e262c7ac
💥 Refactor add-hook! macro & change arg order
This update may potentially break your usage of add-hook! if you pass
the :local or :append properties to it. This is how they used to work:

  (add-hook! :append 'some-mode-hook #'do-something)

Thsoe properties must now follow the hooks, e.g.

  (add-hook! 'some-mode-hook :append #'do-something)

Other changes:
- Various add-hook calls have been renamed to add-hook! because I
  incorrectly assumed `defun` always returned its definition's symbol,
  when in fact, its return value is "undefined" (so sayeth the
  documentation). This should fix #1597.
- This update adds the ability to add multiple functions to hooks
  without a list:

    (add-hook! 'some-mode-hook
               #'do-something
               #'do-something-else)

- The indentation logic has been changed so that consecutive function
  symbols at indented at the same level as the first argument, but forms
  are indent like a defun.

    (add-hook! 'some-mode-hook
               #'do-something
               #'do-something-else)

    (add-hook! 'some-mode-hook
      (message "Hello"))
2019-07-26 20:17:29 +02:00
Henrik Lissner
82ae3a73f3
def-advice!->defadvice! & conform to new advice conventions
This commit does two things:

- Renames def-advice! to defadvice!, in the spirit of naming convenience
  macros after the function/macro they enhance or replace.
- Correct the names of advice functions to indicate visibility and
  intent. A public advice function like doom-set-jump-a is meant to be
  used elsewhere. A private one like +dired--cleanup-header-line-a
  shouldn't -- it likely won't work anywhere but the function(s) it was
  made to advise.
2019-07-23 17:24:56 +02:00
Henrik Lissner
76cacb5bfe
💥 Rename def-package! -> use-package!
Calling this pivotal macro "def-package!" has frequently been a source
of confusion. It is a thin wrapper around use-package, and it should be
obvious that it is so. For this reason, and to match the naming
convention used with other convenience macros/wrappers, it is now
use-package!.

Also changes def-package-hook! -> use-package-hook!

The old macros are now marked obsolete and will be removed when straight
integration is merged.
2019-07-23 12:50:45 +02:00
Henrik Lissner
88813ff196
Minor reformatting across the board
Gotta

Look

Nice
2019-07-22 22:34:08 +02:00
Henrik Lissner
33c220902e
editor/snippets: don't auto-enable yas-global-mode 2019-07-22 02:37:46 +02:00
Henrik Lissner
d12e7b831f
editor/snippets: load doom-snippets sooner
We want +snippets-dir to be first in yas-snippet-dirs. To ensure this,
doom-snippets should be loaded immediately before it is added to it, if
possible.
2019-07-14 22:47:15 +02:00
Henrik Lissner
62af55dad0
Move emacs-snippets -> doom-snippets
The repo was renamed upstream.
2019-07-14 17:05:48 +02:00
Henrik Lissner
05eb333a0c
editor/snippets: expand on snippet commands & keybinds
- Introduces the +snippets/new (SPC s n) command for creating a new
  private snippet
- Introduces the +snippets/new-lias (SPC s N) command for creating a new
  private snippet alias, which will invoke another snippet (you will be
  prompted to select one). This will only work with the emacs-snippets
  library bundled with Doom Emacs, however, as it depends on its API.
- Introduces +snippets/edit (SPC s c) for modifying existing snippets.
  How this differs from yas-visit-snippet-file is it will copy the
  contents of built-in snippets into a buffer primed for your private
  snippets (in DOOMDIR/snippets), while yas-visit-snippet-file will
  simply open the originating snippet.
- Introduces the +snippets/find (SPC s ?),
  +snippets/find-for-current-mode (SPC s /) and
  +snippets/find-private (SPC s f) commands for, respectively, finding a
  snippet file among *all* directories in yas-snippet-dirs, finding a
  snippet for the current major mode (plus parents), and finding a
  snippet from among your private library. This opens built-in snippets
  in read-only mode, but you can press C-c C-e to open it in
  +snippets/edit.
2019-07-12 20:41:50 +02:00
Henrik Lissner
dcdebdb283
Convert +snippets/expand-on-region to advice
It's meant to be corrective, not alternative behavior.
2019-06-10 09:38:51 +02:00
Henrik Lissner
78cff4ef97
editor/snippets: yas-triggers-in-field = nil
Made TAB (move to next field) unpredictably expand sub-snippets.
2019-05-05 14:20:52 -04:00
Henrik Lissner
a4f9eb6f6c
Enable read-only-mode for built-in snippets
Because they shouldn't be edited out of ~/.emacs.d/.local -- if a
snippet in ~/.doom.d/snippets has the same name, built-in snippets will
be ignored.
2019-04-24 18:16:05 -04:00
Henrik Lissner
77e4cc4d58
💥 Remove :feature category
:feature was a "catch-all" category. Many of its modules fit better in
other categories, so they've been moved:

- feature/debugger -> tools/debugger
- feature/evil -> editor/evil
- feature/eval -> tools/eval
- feature/lookup -> tools/lookup
- feature/snippets -> editor/snippets
- feature/file-templates -> editor/file-templates
- feature/workspaces -> ui/workspaces

More potential changes in the future:

- A new :term category for terminal emulation modules (eshell, term and
  vterm).
- A new :os category for modules dedicated to os-specific functionality.
  The :tools macos module would fit here, but so would modules for nixos
  and arch.
- A new :services category for web-service integration, like wakatime,
  twitter, elfeed, gist and pastebin services.
2019-04-24 18:16:04 -04:00
Renamed from modules/feature/snippets/config.el (Browse further)