emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/sqlite 576a03f 2/2: Add command to edit from the listing buffer


From: Lars Ingebrigtsen
Subject: scratch/sqlite 576a03f 2/2: Add command to edit from the listing buffer
Date: Tue, 14 Dec 2021 21:32:27 -0500 (EST)

branch: scratch/sqlite
commit 576a03f6fb3a412fddccef0910475e29ff46deae
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Add command to edit from the listing buffer
---
 lisp/emacs-lisp/multisession.el | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/multisession.el b/lisp/emacs-lisp/multisession.el
index cd33f1e..3df20d9 100644
--- a/lisp/emacs-lisp/multisession.el
+++ b/lisp/emacs-lisp/multisession.el
@@ -335,7 +335,8 @@ DOC should be a doc string, and ARGS are keywords as 
applicable to
 
 (defvar-keymap multisession-edit-mode-map
   :parent tabulated-list-mode-map
-  "d" #'multisession-delete-value)
+  "d" #'multisession-delete-value
+  "e" #'multisession-edit-value)
 
 (define-derived-mode multisession-edit-mode special-mode "Multisession"
   "This mode lists all elements in the \"multisession\" database."
@@ -393,6 +394,22 @@ storage method to list."
     (beginning-of-line)
     (delete-region (point) (progn (forward-line 1) (point)))))
 
+(defun multisession-edit-value (id)
+  "Edit the value at point."
+  (interactive (list (get-text-property (point) 'tabulated-list-id))
+               multisession-edit-mode)
+  (unless id
+    (error "No value on the current line"))
+  (let* ((object (make-multisession
+                  :package (car id)
+                  :key (cdr id)
+                  :storage multisession-storage))
+         (value (multisession-value object)))
+    (setf (multisession-value object)
+          (car (read-from-string
+                (read-string "New value: " (prin1-to-string value))))))
+  (multisession-edit-mode--revert))
+
 (provide 'multisession)
 
 ;;; multisession.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]