Commit Graph

129 Commits

Author SHA1 Message Date
e5213f20e5 nit: fix several documentation typos 2022-01-10 02:21:49 +01:00
c19b3c827d Add CODEOWNERS file
This won't be effective until the repo is moved to a github org and
these folks are given the needed permissions.
2021-05-10 04:41:13 -04:00
73c95bb1ad Optimize doom-visible-buffers 2020-08-13 22:49:35 -04:00
6f2471cda7 Bind ZX -> Save then kill current buffer
Since bury-buffer is already on SPC b z, and isn't a common operation in
day to day Emacs use.

Other useful keybinds:
  ZZ      -> Save then kill current window
  zx      -> kill current buffer (prompts if unsaved)
  SPC b z -> bury buffer
  zn      -> (operator) narrow buffer
  zN      -> widen narrowed buffer
2020-08-05 20:58:29 -04:00
bbd1561a3c Make doom-real-buffer-p work for indirect buffers 2020-03-01 01:33:40 -05:00
9fa76836c1 Persist scratch buffer point, mode & contents
Also renames doom-scratch-buffer-major-mode ->
doom-scratch-initial-major-mode, since it only affects the initial
buffer now.

This was designed to be backwards compatible; you won't lose your
scratch buffers from this update. Though I may remove the old format in
3.1.
2020-02-25 20:30:23 -05:00
65a71d5647 Link to doom-real-buffer-p in other real buffer functions
To make the explanation easier to find.
2020-02-22 18:31:10 -05:00
a49c0b6691 Output feedback from buffer/session kill commands 2019-12-21 03:30:44 -05:00
1cb8ec6302 Fix doom/kill-all-buffers triggering dashboard refresh too soon #2219 2019-12-20 20:46:09 -05:00
4fed5e7eb3 Fix doom/kill-buried-buffers deleting windows 2019-11-28 19:56:05 -05:00
b9e5059e3f Ensure only one window after doom/kill-all-buffers 2019-11-15 22:17:30 -05:00
c109acd6fd Optimize doom-visible-buffers
Walking the window list is almost always faster than walking the buffer
list.
2019-10-20 10:58:53 -04:00
24b336322c Fix doom/kill-buried-buffer closing windows
By making doom/kill-all-buffers less gung ho about deleting windows when
the buffer list is empty.
2019-10-14 18:48:42 -04:00
a3fa1e07b1 Refactor doom/kill-*-buffer commands 2019-10-10 16:11:42 -04: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
24b40824ce Add doom-{visible,buried}-buffer-p predicates 2019-07-18 13:13:31 +02:00
9a02bd8ac8 Minor refactors across the board
- when-let* -> when-let
- Fix projectile-locate-dominating-file for connected remote files
2019-06-26 14:31:06 +02:00
aa64cf9426 Replace kill-this-buffer with kill-current-buffer
As per the documentation for kill-this-buffer, it should only be invoked
from the menu and behaves unpredictably when invoked programmatically.
2019-05-30 18:54:58 -07:00
863fc1a6bb Add buffer-live-p check to doom-real-buffer-p 2019-04-17 11:29:41 -04:00
fe6dfb08b6 Add doom/kill-project-buffers command
Prompts for an open project and kills all its buffers.  This is useful
for closing `.emacs.d` in an effort to get some *billable* work done.

Added `doom-fixup-windows` and `doom-kill-buffer(s)-fixup-windows`
helper functions for leaving affected windows on a real buffer or the
fallback buffer.

Fixed `doom/kill-this-buffer-in-all-windows` to properly "fixup"
windows.
2019-04-05 16:04:26 +10:00
259590d54e Remove doom|protect-visible-buffer
This behavior is now isolated to kill-this-buffer.
2019-03-16 23:59:50 -04:00
a086e6967e Fixes for doom/kill-this-buffer-in-all-windows
This was erroring when run inside a popup (eg. `M-x ielm` `C-x k`) due
to a missing check for `window-live-p`.  We don't need to do anything if
the window has already gone away.

The real vs unreal check was backwards; we should only try
`previous-buffer` if the current buffer is *not* real.
2019-03-17 00:53:17 +10:00
a05b1877be Rewrite switch-{buffer,window} hooks
+ Add doom-switch-frame-hook
+ Replace doom-{enter,exit}-{buffer,window}-hook with
  doom-switch-{buffer,window}-hook
+ New switch-buffer hooks run on buffer-list-update-hook rather than
  in select-window advice.
+ Blank our buffer-list-update-hook in some places to reduce how many
  times it gets triggered.
