Org: Replace 'org-find-first-agenda with 'org-switch-agenda-file
parent
034c610cc6
commit
1267fe1f8f
|
@ -258,7 +258,8 @@
|
|||
;;; Org-mode
|
||||
(nconc package-selected-packages '(org-plus-contrib)) ; Contains latest 'org.
|
||||
(with-eval-after-load 'org (require 'init-org))
|
||||
(autoload 'org-find-first-agenda "org")
|
||||
(autoload 'org-switch-agenda-file "org")
|
||||
(autoload 'org-switch-agenda-file-other-window "org")
|
||||
|
||||
;;; PDF
|
||||
;;; pdf-tools requires poppler built with cairo support.
|
||||
|
|
|
@ -82,7 +82,8 @@
|
|||
(exwm-input-set-key (kbd "C-6") #'evil-switch-to-windows-last-buffer))
|
||||
|
||||
;;; Emacs mode shortcuts.
|
||||
(exwm-input-set-key (kbd "s-t") #'org-find-first-agenda)
|
||||
(exwm-input-set-key (kbd "s-t") #'org-switch-agenda-file)
|
||||
(exwm-input-set-key (kbd "s-T") #'org-switch-agenda-file-other-window)
|
||||
(exwm-input-set-key (kbd "s-<return>") #'eshell-or-new-session)
|
||||
(when (fboundp 'magit-status)
|
||||
(exwm-input-set-key (kbd "s-v") #'magit-status))
|
||||
|
|
|
@ -27,9 +27,23 @@
|
|||
|
||||
;;; Agendas.
|
||||
(add-to-list 'org-agenda-files "~/personal/todo/todo.org")
|
||||
(defun org-find-first-agenda ()
|
||||
(defun org-switch-agenda-file (&optional other-window)
|
||||
"Switch between org-agenda and the first org-agenda-files."
|
||||
(interactive "P")
|
||||
(if (and buffer-file-name
|
||||
(member (expand-file-name buffer-file-name) (mapcar 'expand-file-name org-agenda-files)))
|
||||
(org-agenda)
|
||||
(let ((b (find-buffer-visiting (car org-agenda-files))))
|
||||
(if b
|
||||
(if (get-buffer-window b)
|
||||
(select-window (get-buffer-window b))
|
||||
(funcall (if other-window 'switch-to-buffer-other-window 'switch-to-buffer) b))
|
||||
(funcall (if other-window 'find-file-other-window 'find-file) (car org-agenda-files))))))
|
||||
|
||||
(defun org-switch-agenda-file-other-window ()
|
||||
"Like `org-switch-agenda-file' but use other window when possible."
|
||||
(interactive)
|
||||
(find-file (car org-agenda-files)))
|
||||
(org-switch-agenda-file t))
|
||||
|
||||
;;; Set PDF association in Org-mode (original is 'default).
|
||||
(setcdr (assoc "\\.pdf\\'" org-file-apps) 'emacs)
|
||||
|
|
Loading…
Reference in New Issue