Re: [gnu elpa] Adding disk.el
Stefan Monnier <[email protected]>
| Newsgroups | gmane.emacs.devel |
|---|---|
| Message-ID | <[email protected]> |
> A few weeks ago I sent an Emacs patch for adding =disk.el= to the > upstream Emacs dist, since it didn't get accepted, I am now submitting > it as part of GNU Elpa. > Repo is on SourceHut: https://git.sr.ht/~rosell/disk.el AFAICT you haven't signed the copyright paperwork yet, so if you're OK with it, please fill the form below and send it to the FSF as instructed so they can send you the relevant paperwork to sign. See also attached some suggested tweaks to your code. === Stefan Please email the following information to [email protected], and we will send you the assignment form for your past and future changes. Please use your full legal name (in ASCII characters) as the subject line of the message. ---------------------------------------------------------------------- REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES [What is the name of the program or package you're contributing to?] Emacs [Did you copy any files or text written by someone else in these changes? Even if that material is free software, we need to know about it.] [Do you have an employer who might have a basis to claim to own your changes? Do you attend a school which might make such a claim?] [For the copyright registration, what country are you a citizen of?] [What year were you born?] [Please write your email address here.] [Please write your postal address here.] [Which files have you changed so far, and which new files have you written so far?] [Additional people we should notify about the progress of the assignment.] Stefan Monnier <[email protected]>
disk.patch
(text/x-diff, 2 KB)
diff --git a/disk.el b/disk.el index ed3aa2218f3..db0ba684033 100644 --- a/disk.el +++ b/disk.el @@ -1,6 +1,6 @@ ;;; disk.el --- view and manage block devices -*- lexical-binding: t; -*- -;; Copyright (C) 2026 Mario Rosell +;; Copyright (C) 2026 Free Software Foundation, Inc. ;; Author: Mario Rosell <[email protected]> ;; Maintainer: Mario Rosell <[email protected]> @@ -44,18 +44,15 @@ (defcustom disk-auto-mount t "Whether to automatically mount a disk on demand." - :type 'boolean - :group 'disk) + :type 'boolean) (defcustom disk-udisksctl-command "udisksctl" "The path of the udisksctl executable." - :type 'string - :group 'disk) + :type 'string) (defcustom disk-lsblk-command "lsblk" "The path of the lsblk executable." - :type 'string - :group 'disk) + :type 'string) (defun disk--s (v) "Convert V to a safe string." @@ -86,6 +83,13 @@ name (concat "/dev/" name))) +(defvar disk-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "m") #'disk-mount-at-point) + (define-key map (kbd "u") #'disk-unmount-at-point) + (define-key map (kbd "d") #'disk-dired-at-point) + map)) + ;;;###autoload (define-derived-mode disk-mode tabulated-list-mode "Devices" "Major mode for viewing block devices from lsblk." @@ -97,9 +101,10 @@ ("Type" 8 t) ("Mountpoint" 40 t)]) (setq tabulated-list-padding 2) - (tabulated-list-init-header)) + (tabulated-list-init-header) + (setq-local revert-buffer-function #'disk-refresh)) -(defun disk-refresh () +(defun disk-refresh (&rest _) "Refresh device list using lsblk JSON." (interactive) (let* ((json-object-type 'alist) @@ -187,12 +192,6 @@ (user-error "Disk: udisksctl failed")) (disk-refresh)))) -;; Keybindings -(define-key disk-mode-map (kbd "g") #'disk-refresh) -(define-key disk-mode-map (kbd "m") #'disk-mount-at-point) -(define-key disk-mode-map (kbd "u") #'disk-unmount-at-point) -(define-key disk-mode-map (kbd "d") #'disk-dired-at-point) - (provide 'disk) ;;; disk.el ends here