A quick bury mode experiment

This commit is contained in:
Benson Chu 2022-06-01 19:23:10 -05:00
parent da6c06e764
commit bd126145e0
2 changed files with 55 additions and 0 deletions

View file

@ -223,5 +223,21 @@ With a universal argument, prompt to specify which key."
(define-key org-mode-map (kbd "M-g o") (lambda () (interactive) (org-back-to-heading)))
;; My replacement for follow mode
(defun org-agenda-jump-to-heading-show ()
(interactive)
(let ((agenda-buffer (buffer-name))
(agenda-window (selected-window))
(indirect-window
(and org-last-indirect-buffer
(get-buffer-window org-last-indirect-buffer))))
(save-window-excursion (org-agenda-do-tree-to-indirect-buffer t))
(pop-to-buffer org-last-indirect-buffer)
(quick-bury-mode)))
(require 'quick-bury)
(define-key org-agenda-mode-map (kbd "j") #'org-agenda-jump-to-heading-show)
(provide 'my-org-misc)
;;; my-org-misc.el ends here

39
lisp/quick-bury.el Normal file
View file

@ -0,0 +1,39 @@
;;; quick-bury.el --- -*- lexical-binding: t -*-
;; Copyright (C) 2022 Benson Chu
;; Author: Benson Chu <bensonchu457@gmail.com>
;; Created: [2022-06-01 19:04]
;; This file is not part of GNU Emacs
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(defvar quick-bury-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "<escape>") #'(lambda ()
(interactive)
(quick-bury-mode -1)
(bury-buffer)))
map))
(define-minor-mode quick-bury-mode ""
nil nil quick-bury-mode-map)
(provide 'quick-bury)
;;; quick-bury.el ends here