Commit graph

16 commits

Author SHA1 Message Date
Henrik Lissner
2bf74158fd
Minor refactors across the board 2019-11-04 03:37:54 -05:00
Henrik Lissner
a93f097f78
ui/nav-flash: factor out redundancy 2019-11-03 16:27:17 -05:00
Henrik Lissner
effee30138
ui/nav-flash: don't trigger on mouse click 2019-10-29 18:19:02 -04:00
Henrik Lissner
be08f9794e
Fix nav-flash being suppressed
By a variable that will (almost) always be non-til.
2019-10-28 23:23:14 -04:00
Henrik Lissner
616dec5b93
Optimize opening large files #1834
Fixes an issue where dtrt-indent and/or nav-flash would hang Emacs when
opening large files, and disables all mode hooks for large
files (without using fundamental-mode so you can at least get syntax
highlighting).
2019-10-07 16:02:23 -04:00
Henrik Lissner
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
Henrik Lissner
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
Henrik Lissner
9f45197a0b
ui/nav-flash: improve conditional blinking on jump
Sometimes it wouldn't blink when the motion occurred within the same
window. This ensures more consistency.
2019-05-21 17:24:23 -04:00
Henrik Lissner
0041723a80
Make +nav-flash/blink-cursor unconditional
Since it is meant for interactive use
2019-05-21 01:24:55 -04:00
Henrik Lissner
dba3ae5e4d
Prevent nav-flash from firing too often
And trigger on better-jumper-post-jump-hook instead, so that non-evil
users can benefit from nav-flash in this case too.
2019-05-19 02:17:58 -04:00
Henrik Lissner
f58f3c3604
ui/nav-flash: refactor
+ Add +nav-flash-exclude-commands to control where
  +nav-flash-blink-cursor-maybe should not trigger nav-flash.
+ Rename API to conform to Doom naming conventions
  + +nav-flash-blink-cursor
  + +nav-flash-blink-cursor-maybe
  + +nav-flash|delayed-blink-cursor
  + +nav-flash|blink-cursor
  + +nav-flash|blink-cursor-maybe
  + +nav-flash*blink-cursor
2018-07-24 20:04:03 +02:00
Henrik Lissner
b5c57ab6e4
Don't trigger nav-flash in special windows 2018-07-10 23:05:39 +02:00
Henrik Lissner
2364e97285
Fix switch-window hooks when switching with the mouse
And moved it to ui/nav-flash, which is what this code was introduced to
fix in the first place!
2018-03-27 02:50:40 -04:00
Henrik Lissner
b848527f0c
ui/nav-flash: fix wrong-type-argument error on recenter 2018-03-26 02:11:11 -04:00
Henrik Lissner
5319f655b4
Prevent nav-flash from causing seizures in term-mode 2017-09-28 18:22:15 +02:00
Henrik Lissner
c7254e7bdc
Major optimization refactor, across the board
+ enable lexical-scope everywhere (lexical-binding = t): ~5-10% faster
  startup; ~5-20% general boost
+ reduce consing, function calls & garbage collection by preferring
  cl-loop & dolist over lambda closures (for mapc[ar], add-hook, and
  various cl-lib filter/map/reduce functions) -- where possible
+ prefer functions with dedicated opcodes, like assq (see byte-defop's
  in bytecomp.el for more)
+ prefer pcase & cond (faster) over cl-case
+ general refactor for code readability
+ ensure naming & style conventions are adhered to
+ appease byte-compiler by marking unused variables with underscore
+ defer minor mode activation to after-init, emacs-startup or
  window-setup hooks; a customization opportunity for users + ensures
  custom functionality won't interfere with startup.
2017-06-09 00:47:45 +02:00