[tab-bar-helper] Small refinements

This commit is contained in:
Marcel Kapfer 2022-02-10 23:18:47 +01:00
parent f7663559a1
commit b94472f601
Signed by: mmk2410
GPG key ID: CADE6F0C09F21B09

View file

@ -1,12 +1,11 @@
;; -*- lexical-binding: t; -*- ;;; tab-bar-helpers.el -*- lexical-binding: t; -*-
(defun mmk2410/tab-bar-new-tab (name func) (defun mmk2410/tab-bar-new-tab (name func)
(when (eq nil tab-bar-mode) (when (eq nil tab-bar-mode)
(tab-bar-mode)) (tab-bar-mode))
(tab-bar-new-tab) (tab-bar-new-tab)
(tab-bar-rename-tab name) (tab-bar-rename-tab name)
(funcall func) (funcall func))
nil)
(defun mmk2410/tab-bar-tab-exists (name) (defun mmk2410/tab-bar-tab-exists (name)
(member name (member name
@ -24,14 +23,16 @@
(defun mmk2410/tab-bar-run-mail () (defun mmk2410/tab-bar-run-mail ()
(interactive) (interactive)
(mmk2410/tab-bar-switch-or-create "Mail" (mmk2410/tab-bar-switch-or-create
"Mail"
#'(lambda () #'(lambda ()
(mu4e-context-switch :name "Private") (mu4e-context-switch :name "Private")
(mu4e)))) (mu4e))))
(defun mmk2410/tab-bar-run-irc () (defun mmk2410/tab-bar-run-irc ()
(interactive) (interactive)
(mmk2410/tab-bar-switch-or-create "IRC" (mmk2410/tab-bar-switch-or-create
"IRC"
#'(lambda () #'(lambda ()
(mmk2410/erc-connect) (mmk2410/erc-connect)
(sit-for 1) (sit-for 1)
@ -39,17 +40,21 @@
(defun mmk2410/tab-bar-run-agenda () (defun mmk2410/tab-bar-run-agenda ()
(interactive) (interactive)
(mmk2410/tab-bar-switch-or-create "Agenda" (mmk2410/tab-bar-switch-or-create
"Agenda"
#'(lambda () #'(lambda ()
(org-agenda nil "a")))) (org-agenda nil "a"))))
(defun mmk2410/tab-bar-run-journal () (defun mmk2410/tab-bar-run-journal ()
(interactive) (interactive)
(mmk2410/tab-bar-switch-or-create "Journal" #'org-journal-open-current-journal-file)) (mmk2410/tab-bar-switch-or-create
"Journal"
#'org-journal-open-current-journal-file))
(defun mmk2410/tab-bar-run-projects () (defun mmk2410/tab-bar-run-projects ()
(interactive) (interactive)
(mmk2410/tab-bar-switch-or-create "Projects" (mmk2410/tab-bar-switch-or-create
"Projects"
#'(lambda () #'(lambda ()
(find-file "~/org/work.projects.org")))) (find-file "~/org/work.projects.org"))))
@ -65,3 +70,5 @@
(global-set-key (kbd "C-c f") 'mmk2410/tab-bar/body) (global-set-key (kbd "C-c f") 'mmk2410/tab-bar/body)
(provide mmk2410/tab-bar-helpers) (provide mmk2410/tab-bar-helpers)
;;; tab-bar-helpers.el ends here