From 4a5cf047611f65002f49feef9675c26bcf313ef1 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 2 Feb 2020 02:05:20 -0500 Subject: [PATCH] General refactors & appease byte-compiler --- core/autoload/packages.el | 7 ++- core/autoload/projects.el | 4 +- core/autoload/scratch.el | 1 + core/autoload/text.el | 61 +++++++++++++------------ modules/app/calendar/autoload.el | 6 +-- modules/editor/evil/config.el | 2 +- modules/term/eshell/autoload/company.el | 1 + 7 files changed, 46 insertions(+), 36 deletions(-) diff --git a/core/autoload/packages.el b/core/autoload/packages.el index 68e2f8f6e..57a182e69 100644 --- a/core/autoload/packages.el +++ b/core/autoload/packages.el @@ -210,7 +210,8 @@ ones." "Return an alist mapping package names (strings) to pinned commits (strings)." (let (alist) (dolist (package doom-packages alist) - (with-plist! (cdr package) (recipe modules disable ignore pin unpin) + (cl-destructuring-bind (_ &key disable ignore pin unpin &allow-other-keys) + package (when (and (not ignore) (not disable) (or pin unpin)) @@ -223,7 +224,9 @@ ones." "Return an alist mapping package names (strings) to pinned commits (strings)." (let (alist) (dolist (package doom-packages alist) - (with-plist! (cdr package) (recipe modules disable ignore pin unpin) + (cl-destructuring-bind + (_ &key recipe disable ignore pin unpin &allow-other-keys) + package (when (and (not ignore) (not disable) (or unpin diff --git a/core/autoload/projects.el b/core/autoload/projects.el index 6decf3501..e3b924b13 100644 --- a/core/autoload/projects.el +++ b/core/autoload/projects.el @@ -1,6 +1,8 @@ ;;; core/autoload/projects.el -*- lexical-binding: t; -*- -(defvar projectile-project-root nil) +(defvar projectile-enable-caching) +(defvar projectile-project-root) +(defvar projectile-require-project-root) ;;;###autoload (autoload 'projectile-relevant-known-projects "projectile") diff --git a/core/autoload/scratch.el b/core/autoload/scratch.el index 5e5b216ab..3d4947f0d 100644 --- a/core/autoload/scratch.el +++ b/core/autoload/scratch.el @@ -96,6 +96,7 @@ following: ;; ;;; Commands +(defvar projectile-enable-caching) ;;;###autoload (defun doom/open-scratch-buffer (&optional arg project-p) "Pop up a persistent scratch buffer. diff --git a/core/autoload/text.el b/core/autoload/text.el index edfb2997b..ae91e71e7 100644 --- a/core/autoload/text.el +++ b/core/autoload/text.el @@ -117,34 +117,37 @@ in some cases." ;;; Commands (defun doom--bol-bot-eot-eol (&optional pos) - (let* ((bol (if visual-line-mode - (save-excursion - (beginning-of-visual-line) - (point)) - (line-beginning-position))) - (bot (save-excursion - (goto-char bol) - (skip-chars-forward " \t\r") - (point))) - (eol (if visual-line-mode - (save-excursion (end-of-visual-line) (point)) - (line-end-position))) - (eot (or (save-excursion - (if (not comment-use-syntax) - (progn - (goto-char bol) - (when (re-search-forward comment-start-skip eol t) - (or (match-end 1) (match-beginning 0)))) - (goto-char eol) - (while (and (doom-point-in-comment-p) - (> (point) bol)) - (backward-char)) - (skip-chars-backward " " bol) - (unless (or (eq (char-after) 32) (eolp)) - (forward-char)) - (point))) - eol))) - (list bol bot eot eol))) + (save-excursion + (when pos + (goto-char pos)) + (let* ((bol (if visual-line-mode + (save-excursion + (beginning-of-visual-line) + (point)) + (line-beginning-position))) + (bot (save-excursion + (goto-char bol) + (skip-chars-forward " \t\r") + (point))) + (eol (if visual-line-mode + (save-excursion (end-of-visual-line) (point)) + (line-end-position))) + (eot (or (save-excursion + (if (not comment-use-syntax) + (progn + (goto-char bol) + (when (re-search-forward comment-start-skip eol t) + (or (match-end 1) (match-beginning 0)))) + (goto-char eol) + (while (and (doom-point-in-comment-p) + (> (point) bol)) + (backward-char)) + (skip-chars-backward " " bol) + (unless (or (eq (char-after) 32) (eolp)) + (forward-char)) + (point))) + eol))) + (list bol bot eot eol)))) (defvar doom--last-backward-pt nil) ;;;###autoload @@ -154,7 +157,7 @@ beginning of the line. The opposite of `doom/forward-to-last-non-comment-or-eol'." (interactive "d") (let ((pt (or point (point)))) - (cl-destructuring-bind (bol bot _eot eol) + (cl-destructuring-bind (bol bot _eot _eol) (doom--bol-bot-eot-eol pt) (cond ((> pt bot) (goto-char bot)) diff --git a/modules/app/calendar/autoload.el b/modules/app/calendar/autoload.el index f642c184b..7a6a1b73f 100644 --- a/modules/app/calendar/autoload.el +++ b/modules/app/calendar/autoload.el @@ -3,9 +3,9 @@ (defvar +calendar--wconf nil) (defun +calendar--init () - (if-let* ((win (cl-loop for win in (doom-visible-windows) - if (string-match-p "^\\*cfw:" (buffer-name (window-buffer win))) - return win))) + (if-let (win (cl-find-if (lambda (b) (string-match-p "^\\*cfw:" (buffer-name b))) + (doom-visible-windows) + :key #'window-buffer)) (select-window win) (call-interactively +calendar-open-function))) diff --git a/modules/editor/evil/config.el b/modules/editor/evil/config.el index 282de7552..bb225764c 100644 --- a/modules/editor/evil/config.el +++ b/modules/editor/evil/config.el @@ -126,7 +126,7 @@ directives. By default, this only recognizes C directives.") (count-lines (point-min) (point-max)) (buffer-size))))) - ;; 'gq' moves the cursor to the beginning of selection. Disable this, since + ;; '=' moves the cursor to the beginning of selection. Disable this, since ;; it's more disruptive than helpful. (defadvice! +evil--dont-move-cursor-a (orig-fn &rest args) :around #'evil-indent diff --git a/modules/term/eshell/autoload/company.el b/modules/term/eshell/autoload/company.el index 1d24cf99a..94d0662ce 100644 --- a/modules/term/eshell/autoload/company.el +++ b/modules/term/eshell/autoload/company.el @@ -3,6 +3,7 @@ ;; REVIEW Refactor me +(defvar pcomplete-suffix-list) (defvar company-pcomplete-available 'unknown) (defun company-pcomplete--prefix ()