73 lines
2.4 KiB
EmacsLisp
73 lines
2.4 KiB
EmacsLisp
;;; dconf-mode.el --- Edit dconf settings in an emacs buffer
|
|
|
|
;; Author: Mitchell Marquez <dr.m.perseos@gmail.com>
|
|
;; URL: https://git.mitchmarq42.xyz/mitch/dconf-mode.el
|
|
;; Version: 0.1
|
|
;; Keywords: convenience
|
|
|
|
;;; Copyright © 2022 Mitchell Marquez <dr.m.perseos@gmail.com>
|
|
;;;
|
|
;;;
|
|
;;; This file is NOT part of GNU Emacs.
|
|
;;;
|
|
;;; This program is free software: you can redistribute it and/or modify
|
|
;;; it under the terms of the GNU General Public License as published by
|
|
;;; the Free Software Foundation, either version 3 of the License, or
|
|
;;; (at your option) any later version.
|
|
;;;
|
|
;;; This program is distributed in the hope that it will be useful,
|
|
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;;; GNU General Public License for more details.
|
|
;;;
|
|
;;; You should have received a copy of the GNU General Public License
|
|
;;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
;;; Commentary:
|
|
|
|
;; dconf-mode is a lightweight major mode for editing dconf databases such as
|
|
;; the settings of the GNOME desktop environment from the comfort of Emacs, and
|
|
;; saving its configuration in simple text files.
|
|
|
|
|
|
;;; Code:
|
|
|
|
(defcustom dconf--default-path "/org/gnome/"
|
|
"The default path for dconf-mode to read and write from."
|
|
:group 'dconf-mode
|
|
:type 'string)
|
|
|
|
(defun dconf-load-current-file ()
|
|
"Load the current file into dconf's live registry."
|
|
(interactive)
|
|
(shell-command
|
|
(concat "cat " buffer-file-name
|
|
" | dconf load " dconf--default-path (file-name-base buffer-file-name) "/")))
|
|
(defun dconf-dump-current-file ()
|
|
"Load dconf's live registry into the current file."
|
|
(interactive)
|
|
(erase-buffer)
|
|
(shell-command
|
|
(concat "dconf dump " dconf--default-path (file-name-base buffer-file-name) "/")
|
|
(current-buffer)))
|
|
|
|
(defun dconf-edit (path)
|
|
"Open a dconf buffer to edit PATH."
|
|
(interactive "M")
|
|
(pop-to-buffer (get-buffer-create (format "*dconf %s*" path)))
|
|
(setq-local dconf-current-path path)
|
|
(dconf-mode))
|
|
|
|
;;;###autoload
|
|
(define-derived-mode dconf-mode conf-mode "Dconf"
|
|
"Major mode for interacting with the dconf database."
|
|
:group 'dconf-mode
|
|
;; :after-hook (dconf-dump-current-file)
|
|
(add-hook 'after-save-hook 'dconf-load-current-file 0 t))
|
|
|
|
;;;###autoload
|
|
(add-to-list 'auto-mode-alist '("\\.gsets" . dconf-mode))
|
|
|
|
(provide 'dconf-mode)
|
|
;;; dconf-mode.el ends here
|