From 26c1a6074dd9f9e08ee5f54af6766e43d1c2956d Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Fri, 12 Apr 2024 10:17:50 +0100 Subject: [PATCH] Disable buffer switch preview on WM mode --- lisp/fg42/minibuffer.el | 5 +++++ lisp/fg42/utils.el | 49 ----------------------------------------- 2 files changed, 5 insertions(+), 49 deletions(-) diff --git a/lisp/fg42/minibuffer.el b/lisp/fg42/minibuffer.el index 16f87c7..9926646 100644 --- a/lisp/fg42/minibuffer.el +++ b/lisp/fg42/minibuffer.el @@ -150,6 +150,11 @@ match all of the components in any order." (advice-add #'register-preview :override #'consult-register-window) :config + (when-wm + (consult-customize + ;; Set preview for `consult-buffer' to key `M-.' + consult-buffer :preview-key nil)) + ;; For some reason `consult's autoloads do not work (require 'consult-xref) ;; Use Consult to select xref locations with preview diff --git a/lisp/fg42/utils.el b/lisp/fg42/utils.el index 3aee1c0..1f8d8e8 100644 --- a/lisp/fg42/utils.el +++ b/lisp/fg42/utils.el @@ -97,29 +97,6 @@ with is the buffer." ,@form)) -;; TODO: A good candidate for an inline function -(defun find-value-for (lst key) - "Return the value of the given KEY in the given LST. -For example for a list like (list :x 4 :y 5) we can find the value of -`:x' by doing `(get-value-for lst :x)'." - (let ((pairs (seq-partition lst 2))) - (let ((pair (assq key pairs))) - (when pair - (cadr pair))))) - - -(defun comp (&rest fns) - "Compose the given list of FNS into one function that accepts multiple values. -For example: - (funcall (compose (lambda (x) (+ 1 x)) (lambda (x) (* x s))) 5) -or - (funcall (compose #'some-fn #'message) some-value)" - (lambda (&rest values) - (cl-reduce 'funcall (butlast fns) - :from-end t - :initial-value (apply (car (last fns)) values)))) - - (defun path-join (&rest paths) "Join the given PATHS." (apply #'concat @@ -157,20 +134,6 @@ last item in second form, etc." (:else `(->> (->> ,x ,form) ,@more)))) -(defun load-user-config (file) - "Load the given FILE as user config file." - (if (file-exists-p file) - (load-file file))) - - -(defmacro autoload-cube (fn file docstring &optional interactive) - "A wrapper for autloading FN at FILE with the given DOCSTRING. -This macro looks inside of the cubes directories. If the INTERACTIVE param -is non-nil value it means that the function can be called interactively." - `(autoload ,fn (expand-file-name (format "lisp/fg42/cubes/%s" ,file) fg42-home) - ,docstring ,interactive)) - - (defmacro when-wm (&rest body) "Run the BODY only if in wm mode." (if (string= (getenv "FG42_WM") "true") @@ -184,18 +147,6 @@ is non-nil value it means that the function can be called interactively." nil)) -(defmacro fg42/log (tag args) - "If the debug is enabled log the give ARGS." - (if fg42/debug-p - `(message "[%s]: %s" ,tag (apply #'format ,args)) - nil)) - - -(defmacro fg42/info (&rest args) - "If the debug is enabled log the give ARGS." - (fg42/log "INFO" args)) - - (defun get-base16-color-or (color-name default) "Return the color for COLOR-NAME if a base16 theme is loade otherwise DEFAULT." (let* ((theme (car custom-enabled-themes))