2019-03-08 02:37:33 -05:00
b98f34d1fd Add :killb & doom/kill-buried-buffers
Also fix reported killed-buffer count when invoking kill commands
interactively.
2019-03-04 14:07:34 -05:00
9b7d95f43a Remove doom-cleanup-hook & doom/cleanup-session
These weren't reliable, often times buggy or overzealous about killing
buffers and processes. Best to do it manually or come up with a better
solution.
2019-02-26 22:57:02 -05:00
d80802d3c9 doom/cleanup-session: don't kill processes by default 2019-01-14 00:52:31 -05:00
53fe7a1f04 Refactor Project API to reflect changes upstream
projectile-project-root no longer returns `default-directory` if not in
a project (it returns nil). As such, doom-project-* functions (and their
uses) have been refactored.

+ doom-project-p & doom-project-root are aliases for
  projectile-project-p & projectile-project-root.
+ doom-project-{p,root,name,expand} now has a DIR argument (for
  consistency, since projectile-project-name and
  projectile-project-expand do not).
+ The nocache parameter is no longer necessary, as projectile's caching
  behavior is now more sane.
+ Removed some projectile advice/hacks that are no longer necessary.
+ Updated unit tests
2018-09-28 21:13:27 -04:00
7d3ffdff06 Remove third line in section headers
This is truly important stuff. We've saved many lives with this update.
2018-09-09 09:58:19 -04:00
44e536e8e8 Refactor core-ui
+ Remove doom/switch-theme (replaced with an advice for load-theme)
+ Reorganize core-ui
+ Fix Emacs 26+ hl-line hack being applied for Emacs 25 users
+ Rename doom|show-whitespace-maybe to doom|highlight-non-default-indentation
+ Disable tool-bar, menu-bar and vertical-scroll-bars via
  default-frame-alist; this is a little faster than using the minor
  modes.
2018-08-31 23:44:08 +02:00
4618b7afad Refactor & reformat core-ui 2018-08-21 02:56:54 +02:00
ee91748613 Document doom-cleanup-hook 2018-07-07 13:14:50 +02:00
537cc9e1ed Rewrite doom-real-buffer-p; require first arg
Because of how widely used this function is, I'd rather it be as
explicit as possible to avoid bugs and to make it faster.
2018-06-30 01:57:51 +02:00
70230b0892 Add doom-unreal-buffer-p predicate function 2018-06-30 01:57:51 +02:00
f3aadf6c77 Fix doom-temp-buffer-p & doom-real-buffer-p
A regression caused the former to error out (if the buffer name was less
than 2 characters long) and the latter to return t too eagerly (because
of an incorrect condition chain).
2018-06-17 02:30:02 +02:00
ec6372ef66 Mark all temp buffers as unreal
Hopefully there are no plugins that use temp buffers to display things!
2018-06-16 21:02:54 +02:00
bf44c1abcc Add doom-temp-buffer-p predicate function 2018-06-16 21:02:40 +02:00
3027ed2f7f Add new doom|mark-buffer-as-real hook to term/eshell
This is simpler (and perhaps faster) than doom-real-buffer-functions.
Better to reserve that for more complex logic.
2018-06-04 21:17:49 +02:00
d2ca6f65b3 doom/cleanup-session: don't kill modified buffers 2018-05-30 23:06:13 +02:00
d0f8bf402a doom-visible-windows: support visible window-parameter 2018-05-15 01:31:40 +02:00
326763ab3d doom/cleanup-processes => doom/cleanup-buffer-processes 2018-03-23 16:01:46 -04:00
f064c5d1ae Change doom/kill-all-buffers behavior (C-u = only kill project buffers) 2018-03-23 16:01:35 -04:00
358d7af9ac doom/kill-all-buffers: reduce redundancy 2018-03-22 06:31:16 -04:00
7542f4a660 Fix doom-visible-windows including popup windows 2018-03-01 22:07:14 -05:00
139a0c8045 Fix kill-buffer arguments. 2018-02-10 19:36:06 +03:00
414383e5f4 Remove vestigial references to doom/{next,previous}-buffer 2018-02-04 05:05:40 -05:00
d1953e00c4 Remove doom--cycle-real-buffers; refactor kill-this-buffer advice
cycle-real-buffers was a tidbit of complexity that was never necessary
in the first place. This functionality was already available in the form
of the frame buffer-predicate parameter, which controls where functions
like next-buffer and other-buffer can land you.

The only thing I have to do myself, is check for the condition where
there are no more real buffers left to switch to, and in that case send
you to the fallback-buffer.
2018-02-02 20:47:31 -05:00
ca262f5e4e Rename doom-fallback-buffer (variable) => doom-fallback-buffer-name 2018-02-01 20:06:00 -05:00
7b2bbb973a Improve real-buffer function docstrings 2018-02-01 20:04:54 -05:00
2989296521 Use frame's buffer-predicate instead of doom/{next,previous}-buffer
doom/{next,previous}-buffer was implemented so that these commands could
skip over unreal buffers, and land us on either a real one or the
dashboard. Using the frame's buffer-predicate parameter accomplishes
exactly this, natively.
2018-02-01 19:58:43 -05:00