Commit Graph

211 Commits

Author SHA1 Message Date
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
6f56b9f9d4 Add autoload/themes.el library 2019-07-23 14:31:00 +02:00
83763414fb Improve docstring for def-advice! functions
Now lists linked functions that the advice was defined with.
2019-07-23 14:12:01 +02:00
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
6200f5d876 Move file functions in core-lib to autoload/files 2019-07-22 23:22:55 +02:00
be2ade62d2 Add polyfill for Emacs 26+ alist-get 2019-07-22 23:22:54 +02:00
060ede0e2e General, minor reformatting across the board
And an offering of blood to our great lord Byte Compiler-sama.
2019-07-22 02:37:45 +02:00
be789caa04 Add elisp demos for Doom API in helpful buffer 2019-07-22 02:30:40 +02:00
492f2dea1e core-lib: add nconcq! macro 2019-07-22 02:30:40 +02:00
e8ecf65cf9 core-lib: add pushmany! macro, refactor pushnew! 2019-07-22 02:30:40 +02:00
0a84d2f0a9 core-lib: add auto-minor-mode, revise def-project-mode!
- Adds the auto-minor-mode package to replace our in-house
  implementation.
- Merges associate! into the def-project-mode! macro because associate!
  on its own is less useful than auto-minor-mode-alist,
  auto-minor-mode-magic-alist or hooks.
- Changes the semantics of :modes and :add-hooks properties of
  def-project-mode!. Its arguments are evaluated as is; lists will need
  to be quoted.

squash! core-lib: remove associate! macro
2019-07-22 02:30:39 +02:00
3404899ec3 core-lib: add doom-partial & doom-rpartial functions 2019-07-22 02:30:39 +02:00
ee10b3b0d9 core-lib: add doom-{glob,path,dir}, replace {file,dir}!
- file! replaces FILE!
- dir! replaces DIR!
- doom-{glob,path,dir} have the power to construct paths out of the
  segment pieces provided to it.
- Move doom-files-in to core-lib and refactor to use the above.
2019-07-22 02:30:39 +02:00
602e2f31c7 core-lib: refactor pushnew! macro
Do a little more work at expand-time.
2019-07-22 02:30:39 +02:00
3306eaa17c core-lib: refactor defer-until!, add-transient-hook!
Now uses an interned hook name (that could be removed, unlike the
uninterned symbol make-symbol creates).

Also, for consistency: fun -> fn

No fun allowed!
2019-07-22 02:30:39 +02:00
b742bf086f core-lib: add prependq! and appendq! macros 2019-07-22 02:30:39 +02:00
0f98b5b3c2 core-lib: use projectile cache in file-exists-p!
If available.
2019-07-22 02:30:39 +02:00
f05aa3a0b1 core-lib: add unsetq-hook! #1568 2019-07-22 02:30:39 +02:00
fdcb259bcd Major refactor of Doom core files
- Remove core-os and move many of its settings out to other core
  libraries, where they belong
- Significantly improve commenting & compartmentalization of many
  settings
- Correct some mis-named public hooks (that were named as if they were
  private)
- Move the vast majority of optimizations to "Optimizations" section in
  core.el
- Don't activate xclip-mode or osx-clipboard-mode if we're accessing
  Emacs through an SSH connection (does more bad than good there)
- Add fast-but-imprecise-scrolling = t
- Set bidi-display-reordering = 'left-to-right, at the recommendation of
  an Emacs dev. Apparently setting it to nil is undefined, as Emacs is
  designed to always assume it's set; setting it explicitly to
  left-to-right will still do what was originally intended by turning it
  off: to reduce line/text scans for bidirectional text, which gives us
  a moderate boost in general runtime snappiness
- Set inhibit-compacting-fon-caches = t on windows (where it struggles
  especially with icon fonts)
- Disables "literal" mode for very large files (because I will be
  backporting so-long.el from Emacs 27 in the next commit)
2019-07-22 02:30:38 +02:00
149b2617b0 💥 revise hook/var fns naming convention (2/2)
This is second of three big naming convention changes. In this commit,
we change the naming conventions for hook functions and variable
functions:

1. Replace the bar | to indicate a hook function with a -h suffix, e.g.

     doom|init-ui -> doom-init-ui-h
     doom|run-local-var-hooks -> doom-run-local-var-hooks-h

2. And add a -fn suffix for functions meant to be set on variables,
   e.g.

     (setq magit-display-buffer-function #'+magit-display-buffer-fn)

See ccf327f8 for the reasoning behind these changes.
2019-07-22 02:30:38 +02:00
51d3b1b424 💥 revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.

In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.

  doom*shut-up -> doom-shut-up-a
  doom*recenter -> doom-recenter-a
  +evil*static-reindent -> +evil--static-reindent-a

The rationale behind this change is:

1. Elisp's own formatting/indenting tools would occasionally struggle
   with | and * (particularly pp and cl-prettyprint). They have no
   problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
   github markdown) struggle with it, sometimes refusing to highlight
   code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
   intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
   on haphazardly way back when Doom was simply "my private config".

Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.

Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
  macro. The old pair weren't as useful. The new def-advice! saves on a
  lot of space.
- Removed "stage" assertions to make sure you were using the right
  macros in the right place. Turned out to not be necessary, we'll
  employ better checks later.
