aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Barć <xgqt@gentoo.org>2023-02-10 03:40:49 +0100
committerMaciej Barć <xgqt@gentoo.org>2023-02-10 03:40:49 +0100
commita24902e9444191206529bbad9d54aa71f63dbd92 (patch)
tree56ce27301ac5a4c2b18a30c693282e94c613cb0f
parentelogt.el: use faster tabulated-list call (diff)
downloademacs-elogt-a24902e9444191206529bbad9d54aa71f63dbd92.tar.gz
emacs-elogt-a24902e9444191206529bbad9d54aa71f63dbd92.tar.bz2
emacs-elogt-a24902e9444191206529bbad9d54aa71f63dbd92.zip
elogt.el: add elogt-mode-menu
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
-rw-r--r--elogt.el35
1 files changed, 28 insertions, 7 deletions
diff --git a/elogt.el b/elogt.el
index 87e7977..15dec2c 100644
--- a/elogt.el
+++ b/elogt.el
@@ -52,6 +52,7 @@
(require 'ansi-color)
+(require 'easymenu)
(defconst elogt-version "0.0.0"
@@ -291,7 +292,7 @@ Uses the `elogt--narrow' function."
;; Major mode
(defvar elogt-mode-hook nil
- "Hook for the `elogt' major mode.")
+ "Hook for the `elogt-mode'.")
(defvar elogt-mode-map
(let ((elogt-mode-map (make-keymap)))
@@ -299,19 +300,39 @@ Uses the `elogt--narrow' function."
(define-key elogt-mode-map (kbd "o") #'elogt-open-entry)
(define-key elogt-mode-map (kbd "d") #'elogt-delete-entry)
(define-key elogt-mode-map (kbd "g") #'elogt-refresh-table)
- ;; Elogv key bindings.
- (define-key elogt-mode-map (kbd "A") #'elogt-sort-package)
- (define-key elogt-mode-map (kbd "a") #'elogt-sort-category)
- (define-key elogt-mode-map (kbd "c") #'elogt-sort-priority)
- (define-key elogt-mode-map (kbd "t") #'elogt-sort-time)
(define-key elogt-mode-map (kbd "n l") #'elogt-narrow-priority)
(define-key elogt-mode-map (kbd "n c") #'elogt-narrow-category)
(define-key elogt-mode-map (kbd "n p") #'elogt-narrow-package)
(define-key elogt-mode-map (kbd "n t") #'elogt-narrow-time)
+ ;; Elogv-mimicking key bindings.
+ (define-key elogt-mode-map (kbd "A") #'elogt-sort-package)
+ (define-key elogt-mode-map (kbd "a") #'elogt-sort-category)
+ (define-key elogt-mode-map (kbd "c") #'elogt-sort-priority)
+ (define-key elogt-mode-map (kbd "t") #'elogt-sort-time)
;; Miscellaneous key bindings.
(define-key elogt-mode-map (kbd "/") #'isearch-forward)
elogt-mode-map)
- "Key map for `elogt' major mode.")
+ "Key map for `elogt-mode'.")
+
+(easy-menu-define elogt-mode-menu elogt-mode-map
+ "Menu for `elogt-mode'."
+ `("ElogT"
+ ;; Menu-bar: standard.
+ ["Open current entry" elogt-open-entry]
+ ["Delete current entry" elogt-delete-entry]
+ ["Refresh the table" elogt-refresh-table]
+ ;; Menu-bar: narrow.
+ ("Narrow"
+ ["Narrow to Priority" elogt-narrow-priority]
+ ["Narrow to Category" elogt-narrow-category]
+ ["Narrow to Package" elogt-narrow-package]
+ ["Narrow to Time" elogt-narrow-time])
+ ;; Menu-bar: sort.
+ ("Sort"
+ ["Sort by Priority" elogt-sort-priority]
+ ["Sort by Category" elogt-sort-category]
+ ["Sort by Package" elogt-sort-package]
+ ["Sort by Time" elogt-sort-time])))
(define-derived-mode elogt-mode tabulated-list-mode
"ElogT"