Skip to content

Commit

Permalink
refactor: minor refactor, regenerate loaddefs
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Nov 8, 2023
1 parent 7a645ae commit 5807929
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 23 deletions.
9 changes: 9 additions & 0 deletions core/me-builtin.el
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@
;; Use UTF-16-LE in Windows, see: rufflewind.com/2014-07-20/pasting-unicode-in-emacs-on-windows
(set-selection-coding-system (if os/win 'utf-16-le 'utf-8))

(defun +toggle-auto-whitespace-cleanup ()
"Toggle auto-deleting trailing whitespaces."
(interactive)
(if (member #'+save--whitespace-cleanup-h before-save-hook)
(progn
(message "+toggle-auto-whitespace-cleanup: Disabled.")
(remove-hook 'before-save-hook #'+save--whitespace-cleanup-h))
(message "+toggle-auto-whitespace-cleanup: Enabled.")
(add-hook 'before-save-hook #'+save--whitespace-cleanup-h)))
:config
(defun +show-trailing-whitespace-h () (setq-local show-trailing-whitespace t))
;; Guess the major mode after saving a file in `fundamental-mode' (adapted from Doom Emacs).
Expand Down
28 changes: 17 additions & 11 deletions core/me-loaddefs.el
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ If ENABLE is non-nil, force enabling autoreloading.
(fn &optional ENABLE)" t)
(autoload '+dir-locals-open-or-create "../elisp/+emacs" "\
Open or create the dir-locals.el for the current project." t)
(autoload '+toggle-auto-whitespace-cleanup "../elisp/+emacs" "\
Toggle auto-deleting trailing whitespaces." t)
(autoload '+what-faces "../elisp/+emacs" "\
Get the font faces at POS.
Expand Down Expand Up @@ -421,8 +419,8 @@ Hook BODY in HOOK, it runs only once.
Make a hook which runs on the first FILETYPE file which with an extension
that matches EXT-REGEXP.
This will creates a function named `+first-file--FILETYPE-h' which and adds it
to `first-file-hook', this function will run on the first file that matches
This will creates a function named `+first-file--FILETYPE-h' which gets executed
before `after-find-file'. This function will run on the first file that matches
EXT-REGEXP. When it runs, this function provides a feature named
`minemacs-first-FILETYPE-file' and a run all hooks in
`minemacs-first-FILETYPE-file-hook'.
Expand All @@ -442,6 +440,12 @@ This macro accepts, in order:
thereof, a list of `defun' or `cl-defun' forms, or arbitrary forms (will
implicitly be wrapped in a lambda).
If the hook function should receive an argument (like in
`enable-theme-functions'), the `args' variable can be expanded in the forms
(+add-hook! 'enable-theme-functions
(message \"Enabled theme: %s\" (car args)))
(fn HOOKS [:append :local [:depth N]] FUNCTIONS-OR-FORMS...)" nil t)
(function-put '+add-hook! 'lisp-indent-function '(lambda (indent-point state) (goto-char indent-point) (when (looking-at-p "\\s-*(") (lisp-indent-defform state indent-point))))
(autoload '+remove-hook! "../elisp/+minemacs" "\
Expand All @@ -456,12 +460,19 @@ If N and M = 1, there's no benefit to using this macro over `remove-hook'.
(autoload '+setq-hook! "../elisp/+minemacs" "\
Sets buffer-local variables on HOOKS.
HOOKS can be expect receiving arguments (like in `enable-theme-functions'), the
`args' variable can be used inside VAR-VALS forms to get the arguments passed
the the function.
(+setq-hook! 'enable-theme-functions
current-theme (car args))
(fn HOOKS &rest [SYM VAL]...)" nil t)
(function-put '+setq-hook! 'lisp-indent-function 1)
(autoload '+unsetq-hook! "../elisp/+minemacs" "\
Unbind setq hooks on HOOKS for VARS.
(fn HOOKS &rest [SYM VAL]...)" nil t)
(fn HOOKS &rest VAR1 VAR2...)" nil t)
(function-put '+unsetq-hook! 'lisp-indent-function 1)
(autoload '+compile-functions "../elisp/+minemacs" "\
Queue FNS to be byte/natively-compiled after a brief delay.
Expand Down Expand Up @@ -718,11 +729,6 @@ Fallback to FALLBACK-RELEASE when it can't get the last one.
(fn USER REPO &optional FALLBACK-RELEASE)")


;;; Generated autoloads from me-defaults.el

(register-definition-prefixes "me-defaults" '("+pulse-line"))


;;; Generated autoloads from ../modules/extras/me-eglot-ltex.el

Expand All @@ -734,7 +740,7 @@ Fallback to FALLBACK-RELEASE when it can't get the last one.

(autoload '+setup-fonts "me-fonts" "\
Setup fonts." t)
(register-definition-prefixes "me-fonts" '("+apply-font-script" "+f" "+known-scripts" "minemacs-fonts"))
(register-definition-prefixes "me-fonts" '("+apply-font-script" "+f" "+known-scripts" "minemacs-fonts-plist"))


;;; Generated autoloads from ../modules/extras/me-gdb.el
Expand Down
12 changes: 0 additions & 12 deletions elisp/+emacs.el
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,6 @@ If ENABLE is non-nil, force enabling autoreloading."
((vc-root-dir) (expand-file-name dir-locals-file (vc-root-dir)))
(t (expand-file-name dir-locals-file (file-name-directory file-name)))))))

;; The hook is defined and enabled by default in `me-defaults'
;;;###autoload
(defun +toggle-auto-whitespace-cleanup ()
"Toggle auto-deleting trailing whitespaces."
(interactive)
(if (member #'+save--whitespace-cleanup-h before-save-hook)
(progn
(message "+toggle-auto-whitespace-cleanup: Disabled.")
(remove-hook 'before-save-hook #'+save--whitespace-cleanup-h))
(message "+toggle-auto-whitespace-cleanup: Enabled.")
(add-hook 'before-save-hook #'+save--whitespace-cleanup-h)))

;; Adapted from: rougier/nano-emacs
;;;###autoload
(defun +what-faces (pos)
Expand Down

0 comments on commit 5807929

Please sign in to comment.