Create my own Transient command

It’s presented as a nice menu, and will most probably take over my personal keymap soon.
This commit is contained in:
Gergely Polonkai 2019-02-19 15:22:17 +01:00
parent 482173351c
commit b3cc6bd29c
2 changed files with 65 additions and 0 deletions

View File

@ -2303,6 +2303,12 @@ Then configure ~real-auto-save-mode~
(prog-mode . fci-mode)) (prog-mode . fci-mode))
#+END_SRC #+END_SRC
** Transient for creating beautiful command menus
#+BEGIN_SRC emacs-lisp
(use-package transient)
#+END_SRC
* Make programming a bit easier * Make programming a bit easier
** Electric case ** Electric case
@ -3238,6 +3244,63 @@ directory. It is available from [[http://plantuml.com/download][here]].
* Last, but not least, key bindings! * Last, but not least, key bindings!
** TODO My own, personal, Magit-popup! :experimental:
With the new Transient package it will be easier. I just dont know how to use it yet.
#+BEGIN_SRC emacs-lisp
(define-transient-command gpolonkai/clock-menu ()
[("I" "Clock in to last clocked task" org-clock-in-last)
("g" "Go to the currently clocked task" org-clock-goto)
("i" "Clock in here" org-clock-in)
("o" "Clock out" org-clock-out)])
(define-transient-command gpolonkai/special-files-menu ()
[("i" "My Emacs init file" gpolonkai/visit-init-file)
("o" "My main Org file" gpolonkai/visit-org-index)])
(define-transient-command gpolonkai/git-menu ()
[("g" "Update Git gutter everywhere" git-gutter:update-all-windows)
("m" "Show the origin of this line" git-messenger:popup-message)
("n" "Next hunk" git-gutter:next-hunk)
("p" "Previous hunk" git-gutter:previous-hunk)])
(define-transient-command gpolonkai/mail-menu ()
[("c" "Compose mail" mu4e-compose-new)
("i" "Jump to folder" mu4e~headers-jump-to-maildir)
("m" "Mu4e main screen" mu4e)
("s" "Mu4u search" mu4e-headers-search)])
(define-transient-command gpolonkai/sx-menu ()
[("i" "Inbox" sx-inbox)
("s" "Search" sx-search)])
(define-transient-command gpolonkai/zone-menu ()
[("i" "Enable zone on idle" gpolonkai/zone-enable)
("q" "Disable zone on idle" zone-leave-me-alone)])
(define-transient-command gpolonkai/menu ()
[("a" "My agenda" gpolonkai/org-agenda-list)
("b" "Where has my cursor gone?" beacon-blink)
("C" "Capture" org-capture)
("c" "Clocking…" gpolonkai/clock-menu)
("M-C" "Clean up old buffers" clean-buffer-list)
("e" "EShell" eshell)
("g" "Git…" gpolonkai/git-menu)
("h" "Hide mode-line" hidden-mode-line-mode)
("l" "Store Org link" org-store-link)
("m" "Mail…" gpolonkai/mail-menu)
("o" "Special files…" gpolonkai/special-files-menu)
("q" "Stack Exchange…" gpolonkai/sx-menu)
("r" "Show a random TODO" org-random-todo)
("u" "Open URL" browse-url-at-point)
("w" "Clean up whitespace problems" whitespace-cleanup)
("x" "Expand region" er/expand-region)
("z" "Zone…" gpolonkai/zone-menu)])
#+END_SRC
** The actual key bindings
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(bind-keys (bind-keys
:map global-map :map global-map
@ -3275,6 +3338,7 @@ directory. It is available from [[http://plantuml.com/download][here]].
("<C-return>" . isearch-exit-other-end) ("<C-return>" . isearch-exit-other-end)
("<S-return>" . isearch-exit-mark-match) ("<S-return>" . isearch-exit-mark-match)
:map gpolonkai/pers-map :map gpolonkai/pers-map
("C-t" . gpolonkai/menu)
("h" . hidden-mode-line-mode) ("h" . hidden-mode-line-mode)
("C-i e" . "gergely@polonkai.eu") ("C-i e" . "gergely@polonkai.eu")
("C-i w" . "http://gergely.polonkai.eu/") ("C-i w" . "http://gergely.polonkai.eu/")

View File

@ -182,6 +182,7 @@
sphinx-doc sphinx-doc
spinner spinner
sx sx
transient
typescript-mode typescript-mode
undo-tree undo-tree
use-package use-package