2019-07-22 02:27:45 +02:00
e3a102d05a core-lib: minor reformatting 2019-07-20 11:40:03 +02:00
2caaec50e8 Remove cond!
Well, that was short lived, but pcase and pcase-let are superior and
already available.
2019-07-20 11:40:03 +02:00
103612a347 Add cond! macro to core-lib
An anaphoric cond.
2019-07-18 01:20:55 +02:00
c3c282f0a4 Add λ!! (lambda!!) macro
For quick inline commands for keybinds that simply call a
command (interactively) with a prefix argument.
2019-07-09 02:34:24 +02:00
ebd53e5664 Allow expansion of stage-restricted forms
The package! family of macros will throw an error if used in the wrong
files. This same check would prevent macroexpand from expanding them, or
prevent them from being evaluated inline.
2019-07-07 13:29:22 +02:00
9c15bb82f9 Fix hook collisions by setq-hook!
Fixes an edge case where setq-hook! would override the setq hooks of
other calls to setq-hook!

I want to avoid make-symbol/gensym so users can refer to these hook
functions by name, in case users want to remove these hooks by hand, if
necessary (e.g. for debugging purposes).
2019-07-06 23:22:28 +02:00
0f0a8a5744 Rewrite custom-set-face!, add custom-theme-set-face!
custom-set-faces! and custom-theme-set-faces! are now drop-in
replacements for custom-set-faces and custom-theme-set-faces with one
major distinction: the latter will wait for the theme to be loaded
before applying the changes, this allows you to use theme-specific APIs
in your face definitions (like doom-color from doom-themes).

You no longer have to think about load order when using these macros.
2019-07-06 23:22:27 +02:00
6be401f1a7 Refactor Doom core & reload autoloads remotely
- Move subr-x/cl-lib loading to core-lib
- Revise docstrings for and rename various CLI functions to be more
  descriptive and up-to-date
- After regenerating autoloads file, bin/doom will try to reload
  autoloads files remotely, through the server/daemon, if possible. This
  is highly experimental and could break
2019-06-16 23:01:17 +02:00
f3d8053933 Add internal doom-customize-theme-hook
Ensures custom-set-faces! take effect before any load-theme hooks.
2019-06-12 22:42:32 +02:00
4cde9afd93 Refactor setq-hook!
Simplifies its expanded form and names the hook function to make the
hook's value more readable in help buffers.
2019-05-19 02:17:58 -04:00
81a054deda Add custom-set-faces! convenience macro
For setting face attributes non-destructively. See docstring for usage
example.
2019-05-18 16:46:21 -04:00
c6ceb147e6 doom-log: show source module before message 2019-05-15 15:22:09 -04:00
7443669b1e Minor refactors & comment revision 2019-05-13 14:37:00 -04:00
c42600d771 Fix void-variable sym errors
And remove trailing hyphen on anonymous transient hooks.
2019-05-05 00:01:52 -04:00
7f004f321a Optimize set-transient-hook!
In case HOOK-OR-FUNCTION is an expensive lisp form.
2019-05-04 19:13:26 -04:00
388e0def2c Cheer up the byte-compiler
You deserve better than those warnings.
2019-05-02 21:54:47 -04:00
6d314c2795 Revise and update docstrings and comments 2019-05-01 21:02:28 -04:00
25a86c18c8 Fix quiet! not returning BODY's return value 2019-04-19 13:30:39 -04:00
742687a51e Add delq! and pushnew! macros
And move projectile configs to their respective modules (and out of
package configs).
2019-04-08 23:01:30 -04:00
a258995db9 Set arglist to add-hook!/remove-hook! macros
More sensible eldoc support.
2019-03-10 08:15:46 -04:00
e0ed8669af Move (if|when)-let* shims to core.el
Fix void-functon when-let* errors at startup for Emacs 25.* users.
2019-03-08 18:06:35 -05:00
748b197676 Minor, general refactors 2019-03-08 04:25:45 -05:00
a443d9ab07 Refactor doom-initialize-packages & package API
- Packages are initialized once, when package.el is first loaded, and
  must be updated manually via doom/reload-packages.
- Package->module association is now stored in the package's PLIST under
  :modules. This is an internal property and cannot be explicitly set
  through `package!'
- Add doom-package-list function
- Rename doom-get-packages to doom-find-packages
- Updated doom-find-packages' docstring
- Added the :core filter to doom-find-packages
- Simplified doom-initialize-packages
- doom/reload calls doom/reload-packages if necessary.
- Fix redundant properties in doom-packages
- Remove tracking of after!, def-package! and def-package-hook! blocks.
  Replaced with doom-package-list being able to see all packages, even
  in disabled modules.
- Add :built-in property to package! for dummy packages. This is
  important so that doom/describe-package can see built-in packages.
2019-03-08 04:25:44 -05:00
8f2fb07948 Add advice-add! & advice-remove! helpers 2019-03-08 02:37:33 -05:00
9b180fda97 Refactor doom-initialize & bootstrap in core.el 2019-03-08 02:37:32 -05:00
2d353b849c Change file-exists-p! to return file if it exists 2019-03-08 02:34:26 -05:00
cfa97470fc Add links to config files in describe-packages
Also dims packages that aren't installed.
2019-03-05 01:55:40 -05:00
cf5a398e0d doom-log: include doom-debug-mode test in result
Relevant to #1215
2019-03-05 00:19:51 -05:00
f6cc2644b0 New doom-log macro for debug-time logging
doom-log won't interfere with the minibuffer if it's in use, and will
report the originating module.

Addresses #1215
2019-03-04 18:38:25 -05:00