Skip to content

Instantly share code, notes, and snippets.

@MarkRedeman
Created December 22, 2020 11:56
Show Gist options
  • Save MarkRedeman/6b004914b61d3cf36ff8bbf6acc981b2 to your computer and use it in GitHub Desktop.
Save MarkRedeman/6b004914b61d3cf36ff8bbf6acc981b2 to your computer and use it in GitHub Desktop.
;;; private/renamed.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +renamed/find-in-dotfiles ()
"Open a file somewhere in ~/.dotfiles via a fuzzy filename search."
(interactive)
(doom-project-find-file (expand-file-name "~/dotfiles")))
;;;###autoload
(defun +renamed/browse-dotfiles ()
"Browse the files in ~/dotfiles."
(interactive)
(doom-project-browse (expand-file-name "~/dotfiles")))
;;;###autoload
(defun +renamed/toggle-maximize-buffer ()
"Maximize buffer"
(interactive)
(if (and (= 1 (length (window-list)))
(assoc ?_ register-alist))
(jump-to-register ?_)
(progn
(window-configuration-to-register ?_)
(delete-other-windows))))
;;;###autoload
(defun +renamed/alternate-buffer (&optional window)
"Switch back and forth between current and last buffer in the
current window."
(interactive)
(let ((current-buffer (window-buffer window)))
;; if no window is found in the windows history, `switch-to-buffer' will
;; default to calling `other-buffer'.
(switch-to-buffer
(cl-find-if (lambda (buffer)
(not (eq buffer current-buffer)))
(mapcar #'car (window-prev-buffers window))))))
;;;###autoload
(defun +renamed/alternate-window ()
"Switch back and forth between current and last window in the
current frame."
(interactive)
(let (;; switch to first window previously shown in this frame
(prev-window (get-mru-window nil t t)))
;; Check window was not found successfully
(unless prev-window (user-error "Last window not found."))
(select-window prev-window)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment